pub trait BalStore:
Send
+ Sync
+ 'static {
// Required methods
fn insert(
&self,
block_hash: BlockHash,
block_number: BlockNumber,
bal: Bytes,
) -> ProviderResult<()>;
fn get_by_hashes(
&self,
block_hashes: &[BlockHash],
) -> ProviderResult<Vec<Option<Bytes>>>;
fn get_by_range(
&self,
start: BlockNumber,
count: u64,
) -> ProviderResult<Vec<Bytes>>;
// Provided methods
fn get_by_hashes_with_limit(
&self,
block_hashes: &[BlockHash],
limit: GetBlockAccessListLimit,
) -> ProviderResult<Vec<Bytes>> { ... }
fn append_by_hashes_with_limit(
&self,
block_hashes: &[BlockHash],
limit: GetBlockAccessListLimit,
out: &mut Vec<Bytes>,
) -> ProviderResult<()> { ... }
}Expand description
Store for Block Access Lists (BALs).
This abstraction intentionally does not prescribe where BALs live. Implementations may keep recent BALs in memory, read canonical BALs from static files, or compose multiple tiers behind a single interface.
Required Methods§
Sourcefn insert(
&self,
block_hash: BlockHash,
block_number: BlockNumber,
bal: Bytes,
) -> ProviderResult<()>
fn insert( &self, block_hash: BlockHash, block_number: BlockNumber, bal: Bytes, ) -> ProviderResult<()>
Insert the BAL for the given block.
Sourcefn get_by_hashes(
&self,
block_hashes: &[BlockHash],
) -> ProviderResult<Vec<Option<Bytes>>>
fn get_by_hashes( &self, block_hashes: &[BlockHash], ) -> ProviderResult<Vec<Option<Bytes>>>
Fetch BALs for the given block hashes.
The returned vector must align with block_hashes.
Sourcefn get_by_range(
&self,
start: BlockNumber,
count: u64,
) -> ProviderResult<Vec<Bytes>>
fn get_by_range( &self, start: BlockNumber, count: u64, ) -> ProviderResult<Vec<Bytes>>
Fetch BALs for the requested range.
Implementations may stop at the first gap and return the contiguous prefix.
Provided Methods§
Sourcefn get_by_hashes_with_limit(
&self,
block_hashes: &[BlockHash],
limit: GetBlockAccessListLimit,
) -> ProviderResult<Vec<Bytes>>
fn get_by_hashes_with_limit( &self, block_hashes: &[BlockHash], limit: GetBlockAccessListLimit, ) -> ProviderResult<Vec<Bytes>>
Fetch BAL response entries for the given block hashes, stopping after the soft limit is exceeded.
Entries are returned in request order. Unavailable BALs are represented as an RLP-encoded
empty list (0xc0). The limit is soft: the entry that exceeds the limit is included.
Sourcefn append_by_hashes_with_limit(
&self,
block_hashes: &[BlockHash],
limit: GetBlockAccessListLimit,
out: &mut Vec<Bytes>,
) -> ProviderResult<()>
fn append_by_hashes_with_limit( &self, block_hashes: &[BlockHash], limit: GetBlockAccessListLimit, out: &mut Vec<Bytes>, ) -> ProviderResult<()>
Extends the given vector with BAL response entries for the given hashes.
This adheres to the expected behavior of Self::get_by_hashes_with_limit.