simulation

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: Apache-2.0, MIT Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppliedMessage

type AppliedMessage struct {
	types.Message
	types.MessageReceipt
}

type Node

type Node struct {
	Blockstore blockstore.Blockstore
	MetadataDS datastore.Batching
	Chainstore *store.ChainStore
	// contains filtered or unexported fields
}

Node represents the local lotus node, or at least the part of it we care about.

func NewNode

func NewNode(ctx context.Context, r repo.Repo) (nd *Node, _err error)

NewNode constructs a new node from the given repo.

func OpenNode

func OpenNode(ctx context.Context, path string) (*Node, error)

OpenNode opens the local lotus node for writing. This will fail if the node is online.

func (*Node) Close

func (nd *Node) Close() error

Close cleanly close the repo. Please call this on shutdown to make sure everything is flushed.

func (*Node) CopySim

func (nd *Node) CopySim(ctx context.Context, oldName, newName string) error

CopySim copies a simulation.

func (*Node) CreateSim

func (nd *Node) CreateSim(ctx context.Context, name string, head *types.TipSet) (*Simulation, error)

Create creates a new simulation.

- This will fail if a simulation already exists with the given name. - Name must not contain a '/'.

func (*Node) DeleteSim

func (nd *Node) DeleteSim(ctx context.Context, name string) error

DeleteSim deletes a simulation and all related metadata.

NOTE: This function does not delete associated messages, blocks, or chain state.

func (*Node) ListSims

func (nd *Node) ListSims(ctx context.Context) ([]string, error)

ListSims lists all simulations.

func (*Node) LoadSim

func (nd *Node) LoadSim(ctx context.Context, name string) (*Simulation, error)

LoadSim loads

func (*Node) RenameSim

func (nd *Node) RenameSim(ctx context.Context, oldName, newName string) error

RenameSim renames a simulation.

type Simulation

type Simulation struct {
	Node         *Node
	StateManager *stmgr.StateManager
	// contains filtered or unexported fields
}

Simulation specifies a lotus-sim simulation.

func (*Simulation) GetHead

func (sim *Simulation) GetHead() *types.TipSet

GetHead returns the current simulation head.

func (*Simulation) GetNetworkVersion

func (sim *Simulation) GetNetworkVersion() network.Version

GetNetworkVersion returns the current network version for the simulation.

func (*Simulation) GetStart

func (sim *Simulation) GetStart() *types.TipSet

GetStart returns simulation's parent tipset.

func (*Simulation) ListUpgrades

func (sim *Simulation) ListUpgrades() (stmgr.UpgradeSchedule, error)

ListUpgrades returns any future network upgrades.

func (*Simulation) Name

func (sim *Simulation) Name() string

Name returns the simulation's name.

func (*Simulation) SetHead

func (sim *Simulation) SetHead(head *types.TipSet) error

SetHead updates the current head of the simulation and stores it in the metadata store. This is called for every Simulation.Step.

func (*Simulation) SetUpgradeHeight

func (sim *Simulation) SetUpgradeHeight(nv network.Version, epoch abi.ChainEpoch) (_err error)

SetUpgradeHeight sets the height of the given network version change (and saves the config).

This fails if the specified epoch has already passed or the new upgrade schedule is invalid.

func (*Simulation) Step

func (sim *Simulation) Step(ctx context.Context) (*types.TipSet, error)

Step steps the simulation forward one step. This may move forward by more than one epoch.

func (*Simulation) Walk

func (sim *Simulation) Walk(
	ctx context.Context,
	lookback int64,
	cb func(sm *stmgr.StateManager,
		ts *types.TipSet,
		stCid cid.Cid,
		messages []*AppliedMessage) error,
) error

Walk walks the simulation's chain from the current head back to the first tipset.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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