cluster

package
v0.3.2-beta.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapperEndpoint

func BootstrapperEndpoint(ith int) string

func MakePoetEndpoint

func MakePoetEndpoint(ith int) string

MakePoetEndpoint generate a poet endpoint for the ith instance.

Types

type Account

type Account struct {
	PrivateKey ed25519.PrivateKey
	Address    types.Address
}

Account contains address and private key.

func (Account) String

func (a Account) String() string

type Cluster

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

Cluster for managing state of the spacemesh cluster.

func Default

func Default(cctx *testcontext.Context, opts ...Opt) (*Cluster, error)

Default deployes bootnodes, one poet and the smeshers according to the cluster size.

func New

func New(cctx *testcontext.Context, opts ...Opt) *Cluster

New initializes Cluster with options.

func Reuse

func Reuse(cctx *testcontext.Context, opts ...Opt) (*Cluster, error)

Reuse will try to recover cluster from the given namespace, if not found it will create a new one.

func (*Cluster) Account

func (a *Cluster) Account(i int) Account

func (*Cluster) Accounts

func (a *Cluster) Accounts() int

func (*Cluster) AddBootnodes

func (c *Cluster) AddBootnodes(cctx *testcontext.Context, n int) error

AddBootnodes ...

func (*Cluster) AddBootstrapper

func (c *Cluster) AddBootstrapper(cctx *testcontext.Context, i int) error

func (*Cluster) AddBootstrappers

func (c *Cluster) AddBootstrappers(cctx *testcontext.Context) error

func (*Cluster) AddPoet

func (c *Cluster) AddPoet(cctx *testcontext.Context) error

AddPoet spawns a single poet with the first available id. Id is of form "poet-N", where N ∈ [0, ∞).

func (*Cluster) AddPoets

func (c *Cluster) AddPoets(cctx *testcontext.Context) error

AddPoets spawns poets up to configured number of poets.

func (*Cluster) AddSmeshers

func (c *Cluster) AddSmeshers(tctx *testcontext.Context, n int) error

AddSmeshers ...

func (*Cluster) Address

func (a *Cluster) Address(i int) types.Address

func (*Cluster) Bootnodes

func (c *Cluster) Bootnodes() int

Bootnodes returns number of the bootnodes in the cluster.

func (*Cluster) Client

func (c *Cluster) Client(i int) *NodeClient

Client returns client for i-th node, either bootnode or smesher.

func (*Cluster) CloseClients

func (c *Cluster) CloseClients() error

CloseClients closes connections to clients.

func (*Cluster) DeletePoet

func (c *Cluster) DeletePoet(cctx *testcontext.Context, i int) error

func (*Cluster) DeletePoets

func (c *Cluster) DeletePoets(cctx *testcontext.Context) error

DeletePoets delete all poet servers.

func (*Cluster) DeleteSmesher

func (c *Cluster) DeleteSmesher(cctx *testcontext.Context, node *NodeClient) error

DeleteSmesher will smesher i from the cluster.

func (*Cluster) GenesisID

func (c *Cluster) GenesisID() types.Hash20

GenesisID computes id from the configuration.

func (*Cluster) Persist

func (a *Cluster) Persist(ctx *testcontext.Context) error

func (*Cluster) Poet

func (c *Cluster) Poet(i int) *NodeClient

Poet returns client for i-th poet node.

func (*Cluster) Poets

func (c *Cluster) Poets() int

Poets returns total number of poet servers.

func (*Cluster) Private

func (a *Cluster) Private(i int) ed25519.PrivateKey

func (*Cluster) Recover

func (a *Cluster) Recover(ctx *testcontext.Context) error

func (*Cluster) Total

func (c *Cluster) Total() int

Total returns total number of clients.

func (*Cluster) Wait

func (c *Cluster) Wait(tctx *testcontext.Context, i int) error

Wait for i-th client to be up.

type DeploymentFlag

type DeploymentFlag struct {
	Name, Value string
}

DeploymentFlag allows to configure specific flags for application binaries.

func Accounts

func Accounts(accounts map[string]uint64) DeploymentFlag

Accounts flag.

func Bootnodes

func Bootnodes(bootnodes ...string) DeploymentFlag

Bootnodes flag.

func BootstrapperUrl

func BootstrapperUrl(endpoint string) DeploymentFlag

func DurationFlag

func DurationFlag(flag string, d time.Duration) DeploymentFlag

DurationFlag is a generic duration flag.

func GenerateFallback

func GenerateFallback() DeploymentFlag

func GenesisExtraData

func GenesisExtraData(extra string) DeploymentFlag

GenesisExtraData flag.

func GenesisTime

func GenesisTime(t time.Time) DeploymentFlag

GenesisTime flag.

func MinPeers

func MinPeers(target int) DeploymentFlag

MinPeers flag.

func PoetEndpoint

func PoetEndpoint(endpoint string) DeploymentFlag

PoetEndpoint flag.

func PoetRestListen

func PoetRestListen(port int) DeploymentFlag

PoetRestListen socket pair with http api.

func StartSmeshing

func StartSmeshing(start bool) DeploymentFlag

func (DeploymentFlag) Flag

func (d DeploymentFlag) Flag() string

Flag returns parseable flag from Name and Value.

type Node

type Node struct {
	Name      string
	IP        string
	P2P, GRPC uint16

	Restarted time.Time
}

Node ...

func (Node) GRPCEndpoint

func (n Node) GRPCEndpoint() string

GRPCEndpoint returns grpc endpoint for the Node.

type NodeClient

type NodeClient struct {
	Node
	*grpc.ClientConn
}

NodeClient is a Node with attached grpc connection.

type Opt

type Opt func(c *Cluster)

Opt is for configuring cluster.

func WithBootstrapperFlag

func WithBootstrapperFlag(flag DeploymentFlag) Opt

func WithKeys

func WithKeys(n int) Opt

WithKeys generates n prefunded keys.

func WithSmesherFlag

func WithSmesherFlag(flag DeploymentFlag) Opt

WithSmesherFlag adds smesher flag.

Jump to

Keyboard shortcuts

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