Skip to main content

QueueState

Trait QueueState 

Source
pub trait QueueState<V: InternalMessageValue>: Send + Sync {
Show 14 methods // Required methods fn snapshot(&self) -> InternalQueueSnapshot; fn iterator( &self, snapshot: &InternalQueueSnapshot, receiver: ShardIdent, partition: QueuePartitionIdx, ranges: &[QueueShardRange], ) -> Result<Box<dyn StateIterator<V>>>; fn delete( &self, partition: QueuePartitionIdx, ranges: &[QueueShardRange], ) -> Result<()>; fn commit( &self, commit_pointers: FastHashMap<ShardIdent, (QueueKey, u32)>, mc_block_id: &BlockId, ) -> Result<()>; fn load_diff_statistics( &self, partition: QueuePartitionIdx, range: &QueueShardRange, result: &mut AccountStatistics, ) -> Result<()>; fn load_separated_diff_statistics( &self, partitions: &FastHashSet<QueuePartitionIdx>, range: &QueueShardRange, ) -> Result<SeparatedStatisticsByPartitions>; fn get_last_committed_mc_block_id(&self) -> Result<Option<BlockId>>; fn get_diffs_tail_len( &self, shard_ident: &ShardIdent, from: &QueueKey, ) -> u32; fn get_diff_info( &self, shard_ident: &ShardIdent, seqno: u32, zone: DiffZone, ) -> Result<Option<DiffInfo>>; fn get_last_applied_seqno( &self, shard_ident: &ShardIdent, ) -> Result<Option<u32>>; fn get_commit_pointers( &self, ) -> Result<FastHashMap<ShardIdent, CommitPointerValue>>; fn prepare_diff( &self, block_id_short: &BlockIdShort, statistics: &DiffStatistics, hash: HashBytes, diff: QueueDiffWithMessages<V>, ) -> Result<InternalQueueTransaction>; fn clear_uncommitted( &self, partitions: &FastHashSet<QueuePartitionIdx>, top_shards: &[ShardIdent], ) -> Result<()>; // Provided method fn write_diff( &self, block_id_short: &BlockIdShort, statistics: &DiffStatistics, hash: HashBytes, diff: QueueDiffWithMessages<V>, ) -> Result<()> { ... }
}

Required Methods§

Source

fn snapshot(&self) -> InternalQueueSnapshot

Create snapshot

Source

fn iterator( &self, snapshot: &InternalQueueSnapshot, receiver: ShardIdent, partition: QueuePartitionIdx, ranges: &[QueueShardRange], ) -> Result<Box<dyn StateIterator<V>>>

Create iterator for given partition and ranges

Source

fn delete( &self, partition: QueuePartitionIdx, ranges: &[QueueShardRange], ) -> Result<()>

Delete messages in given partition and ranges

Source

fn commit( &self, commit_pointers: FastHashMap<ShardIdent, (QueueKey, u32)>, mc_block_id: &BlockId, ) -> Result<()>

Set commit pointers and last committed mc block id. ATTENTION! Overrides old value without checks. Should validate the new value in the calling code.

Source

fn load_diff_statistics( &self, partition: QueuePartitionIdx, range: &QueueShardRange, result: &mut AccountStatistics, ) -> Result<()>

Load statistics for given partition and ranges

Source

fn load_separated_diff_statistics( &self, partitions: &FastHashSet<QueuePartitionIdx>, range: &QueueShardRange, ) -> Result<SeparatedStatisticsByPartitions>

Load separated diff statistics for the specified partitions and range

Source

fn get_last_committed_mc_block_id(&self) -> Result<Option<BlockId>>

Get mc block id on which the queue was committed. Returns None if queue was not committed

Source

fn get_diffs_tail_len(&self, shard_ident: &ShardIdent, from: &QueueKey) -> u32

Get diffs tail len from uncommitted state and committed state

Source

fn get_diff_info( &self, shard_ident: &ShardIdent, seqno: u32, zone: DiffZone, ) -> Result<Option<DiffInfo>>

Get diff info by diff seqno

Source

fn get_last_applied_seqno( &self, shard_ident: &ShardIdent, ) -> Result<Option<u32>>

Get last applied block seqno by shard ident from committed and uncommited zone

Source

fn get_commit_pointers( &self, ) -> Result<FastHashMap<ShardIdent, CommitPointerValue>>

Get commit pointers

Source

fn prepare_diff( &self, block_id_short: &BlockIdShort, statistics: &DiffStatistics, hash: HashBytes, diff: QueueDiffWithMessages<V>, ) -> Result<InternalQueueTransaction>

Prepare diff for writing to storage. Returns transaction that should be committed later.

Source

fn clear_uncommitted( &self, partitions: &FastHashSet<QueuePartitionIdx>, top_shards: &[ShardIdent], ) -> Result<()>

Provided Methods§

Source

fn write_diff( &self, block_id_short: &BlockIdShort, statistics: &DiffStatistics, hash: HashBytes, diff: QueueDiffWithMessages<V>, ) -> Result<()>

Write diff to storage immediately.

Implementors§