network

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainConfig

type ChainConfig struct {
	ChainID string
	VMType  string
	Genesis []byte
	Config  []byte
}

ChainConfig defines configuration for a chain

type Network

type Network struct {
	ID        string
	Name      string
	Type      NetworkType
	Status    NetworkStatus
	Nodes     []*Node
	ChainIDs  []string
	CreatedAt time.Time
}

Network represents a managed Lux network

type NetworkManager

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

NetworkManager handles all network operations using netrunner

func NewNetworkManager

func NewNetworkManager(config *config.NetworkConfig, logger log.Logger) (*NetworkManager, error)

NewNetworkManager creates a new network manager

func (*NetworkManager) AddNode

func (nm *NetworkManager) AddNode(ctx context.Context, networkID string, nodeParams *NodeParams) (*Node, error)

AddNode adds a new node to the network

func (*NetworkManager) CreateNetwork

func (nm *NetworkManager) CreateNetwork(ctx context.Context, params *NetworkParams) (*Network, error)

CreateNetwork creates a new network

func (*NetworkManager) DeleteNetwork

func (nm *NetworkManager) DeleteNetwork(ctx context.Context, networkID string) error

DeleteNetwork deletes a network

func (*NetworkManager) GetNetwork

func (nm *NetworkManager) GetNetwork(networkID string) (*Network, error)

GetNetwork returns a network by ID

func (*NetworkManager) GetNodeStatus

func (nm *NetworkManager) GetNodeStatus(ctx context.Context, networkID, nodeID string) (*NodeStatus, error)

GetNodeStatus returns the status of a node

func (*NetworkManager) ListNetworks

func (nm *NetworkManager) ListNetworks() []*Network

ListNetworks returns all networks

func (*NetworkManager) RemoveNode

func (nm *NetworkManager) RemoveNode(ctx context.Context, networkID, nodeID string) error

RemoveNode removes a node from the network

func (*NetworkManager) StartNetwork

func (nm *NetworkManager) StartNetwork(ctx context.Context, networkID string) error

StartNetwork starts a stopped network

func (*NetworkManager) StopNetwork

func (nm *NetworkManager) StopNetwork(ctx context.Context, networkID string) error

StopNetwork stops a running network

type NetworkParams

type NetworkParams struct {
	Name             string
	Type             NetworkType
	NumNodes         int
	BinaryPath       string
	ConfigPath       string
	DataDir          string
	LogLevel         string
	HTTPPort         int
	StakingPort      int
	EnableStaking    bool
	EnableMonitoring bool
	ChainConfigs     []ChainConfig
}

NetworkParams defines parameters for creating a network

type NetworkStatus

type NetworkStatus string

NetworkStatus defines the status of a network

const (
	NetworkStatusCreating NetworkStatus = "creating"
	NetworkStatusRunning  NetworkStatus = "running"
	NetworkStatusStopped  NetworkStatus = "stopped"
	NetworkStatusError    NetworkStatus = "error"
)

type NetworkType

type NetworkType string

NetworkType defines the type of network

const (
	NetworkTypeMainnet NetworkType = "mainnet"
	NetworkTypeTestnet NetworkType = "testnet"
	NetworkTypeLocal   NetworkType = "local"
	NetworkTypeCustom  NetworkType = "custom"
)

type Node

type Node struct {
	ID          string
	NodeID      string
	Type        NodeType
	Status      NodeStatus
	Endpoint    string
	StakeAmount uint64
	PublicKey   string
}

Node represents a node in the network

type NodeParams

type NodeParams struct {
	Name        string
	Type        NodeType
	StakeAmount uint64
}

NodeParams defines parameters for adding a node

type NodeStatus

type NodeStatus string

NodeStatus defines the status of a node

const (
	NodeStatusBootstrapping NodeStatus = "bootstrapping"
	NodeStatusHealthy       NodeStatus = "healthy"
	NodeStatusUnhealthy     NodeStatus = "unhealthy"
	NodeStatusStopped       NodeStatus = "stopped"
)

type NodeType

type NodeType string

NodeType defines the type of node

const (
	NodeTypeValidator NodeType = "validator"
	NodeTypeAPI       NodeType = "api"
	NodeTypeFull      NodeType = "full"
	NodeTypeLight     NodeType = "light"
)

Jump to

Keyboard shortcuts

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