orchestration

package
v0.15.9 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSet = errors.New("orchestration client not set")

ErrNotSet represents error when orchestration client is not set

Functions

This section is empty.

Types

type BeeClientOption added in v0.15.9

type BeeClientOption func(*bee.ClientOptions) error

BeeClientOption represents bee client option

func WithNoOptions added in v0.15.9

func WithNoOptions() BeeClientOption

WithNoOptions represents no BeeClientOption

func WithURLs added in v0.15.9

func WithURLs(apiURL, debugAPIURL string) BeeClientOption

WithAPIURL returns BeeClientOption with given api url and debug api url

type Cluster

type Cluster interface {
	Accounting(ctx context.Context) (accounting ClusterAccounting, err error)
	AddNodeGroup(name string, o NodeGroupOptions)
	Addresses(ctx context.Context) (addrs map[string]NodeGroupAddresses, err error)
	Balances(ctx context.Context) (balances ClusterBalances, err error)
	FlattenAccounting(ctx context.Context) (accounting NodeGroupAccounting, err error)
	FlattenBalances(ctx context.Context) (balances NodeGroupBalances, err error)
	FlattenOverlays(ctx context.Context, exclude ...string) (map[string]swarm.Address, error)
	FlattenSettlements(ctx context.Context) (settlements NodeGroupSettlements, err error)
	FlattenTopologies(ctx context.Context) (topologies map[string]bee.Topology, err error)
	FullNodeNames() (names []string)
	GlobalReplicationFactor(ctx context.Context, a swarm.Address) (grf int, err error)
	LightNodeNames() (names []string)
	Name() string
	NodeGroup(name string) (ng NodeGroup, err error)
	NodeGroups() (l map[string]NodeGroup)
	NodeGroupsSorted() (l []string)
	NodeNames() (names []string)
	Nodes() map[string]Node
	NodesClients(ctx context.Context) (map[string]*bee.Client, error)
	NodesClientsAll(ctx context.Context) (map[string]*bee.Client, error)
	Overlays(ctx context.Context, exclude ...string) (overlays ClusterOverlays, err error)
	Peers(ctx context.Context, exclude ...string) (peers ClusterPeers, err error)
	RandomNode(ctx context.Context, r *rand.Rand) (node Node, err error)
	Settlements(ctx context.Context) (settlements ClusterSettlements, err error)
	Size() (size int)
	Topologies(ctx context.Context) (topologies ClusterTopologies, err error)
}

type ClusterAccounting added in v0.11.4

type ClusterAccounting map[string]NodeGroupAccounting

ClusterAccounting represents accounting of all nodes in the cluster

type ClusterAddresses

type ClusterAddresses map[string]NodeGroupAddresses

ClusterAddresses represents addresses of all nodes in the cluster

type ClusterBalances

type ClusterBalances map[string]NodeGroupBalances

ClusterBalances represents balances of all nodes in the cluster

type ClusterOptions

type ClusterOptions struct {
	Annotations         map[string]string
	APIDomain           string
	APIInsecureTLS      bool
	APIScheme           string
	DebugAPIDomain      string
	DebugAPIInsecureTLS bool
	DebugAPIScheme      string
	K8SClient           *k8s.Client
	SwapClient          swap.Client
	Labels              map[string]string
	Namespace           string
	DisableNamespace    bool
	AdminPassword       string
}

ClusterOptions represents Bee cluster options

func (ClusterOptions) ApiURL added in v0.15.9

func (c ClusterOptions) ApiURL(name string) (u *url.URL, err error)

ApiURL generates URL for node's API

func (ClusterOptions) DebugAPIURL added in v0.15.9

func (c ClusterOptions) DebugAPIURL(name string) (u *url.URL, err error)

DebugAPIURL generates URL for node's DebugAPI

func (ClusterOptions) IngressDebugHost added in v0.15.9

func (c ClusterOptions) IngressDebugHost(name string) string

IngressDebugHost generates host for node's DebugAPI ingress

func (ClusterOptions) IngressHost added in v0.15.9

func (c ClusterOptions) IngressHost(name string) string

IngressHost generates host for node's API ingress

type ClusterOverlays

type ClusterOverlays map[string]NodeGroupOverlays

ClusterOverlays represents overlay addresses of all nodes in the cluster

func (ClusterOverlays) Random

func (c ClusterOverlays) Random(r *rand.Rand) (nodeGroup string, nodeName string, overlay swarm.Address)

RandomOverlay returns a random overlay from a random NodeGroup

type ClusterPeers

type ClusterPeers map[string]NodeGroupPeers

ClusterPeers represents peers of all nodes in the cluster

type ClusterSettlements

type ClusterSettlements map[string]NodeGroupSettlements

ClusterSettlements represents settlements of all nodes in the cluster

type ClusterTopologies

type ClusterTopologies map[string]NodeGroupTopologies

ClusterTopologies represents Kademlia topology of all nodes in the cluster

type Config

