actorstate

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0, MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(code cid.Cid, e ActorStateExtractor)

Register adds an actor state extractor

Types

type AccountExtractor

type AccountExtractor struct{}

AccountExtractor is a state extractor that deals with Account actors.

func (AccountExtractor) Extract

Extract will create persistable data for a given actor's state.

type ActorExtractor

type ActorExtractor struct{}

ActorExtractor extracts common actor state

func (ActorExtractor) Extract

type ActorExtractorFilter

type ActorExtractorFilter interface {
	AllowAddress(addr string) bool
}

type ActorExtractorMap

type ActorExtractorMap interface {
	Allow(code cid.Cid) bool
	GetExtractor(code cid.Cid) (ActorStateExtractor, bool)
}

An ActorExtractorMap controls which actor types may be extracted.

type ActorInfo

type ActorInfo struct {
	Actor           types.Actor
	ChangeType      lens.ChangeType
	Address         address.Address
	ParentStateRoot cid.Cid
	Epoch           abi.ChainEpoch
	TipSet          *types.TipSet
	ParentTipSet    *types.TipSet
}

type ActorStateAPI

type ActorStateAPI interface {
	// TODO(optimize): StateGetActor is just a wrapper around StateManager.LoadActor with a lookup of the tipset which we already have
	StateGetActor(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.Actor, error)

	// TODO(optimize): StateMinerPower is just a wrapper for stmgr.GetPowerRaw which loads the power actor as we do in StoragePowerExtractor
	StateMinerPower(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*api.MinerPower, error)

	// TODO(optimize): StateReadState looks up the tipset and actor that we already have available
	StateReadState(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*api.ActorState, error)

	// TODO(remove): StateMinerSectors loads the actor and then calls miner.Load which StorageMinerExtractor already has available
	// StateMinerSectors(ctx context.Context, addr address.Address, bf *bitfield.BitField, tsk types.TipSetKey) ([]*miner.SectorOnChainInfo, error)
	Store() adt.Store
}

ActorStateAPI is the minimal subset of lens.API that is needed for actor state extraction

type ActorStateError

type ActorStateError struct {
	Code    string
	Name    string
	Head    string
	Address string
	Error   string
}

type ActorStateExtractor

type ActorStateExtractor interface {
	Extract(ctx context.Context, a ActorInfo, emsgs []*lens.ExecutedMessage, node ActorStateAPI) (model.Persistable, error)
}

An ActorStateExtractor extracts actor state into a persistable format

func GetActorStateExtractor

func GetActorStateExtractor(code cid.Cid) (ActorStateExtractor, bool)

type ActorStateResult

type ActorStateResult struct {
	Code         cid.Cid
	Head         cid.Cid
	Address      string
	Error        error
	SkippedParse bool
	Data         model.Persistable
}

type InitExtractor

type InitExtractor struct{}

InitExtractor extracts init actor state

func (InitExtractor) Extract

type MarketStateExtractionContext

type MarketStateExtractionContext struct {
	PrevState market.State
	PrevTs    *types.TipSet

	CurrActor *types.Actor
	CurrState market.State
	CurrTs    *types.TipSet

	Store adt.Store
}

func NewMarketStateExtractionContext

func NewMarketStateExtractionContext(ctx context.Context, a ActorInfo, node ActorStateAPI) (*MarketStateExtractionContext, error)

func (*MarketStateExtractionContext) IsGenesis

func (m *MarketStateExtractionContext) IsGenesis() bool

type MinerStateExtractionContext

type MinerStateExtractionContext struct {
	PrevState miner.State
	PrevTs    *types.TipSet

	CurrActor *types.Actor
	CurrState miner.State
	CurrTs    *types.TipSet
}

func NewMinerStateExtractionContext

func NewMinerStateExtractionContext(ctx context.Context, a ActorInfo, node ActorStateAPI) (*MinerStateExtractionContext, error)

func (*MinerStateExtractionContext) HasPreviousState

func (m *MinerStateExtractionContext) HasPreviousState() bool

