state

package
v0.2103.6 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImmutableState

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

ImmutableState is the immutable registry state wrapper.

func NewImmutableState

func NewImmutableState(ctx context.Context, state abciAPI.ApplicationQueryState, version int64) (*ImmutableState, error)

func (*ImmutableState) AllRuntimes

func (s *ImmutableState) AllRuntimes(ctx context.Context) ([]*registry.Runtime, error)

AllRuntimes returns a list of all registered runtimes (suspended included).

func (*ImmutableState) AnyRuntime

func (s *ImmutableState) AnyRuntime(ctx context.Context, id common.Namespace) (rt *registry.Runtime, err error)

AnyRuntime looks up either an active or suspended runtime by its identifier and returns it.

func (*ImmutableState) ConsensusParameters

func (s *ImmutableState) ConsensusParameters(ctx context.Context) (*registry.ConsensusParameters, error)

ConsensusParameters returns the registry consensus parameters.

func (*ImmutableState) Entities

func (s *ImmutableState) Entities(ctx context.Context) ([]*entity.Entity, error)

Entities returns a list of all registered entities.

func (*ImmutableState) Entity

Entity looks up a registered entity by its identifier.

func (*ImmutableState) GetEntityNodes added in v0.2100.0

func (s *ImmutableState) GetEntityNodes(ctx context.Context, id signature.PublicKey) ([]*node.Node, error)

GetEntityNodes returns nodes registered by given entity. Note that this returns both active and expired nodes.

func (*ImmutableState) HasEntityNodes

func (s *ImmutableState) HasEntityNodes(ctx context.Context, id signature.PublicKey) (bool, error)

HasEntityNodes checks whether an entity has any registered nodes.

func (*ImmutableState) HasEntityRuntimes

func (s *ImmutableState) HasEntityRuntimes(ctx context.Context, id signature.PublicKey) (bool, error)

HasEntityRuntimes checks whether an entity has any registered runtimes.

func (*ImmutableState) Node

Node looks up a specific node by its identifier.

func (*ImmutableState) NodeByBeaconPoint added in v0.2100.0

func (s *ImmutableState) NodeByBeaconPoint(ctx context.Context, point pvss.Point) (*node.Node, error)

NodeByBeaconPoint looks up a specific node by its beacon point.

func (*ImmutableState) NodeByConsensusAddress

func (s *ImmutableState) NodeByConsensusAddress(ctx context.Context, address []byte) (*node.Node, error)

NodeByConsensusAddress looks up a specific node by its consensus address.

func (*ImmutableState) NodeBySubKey

func (s *ImmutableState) NodeBySubKey(ctx context.Context, key signature.PublicKey) (*node.Node, error)

NodeBySubKey looks up a specific node by its consensus, P2P or TLS key.

func (*ImmutableState) NodeIDByConsensusAddress added in v0.2100.0

func (s *ImmutableState) NodeIDByConsensusAddress(ctx context.Context, address []byte) (signature.PublicKey, error)

NodeIDByConsensusAddress looks up a specific node ID by its consensus address.

If you need to get the actual node descriptor, use NodeByConsensusAddress instead.

func (*ImmutableState) NodeStatus

NodeStatus returns a specific node status.

func (*ImmutableState) Nodes

func (s *ImmutableState) Nodes(ctx context.Context) ([]*node.Node, error)

Nodes returns a list of all registered nodes.

func (*ImmutableState) Runtime

Runtime looks up a runtime by its identifier and returns it.

This excludes any suspended runtimes, use SuspendedRuntime to query suspended runtimes only.

func (*ImmutableState) Runtimes

func (s *ImmutableState) Runtimes(ctx context.Context) ([]*registry.Runtime, error)

Runtimes returns a list of all registered runtimes.

This excludes any suspended runtimes.

func (*ImmutableState) SignedEntities

func (s *ImmutableState) SignedEntities(ctx context.Context) ([]*entity.SignedEntity, error)

SignedEntities returns a list of all registered entities (signed).

func (*ImmutableState) SignedNodes

func (s *ImmutableState) SignedNodes(ctx context.Context) ([]*node.MultiSignedNode, error)

SignedNodes returns a list of all registered nodes (in signed form).

func (*ImmutableState) SuspendedRuntime

func (s *ImmutableState) SuspendedRuntime(ctx context.Context, id common.Namespace) (*registry.Runtime, error)

SuspendedRuntime looks up a suspended runtime by its identifier and returns it.

func (*ImmutableState) SuspendedRuntimes

func (s *ImmutableState) SuspendedRuntimes(ctx context.Context) ([]*registry.Runtime, error)

SuspendedRuntimes returns a list of all suspended runtimes.

type MutableState

type MutableState struct {
	*ImmutableState
	// contains filtered or unexported fields
}

MutableState is a mutable registry state wrapper.

func NewMutableState

func NewMutableState(tree mkvs.KeyValueTree) *MutableState

NewMutableState creates a new mutable registry state wrapper.

func (*MutableState) RemoveEntity

func (s *MutableState) RemoveEntity(ctx context.Context, id signature.PublicKey) (*entity.Entity, error)

RemoveEntity removes a previously registered entity.

func (*MutableState) RemoveNode

func (s *MutableState) RemoveNode(ctx context.Context, node *node.Node) error

RemoveNode removes a registered node.

func (*MutableState) ResumeRuntime

func (s *MutableState) ResumeRuntime(ctx context.Context, id common.Namespace) error

ResumeRuntime resumes a previously suspended runtime.

func (*MutableState) SetConsensusParameters

func (s *MutableState) SetConsensusParameters(ctx context.Context, params *registry.ConsensusParameters) error

SetConsensusParameters sets registry consensus parameters.

NOTE: This method must only be called from InitChain/EndBlock contexts.

func (*MutableState) SetEntity

func (s *MutableState) SetEntity(ctx context.Context, ent *entity.Entity, sigEnt *entity.SignedEntity) error

SetEntity sets a signed entity descriptor for a registered entity.

func (*MutableState) SetNode

func (s *MutableState) SetNode(ctx context.Context, existingNode, node *node.Node, signedNode *node.MultiSignedNode) error

SetNode sets a signed node descriptor for a registered node.

func (*MutableState) SetNodeStatus

func (s *MutableState) SetNodeStatus(ctx context.Context, id signature.PublicKey, status *registry.NodeStatus) error

SetNodeStatus sets a status for a registered node.

func (*MutableState) SetRuntime

func (s *MutableState) SetRuntime(ctx context.Context, rt *registry.Runtime, suspended bool) error

SetRuntime sets a runtime descriptor for a registered runtime.

func (*MutableState) SuspendRuntime

func (s *MutableState) SuspendRuntime(ctx context.Context, id common.Namespace) error

SuspendRuntime marks a runtime as suspended.

Jump to

Keyboard shortcuts

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