dijets_network_runner_sdk

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

README


Dijets Network Runner and Simulator for testing network and nodes before deploying.

Dijets NetSims SDK

NetSims-SDK allows developers to define, create, and interact with a network of Dijets nodes. Devs and system integrators can run networks of Dijets nodes with support for custom nodes, ECCs, and network configurations. With NetSims, developers can easily test code locally before deploying to public testnets like Lothar Testnet or Mainnet.

NetSims-SDK lets you:

  1. Define the network

  2. Start the network

  3. Interact with network and individual nodes and rpcs

  4. Shutdown

The API package contained within allows the user to make API calls to Dijets nodes within the network.

Documentation

Overview

Package netsims-sdk implements client. Copied from https://github.com/lasthyphen/dijets-network-runner/blob/v1.3.0/client/client.go except "local.DefaultNumNodes" and "logging.Logger"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Ping(ctx context.Context) (*rpcpb.PingResponse, error)
	Start(ctx context.Context, execPath string, opts ...OpOption) (*rpcpb.StartResponse, error)
	CreateBlockchains(ctx context.Context, blockchainSpecs []*rpcpb.BlockchainSpec) (*rpcpb.CreateBlockchainsResponse, error)
	CreateSubnets(ctx context.Context, opts ...OpOption) (*rpcpb.CreateSubnetsResponse, error)
	Health(ctx context.Context) (*rpcpb.HealthResponse, error)
	URIs(ctx context.Context) ([]string, error)
	Status(ctx context.Context) (*rpcpb.StatusResponse, error)
	StreamStatus(ctx context.Context, pushInterval time.Duration) (<-chan *rpcpb.ClusterInfo, error)
	RemoveNode(ctx context.Context, name string) (*rpcpb.RemoveNodeResponse, error)
	RestartNode(ctx context.Context, name string, opts ...OpOption) (*rpcpb.RestartNodeResponse, error)
	AddNode(ctx context.Context, name string, execPath string, opts ...OpOption) (*rpcpb.AddNodeResponse, error)
	Stop(ctx context.Context) (*rpcpb.StopResponse, error)
	AttachPeer(ctx context.Context, nodeName string) (*rpcpb.AttachPeerResponse, error)
	SendOutboundMessage(ctx context.Context, nodeName string, peerID string, op uint32, msgBody []byte) (*rpcpb.SendOutboundMessageResponse, error)
	Close() error
	SaveSnapshot(ctx context.Context, snapshotName string) (*rpcpb.SaveSnapshotResponse, error)
	LoadSnapshot(ctx context.Context, snapshotName string, opts ...OpOption) (*rpcpb.LoadSnapshotResponse, error)
	RemoveSnapshot(ctx context.Context, snapshotName string) (*rpcpb.RemoveSnapshotResponse, error)
	GetSnapshotNames(ctx context.Context) ([]string, error)
}

func New

func New(cfg Config) (Client, error)

type Config

type Config struct {
	LogLevel    string
	Endpoint    string
	DialTimeout time.Duration
}

type Op

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

type OpOption

type OpOption func(*Op)

func WithBlockchainSpecs

func WithBlockchainSpecs(blockchainSpecs []*rpcpb.BlockchainSpec) OpOption

Slice of BlockchainSpec

func WithChainConfigs

func WithChainConfigs(chainConfigs map[string]string) OpOption

Map from chain name to its configuration json contents.

func WithCustomNodeConfigs

func WithCustomNodeConfigs(customNodeConfigs map[string]string) OpOption

Map from node name to its custom node config

func WithDynamicPorts

func WithDynamicPorts(dynamicPorts bool) OpOption

func WithExecPath

func WithExecPath(execPath string) OpOption

func WithGlobalNodeConfig

func WithGlobalNodeConfig(nodeConfig string) OpOption

func WithNumNodes

func WithNumNodes(numNodes uint32) OpOption

func WithNumSubnets

func WithNumSubnets(numSubnets uint32) OpOption

func WithPluginDir

func WithPluginDir(pluginDir string) OpOption

func WithReassignPortsIfUsed

func WithReassignPortsIfUsed(reassignPortsIfUsed bool) OpOption

func WithRootDataDir

func WithRootDataDir(rootDataDir string) OpOption

func WithUpgradeConfigs

func WithUpgradeConfigs(upgradeConfigs map[string]string) OpOption

Map from chain name to its upgrade json contents.

func WithWhitelistedSubnets

func WithWhitelistedSubnets(whitelistedSubnets string) OpOption

Directories

Path Synopsis
pkg
logutil
Package logutil implements various log utilities.
Package logutil implements various log utilities.

Jump to

Keyboard shortcuts

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