type MsigExtractionContext

type MsigExtractionContext struct {
	PrevState multisig.State

	CurrActor *types.Actor
	CurrState multisig.State
	CurrTs    *types.TipSet

	Store adt.Store
}

func NewMultiSigExtractionContext

func NewMultiSigExtractionContext(ctx context.Context, a ActorInfo, node ActorStateAPI) (*MsigExtractionContext, error)

func (*MsigExtractionContext) HasPreviousState

func (m *MsigExtractionContext) HasPreviousState() bool

type MultiSigActorExtractor

type MultiSigActorExtractor struct{}

func (MultiSigActorExtractor) Extract

type PartitionStatus

type PartitionStatus struct {
	Removed    bitfield.BitField
	Faulted    bitfield.BitField
	Recovering bitfield.BitField
	Recovered  bitfield.BitField
}

PartitionStatus contains bitfileds of sectorID's that are removed, faulted, recovered and recovering.

type PowerStateExtractionContext

type PowerStateExtractionContext struct {
	PrevState power.State
	CurrState power.State
	CurrTs    *types.TipSet

	Store adt.Store
}

func NewPowerStateExtractionContext

func NewPowerStateExtractionContext(ctx context.Context, a ActorInfo, node ActorStateAPI) (*PowerStateExtractionContext, error)

func (*PowerStateExtractionContext) HasPreviousState

func (p *PowerStateExtractionContext) HasPreviousState() bool

type RawActorExtractorMap

type RawActorExtractorMap struct{}

A RawActorExtractorMap extracts all types of actors using basic actor extraction which only parses shallow state.

func (RawActorExtractorMap) Allow

func (RawActorExtractorMap) Allow(code cid.Cid) bool

func (RawActorExtractorMap) GetExtractor

func (RawActorExtractorMap) GetExtractor(code cid.Cid) (ActorStateExtractor, bool)

type RewardExtractor

type RewardExtractor struct{}

RewardExtractor extracts reward actor state

func (RewardExtractor) Extract

type StorageMarketExtractor

type StorageMarketExtractor struct{}

StorageMarketExtractor extracts market actor state

func (StorageMarketExtractor) Extract

type StorageMinerExtractor

type StorageMinerExtractor struct{}

StorageMinerExtractor extracts miner actor state

func (StorageMinerExtractor) Extract

type StoragePowerExtractor

type StoragePowerExtractor struct{}

StoragePowerExtractor extracts power actor state

func (StoragePowerExtractor) Extract

type Task

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

A Task processes the extraction of actor state according the allowed types in its extracter map.

func NewTask

func NewTask(node lens.API, extracterMap ActorExtractorMap) *Task

func (*Task) ProcessActors

func (t *Task) ProcessActors(ctx context.Context, ts *types.TipSet, pts *types.TipSet, candidates map[string]lens.ActorStateChange, emsgs []*lens.ExecutedMessage) (model.Persistable, *visormodel.ProcessingReport, error)

type TypedActorExtractorMap

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

A TypedActorExtractorMap extracts a single type of actor using full parsing of actor state

func NewTypedActorExtractorMap

func NewTypedActorExtractorMap(codes []cid.Cid) *TypedActorExtractorMap

func (*TypedActorExtractorMap) Allow

func (t *TypedActorExtractorMap) Allow(code cid.Cid) bool

func (*TypedActorExtractorMap) GetExtractor

func (t *TypedActorExtractorMap) GetExtractor(code cid.Cid) (ActorStateExtractor, bool)

type VerifiedRegistryExtractionContext

type VerifiedRegistryExtractionContext struct {
	PrevState, CurrState verifreg.State
	PrevTs, CurrTs       *types.TipSet

	Store adt.Store
}

func (*VerifiedRegistryExtractionContext) HasPreviousState

func (v *VerifiedRegistryExtractionContext) HasPreviousState() bool

type VerifiedRegistryExtractor

type VerifiedRegistryExtractor struct{}

func (VerifiedRegistryExtractor) Extract

Jump to

Keyboard shortcuts

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