Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound is returned when a blob is not found in the storage. ErrNotFound = errors.New("blob not found") // ErrStorage is returned when there is an error accessing the storage. ErrStorage = errors.New("error accessing storage") // ErrMarshaling is returned when there is an error in (un)marshaling the blob ErrMarshaling = errors.New("error encoding/decoding blob") // ErrCompress is returned when there is an error gzipping the data ErrCompress = errors.New("error compressing blob") )
Functions ¶
This section is empty.
Types ¶
type BlobData ¶
type BlobData struct { Header Header `json:"header"` BlobSidecars BlobSidecars `json:"blob_sidecars"` }
type BlobSidecars ¶
type BlobSidecars struct {
Data []*deneb.BlobSidecar `json:"data"`
}
func (*BlobSidecars) MarshalSSZ ¶
func (b *BlobSidecars) MarshalSSZ() ([]byte, error)
MarshalSSZ marshals the blob sidecars into SSZ. As the blob sidecars are a single list of fixed size elements, we can simply concatenate the marshaled sidecars together.
func (*BlobSidecars) SizeSSZ ¶
func (b *BlobSidecars) SizeSSZ() int
type DataStore ¶
type DataStore interface { DataStoreReader DataStoreWriter }
DataStore is the interface for a data store that can be both written to and read from.
func NewStorage ¶
type DataStoreReader ¶
type DataStoreReader interface { // Exists returns true if the given blob hash exists in the data store, false otherwise. // It should return one of the following: // - nil: the existence check was successful. In this case the boolean should also be set correctly. // - ErrStorage: there was an error accessing the data store. Exists(ctx context.Context, hash common.Hash) (bool, error) // Read reads the blob data for the given beacon block hash from the data store. // It should return one of the following: // - nil: reading the blob was successful. The blob data is also returned. // - ErrNotFound: the blob data was not found in the data store. // - ErrStorage: there was an error accessing the data store. // - ErrMarshaling: there was an error decoding the blob data. Read(ctx context.Context, hash common.Hash) (BlobData, error) }
DataStoreReader is the interface for reading from a data store.
type DataStoreWriter ¶
type DataStoreWriter interface { // Write writes the given blob data to the data store. It should return one of the following errors: // - nil: writing the blob was successful. // - ErrStorage: there was an error accessing the data store. // - ErrMarshaling: there was an error encoding the blob data. Write(ctx context.Context, data BlobData) error }
DataStoreWriter is the interface for writing to a data store.
type FileStorage ¶
type FileStorage struct {
// contains filtered or unexported fields
}
func NewFileStorage ¶
func NewFileStorage(dir string, l log.Logger) *FileStorage
Click to show internal directories.
Click to hide internal directories.