sdk

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootPrefix       = "r"
	SubnetSeparator  = "/"
	UndefStr         = ""
	IPCAddrSeparator = ":"

	// MaxChainID is the maximum chain ID value
	// possible.
	MaxChainID = 4503599627370476
)

Variables

View Source
var UndefIPCAddress = IPCAddress{}

UndefIPCAddress creates a convenient type to define undefined IPC address

View Source
var UndefSubnetID = SubnetID{
	Root:     0,
	Children: []address.Address{},
}

UndefSubnetID is the undef ID

Functions

func IsBottomUp added in v0.1.2

func IsBottomUp(from SubnetID, to SubnetID) bool

IsBottomUp returns true if the from subnet is above in the hierarchy.

Types

type EpochKey added in v0.1.4

type EpochKey abi.ChainEpoch

func (EpochKey) Key added in v0.1.4

func (k EpochKey) Key() string

type IPCAddress

type IPCAddress struct {
	SubnetID   SubnetID
	RawAddress address.Address
}

IPCAddress adds subnet information to raw Filecoin addresses

func AddressFromString

func AddressFromString(addr string) (IPCAddress, error)

func (*IPCAddress) MarshalCBOR

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

func (*IPCAddress) UnmarshalCBOR

func (t *IPCAddress) UnmarshalCBOR(r io.Reader) (err error)

type Status

type Status int64

Status defines the different states in which a subnet can be.

const (
	Instantiated Status = iota
	Active
	Inactive
	Terminating
	Killed
)

type SubnetID

type SubnetID struct {
	// ChainID of the root network
	Root uint64
	// Children up to the current subnet.
	Children []address.Address
}

func NewRootID added in v0.1.6

func NewRootID(chainID uint64) SubnetID

NewRootID creates a new root subnet ID from its chainID.

func NewSubnetID

func NewSubnetID(parent SubnetID, subnetAct address.Address) SubnetID

func NewSubnetIDFromRoute added in v0.1.6

func NewSubnetIDFromRoute(rootID uint64, route []address.Address) SubnetID

func NewSubnetIDFromString

func NewSubnetIDFromString(addr string) (SubnetID, error)

func (SubnetID) Actor

func (id SubnetID) Actor() address.Address

Actor returns the subnet actor ID that governs the current subnet or the ID=0 if the current subnet is the root.

func (SubnetID) Bytes

func (id SubnetID) Bytes() ([]byte, error)

func (SubnetID) ChainID added in v0.1.6

func (id SubnetID) ChainID() uint64

func (SubnetID) CommonParent

func (id SubnetID) CommonParent(other SubnetID) (SubnetID, int)

CommonParent computes the common parent of two subnet IDs and returns the number of children in it.

func (SubnetID) Down

func (id SubnetID) Down(curr SubnetID) SubnetID

Down Returns from the current subnet the next subnet down in the path defined by the current subnet and the destination subnet.

func (SubnetID) Equal added in v0.1.6

func (id SubnetID) Equal(other SubnetID) bool

Equal checks if two subnet IDs are equal.

func (SubnetID) IsRoot added in v0.1.6

func (id SubnetID) IsRoot() bool

IsRoot Returns true if the current subnet is the root subnet

func (SubnetID) Key added in v0.1.2

func (id SubnetID) Key() string

func (*SubnetID) MarshalCBOR

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

func (SubnetID) Parent

func (id SubnetID) Parent() SubnetID

func (SubnetID) String

func (id SubnetID) String() string

String returns the id in string form.

func (*SubnetID) UnmarshalCBOR

func (t *SubnetID) UnmarshalCBOR(r io.Reader) (err error)

func (SubnetID) Up

func (id SubnetID) Up(curr SubnetID) SubnetID

Up returns the SubnetID immediately up from the current subnet.

Jump to

Keyboard shortcuts

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