migration

package
v0.9.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0, MIT Imports: 32 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActorHeadKey

func ActorHeadKey(addr address.Address, head cid.Cid) string

func MigrateStateTree

func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID cid.Cid, actorsRootIn cid.Cid, priorEpoch abi.ChainEpoch, cfg Config, log Logger, cache MigrationCache) (cid.Cid, error)

Migrates the filecoin state tree starting from the global state tree and upgrading all actor state. The store must support concurrent writes (even if the configured worker count is 1).

func MinerPrevSectorsInKey added in v0.9.0

func MinerPrevSectorsInKey(m address.Address) string

func MinerPrevSectorsOutKey added in v0.9.0

func MinerPrevSectorsOutKey(m address.Address) string

func SectorsAmtKey added in v0.9.0

func SectorsAmtKey(sectorsAmt cid.Cid) string

Types

type Actor

type Actor struct {
	Code       cid.Cid // CID representing the code associated with the actor
	Head       cid.Cid // CID of the head state object for the actor
	CallSeqNum uint64  // CallSeqNum for the next message to be received by the actor (non-zero for accounts only)
	Balance    big.Int // Token balance of the actor
}

Value type of the top level of the state tree. Represents the on-chain state of a single actor.

func (*Actor) MarshalCBOR

func (t *Actor) MarshalCBOR(w io.Writer) error

func (*Actor) UnmarshalCBOR

func (t *Actor) UnmarshalCBOR(r io.Reader) error

type Config

type Config struct {
	// Number of migration worker goroutines to run.
	// More workers enables higher CPU utilization doing migration computations (including state encoding)
	MaxWorkers uint
	// Capacity of the queue of jobs available to workers (zero for unbuffered).
	// A queue length of hundreds to thousands improves throughput at the cost of memory.
	JobQueueSize uint
	// Capacity of the queue receiving migration results from workers, for persisting (zero for unbuffered).
	// A queue length of tens to hundreds improves throughput at the cost of memory.
	ResultQueueSize uint
	// Time between progress logs to emit.
	// Zero (the default) results in no progress logs.
	ProgressLogPeriod time.Duration
}

Config parameterizes a state tree migration

type DealAllocationTuple added in v0.9.0

type DealAllocationTuple struct {
	Deal       abi.DealID
	Allocation verifreg9.AllocationId
}

type Logger

type Logger interface {
	// This is the same logging interface provided by the Runtime
	Log(level rt.LogLevel, msg string, args ...interface{})
}

type MemMigrationCache

type MemMigrationCache struct {
	MigrationMap sync.Map
}

func NewMemMigrationCache

func NewMemMigrationCache() *MemMigrationCache

func (*MemMigrationCache) Clone

func (*MemMigrationCache) Load

func (m *MemMigrationCache) Load(key string, loadFunc func() (cid.Cid, error)) (cid.Cid, error)

func (*MemMigrationCache) Read

func (m *MemMigrationCache) Read(key string) (bool, cid.Cid, error)

func (*MemMigrationCache) Update

func (m *MemMigrationCache) Update(other *MemMigrationCache)

func (*MemMigrationCache) Write

func (m *MemMigrationCache) Write(key string, c cid.Cid) error

type MigrationCache

type MigrationCache interface {
	Write(key string, newCid cid.Cid) error
	Read(key string) (bool, cid.Cid, error)
	Load(key string, loadFunc func() (cid.Cid, error)) (cid.Cid, error)
}

MigrationCache stores and loads cached data. Its implementation must be threadsafe

type Tree

type Tree struct {
	Map   *adt.Map
	Store adt.Store
}

A specialization of a map of ID-addresses to actor heads.

func LoadTree

func LoadTree(s adt.Store, r cid.Cid) (*Tree, error)

Loads a tree from a root CID and store.

func NewTree

func NewTree(store adt.Store) (*Tree, error)

Initializes a new, empty state tree backed by a store.

func (*Tree) Flush

func (t *Tree) Flush() (cid.Cid, error)

Writes the tree root node to the store, and returns its CID.

func (*Tree) ForEach

func (t *Tree) ForEach(fn func(addr address.Address, actor *Actor) error) error

Traverses all entries in the tree.

func (*Tree) ForEachKey

func (t *Tree) ForEachKey(fn func(addr address.Address) error) error

Traverses all keys in the tree, without decoding the actor states.

func (*Tree) GetActor

func (t *Tree) GetActor(addr address.Address) (*Actor, bool, error)

Loads the state associated with an address.

func (*Tree) SetActor

func (t *Tree) SetActor(addr address.Address, actor *Actor) error

Sets the state associated with an address, overwriting if it already present.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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