execution_data

package
v0.30.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

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)

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

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

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
}

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               flow.Identifier
	ChunkExecutionDataIDs []cid.Cid
}

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

	// Download downloads and returns a Block Execution Data from the network.
	// The returned error will be:
	// - MalformedDataError if some level of the blob tree cannot be properly deserialized
	// - BlobNotFoundError if some CID in the blob tree could not be found from the blob service
	// - BlobSizeLimitExceededError if some blob in the blob tree exceeds the maximum allowed size
	Download(ctx context.Context, executionDataID flow.Identifier) (*BlockExecutionData, error)
}

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

type ExecutionDataStore

type ExecutionDataStore interface {
	// GetExecutionData gets the BlockExecutionData for the given root ID from the blobstore.
	// The returned error will be:
	// - MalformedDataError if some level of the blob tree cannot be properly deserialized
	// - BlobNotFoundError if some CID in the blob tree could not be found from the blobstore
	GetExecutionData(ctx context.Context, rootID flow.Identifier) (*BlockExecutionData, error)

	// AddExecutionData constructs a blob tree for the given BlockExecutionData and adds it to the
	// blobstore, and then returns the root CID.
	AddExecutionData(ctx context.Context, executionData *BlockExecutionData) (flow.Identifier, error)
}

ExecutionDataStore handles adding / getting execution data to / from a local 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(io.Writer, interface{}) error
	Deserialize(io.Reader) (interface{}, error)
}

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

var DefaultSerializer Serializer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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