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§
Sourcefn snapshot(&self) -> InternalQueueSnapshot
fn snapshot(&self) -> InternalQueueSnapshot
Create snapshot
Sourcefn iterator(
&self,
snapshot: &InternalQueueSnapshot,
receiver: ShardIdent,
partition: QueuePartitionIdx,
ranges: &[QueueShardRange],
) -> Result<Box<dyn StateIterator<V>>>
fn iterator( &self, snapshot: &InternalQueueSnapshot, receiver: ShardIdent, partition: QueuePartitionIdx, ranges: &[QueueShardRange], ) -> Result<Box<dyn StateIterator<V>>>
Create iterator for given partition and ranges
Sourcefn delete(
&self,
partition: QueuePartitionIdx,
ranges: &[QueueShardRange],
) -> Result<()>
fn delete( &self, partition: QueuePartitionIdx, ranges: &[QueueShardRange], ) -> Result<()>
Delete messages in given partition and ranges
Sourcefn commit(
&self,
commit_pointers: FastHashMap<ShardIdent, (QueueKey, u32)>,
mc_block_id: &BlockId,
) -> Result<()>
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.
Sourcefn load_diff_statistics(
&self,
partition: QueuePartitionIdx,
range: &QueueShardRange,
result: &mut AccountStatistics,
) -> Result<()>
fn load_diff_statistics( &self, partition: QueuePartitionIdx, range: &QueueShardRange, result: &mut AccountStatistics, ) -> Result<()>
Load statistics for given partition and ranges
Sourcefn load_separated_diff_statistics(
&self,
partitions: &FastHashSet<QueuePartitionIdx>,
range: &QueueShardRange,
) -> Result<SeparatedStatisticsByPartitions>
fn load_separated_diff_statistics( &self, partitions: &FastHashSet<QueuePartitionIdx>, range: &QueueShardRange, ) -> Result<SeparatedStatisticsByPartitions>
Load separated diff statistics for the specified partitions and range
Sourcefn get_last_committed_mc_block_id(&self) -> Result<Option<BlockId>>
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
Sourcefn get_diffs_tail_len(&self, shard_ident: &ShardIdent, from: &QueueKey) -> u32
fn get_diffs_tail_len(&self, shard_ident: &ShardIdent, from: &QueueKey) -> u32
Get diffs tail len from uncommitted state and committed state
Sourcefn get_diff_info(
&self,
shard_ident: &ShardIdent,
seqno: u32,
zone: DiffZone,
) -> Result<Option<DiffInfo>>
fn get_diff_info( &self, shard_ident: &ShardIdent, seqno: u32, zone: DiffZone, ) -> Result<Option<DiffInfo>>
Get diff info by diff seqno
Sourcefn get_last_applied_seqno(
&self,
shard_ident: &ShardIdent,
) -> Result<Option<u32>>
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
Sourcefn get_commit_pointers(
&self,
) -> Result<FastHashMap<ShardIdent, CommitPointerValue>>
fn get_commit_pointers( &self, ) -> Result<FastHashMap<ShardIdent, CommitPointerValue>>
Get commit pointers
Sourcefn prepare_diff(
&self,
block_id_short: &BlockIdShort,
statistics: &DiffStatistics,
hash: HashBytes,
diff: QueueDiffWithMessages<V>,
) -> Result<InternalQueueTransaction>
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.
fn clear_uncommitted( &self, partitions: &FastHashSet<QueuePartitionIdx>, top_shards: &[ShardIdent], ) -> Result<()>
Provided Methods§
Sourcefn write_diff(
&self,
block_id_short: &BlockIdShort,
statistics: &DiffStatistics,
hash: HashBytes,
diff: QueueDiffWithMessages<V>,
) -> Result<()>
fn write_diff( &self, block_id_short: &BlockIdShort, statistics: &DiffStatistics, hash: HashBytes, diff: QueueDiffWithMessages<V>, ) -> Result<()>
Write diff to storage immediately.