snapshot

package
v0.31.9 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: AGPL-3.0 Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyStorageSnapshot

type EmptyStorageSnapshot struct{}

func (EmptyStorageSnapshot) Get

type ExecutionSnapshot

type ExecutionSnapshot struct {
	// Note that the ReadSet only include reads from the storage snapshot.
	// Reads from the WriteSet are excluded from the ReadSet.
	ReadSet map[flow.RegisterID]struct{}

	WriteSet map[flow.RegisterID]flow.RegisterValue

	// Note that the spock secret may be nil if the view does not support spock.
	SpockSecret []byte

	// Note that the meter may be nil if the view does not support metering.
	*meter.Meter
}

func (*ExecutionSnapshot) AllRegisterIDs

func (snapshot *ExecutionSnapshot) AllRegisterIDs() []flow.RegisterID

AllRegisterIDs returns all register ids that were read / write by this view. The returned ids are unsorted.

func (*ExecutionSnapshot) ReadRegisterIDs

func (snapshot *ExecutionSnapshot) ReadRegisterIDs() []flow.RegisterID

ReadRegisterIDs returns a list of register ids that were read. The returned ids are unsorted

func (*ExecutionSnapshot) UpdatedRegisterIDs

func (snapshot *ExecutionSnapshot) UpdatedRegisterIDs() []flow.RegisterID

UpdatedRegisterIDs returns all register ids that were updated by this view. The returned ids are unsorted.

func (*ExecutionSnapshot) UpdatedRegisters

func (snapshot *ExecutionSnapshot) UpdatedRegisters() flow.RegisterEntries

UpdatedRegisters returns all registers that were updated by this view. The returned entries are sorted by ids.

type MapStorageSnapshot

type MapStorageSnapshot map[flow.RegisterID]flow.RegisterValue

func (MapStorageSnapshot) Get

func (storage MapStorageSnapshot) Get(
	id flow.RegisterID,
) (
	flow.RegisterValue,
	error,
)

type Peeker

type Peeker interface {
	Peek(id flow.RegisterID) (flow.RegisterValue, error)
}

type ReadFuncStorageSnapshot

type ReadFuncStorageSnapshot struct {
	ReadFunc func(flow.RegisterID) (flow.RegisterValue, error)
}

func (ReadFuncStorageSnapshot) Get

type SnapshotTree

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

SnapshotTree is a simple LSM tree representation of the key/value storage at a given point in time.

func NewSnapshotTree

func NewSnapshotTree(base StorageSnapshot) SnapshotTree

NewSnapshotTree returns a tree with keys/values initialized to the base storage snapshot.

func (SnapshotTree) Append

func (tree SnapshotTree) Append(
	update *ExecutionSnapshot,
) SnapshotTree

Append returns a new tree with updates from the execution snapshot "applied" to the original original tree.

func (SnapshotTree) Get

Get returns the register id's value.

type StorageSnapshot

type StorageSnapshot interface {
	// Get returns the register id's value, or an empty RegisterValue if the id
	// is not found.  Get should be idempotent (i.e., the same value is returned
	// for the same id).
	Get(id flow.RegisterID) (flow.RegisterValue, error)
}

Note: StorageSnapshot must be thread safe (or immutable).

func NewPeekerStorageSnapshot

func NewPeekerStorageSnapshot(peeker Peeker) StorageSnapshot

func NewReadFuncStorageSnapshot

func NewReadFuncStorageSnapshot(
	readFunc func(flow.RegisterID) (flow.RegisterValue, error),
) StorageSnapshot

type UpdateLog

type UpdateLog []map[flow.RegisterID]flow.RegisterValue

Jump to

Keyboard shortcuts

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