Documentation
¶
Index ¶
- type ChainConfig
- type Network
- type NetworkManager
- func (nm *NetworkManager) AddNode(ctx context.Context, networkID string, nodeParams *NodeParams) (*Node, error)
- func (nm *NetworkManager) CreateNetwork(ctx context.Context, params *NetworkParams) (*Network, error)
- func (nm *NetworkManager) DeleteNetwork(ctx context.Context, networkID string) error
- func (nm *NetworkManager) GetNetwork(networkID string) (*Network, error)
- func (nm *NetworkManager) GetNodeStatus(ctx context.Context, networkID, nodeID string) (*NodeStatus, error)
- func (nm *NetworkManager) ListNetworks() []*Network
- func (nm *NetworkManager) RemoveNode(ctx context.Context, networkID, nodeID string) error
- func (nm *NetworkManager) StartNetwork(ctx context.Context, networkID string) error
- func (nm *NetworkManager) StopNetwork(ctx context.Context, networkID string) error
- type NetworkParams
- type NetworkStatus
- type NetworkType
- type Node
- type NodeParams
- type NodeStatus
- type NodeType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainConfig ¶
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 ¶
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" )