execution_data

package
v0.38.0-preview.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 22 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 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

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

type DownloaderOption

type DownloaderOption func(*downloader)

func WithExecutionDataTracker added in v0.35.17

func WithExecutionDataTracker(storage tracker.Storage, headers storage.Headers) DownloaderOption

WithExecutionDataTracker configures the execution data tracker and the storage headers for the downloader

func WithSerializer

func WithSerializer(serializer Serializer) DownloaderOption

WithSerializer configures the serializer for the downloader

type ExecutionDataDBMode added in v0.37.1

type ExecutionDataDBMode int

ExecutionDataDBMode controls which db type to use.

const (
	// ExecutionDataDBModeBadger uses badger db
	ExecutionDataDBModeBadger ExecutionDataDBMode = iota + 1

	// ExecutionDataDBModePebble uses pebble db
	ExecutionDataDBModePebble
)

func ParseExecutionDataDBMode added in v0.37.1

func ParseExecutionDataDBMode(s string) (ExecutionDataDBMode, error)

func (ExecutionDataDBMode) String added in v0.37.1

func (m ExecutionDataDBMode) String() string

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 HeightUpdatesConsumer added in v0.37.22

type HeightUpdatesConsumer func(height uint64)

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 ProcessedHeightRecorder added in v0.37.1

type ProcessedHeightRecorder interface {
	// OnBlockProcessed updates the highest processed height when a block is processed.
	OnBlockProcessed(uint64)
	// HighestCompleteHeight returns the highest complete processed block height.
	HighestCompleteHeight() uint64

	// SetHeightUpdatesConsumer subscribe consumer for processed height updates.
	// Callback are called synchronously and must be non-blocking
	SetHeightUpdatesConsumer(HeightUpdatesConsumer)
}

ProcessedHeightRecorder is an interface for tracking the highest execution data processed height when a block is processed and for providing this height.

type ProcessedHeightRecorderManager added in v0.37.1

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

ProcessedHeightRecorderManager manages an execution data height recorder and tracks the highest processed block height.

func NewProcessedHeightRecorderManager added in v0.37.1

func NewProcessedHeightRecorderManager(initHeight uint64) *ProcessedHeightRecorderManager

NewProcessedHeightRecorderManager creates a new ProcessedHeightRecorderManager with the given initial height.

func (*ProcessedHeightRecorderManager) HighestCompleteHeight added in v0.37.1

func (e *ProcessedHeightRecorderManager) HighestCompleteHeight() uint64

HighestCompleteHeight returns the highest complete processed block height.

func (*ProcessedHeightRecorderManager) OnBlockProcessed added in v0.37.1

func (e *ProcessedHeightRecorderManager) OnBlockProcessed(height uint64)

OnBlockProcessed updates the highest processed height when a block is processed.

func (*ProcessedHeightRecorderManager) SetHeightUpdatesConsumer added in v0.37.22

func (e *ProcessedHeightRecorderManager) SetHeightUpdatesConsumer(consumer HeightUpdatesConsumer)

SetHeightUpdatesConsumer subscribe consumers for processed height updates.

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