migration

package
v0.10.0-alpha-9 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0, MIT Imports: 10 Imported by: 6

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 ExpirationsAmtKey

func ExpirationsAmtKey(expirationsAmt cid.Cid) string

func MinerPrevSectorsInKey

func MinerPrevSectorsInKey(m address.Address) string

func MinerPrevSectorsOutKey

func MinerPrevSectorsOutKey(m address.Address) string

func PartitionsAmtKey

func PartitionsAmtKey(partitionsAmt cid.Cid) string

func SectorsAmtKey

func SectorsAmtKey(sectorsAmt cid.Cid) string

Types

type ActorMigration

type ActorMigration interface {
	// MigrateState Loads an actor's state from an input store and writes new state to an output store.
	// Returns the new state head CID.
	MigrateState(ctx context.Context, store cbor.IpldStore, input ActorMigrationInput) (result *ActorMigrationResult, err error)
	MigratedCodeCID() cid.Cid
}

func CachedMigration

func CachedMigration(cache MigrationCache, m ActorMigration) ActorMigration

type ActorMigrationInput

type ActorMigrationInput struct {
	Address    address.Address // actor's address
	Head       cid.Cid
	PriorEpoch abi.ChainEpoch // epoch of last state transition prior to migration
	Cache      MigrationCache // cache of existing cid -> cid migrations for this actor
}

type ActorMigrationResult

type ActorMigrationResult struct {
	NewCodeCID cid.Cid
	NewHead    cid.Cid
}

type CachedMigrator

type CachedMigrator struct {
	ActorMigration
	// contains filtered or unexported fields
}

Migrator that uses cached transformation if it exists

func (CachedMigrator) MigrateState

type CodeMigrator

type CodeMigrator struct {
	OutCodeCID cid.Cid
}

Migrator which preserves the head CID and provides a fixed result code CID.

func (CodeMigrator) MigrateState

func (CodeMigrator) MigratedCodeCID

func (n CodeMigrator) MigratedCodeCID() cid.Cid

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 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 thread-safe

Jump to

Keyboard shortcuts

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