pub trait BlobStore:
Debug
+ Send
+ Sync
+ 'static {
Show 13 methods
// Required methods
fn insert(
&self,
tx: B256,
data: BlobTransactionSidecarVariant,
) -> Result<(), BlobStoreError>;
fn insert_all(
&self,
txs: Vec<(B256, BlobTransactionSidecarVariant)>,
) -> Result<(), BlobStoreError>;
fn delete(&self, tx: B256) -> Result<(), BlobStoreError>;
fn delete_all(&self, txs: Vec<B256>) -> Result<(), BlobStoreError>;
fn cleanup(&self) -> BlobStoreCleanupStat;
fn get(
&self,
tx: B256,
) -> Result<Option<Arc<BlobTransactionSidecarVariant>>, BlobStoreError>;
fn contains(&self, tx: B256) -> Result<bool, BlobStoreError>;
fn get_all(
&self,
txs: Vec<B256>,
) -> Result<Vec<(B256, Arc<BlobTransactionSidecarVariant>)>, BlobStoreError>;
fn get_exact(
&self,
txs: Vec<B256>,
) -> Result<Vec<Arc<BlobTransactionSidecarVariant>>, BlobStoreError>;
fn get_by_versioned_hashes_v1(
&self,
versioned_hashes: &[B256],
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>;
fn get_by_versioned_hashes_v2(
&self,
versioned_hashes: &[B256],
) -> Result<Option<Vec<BlobAndProofV2>>, BlobStoreError>;
fn data_size_hint(&self) -> Option<usize>;
fn blobs_len(&self) -> usize;
}
Expand description
A blob store that can be used to store blob data of EIP4844 transactions.
This type is responsible for keeping track of blob data until it is no longer needed (after finalization).
Note: this is Clone because it is expected to be wrapped in an Arc.
Required Methods§
Sourcefn insert(
&self,
tx: B256,
data: BlobTransactionSidecarVariant,
) -> Result<(), BlobStoreError>
fn insert( &self, tx: B256, data: BlobTransactionSidecarVariant, ) -> Result<(), BlobStoreError>
Inserts the blob sidecar into the store
Sourcefn insert_all(
&self,
txs: Vec<(B256, BlobTransactionSidecarVariant)>,
) -> Result<(), BlobStoreError>
fn insert_all( &self, txs: Vec<(B256, BlobTransactionSidecarVariant)>, ) -> Result<(), BlobStoreError>
Inserts multiple blob sidecars into the store
Sourcefn delete(&self, tx: B256) -> Result<(), BlobStoreError>
fn delete(&self, tx: B256) -> Result<(), BlobStoreError>
Deletes the blob sidecar from the store
Sourcefn delete_all(&self, txs: Vec<B256>) -> Result<(), BlobStoreError>
fn delete_all(&self, txs: Vec<B256>) -> Result<(), BlobStoreError>
Deletes multiple blob sidecars from the store
Sourcefn cleanup(&self) -> BlobStoreCleanupStat
fn cleanup(&self) -> BlobStoreCleanupStat
A maintenance function that can be called periodically to clean up the blob store, returns the number of successfully deleted blobs and the number of failed deletions.
This is intended to be called in the background to clean up any old or unused data, in case
the store uses deferred cleanup: DiskFileBlobStore
Sourcefn get(
&self,
tx: B256,
) -> Result<Option<Arc<BlobTransactionSidecarVariant>>, BlobStoreError>
fn get( &self, tx: B256, ) -> Result<Option<Arc<BlobTransactionSidecarVariant>>, BlobStoreError>
Retrieves the decoded blob data for the given transaction hash.
Sourcefn contains(&self, tx: B256) -> Result<bool, BlobStoreError>
fn contains(&self, tx: B256) -> Result<bool, BlobStoreError>
Checks if the given transaction hash is in the blob store.
Sourcefn get_all(
&self,
txs: Vec<B256>,
) -> Result<Vec<(B256, Arc<BlobTransactionSidecarVariant>)>, BlobStoreError>
fn get_all( &self, txs: Vec<B256>, ) -> Result<Vec<(B256, Arc<BlobTransactionSidecarVariant>)>, BlobStoreError>
Retrieves all decoded blob data for the given transaction hashes.
This only returns the blobs that were found in the store. If there’s no blob it will not be returned.
Note: this is not guaranteed to return the blobs in the same order as the input.
Sourcefn get_exact(
&self,
txs: Vec<B256>,
) -> Result<Vec<Arc<BlobTransactionSidecarVariant>>, BlobStoreError>
fn get_exact( &self, txs: Vec<B256>, ) -> Result<Vec<Arc<BlobTransactionSidecarVariant>>, BlobStoreError>
Returns the exact [BlobTransactionSidecarVariant
] for the given transaction hashes in the
exact order they were requested.
Returns an error if any of the blobs are not found in the blob store.
Sourcefn get_by_versioned_hashes_v1(
&self,
versioned_hashes: &[B256],
) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>
fn get_by_versioned_hashes_v1( &self, versioned_hashes: &[B256], ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>
Return the [BlobAndProofV1
]s for a list of blob versioned hashes.
Sourcefn get_by_versioned_hashes_v2(
&self,
versioned_hashes: &[B256],
) -> Result<Option<Vec<BlobAndProofV2>>, BlobStoreError>
fn get_by_versioned_hashes_v2( &self, versioned_hashes: &[B256], ) -> Result<Option<Vec<BlobAndProofV2>>, BlobStoreError>
Return the [BlobAndProofV2
]s for a list of blob versioned hashes.
Blobs and proofs are returned only if they are present for all requested
versioned hashes.
This differs from BlobStore::get_by_versioned_hashes_v1
in that it also returns all the
cell proofs in [BlobAndProofV2
] supported by the EIP-7594 blob sidecar variant.
The response also differs from BlobStore::get_by_versioned_hashes_v1
in that this
returns None
if any of the requested versioned hashes are not present in the blob store:
e.g. where v1 would return [A, None, C]
v2 would return None
. See also https://github.com/ethereum/execution-apis/blob/main/src/engine/osaka.md#engine_getblobsv2
Sourcefn data_size_hint(&self) -> Option<usize>
fn data_size_hint(&self) -> Option<usize>
Data size of all transactions in the blob store.