Skip to main content

Module state_compressor

Module state_compressor 

Source
Expand description

Encodes room state snapshots as compact parent-linked deltas.

Each state entry combines a short state key with a short event ID in a fixed-width record. Reconstructed parent chains are cached to make repeated state resolution inexpensive while bounding persistent diff depth.

Re-exportsΒ§

use std::collections::BTreeSet; πŸ”’
use std::collections::HashMap; πŸ”’
use std::fmt::Debug; πŸ”’
use std::fmt::Debug; πŸ”’
use std::fmt::Write; πŸ”’
use std::sync::Arc; πŸ”’
use std::sync::Mutex; πŸ”’
use async_trait::async_trait; πŸ”’
use futures::Stream; πŸ”’
use futures::StreamExt; πŸ”’
use lru_cache::LruCache; πŸ”’
use ruma::EventId; πŸ”’
use ruma::RoomId; πŸ”’
use tuwunel_core::Result; πŸ”’
use tuwunel_core::arrayvec::ArrayVec; πŸ”’
use tuwunel_core::at; πŸ”’
use tuwunel_core::checked; πŸ”’
use tuwunel_core::err; πŸ”’
use tuwunel_core::expected; πŸ”’
use tuwunel_core::implement; πŸ”’
use tuwunel_core::utils; πŸ”’
use tuwunel_core::utils::bytes; πŸ”’
use tuwunel_core::utils::math::usize_from_f64; πŸ”’
use tuwunel_core::utils::stream::IterStream; πŸ”’
use tuwunel_database::Map; πŸ”’
use tuwunel_database::Txn; πŸ”’
use crate::rooms::short::ShortEventId; πŸ”’
use crate::rooms::short::ShortId; πŸ”’
use crate::rooms::short::ShortStateHash; πŸ”’
use crate::rooms::short::ShortStateKey; πŸ”’

StructsΒ§

Data πŸ”’
HashSetCompressStateEvent
Reports a saved snapshot and its change from the room’s previous state.
Service
Persists, reconstructs, and caches compressed room state snapshots.
ShortStateInfo
Describes one materialized frame in a compressed state chain.
StateDiff πŸ”’
One state as a delta against a parent state.

FunctionsΒ§

compress_state_event πŸ”’
Packs a short state key and short event ID into one compressed record.
compressed_state_size πŸ”’
parse_compressed_state_event πŸ”’
Unpacks a compressed state record into its two short IDs.

Type AliasesΒ§

CompressedState
Ordered set of compressed state-key and event-ID pairs.
CompressedStateEvent
Fixed-width encoding of one short state key and short event ID.
ParentStatesVec πŸ”’
ShortStateInfoVec πŸ”’
StateInfoLruCache πŸ”’