Documentation ¶
Index ¶
- func AddAccount(t *testing.T, tree *State, store cbor.IpldStore, addr address.Address)
- func Diff(oldTree, newTree *State) (map[string]types.Actor, error)
- func MustCommit(st State) cid.Cid
- func MustGetActor(st State, a address.Address) (*types.Actor, bool)
- func MustSetActor(st State, address address.Address, actor *types.Actor) cid.Cid
- func UpdateAccount(t *testing.T, tree *State, addr address.Address, fn func(*types.Actor))
- type ActorKey
- type AdtStore
- type Root
- type State
- func LoadState(ctx context.Context, cst cbor.IpldStore, c cid.Cid) (*State, error)
- func NewFromString(t *testing.T, s string, store cbor.IpldStore) *State
- func NewState(cst cbor.IpldStore, ver StateTreeVersion) (*State, error)
- func NewStateWithBuiltinActor(t *testing.T, store cbor.IpldStore, ver StateTreeVersion) (*State, error)
- func (st *State) At(root Root) error
- func (st *State) ClearSnapshot()
- func (st *State) DeleteActor(ctx context.Context, addr ActorKey) error
- func (st *State) Flush(ctx context.Context) (cid.Cid, error)
- func (st *State) ForEach(f func(ActorKey, *types.Actor) error) error
- func (st *State) GetActor(ctx context.Context, addr ActorKey) (*types.Actor, bool, error)
- func (st *State) GetStore() cbor.IpldStore
- func (st *State) LookupID(addr ActorKey) (address.Address, error)
- func (st *State) MutateActor(addr ActorKey, f func(*types.Actor) error) error
- func (st *State) RegisterNewAddress(addr ActorKey) (address.Address, error)
- func (st *State) Revert() error
- func (st *State) SetActor(ctx context.Context, addr ActorKey, act *types.Actor) error
- func (st *State) Snapshot(ctx context.Context) error
- func (st *State) Version() StateTreeVersion
- type StateInfo0
- type StateRoot
- type StateTreeVersion
- type Tree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAccount ¶
func MustCommit ¶
func MustCommit(st State) cid.Cid
MustCommit flushes the state or panics if it can't.
func MustGetActor ¶
MustGetActor gets the actor or panics if it can't.
func MustSetActor ¶
MustSetActor sets the actor or panics if it can't.
Types ¶
type State ¶
state stores actors state by their ID.
func NewFromString ¶
NewFromString sets a state tree based on an int.
TODO: we could avoid this if write a test cborStore that can map test cids to test states.
func (*State) ClearSnapshot ¶
func (st *State) ClearSnapshot()
func (*State) GetActor ¶
ToDo Return nil if it is actor not found[ErrActorNotFound],Because the basis for judgment is: err != nil ==> panic ??? GetActor returns the actor from any type of `addr` provided.
func (*State) LookupID ¶
LookupID gets the ID address of this actor's `addr` stored in the `InitActor`.
func (*State) MutateActor ¶
func (*State) RegisterNewAddress ¶
func (*State) Version ¶
func (st *State) Version() StateTreeVersion
Version returns the version of the StateTree data structure in use.
type StateInfo0 ¶
type StateInfo0 struct{} //nolint
TODO: version this.
func (*StateInfo0) MarshalCBOR ¶
func (t *StateInfo0) MarshalCBOR(w io.Writer) error
func (*StateInfo0) UnmarshalCBOR ¶
func (t *StateInfo0) UnmarshalCBOR(r io.Reader) error
type StateRoot ¶
type StateRoot struct { // State tree version. Version StateTreeVersion // Actors tree. The structure depends on the state root version. Actors cid.Cid // Info. The structure depends on the state root version. Info cid.Cid }
type StateTreeVersion ¶
type StateTreeVersion uint64 //nolint
const ( // StateTreeVersion0 corresponds to actors < v2. StateTreeVersion0 StateTreeVersion = iota // StateTreeVersion1 corresponds to actors v2 StateTreeVersion1 // StateTreeVersion2 corresponds to actors v3. StateTreeVersion2 // StateTreeVersion3 corresponds to actors v4. StateTreeVersion3 // StateTreeVersion4 corresponds to actors v5. StateTreeVersion4 )
func VersionForNetwork ¶ added in v1.0.4
func VersionForNetwork(ver network.Version) (StateTreeVersion, error)
VersionForNetwork returns the state tree version for the given network version.
type Tree ¶
type Tree interface { GetActor(ctx context.Context, addr ActorKey) (*types.Actor, bool, error) SetActor(ctx context.Context, addr ActorKey, act *types.Actor) error DeleteActor(ctx context.Context, addr ActorKey) error LookupID(addr ActorKey) (address.Address, error) Flush(ctx context.Context) (cid.Cid, error) Snapshot(ctx context.Context) error ClearSnapshot() Revert() error At(Root) error RegisterNewAddress(addr ActorKey) (address.Address, error) MutateActor(addr ActorKey, f func(*types.Actor) error) error ForEach(f func(ActorKey, *types.Actor) error) error GetStore() cbor.IpldStore }
Review: can we get rid of this?