Documentation ¶
Index ¶
- func BootstrapperEndpoint(ith int) string
- func BootstrapperGlobalEndpoint(namespace string, ith int) string
- func ExtractP2PEndpoints(tctx *testcontext.Context, nodes []*NodeClient) ([]string, error)
- func MakePoetEndpoint(ith int) string
- func MakePoetGlobalEndpoint(testNamespace string, ith int) string
- func MakePoetKey(ith int) (ed25519.PublicKey, ed25519.PrivateKey)
- func MakePoetMetricsEndpoint(testNamespace string, ith int) string
- type Account
- type Cluster
- func (a *Cluster) Account(i int) Account
- func (a *Cluster) Accounts() int
- func (c *Cluster) AddBootnodes(cctx *testcontext.Context, n int) error
- func (c *Cluster) AddBootstrapper(cctx *testcontext.Context, i int) error
- func (c *Cluster) AddBootstrappers(cctx *testcontext.Context) error
- func (c *Cluster) AddCertifier(cctx *testcontext.Context, privkey string) error
- func (c *Cluster) AddPoet(cctx *testcontext.Context, flags ...DeploymentFlag) error
- func (c *Cluster) AddPoets(cctx *testcontext.Context) error
- func (c *Cluster) AddRemoteSmeshers(tctx *testcontext.Context, n int, opts ...DeploymentOpt) error
- func (c *Cluster) AddSmeshers(tctx *testcontext.Context, n int, opts ...DeploymentOpt) error
- func (a *Cluster) Address(i int) types.Address
- func (c *Cluster) Bootnodes() int
- func (c *Cluster) Bootstrapper(i int) *NodeClient
- func (c *Cluster) Client(i int) *NodeClient
- func (c *Cluster) CloseClients()
- func (c *Cluster) DeleteBootstrappers(cctx *testcontext.Context) error
- func (c *Cluster) DeletePoet(cctx *testcontext.Context, i int) error
- func (c *Cluster) DeletePoets(cctx *testcontext.Context) error
- func (c *Cluster) DeleteSmesher(cctx *testcontext.Context, node *NodeClient) error
- func (c *Cluster) Genesis() time.Time
- func (c *Cluster) GenesisExtraData() string
- func (c *Cluster) GenesisID() types.Hash20
- func (c *Cluster) GoldenATX() types.ATXID
- func (c *Cluster) NodeConfig(ctx *testcontext.Context) (*config.Config, error)
- func (a *Cluster) Persist(ctx *testcontext.Context) error
- func (c *Cluster) Poet(i int) *NodeClient
- func (c *Cluster) Poets() int
- func (a *Cluster) Private(i int) ed25519.PrivateKey
- func (a *Cluster) Recover(ctx *testcontext.Context) error
- func (c *Cluster) Smeshers() int
- func (c *Cluster) Total() int
- func (c *Cluster) Wait(tctx *testcontext.Context, i int) error
- func (c *Cluster) WaitAll(ctx context.Context) error
- func (c *Cluster) WaitAllTimeout(timeout time.Duration) error
- type DeploymentFlag
- func Accounts(accounts map[string]uint64) DeploymentFlag
- func Bootnode() DeploymentFlag
- func Bootnodes(bootnodes ...string) DeploymentFlag
- func BootstrapperUrl(endpoint string) DeploymentFlag
- func CheckpointLayer(restoreLayer uint32) DeploymentFlag
- func CheckpointUrl(endpoint string) DeploymentFlag
- func DurationFlag(flag string, d time.Duration) DeploymentFlag
- func GenerateFallback() DeploymentFlag
- func GenesisExtraData(extra string) DeploymentFlag
- func GenesisTime(t time.Time) DeploymentFlag
- func MinPeers(target int) DeploymentFlag
- func PoetCertifierPubkey(key string) DeploymentFlag
- func PoetCertifierURL(url string) DeploymentFlag
- func PoetEndpoints(ids ...int) DeploymentFlag
- func PoetRestListen(port int) DeploymentFlag
- func PostK3(k3 int) DeploymentFlag
- func PrivateNetwork() DeploymentFlag
- func StartSmeshing(start bool) DeploymentFlag
- type DeploymentOpt
- type GenAccount
- type Node
- type NodeClient
- type Opt
- type PrivNodeClient
- type PubNodeClient
- type SmesherDeploymentConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BootstrapperEndpoint ¶
func BootstrapperGlobalEndpoint ¶ added in v1.4.0
func ExtractP2PEndpoints ¶ added in v1.4.0
func ExtractP2PEndpoints(tctx *testcontext.Context, nodes []*NodeClient) ([]string, error)
func MakePoetEndpoint ¶
MakePoetEndpoint generate a poet endpoint for the ith instance.
func MakePoetGlobalEndpoint ¶ added in v1.4.0
func MakePoetKey ¶ added in v1.4.0
func MakePoetKey(ith int) (ed25519.PublicKey, ed25519.PrivateKey)
Deterministically generate poet keys for given instance.
func MakePoetMetricsEndpoint ¶ added in v1.6.0
Types ¶
type Account ¶
type Account struct { PrivateKey ed25519.PrivateKey Address types.Address }
Account contains address and private key.
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 deploys 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) 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) AddCertifier ¶ added in v1.6.0
func (c *Cluster) AddCertifier(cctx *testcontext.Context, privkey string) error
AddCertifier spawns a single certifier with the first available id. Id is of form "certifier-N", where N ∈ [0, ∞).
func (*Cluster) AddPoet ¶
func (c *Cluster) AddPoet(cctx *testcontext.Context, flags ...DeploymentFlag) 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) AddRemoteSmeshers ¶ added in v1.4.0
func (c *Cluster) AddRemoteSmeshers(tctx *testcontext.Context, n int, opts ...DeploymentOpt) error
func (*Cluster) AddSmeshers ¶
func (c *Cluster) AddSmeshers(tctx *testcontext.Context, n int, opts ...DeploymentOpt) error
AddSmeshers ...
func (*Cluster) Bootstrapper ¶
func (c *Cluster) Bootstrapper(i int) *NodeClient
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()
CloseClients closes connections to clients.
func (*Cluster) DeleteBootstrappers ¶
func (c *Cluster) DeleteBootstrappers(cctx *testcontext.Context) error
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) GenesisExtraData ¶ added in v1.4.0
func (*Cluster) NodeConfig ¶ added in v1.4.0
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) Private ¶
func (a *Cluster) Private(i int) ed25519.PrivateKey
func (*Cluster) Recover ¶
func (a *Cluster) Recover(ctx *testcontext.Context) error
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 Bootnode ¶ added in v1.0.7
func Bootnode() DeploymentFlag
func BootstrapperUrl ¶
func BootstrapperUrl(endpoint string) DeploymentFlag
func CheckpointLayer ¶
func CheckpointLayer(restoreLayer uint32) DeploymentFlag
func CheckpointUrl ¶
func CheckpointUrl(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 PoetCertifierPubkey ¶ added in v1.6.0
func PoetCertifierPubkey(key string) DeploymentFlag
func PoetCertifierURL ¶ added in v1.6.0
func PoetCertifierURL(url string) DeploymentFlag
func PoetEndpoints ¶ added in v1.4.0
func PoetEndpoints(ids ...int) DeploymentFlag
func PoetRestListen ¶
func PoetRestListen(port int) DeploymentFlag
PoetRestListen socket pair with http api.
func PostK3 ¶ added in v1.4.0
func PostK3(k3 int) DeploymentFlag
func PrivateNetwork ¶ added in v1.0.7
func PrivateNetwork() DeploymentFlag
func StartSmeshing ¶
func StartSmeshing(start bool) DeploymentFlag
func (DeploymentFlag) Flag ¶
func (d DeploymentFlag) Flag() string
Flag returns parseable flag from Name and Value.
type DeploymentOpt ¶
type DeploymentOpt func(cfg *SmesherDeploymentConfig)
func NoDefaultPoets ¶ added in v1.3.0
func NoDefaultPoets() DeploymentOpt
func WithFlags ¶
func WithFlags(flags ...DeploymentFlag) DeploymentOpt
func WithSmeshers ¶
func WithSmeshers(keys []ed25519.PrivateKey) DeploymentOpt
type GenAccount ¶
type NodeClient ¶
type NodeClient struct { Node // contains filtered or unexported fields }
NodeClient is a Node with attached grpc connection.
func (*NodeClient) Close ¶
func (n *NodeClient) Close()
func (*NodeClient) PrivConn ¶ added in v1.3.0
func (n *NodeClient) PrivConn() *PrivNodeClient
func (*NodeClient) PubConn ¶ added in v1.3.0
func (n *NodeClient) PubConn() *PubNodeClient
type Opt ¶
type Opt func(c *Cluster)
Opt is for configuring cluster.
func WithBootstrapEpochs ¶
func WithBootstrapperFlag ¶
func WithBootstrapperFlag(flag DeploymentFlag) Opt
func WithGenesisBalances ¶
func WithGenesisBalances(gaccs ...GenAccount) Opt
func WithSmesherFlag ¶
func WithSmesherFlag(flag DeploymentFlag) Opt
WithSmesherFlag adds smesher flag.
type PrivNodeClient ¶ added in v1.3.0
type PrivNodeClient struct {
*NodeClient
}
func (*PrivNodeClient) Invoke ¶ added in v1.3.0
func (n *PrivNodeClient) Invoke(ctx context.Context, method string, args, reply any, opts ...grpc.CallOption) error
func (*PrivNodeClient) NewStream ¶ added in v1.3.0
func (n *PrivNodeClient) NewStream( ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption, ) (grpc.ClientStream, error)
type PubNodeClient ¶ added in v1.3.0
type PubNodeClient struct {
*NodeClient
}
func (*PubNodeClient) Invoke ¶ added in v1.3.0
func (n *PubNodeClient) Invoke(ctx context.Context, method string, args, reply any, opts ...grpc.CallOption) error
func (*PubNodeClient) NewStream ¶ added in v1.3.0
func (n *PubNodeClient) NewStream( ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption, ) (grpc.ClientStream, error)
type SmesherDeploymentConfig ¶
type SmesherDeploymentConfig struct {
// contains filtered or unexported fields
}