type Config struct {
	AllowPrivateCIDRs         bool          // allow to advertise private CIDRs to the public network
	APIAddr                   string        // HTTP API listen address
	BlockTime                 uint64        // chain block time
	Bootnodes                 string        // initial nodes to connect to
	BootnodeMode              bool          // cause the node to always accept incoming connections
	CacheCapacity             uint64        // cache capacity in chunks, multiply by 4096 (MaxChunkSize) to get approximate capacity in bytes
	ClefSignerEnable          bool          // enable clef signer
	ClefSignerEndpoint        string        // clef signer endpoint
	CORSAllowedOrigins        string        // origins with CORS headers enabled
	DataDir                   string        // data directory
	DbOpenFilesLimit          int           // number of open files allowed by database
	DbBlockCacheCapacity      int           // size of block cache of the database in bytes
	DbWriteBufferSize         int           // size of the database write buffer in bytes
	DbDisableSeeksCompaction  bool          // disables DB compactions triggered by seeks
	DebugAPIAddr              string        // debug HTTP API listen address
	DebugAPIEnable            bool          // enable debug HTTP API
	FullNode                  bool          // cause the node to start in full mode
	Mainnet                   bool          // enable mainnet
	NATAddr                   string        // NAT exposed address
	NetworkID                 uint64        // ID of the Swarm network
	P2PAddr                   string        // P2P listen address
	P2PWSEnable               bool          // enable P2P WebSocket transport
	Password                  string        // password for decrypting keys
	PaymentEarly              uint64        // amount in BZZ below the peers payment threshold when we initiate settlement
	PaymentThreshold          uint64        // threshold in BZZ where you expect to get paid from your peers
	PaymentTolerance          uint64        // excess debt above payment threshold in BZZ where you disconnect from your peer
	PostageStampAddress       string        // postage stamp address
	PostageContractStartBlock uint64        // postage stamp address
	PriceOracleAddress        string        // price Oracle address
	ResolverOptions           string        // ENS compatible API endpoint for a TLD and with contract address, can be repeated, format [tld:][contract-addr@]url
	Restricted                bool          // start node in restricted mode
	TokenEncryptionKey        string        // username for API authentication
	AdminPassword             string        // password hash for API authentication
	ChequebookEnable          bool          // enable chequebook
	SwapEnable                bool          // enable swap
	SwapEndpoint              string        // swap ethereum blockchain endpoint
	SwapDeploymentGasPrice    string        // gas price in wei to use for deployment and funding
	SwapFactoryAddress        string        // swap factory address
	RedistributionAddress     string        // redistribution address
	StakingAddress            string        // staking address
	StorageIncentivesEnable   string        // storage incentives enable flag
	SwapInitialDeposit        uint64        // initial deposit if deploying a new chequebook
	TracingEnabled            bool          // enable tracing
	TracingEndpoint           string        // endpoint to send tracing data
	TracingServiceName        string        // service name identifier for tracing
	Verbosity                 uint64        // log verbosity level 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=trace
	WelcomeMessage            string        // send a welcome message string during handshakes
	WarmupTime                time.Duration // warmup time pull/pushsync protocols
	WithdrawAddress           string        // allowed addresses for wallet withdrawal
}

Config represents Bee configuration

type CreateOptions

type CreateOptions struct {
	// Bee configuration
	Config Config
	// Kubernetes configuration
	Name                      string
	Namespace                 string
	Annotations               map[string]string
	ClefImage                 string
	ClefImagePullPolicy       string
	ClefKey                   string
	ClefPassword              string
	Labels                    map[string]string
	Image                     string
	ImagePullPolicy           string
	ImagePullSecrets          []string
	IngressAnnotations        map[string]string
	IngressClass              string
	IngressHost               string
	IngressDebugAnnotations   map[string]string
	IngressDebugClass         string
	IngressDebugHost          string
	LibP2PKey                 string
	NodeSelector              map[string]string
	PersistenceEnabled        bool
	PersistenceStorageClass   string
	PersistenceStorageRequest string
	PodManagementPolicy       string
	RestartPolicy             string
	ResourcesLimitCPU         string
	ResourcesLimitMemory      string
	ResourcesRequestCPU       string
	ResourcesRequestMemory    string
	Selector                  map[string]string
	SwarmKey                  string
	UpdateStrategy            string
}

CreateOptions represents available options for creating node

type EncryptedKey added in v0.12.0

type EncryptedKey string

EncryptedKey is part of Ethereum JSON v3 key file format.

func (EncryptedKey) GetEthAddress added in v0.12.0

func (ek EncryptedKey) GetEthAddress() (string, error)

GetEthAddress extracts ethereum address from EncryptedKey.

func (EncryptedKey) String added in v0.15.9

func (ek EncryptedKey) String() string

type EncryptedKeyJson added in v0.12.0

type EncryptedKeyJson struct {
	Address string `json:"address"`
}

EncryptedKeyJson is json string for EncryptedKey.

type FundingOptions

type FundingOptions struct {
	Eth  float64
	Bzz  float64
	GBzz float64
}

type Node

