filesystem

package
v4.2.1-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

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(base string, 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

func NewEphemeralBlobStorageWithFs(t testing.TB) (afero.Fs, *BlobStorage, error)

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) 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 added in v4.2.1

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 WithBlobRetentionEpochs

func WithBlobRetentionEpochs(e primitives.Epoch) BlobStorageOption

WithBlobRetentionEpochs is an option that changes the number of epochs blobs will be persisted.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL