Documentation ¶
Index ¶
- func AlwaysEmptyGetRegisterFunc(owner, key string) (flow.RegisterValue, error)
- type Delta
- func (d Delta) Get(owner, key string) (flow.RegisterValue, bool)
- func (d Delta) MarshalJSON() ([]byte, error)
- func (d Delta) MergeWith(delta Delta)
- func (d Delta) RegisterIDs() []flow.RegisterID
- func (d Delta) RegisterUpdates() ([]flow.RegisterID, []flow.RegisterValue)
- func (d Delta) Set(owner, key string, value flow.RegisterValue)
- func (d *Delta) UnmarshalJSON(data []byte) error
- type GetRegisterFunc
- type Snapshot
- type SnapshotStats
- type SpockSnapshot
- type View
- func (v *View) AllRegisters() []flow.RegisterID
- func (v *View) Delete(owner, key string) error
- func (v *View) Delta() Delta
- func (v *View) Detach()
- func (v *View) DropDelta()
- func (v *View) Get(owner, key string) (flow.RegisterValue, error)
- func (v *View) Interactions() *SpockSnapshot
- func (v *View) MergeView(ch state.View) error
- func (v *View) NewChild() state.View
- func (v *View) Peek(owner, key string) (flow.RegisterValue, error)
- func (v *View) ReadsCount() uint64
- func (v *View) RegisterUpdates() ([]flow.RegisterID, []flow.RegisterValue)
- func (v *View) Set(owner, key string, value flow.RegisterValue) error
- func (v *View) SpockSecret() []byte
- func (v *View) Touch(owner, key string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlwaysEmptyGetRegisterFunc ¶ added in v0.15.0
func AlwaysEmptyGetRegisterFunc(owner, key string) (flow.RegisterValue, error)
Types ¶
type Delta ¶
type Delta struct {
Data map[flow.RegisterID]flow.RegisterValue
}
A Delta is a record of ledger mutations.
func (Delta) Get ¶
func (d Delta) Get(owner, key string) (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) MarshalJSON ¶
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)
RegisterUpdates returns all registers that were updated by this delta. ids are returned sorted, in ascending order
func (Delta) Set ¶
func (d Delta) Set(owner, key string, value flow.RegisterValue)
Set records an update in this delta.
func (*Delta) UnmarshalJSON ¶
type GetRegisterFunc ¶
type GetRegisterFunc func(owner, key string) (flow.RegisterValue, error)
GetRegisterFunc is a function that returns the value for a register.
type Snapshot ¶
type Snapshot struct { Delta Delta SnapshotStats Reads map[flow.RegisterID]struct{} }
func (*Snapshot) AllRegisters ¶
func (r *Snapshot) AllRegisters() []flow.RegisterID
AllRegisters returns all the register IDs either in read or delta
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 SpockSnapshot ¶ added in v0.11.0
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 NewView ¶
func NewView(readFunc GetRegisterFunc) *View
NewView instantiates a new ledger view with the provided read function.
func (*View) AllRegisters ¶ added in v0.16.0
func (v *View) AllRegisters() []flow.RegisterID
func (*View) Detach ¶ added in v0.15.0
func (v *View) Detach()
Detach detaches view from parent, by setting readFunc to default, empty one
func (*View) Get ¶
func (v *View) Get(owner, key string) (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) NewChild ¶
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(owner, key string) (flow.RegisterValue, error)
Peek reads the value without registering the read, as when used as parent read function
func (*View) ReadsCount ¶
ReadsCount returns the total number of reads performed on this view including all child views
func (*View) RegisterUpdates ¶ added in v0.13.0
func (v *View) RegisterUpdates() ([]flow.RegisterID, []flow.RegisterValue)
RegisterUpdates returns a list of register updates
func (*View) Set ¶
func (v *View) Set(owner, key string, value flow.RegisterValue) error
Set sets a register value in this view.
func (*View) SpockSecret ¶
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.