pub trait Queue<V>: Send{
// Required methods
fn iterator(
&self,
partition: QueuePartitionIdx,
ranges: &[QueueShardRange],
for_shard_id: ShardIdent,
) -> Result<Box<dyn StateIterator<V>>>;
fn prepare_diff(
&self,
diff: QueueDiffWithMessages<V>,
block_id_short: BlockIdShort,
hash: &HashBytes,
statistics: DiffStatistics,
check_sequence: Option<DiffZone>,
) -> Result<Option<PendingQueueDiff>>;
fn apply_diff(
&self,
diff: QueueDiffWithMessages<V>,
block_id_short: BlockIdShort,
hash: &HashBytes,
statistics: DiffStatistics,
check_sequence: Option<DiffZone>,
) -> Result<()>;
fn commit_diff(
&self,
mc_top_blocks: &[TopBlockIdUpdated],
partitions: &FastHashSet<QueuePartitionIdx>,
) -> Result<()>;
fn clear_uncommitted_state(
&self,
partitions: &FastHashSet<QueuePartitionIdx>,
top_shards: &[ShardIdent],
) -> Result<()>;
fn get_diffs_tail_len(
&self,
shard_ident: &ShardIdent,
from: &QueueKey,
) -> u32;
fn load_diff_statistics(
&self,
partition: QueuePartitionIdx,
range: &QueueShardRange,
result: &mut AccountStatistics,
) -> Result<()>;
fn get_diff_info(
&self,
shard_ident: &ShardIdent,
seqno: u32,
zone: DiffZone,
) -> Result<Option<DiffInfo>>;
fn is_diff_exists(&self, block_id_short: &BlockIdShort) -> Result<bool>;
fn get_last_committed_mc_block_id(&self) -> Result<Option<BlockId>>;
fn load_separated_diff_statistics(
&self,
partitions: &FastHashSet<QueuePartitionIdx>,
range: &QueueShardRange,
) -> Result<SeparatedStatisticsByPartitions>;
}Required Methods§
Sourcefn iterator(
&self,
partition: QueuePartitionIdx,
ranges: &[QueueShardRange],
for_shard_id: ShardIdent,
) -> Result<Box<dyn StateIterator<V>>>
fn iterator( &self, partition: QueuePartitionIdx, ranges: &[QueueShardRange], for_shard_id: ShardIdent, ) -> Result<Box<dyn StateIterator<V>>>
Create iterator for specified shard and return it
Sourcefn prepare_diff(
&self,
diff: QueueDiffWithMessages<V>,
block_id_short: BlockIdShort,
hash: &HashBytes,
statistics: DiffStatistics,
check_sequence: Option<DiffZone>,
) -> Result<Option<PendingQueueDiff>>
fn prepare_diff( &self, diff: QueueDiffWithMessages<V>, block_id_short: BlockIdShort, hash: &HashBytes, statistics: DiffStatistics, check_sequence: Option<DiffZone>, ) -> Result<Option<PendingQueueDiff>>
Prepare diff for applying to state. Returns transaction that should be committed later. Returns None if diff is already applied (duplicate).
Sourcefn apply_diff(
&self,
diff: QueueDiffWithMessages<V>,
block_id_short: BlockIdShort,
hash: &HashBytes,
statistics: DiffStatistics,
check_sequence: Option<DiffZone>,
) -> Result<()>
fn apply_diff( &self, diff: QueueDiffWithMessages<V>, block_id_short: BlockIdShort, hash: &HashBytes, statistics: DiffStatistics, check_sequence: Option<DiffZone>, ) -> Result<()>
Add messages to state from diff.messages and store diff info (writes immediately)
Sourcefn commit_diff(
&self,
mc_top_blocks: &[TopBlockIdUpdated],
partitions: &FastHashSet<QueuePartitionIdx>,
) -> Result<()>
fn commit_diff( &self, mc_top_blocks: &[TopBlockIdUpdated], partitions: &FastHashSet<QueuePartitionIdx>, ) -> Result<()>
Commit diffs to the state and update GC
Sourcefn clear_uncommitted_state(
&self,
partitions: &FastHashSet<QueuePartitionIdx>,
top_shards: &[ShardIdent],
) -> Result<()>
fn clear_uncommitted_state( &self, partitions: &FastHashSet<QueuePartitionIdx>, top_shards: &[ShardIdent], ) -> Result<()>
Remove all data in uncommitted zone
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
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 the given range by accounts
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 for the given block from committed and/or uncommitted zones
Sourcefn is_diff_exists(&self, block_id_short: &BlockIdShort) -> Result<bool>
fn is_diff_exists(&self, block_id_short: &BlockIdShort) -> Result<bool>
Check if diff exists in state
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 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