type Node interface {
	ClefKey() string
	ClefPassword() string
	Client() *bee.Client
	Config() *Config
	LibP2PKey() string
	Name() string
	SetClefKey(key string) Node
	SetClefPassword(key string) Node
	SetSwarmKey(key string) Node
	SwarmKey() string
	Create(ctx context.Context, o CreateOptions) (err error)
	Delete(ctx context.Context, namespace string) (err error)
	Ready(ctx context.Context, namespace string) (ready bool, err error)
	Start(ctx context.Context, namespace string) (err error)
	Stop(ctx context.Context, namespace string) (err error)
}

type NodeGroup

type NodeGroup interface {
	Accounting(ctx context.Context) (infos NodeGroupAccounting, err error)
	AddNode(ctx context.Context, name string, o NodeOptions, opts ...BeeClientOption) (err error)
	Addresses(ctx context.Context) (addrs NodeGroupAddresses, err error)
	Balances(ctx context.Context) (balances NodeGroupBalances, err error)
	CreateNode(ctx context.Context, name string) (err error)
	DeleteNode(ctx context.Context, name string) (err error)
	GetEthAddress(ctx context.Context, name string, o NodeOptions) (ethAddress string, err error)
	GroupReplicationFactor(ctx context.Context, a swarm.Address) (grf int, err error)
	Name() string
	Node(name string) (Node, error)
	NodeClient(name string) (*bee.Client, error)
	NodeReady(ctx context.Context, name string) (ok bool, err error)
	Nodes() map[string]Node
	NodesClients(ctx context.Context) (map[string]*bee.Client, error)
	NodesClientsAll(ctx context.Context) map[string]*bee.Client
	NodesSorted() (l []string)
	Overlays(ctx context.Context) (overlays NodeGroupOverlays, err error)
	Peers(ctx context.Context) (peers NodeGroupPeers, err error)
	RunningNodes(ctx context.Context) (running []string, err error)
	Settlements(ctx context.Context) (settlements NodeGroupSettlements, err error)
	SetupNode(ctx context.Context, name string, o NodeOptions) (ethAddress string, err error)
	Size() int
	StartNode(ctx context.Context, name string) (err error)
	StopNode(ctx context.Context, name string) (err error)
	StoppedNodes(ctx context.Context) (stopped []string, err error)
	Topologies(ctx context.Context) (topologies NodeGroupTopologies, err error)
}

type NodeGroupAccounting added in v0.11.4

type NodeGroupAccounting map[string]map[string]bee.Account

NodeGroupAccounting represents accounting of all nodes in the node group

type NodeGroupAddresses

type NodeGroupAddresses map[string]bee.Addresses

NodeGroupAddresses represents addresses of all nodes in the node group

type NodeGroupBalances

type NodeGroupBalances map[string]map[string]int64

NodeGroupBalances represents balances of all nodes in the node group

type NodeGroupOptions

type NodeGroupOptions struct {
	Annotations               map[string]string
	ClefImage                 string
	ClefImagePullPolicy       string
	BeeConfig                 *Config
	Image                     string
	ImagePullPolicy           string
	ImagePullSecrets          []string
	IngressAnnotations        map[string]string
	IngressClass              string
	IngressDebugAnnotations   map[string]string
	IngressDebugClass         string
	Labels                    map[string]string
	NodeSelector              map[string]string
	PersistenceEnabled        bool
	PersistenceStorageClass   string
	PersistenceStorageRequest string
	PodManagementPolicy       string
	RestartPolicy             string
	ResourcesLimitCPU         string
	ResourcesLimitMemory      string
	ResourcesRequestCPU       string
	ResourcesRequestMemory    string
	UpdateStrategy            string
}

NodeGroupOptions represents node group options

type NodeGroupOverlays

type NodeGroupOverlays map[string]swarm.Address

NodeGroupOverlays represents overlay addresses of all nodes in the node group

type NodeGroupPeers

type NodeGroupPeers map[string][]swarm.Address

NodeGroupPeers represents peers of all nodes in the node group

type NodeGroupSettlements

type NodeGroupSettlements map[string]map[string]SentReceived

NodeGroupSettlements represents settlements of all nodes in the node group

type NodeGroupTopologies

type NodeGroupTopologies map[string]bee.Topology

NodeGroupTopologies represents Kademlia topology of all nodes in the node group

type NodeOptions

type NodeOptions struct {
	ClefKey      string
	ClefPassword string
	Client       *bee.Client
	Config       *Config
	LibP2PKey    string
	SwarmKey     EncryptedKey
}

NodeOptions holds optional parameters for the Node.

type NodeOrchestrator added in v0.15.9

type NodeOrchestrator interface {
	Create(ctx context.Context, o CreateOptions) (err error)
	Delete(ctx context.Context, name string, namespace string) (err error)
	Ready(ctx context.Context, name string, namespace string) (ready bool, err error)
	Start(ctx context.Context, name string, namespace string) (err error)
	Stop(ctx context.Context, name string, namespace string) (err error)
	RunningNodes(ctx context.Context, namespace string) (running []string, err error)
	StoppedNodes(ctx context.Context, namespace string) (stopped []string, err error)
}

type SentReceived

type SentReceived struct {
	Received int64
	Sent     int64
}

SentReceived object

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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