Documentation ¶
Index ¶
- func NewEphemeralBlobStorageWithMocker(_ testing.TB) (*BlobMocker, *BlobStorage)
- type BlobMocker
- type BlobStorage
- func (bs *BlobStorage) Clear() error
- func (bs *BlobStorage) Get(root [32]byte, idx uint64) (blocks.VerifiedROBlob, error)
- func (bs *BlobStorage) Indices(root [32]byte) ([fieldparams.MaxBlobsPerBlock]bool, error)
- func (bs *BlobStorage) Remove(root [32]byte) error
- func (bs *BlobStorage) Save(sidecar blocks.VerifiedROBlob) error
- func (bs *BlobStorage) WarmCache()
- type BlobStorageOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEphemeralBlobStorageWithMocker ¶
func NewEphemeralBlobStorageWithMocker(_ testing.TB) (*BlobMocker, *BlobStorage)
NewEphemeralBlobStorageWithMocker returns a *BlobMocker value in addition to the BlobStorage value. BlockMocker encapsulates things blob path construction to avoid leaking implementation details.
Types ¶
type BlobMocker ¶
type BlobMocker struct {
// contains filtered or unexported fields
}
func (*BlobMocker) CreateFakeIndices ¶
func (bm *BlobMocker) CreateFakeIndices(root [32]byte, indices ...uint64) error
CreateFakeIndices creates empty blob sidecar files at the expected path for the given root and indices to influence the result of Indices().
type BlobStorage ¶
type BlobStorage struct {
// contains filtered or unexported fields
}
BlobStorage is the concrete implementation of the filesystem backend for saving and retrieving BlobSidecars.
func NewBlobStorage ¶
func NewBlobStorage(opts ...BlobStorageOption) (*BlobStorage, error)
NewBlobStorage creates a new instance of the BlobStorage object. Note that the implementation of BlobStorage may attempt to hold a file lock to guarantee exclusive control of the blob storage directory, so this should only be initialized once per beacon node.
func NewEphemeralBlobStorage ¶
func NewEphemeralBlobStorage(t testing.TB) *BlobStorage
NewEphemeralBlobStorage should only be used for tests. The instance of BlobStorage returned is backed by an in-memory virtual filesystem, improving test performance and simplifying cleanup.
func NewEphemeralBlobStorageWithFs ¶
NewEphemeralBlobStorageWithFs can be used by tests that want access to the virtual filesystem in order to interact with it outside the parameters of the BlobStorage api.
func (*BlobStorage) Clear ¶
func (bs *BlobStorage) Clear() error
Clear deletes all files on the filesystem.
func (*BlobStorage) Get ¶
func (bs *BlobStorage) Get(root [32]byte, idx uint64) (blocks.VerifiedROBlob, error)
Get retrieves a single BlobSidecar by its root and index. Since BlobStorage only writes blobs that have undergone full verification, the return value is always a VerifiedROBlob.
func (*BlobStorage) Indices ¶
func (bs *BlobStorage) Indices(root [32]byte) ([fieldparams.MaxBlobsPerBlock]bool, error)
Indices generates a bitmap representing which BlobSidecar.Index values are present on disk for a given root. This value can be compared to the commitments observed in a block to determine which indices need to be found on the network to confirm data availability.
func (*BlobStorage) Remove ¶
func (bs *BlobStorage) Remove(root [32]byte) error
Remove removes all blobs for a given root.
func (*BlobStorage) Save ¶
func (bs *BlobStorage) Save(sidecar blocks.VerifiedROBlob) error
Save saves blobs given a list of sidecars.
func (*BlobStorage) WarmCache ¶
func (bs *BlobStorage) WarmCache()
WarmCache runs the prune routine with an expiration of slot of 0, so nothing will be pruned, but the pruner's cache will be populated at node startup, avoiding a costly cold prune (~4s in syscalls) during syncing.
type BlobStorageOption ¶
type BlobStorageOption func(*BlobStorage) error
BlobStorageOption is a functional option for configuring a BlobStorage.
func WithBasePath ¶ added in v5.0.1
func WithBasePath(base string) BlobStorageOption
WithBasePath is a required option that sets the base path of blob storage.
func WithBlobRetentionEpochs ¶
func WithBlobRetentionEpochs(e primitives.Epoch) BlobStorageOption
WithBlobRetentionEpochs is an option that changes the number of epochs blobs will be persisted.
func WithSaveFsync ¶ added in v5.0.1
func WithSaveFsync(fsync bool) BlobStorageOption
WithSaveFsync is an option that causes Save to call fsync before renaming part files for improved durability.