gstress

package
v0.0.0-...-506a26f Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const SeedServiceProtocolID = "/gordian-stress/seed"

Protocol ID for seed host service. Since this service is not intended to service process restarts, we don't need a numeric version with it.

Variables

This section is empty.

Functions

This section is empty.

Types

type BootstrapClient

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

BootstrapClient returns a client to connect to a bootstrap host, over the host's unix socket.

Method on BootstrapClient are not safe for concurrent use.

func NewBootstrapClient

func NewBootstrapClient(log *slog.Logger, serverSocketPath string) (*BootstrapClient, error)

func (*BootstrapClient) App

func (c *BootstrapClient) App() (string, error)

func (*BootstrapClient) ChainID

func (c *BootstrapClient) ChainID() (string, error)

func (*BootstrapClient) Halt

func (c *BootstrapClient) Halt() error

func (*BootstrapClient) RegisterValidator

func (c *BootstrapClient) RegisterValidator(v tmconsensus.Validator) error

func (*BootstrapClient) SeedAddrs

func (c *BootstrapClient) SeedAddrs() ([]string, error)

func (*BootstrapClient) SetApp

func (c *BootstrapClient) SetApp(a string) error

func (*BootstrapClient) SetChainID

func (c *BootstrapClient) SetChainID(newID string) error

func (*BootstrapClient) Start

func (c *BootstrapClient) Start() error

func (*BootstrapClient) Validators

func (c *BootstrapClient) Validators() ([]tmconsensus.Validator, error)

type BootstrapHost

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

BootstrapHost is the host portion for bootstrapping a stress cluster.

It is a minimal and rudimentary host intended for bootstrapping nodes into a network. Once bootstrapped, further work should happen over libp2p protocols.

The BootstrapHost (currently) depends on a Unix socket listener for a few reasons. First, it is easy for an operator to pick a file path for a bootstrap host without any kind of conflict. Inspecting the filesystem at a predetermined location gives simple and quick feedback that a particular host is running. Likewise, on a clean shutdown, the socket file is removed, also giving quick feedback that the particular host is no longer running.

Next, running on a Unix socket simplifies permissioned access; there is no risk of the Unix socket being mistakenly exposed on the public internet.

See also BootstrapClient, which is the intended way to access the bootstrap host. But it should also be possible to use curl's --unix-socket flag, if CLI access is required for some reason.

func NewBootstrapHost

func NewBootstrapHost(
	ctx context.Context,
	log *slog.Logger,
	serverSocketPath string,
	hostAddrs []string,
) (*BootstrapHost, error)

func (*BootstrapHost) Halt

func (h *BootstrapHost) Halt()

func (*BootstrapHost) Halted

func (h *BootstrapHost) Halted() <-chan struct{}

func (*BootstrapHost) Wait

func (h *BootstrapHost) Wait()

type RPCGenesisRequest

type RPCGenesisRequest struct{}

type RPCGenesisResponse

type RPCGenesisResponse struct {
	App        string
	ChainID    string
	Validators []tmconsensus.Validator
}

type RPCHaltRequest

type RPCHaltRequest struct{}

type RPCHaltResponse

type RPCHaltResponse struct{}

type RPCPublishMetricsRequest

type RPCPublishMetricsRequest struct {
	Metrics tmengine.Metrics
}

type RPCPublishMetricsResponse

type RPCPublishMetricsResponse struct{}

type SeedRPC

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

func (*SeedRPC) AwaitHalt

func (rpc *SeedRPC) AwaitHalt(args RPCHaltRequest, resp *RPCHaltResponse) error

AwaitHalt is the RPC method for a client to wait for a halt instruction from the host.

func (*SeedRPC) Genesis

func (rpc *SeedRPC) Genesis(args RPCGenesisRequest, resp *RPCGenesisResponse) error

Genesis is the RPC method for getting genesis data from the seed service. This method blocks until the bootstrap host has received a Start call, in order to prevent incomplete genesis data being sent.

func (*SeedRPC) PublishMetrics

func (rpc *SeedRPC) PublishMetrics(args RPCPublishMetricsRequest, resp *RPCPublishMetricsResponse) error

type SeedService

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

SeedService is the libp2p stream handler for the seed service, which coordinates the central seed and any number of validator or mirror instances.

func NewSeedService

func NewSeedService(log *slog.Logger, h libp2phost.Host, bh *BootstrapHost) *SeedService

NewSeedService registers the SeedService on h, providing data stored in bh.

There are currently no useful exported methods on SeedService, although that may change in the future.

func (*SeedService) CopyMetrics

func (s *SeedService) CopyMetrics(dst map[string]tmengine.Metrics)

CopyMetrics copies s's metrics into dst. It is the caller's responsibility to clear dst before calling CopyMetrics.

Jump to

Keyboard shortcuts

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