tracker

package
v0.36.9-crescendo-RC2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenStorage

func OpenStorage(dbPath string, startHeight uint64, logger zerolog.Logger, opts ...StorageOption) (*storage, error)

Types

type NoopStorage added in v0.33.11

type NoopStorage struct{}

func (*NoopStorage) GetFulfilledHeight added in v0.33.11

func (s *NoopStorage) GetFulfilledHeight() (uint64, error)

func (*NoopStorage) GetPrunedHeight added in v0.33.11

func (s *NoopStorage) GetPrunedHeight() (uint64, error)

func (*NoopStorage) PruneUpToHeight added in v0.33.11

func (s *NoopStorage) PruneUpToHeight(height uint64) error

func (*NoopStorage) SetFulfilledHeight added in v0.33.11

func (s *NoopStorage) SetFulfilledHeight(uint64) error

func (*NoopStorage) Update added in v0.33.11

func (s *NoopStorage) Update(update UpdateFn) error

type PruneCallback

type PruneCallback func(cid.Cid) error

PruneCallback is a function which can be provided by the user which is called for each CID when the last height at which that CID appears is pruned. Any returned error will be returned from the surrounding call to Storage.Prune. The prune callback can be used to delete the corresponding blob data from the blob store.

type Storage

type Storage interface {
	// Update is used to track new blob CIDs.
	// It can be used to track blobs for both sealed and unsealed
	// heights, and the same blob may be added multiple times for
	// different heights.
	// The same blob may also be added multiple times for the same
	// height, but it will only be tracked once per height.
	Update(UpdateFn) error

	// GetFulfilledHeight returns the current fulfilled height.
	// No errors are expected during normal operation.
	GetFulfilledHeight() (uint64, error)

	// SetFulfilledHeight updates the fulfilled height value,
	// which is the highest block height `h` such that all
	// heights <= `h` are sealed and the sealed execution data
	// has been downloaded.
	// It is up to the caller to ensure that this is never
	// called with a value lower than the pruned height.
	// No errors are expected during normal operation
	SetFulfilledHeight(height uint64) error

	// GetPrunedHeight returns the current pruned height.
	// No errors are expected during normal operation.
	GetPrunedHeight() (uint64, error)

	// PruneUpToHeight removes all data from storage corresponding
	// to block heights up to and including the given height,
	// and updates the latest pruned height value.
	// It locks the Storage and ensures that no other writes
	// can occur during the pruning.
	// It is up to the caller to ensure that this is never
	// called with a value higher than the fulfilled height.
	PruneUpToHeight(height uint64) error
}

type StorageOption

type StorageOption func(*storage)

func WithPruneCallback

func WithPruneCallback(callback PruneCallback) StorageOption

type TrackBlobsFn

type TrackBlobsFn func(blockHeight uint64, cids ...cid.Cid) error

TrackBlobsFun is passed to the UpdateFn provided to Storage.Update, and can be called to track a list of cids at a given block height. It returns an error if the update failed.

type UpdateFn

type UpdateFn func(TrackBlobsFn) error

UpdateFn is implemented by the user and passed to Storage.Update, which ensures that it will never be run concurrently with any call to Storage.Prune. Any returned error will be returned from the surrounding call to Storage.Update. The function must never make any calls to the Storage interface itself, and should instead only modify the storage via the provided TrackBlobsFn.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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