execution_data

package
v0.33.17 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: AGPL-3.0 Imports: 18 Imported by: 3

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 ConvertTransactionResults added in v0.32.0

func ConvertTransactionResults(results flow.TransactionResults) []flow.LightTransactionResult

ConvertTransactionResults converts a list of flow.TransactionResults into a list of flow.LightTransactionResults to be included in a ChunkExecutionData.

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 ChunkExecutionData

type ChunkExecutionData struct {
	// Collection is the collection for which this chunk was executed
	Collection *flow.Collection

	// Events are the events generated by executing the collection
	Events flow.EventsList

	// TrieUpdate is the trie update generated by executing the collection
	// This includes a list of all registers updated during the execution
	TrieUpdate *ledger.TrieUpdate

	// TransactionResults are the results of executing the transactions in the collection
	// This includes all of the data from flow.TransactionResult, except that it uses a boolean
	// value to indicate if an error occurred instead of a full error message.
	TransactionResults []flow.LightTransactionResult
}

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