execution_data

package
v0.31.14-chunk-data-pack Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: AGPL-3.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

View Source
const DefaultMaxBlobSize = 1 << 20 // 1MiB

DefaultMaxBlobSize is the default maximum size of a blob. This is calibrated to fit within a libp2p message and not exceed the max size recommended by bitswap.

Variables

This section is empty.

Functions

func CalculateID added in v0.29.10

func CalculateID(ctx context.Context, execData *BlockExecutionData, serializer Serializer) (flow.Identifier, error)

CalculateID calculates the root ID of the given execution data without storing any data. No errors are expected during normal operation.

func IsBlobNotFoundError added in v0.30.2

func IsBlobNotFoundError(err error) bool

IsBlobNotFoundError returns whether an error is BlobNotFoundError

func IsBlobSizeLimitExceededError added in v0.30.2

func IsBlobSizeLimitExceededError(err error) bool

IsBlobSizeLimitExceededError returns whether an error is BlobSizeLimitExceededError

func IsMalformedDataError

func IsMalformedDataError(err error) bool

IsMalformedDataError returns whether an error is MalformedDataError

func NewDownloader

func NewDownloader(blobService network.BlobService, opts ...DownloaderOption) *downloader

NewDownloader creates a new Downloader instance

func NewExecutionDataStore

func NewExecutionDataStore(blobstore blobs.Blobstore, serializer Serializer, opts ...ExecutionDataStoreOption) *store

NewExecutionDataStore creates a new Execution Data Store.

func NewSerializer

func NewSerializer(codec encoding.Codec, compressor network.Compressor) *serializer

NewSerializer returns a new Execution Data serializer using the provided encoder and compressor.

Types

type BlobNotFoundError

type BlobNotFoundError struct {
	// contains filtered or unexported fields
}

BlobNotFoundError is returned when a blob could not be found.

func NewBlobNotFoundError

func NewBlobNotFoundError(cid cid.Cid) *BlobNotFoundError

func (*BlobNotFoundError) Error

func (e *BlobNotFoundError) Error() string

type BlobSizeLimitExceededError

type BlobSizeLimitExceededError struct {
	// contains filtered or unexported fields
}

BlobSizeLimitExceededError is returned when a blob exceeds the maximum size allowed.

func (*BlobSizeLimitExceededError) Error

type BlockExecutionData

type BlockExecutionData struct {
	BlockID             flow.Identifier
	ChunkExecutionDatas []*ChunkExecutionData
}

BlockExecutionData represents the execution data of a block.

type BlockExecutionDataEntity added in v0.30.2

type BlockExecutionDataEntity struct {
	*BlockExecutionData
	// contains filtered or unexported fields
}

BlockExecutionDataEntity is a wrapper around BlockExecutionData that implements the flow.Entity interface to support caching with Herocache

func NewBlockExecutionDataEntity added in v0.30.2

func NewBlockExecutionDataEntity(id flow.Identifier, executionData *BlockExecutionData) *BlockExecutionDataEntity

func (BlockExecutionDataEntity) Checksum added in v0.30.2

func (BlockExecutionDataEntity) ID added in v0.30.2

type BlockExecutionDataRoot

type BlockExecutionDataRoot struct {
	// BlockID is the ID of the block who's result this execution data is for.
	BlockID flow.Identifier

	// ChunkExecutionDataIDs is a list of the root CIDs for each serialized ChunkExecutionData
	// associated with this block.
	ChunkExecutionDataIDs []cid.Cid
}

BlockExecutionDataRoot represents the root of a serialized BlockExecutionData. The hash of the serialized BlockExecutionDataRoot is the ExecutionDataID used within an flow.ExecutionResult.

type ChunkExecutionData

type ChunkExecutionData struct {
	Collection *flow.Collection
	Events     flow.EventsList
	TrieUpdate *ledger.TrieUpdate
}

ChunkExecutionData represents the execution data of a chunk

type Downloader

type Downloader interface {
	module.ReadyDoneAware
	ExecutionDataGetter
}

Downloader is used to download execution data blobs from the network via a blob service.

type DownloaderOption

type DownloaderOption func(*downloader)

func WithSerializer

func WithSerializer(serializer Serializer) DownloaderOption

WithSerializer configures the serializer for the downloader

type ExecutionDataGetter added in v0.31.0

type ExecutionDataGetter interface {
	// Get gets the BlockExecutionData for the given root ID from the blobstore.
	// Expected errors during normal operations:
	// - BlobNotFoundError if some CID in the blob tree could not be found from the blobstore
	// - MalformedDataError if some level of the blob tree cannot be properly deserialized
	// - BlobSizeLimitExceededError if some blob in the blob tree exceeds the maximum allowed size
	Get(ctx context.Context, rootID flow.Identifier) (*BlockExecutionData, error)
}

ExecutionDataGetter handles getting execution data from a blobstore

type ExecutionDataStore

type ExecutionDataStore interface {
	ExecutionDataGetter

	// Add constructs a blob tree for the given BlockExecutionData, adds it to the blobstore,
	// then returns the root CID.
	// No errors are expected during normal operation.
	Add(ctx context.Context, executionData *BlockExecutionData) (flow.Identifier, error)
}

ExecutionDataStore handles adding / getting execution data to / from a blobstore

type ExecutionDataStoreOption

type ExecutionDataStoreOption func(*store)

func WithMaxBlobSize

func WithMaxBlobSize(size int) ExecutionDataStoreOption

WithMaxBlobSize configures the maximum blob size of the store

type MalformedDataError

type MalformedDataError struct {
	// contains filtered or unexported fields
}

MalformedDataError is returned when malformed data is found at some level of the requested blob tree. It likely indicates that the tree was generated incorrectly, and hence the request should not be retried.

func NewMalformedDataError

func NewMalformedDataError(err error) *MalformedDataError

func (*MalformedDataError) Error

func (e *MalformedDataError) Error() string

func (*MalformedDataError) Unwrap

func (e *MalformedDataError) Unwrap() error

type Serializer

type Serializer interface {
	// Serialize encodes and compresses the given value to the given writer.
	// No errors are expected during normal operation.
	Serialize(io.Writer, interface{}) error

	// Deserialize decompresses and decodes the data from the given reader.
	// No errors are expected during normal operation.
	Deserialize(io.Reader) (interface{}, error)
}

Serializer is used to serialize / deserialize Execution Data and CID lists for the Execution Data Service.

var DefaultSerializer Serializer

DefaultSerializer is the default implementation for an Execution Data serializer. It is configured to use cbor encoding with LZ4 compression.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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