delta

package
v0.30.8 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delta

type Delta struct {
	Data map[flow.RegisterID]flow.RegisterValue
}

A Delta is a record of ledger mutations.

func NewDelta

func NewDelta() Delta

NewDelta returns an empty ledger delta.

func (Delta) Get

func (d Delta) Get(id flow.RegisterID) (flow.RegisterValue, bool)

Get reads a register value from this delta.

This function will return nil if the given key has been deleted in this delta. Second return parameters indicated if the value has been set/deleted in this delta

func (Delta) MergeWith

func (d Delta) MergeWith(delta Delta)

MergeWith merges this delta with another.

func (Delta) RegisterIDs

func (d Delta) RegisterIDs() []flow.RegisterID

RegisterIDs returns the list of registerIDs inside this delta

func (Delta) RegisterUpdates

func (d Delta) RegisterUpdates() ([]flow.RegisterID, []flow.RegisterValue)

TODO(patrick): remove once emulator is updated.

RegisterUpdates returns all registers that were updated by this delta. ids are returned sorted, in ascending order

func (Delta) Set

func (d Delta) Set(id flow.RegisterID, value flow.RegisterValue)

Set records an update in this delta.

func (Delta) UpdatedRegisterIDs added in v0.30.0

func (d Delta) UpdatedRegisterIDs() []flow.RegisterID

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

func (Delta) UpdatedRegisters added in v0.30.0

func (d Delta) UpdatedRegisters() flow.RegisterEntries

UpdatedRegisters returns all registers that were updated by this delta. The returned entries are sorted by ids in ascending order.

type Snapshot

type Snapshot struct {
	Delta Delta
	SnapshotStats
	Reads map[flow.RegisterID]struct{}
}

func (*Snapshot) AllRegisterIDs added in v0.30.0

func (r *Snapshot) AllRegisterIDs() []flow.RegisterID

AllRegisterIDs returns all the register IDs either in read or delta. The returned ids are unsorted.

func (*Snapshot) RegisterTouches

func (r *Snapshot) RegisterTouches() map[flow.RegisterID]struct{}

RegisterTouches returns the register IDs touched by this view (either read or write)

type SnapshotStats added in v0.28.7

type SnapshotStats struct {
	NumberOfBytesWrittenToRegisters int
	NumberOfRegistersTouched        int
}

type SpockSnapshot added in v0.11.0

type SpockSnapshot struct {
	Snapshot
	SpockSecret []byte
}

Snapshot is state of interactions with the register

type View

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

A View is a read-only view into a ledger stored in an underlying data source.

A ledger view records writes to a delta that can be used to update the underlying data source.

func NewDeltaView added in v0.30.0

func NewDeltaView(storage state.StorageSnapshot) *View

NewDeltaView instantiates a new ledger view with the provided read function.

func NewView

func NewView(
	readFunc func(owner string, key string) (flow.RegisterValue, error),
) *View

func (*View) Delta

func (v *View) Delta() Delta

Delta returns a record of the registers that were mutated in this view.

func (*View) DropChanges added in v0.30.0

func (v *View) DropChanges() error

func (*View) Finalize added in v0.30.0

func (view *View) Finalize() *state.ExecutionSnapshot

func (*View) Get

func (v *View) Get(registerID flow.RegisterID) (flow.RegisterValue, error)

Get gets a register value from this view.

This function will return an error if it fails to read from the underlying data source for this view.

func (*View) Interactions

func (v *View) Interactions() *SpockSnapshot

Snapshot returns copy of current state of interactions with a View

func (*View) Merge added in v0.30.0

func (view *View) Merge(child *state.ExecutionSnapshot) error

func (*View) MergeView

func (view *View) MergeView(child state.View) error

TODO(patrick): remove after updating emulator

func (*View) Meter added in v0.30.0

func (v *View) Meter() *meter.Meter

func (*View) NewChild

func (v *View) NewChild() state.View

NewChild generates a new child view, with the current view as the base, sharing the Get function

func (*View) Peek added in v0.15.0

func (v *View) Peek(id flow.RegisterID) (flow.RegisterValue, error)

Peek reads the value without registering the read, as when used as parent read function

func (*View) Set

func (v *View) Set(registerID flow.RegisterID, value flow.RegisterValue) error

Set sets a register value in this view.

func (*View) SpockSecret

func (v *View) SpockSecret() []byte

SpockSecret returns the secret value for SPoCK

This function modifies the internal state of the SPoCK secret hasher. Once called, it doesn't allow writing more data into the SPoCK secret.

Jump to

Keyboard shortcuts

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