bee

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: BSD-3-Clause Imports: 27 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// MaxChunkSize represents max chunk size in bytes
	MaxChunkSize = 4096
)
View Source
const MinimumBatchDepth = 11

Variables

This section is empty.

Functions

func EstimatePostageBatchDepth added in v0.5.6

func EstimatePostageBatchDepth(contentLength int64) uint64

func GenerateRandomChunkAt added in v0.5.6

func GenerateRandomChunkAt(rnd *rand.Rand, target swarm.Address, po uint8) swarm.Chunk

GenerateRandomChunkAt generates a chunk with address of proximity order po wrt target.

Types

type Addresses added in v0.2.3

type Addresses struct {
	Overlay      swarm.Address
	Underlay     []string
	Ethereum     string
	PublicKey    string
	PSSPublicKey string
}

Addresses represents node's addresses

type AddressesStreamMsg added in v0.2.3

type AddressesStreamMsg struct {
	Name      string
	Addresses Addresses
	Error     error
}

AddressesStreamMsg represents message sent over the AddressStream channel

type Balance added in v0.2.20

type Balance struct {
	Balance int64
	Peer    string
}

Balance represents node's balance with peer

type Balances added in v0.2.20

type Balances struct {
	Balances []Balance
}

Balances represents Balances's response

type BalancesStreamMsg added in v0.2.20

type BalancesStreamMsg struct {
	Name     string
	Balances Balances
	Error    error
}

BalancesStreamMsg represents message sent over the BalancesStream channel

type Bin added in v0.2.2

type Bin struct {
	Connected         int
	ConnectedPeers    []swarm.Address
	DisconnectedPeers []swarm.Address
	Population        int
}

Bin represents Kademlia bin

type CashoutStatusResponse added in v0.5.6

type CashoutStatusResponse struct {
	Peer            swarm.Address
	Cheque          *Cheque
	TransactionHash *string
	Result          *CashoutStatusResult
	UncashedAmount  *big.Int
}

type CashoutStatusResult added in v0.5.6

type CashoutStatusResult struct {
	Recipient  string
	LastPayout *big.Int
	Bounced    bool
}

type Cheque added in v0.5.6

type Cheque struct {
	Beneficiary string
	Chequebook  string
	Payout      *big.Int
}

type ChequebookBalanceResponse added in v0.5.6

type ChequebookBalanceResponse struct {
	TotalBalance     *big.Int
	AvailableBalance *big.Int
}

type Chunk

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

Chunk represents Bee chunk

func NewRandomChunk

func NewRandomChunk(r *rand.Rand) (Chunk, error)

NewRandomChunk returns new pseudorandom chunk

func (*Chunk) Address

func (c *Chunk) Address() swarm.Address

Address returns chunk's address

func (*Chunk) ClosestNode

func (c *Chunk) ClosestNode(nodes []swarm.Address) (closest swarm.Address, err error)

ClosestNode returns chunk's closest node of a given set of nodes

func (*Chunk) ClosestNodeFromMap added in v0.4.0

func (c *Chunk) ClosestNodeFromMap(nodes map[string]swarm.Address, skipNodes ...swarm.Address) (closestName string, closestAddress swarm.Address, err error)

ClosestNodeFromMap returns chunk's closest node of a given map of nodes

func (*Chunk) Data

func (c *Chunk) Data() []byte

Data returns chunk's data

func (*Chunk) SetAddress added in v0.2.17

func (c *Chunk) SetAddress() error

SetAddress calculates the address of a chunk and assign's it to address field

func (*Chunk) Size

func (c *Chunk) Size() int

Size returns chunk size

func (*Chunk) Span added in v0.2.7

func (c *Chunk) Span() int

Span returns chunk span

type Client added in v0.4.0

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

Client manages communication with the Bee node

func NewClient added in v0.4.0

func NewClient(opts ClientOptions) (c *Client)

NewClient returns Bee client

func (*Client) Addresses added in v0.4.0

func (c *Client) Addresses(ctx context.Context) (resp Addresses, err error)

Addresses returns node's addresses

func (*Client) Balance added in v0.4.0

func (c *Client) Balance(ctx context.Context, a swarm.Address) (resp Balance, err error)

Balance returns node's balance with a given peer

func (*Client) Balances added in v0.4.0

func (c *Client) Balances(ctx context.Context) (resp Balances, err error)

Balances returns node's balances

func (*Client) Cashout added in v0.5.6

func (c *Client) Cashout(ctx context.Context, a swarm.Address) (resp string, err error)

func (*Client) CashoutStatus added in v0.5.6

func (c *Client) CashoutStatus(ctx context.Context, a swarm.Address) (resp CashoutStatusResponse, err error)

func (*Client) ChequebookBalance added in v0.5.6

func (c *Client) ChequebookBalance(ctx context.Context) (resp ChequebookBalanceResponse, err error)

func (*Client) Config added in v0.5.0

func (c *Client) Config() ClientOptions

func (*Client) CreatePostageBatch added in v0.5.5

func (c *Client) CreatePostageBatch(ctx context.Context, amount int64, depth uint64, label string) (string, error)

CreatePostageBatch returns the batchID of a batch of postage stamps

func (*Client) CreateTag added in v0.4.0

func (c *Client) CreateTag(ctx context.Context) (resp api.TagResponse, err error)

CreateTag creates tag on the node

func (*Client) DownloadBytes added in v0.4.0

func (c *Client) DownloadBytes(ctx context.Context, a swarm.Address) (data []byte, err error)

DownloadBytes downloads chunk from the node

func (*Client) DownloadChunk added in v0.4.0

func (c *Client) DownloadChunk(ctx context.Context, a swarm.Address, targets string) (data []byte, err error)

DownloadChunk downloads chunk from the node

func (*Client) DownloadFile added in v0.4.0

func (c *Client) DownloadFile(ctx context.Context, a swarm.Address) (size int64, hash []byte, err error)

DownloadFile downloads chunk from the node and returns it's size and hash

func (*Client) DownloadManifestFile added in v0.4.0

func (c *Client) DownloadManifestFile(ctx context.Context, a swarm.Address, path string) (size int64, hash []byte, err error)

DownloadManifestFile downloads manifest file from the node and returns it's size and hash

func (*Client) GetOrCreateBatch added in v0.6.5

func (c *Client) GetOrCreateBatch(ctx context.Context, depth uint64, sleep time.Duration) (string, error)

func (*Client) GetPinnedRootHash added in v0.6.6

func (c *Client) GetPinnedRootHash(ctx context.Context, ref swarm.Address) (swarm.Address, error)

GetPinnedRootHash determines if the root hash of given reference is pinned by returning its reference.

func (*Client) GetPins added in v0.6.6

func (c *Client) GetPins(ctx context.Context) ([]swarm.Address, error)

GetPins returns all references of pinned root hashes.

func (*Client) GetTag added in v0.4.0

func (c *Client) GetTag(ctx context.Context, tagUID uint32) (resp api.TagResponse, err error)

GetTag retrieves tag from node

func (*Client) HasChunk added in v0.4.0

func (c *Client) HasChunk(ctx context.Context, a swarm.Address) (bool, error)

HasChunk returns true/false if node has a chunk

func (*Client) Overlay added in v0.4.0

func (c *Client) Overlay(ctx context.Context) (o swarm.Address, err error)

Overlay returns node's overlay address

func (*Client) Peers added in v0.4.0

func (c *Client) Peers(ctx context.Context) (peers []swarm.Address, err error)

Peers returns addresses of node's peers

func (*Client) PinRootHash added in v0.6.6

func (c *Client) PinRootHash(ctx context.Context, ref swarm.Address) error

PinRootHash pins root hash of given reference.

func (*Client) Ping added in v0.4.0

func (c *Client) Ping(ctx context.Context, node swarm.Address) (rtt string, err error)

Ping pings other node

func (*Client) PingStream added in v0.4.0

func (c *Client) PingStream(ctx context.Context, nodes []swarm.Address) <-chan PingStreamMsg

PingStream returns stream of ping results for given nodes

func (*Client) PostageBatches added in v0.6.5

func (c *Client) PostageBatches(ctx context.Context) ([]api.PostageStampResponse, error)

PostageBatches returns the list of batches of node

func (*Client) RemoveChunk added in v0.4.0

func (c *Client) RemoveChunk(ctx context.Context, a swarm.Address) error

RemoveChunk removes chunk from the node

func (*Client) ReserveState added in v0.5.6

func (c *Client) ReserveState(ctx context.Context) (debugapi.ReserveState, error)

ReserveState returns reserve radius, available capacity, inner and outer radiuses

func (*Client) SendPSSMessage added in v0.5.0

func (c *Client) SendPSSMessage(ctx context.Context, nodeAddress swarm.Address, publicKey string, topic string, prefix int, data []byte, batchID string) error

SendPSSMessage triggers a PSS message with a topic and recipient address

func (*Client) Settlement added in v0.4.0

func (c *Client) Settlement(ctx context.Context, a swarm.Address) (resp Settlement, err error)

Settlement returns node's settlement with a given peer

func (*Client) Settlements added in v0.4.0

func (c *Client) Settlements(ctx context.Context) (resp Settlements, err error)

Settlements returns node's settlements

func (*Client) Topology added in v0.4.0

func (c *Client) Topology(ctx context.Context) (topology Topology, err error)

Topology returns Kademlia topology

func (*Client) Underlay added in v0.4.0

func (c *Client) Underlay(ctx context.Context) ([]string, error)

Underlay returns node's underlay addresses

func (*Client) UnpinRootHash added in v0.6.6

func (c *Client) UnpinRootHash(ctx context.Context, ref swarm.Address) error

UnpinRootHash unpins root hash of given reference.

func (*Client) UploadBytes added in v0.4.0

func (c *Client) UploadBytes(ctx context.Context, b []byte, o api.UploadOptions) (swarm.Address, error)

UploadBytes uploads bytes to the node

func (*Client) UploadChunk added in v0.4.0

func (c *Client) UploadChunk(ctx context.Context, data []byte, o api.UploadOptions) (swarm.Address, error)

UploadChunk uploads chunk to the node

func (*Client) UploadCollection added in v0.4.0

func (c *Client) UploadCollection(ctx context.Context, f *File, o api.UploadOptions) (err error)

UploadCollection uploads TAR collection bytes to the node

func (*Client) UploadFile added in v0.4.0

func (c *Client) UploadFile(ctx context.Context, f *File, o api.UploadOptions) (err error)

UploadFile uploads file to the node

func (*Client) UploadSOC added in v0.5.0

func (c *Client) UploadSOC(ctx context.Context, owner, ID, signature string, data []byte, batchID string) (swarm.Address, error)

UploadSOC uploads a single owner chunk to a node with a E

func (*Client) WaitSync added in v0.5.6

func (c *Client) WaitSync(ctx context.Context, UId uint32) error

UploadBytes uploads bytes to the node

type ClientOptions added in v0.4.0

type ClientOptions struct {
	APIURL              *url.URL
	APIInsecureTLS      bool
	DebugAPIURL         *url.URL
	DebugAPIInsecureTLS bool
	Retry               int
}

ClientOptions holds optional parameters for the Client.

type Cluster

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

Cluster represents cluster of Bee nodes

func NewCluster

func NewCluster(name string, o ClusterOptions) *Cluster

NewCluster returns new cluster

func (*Cluster) AddNodeGroup added in v0.4.0

func (c *Cluster) AddNodeGroup(name string, o NodeGroupOptions)

AddNodeGroup adds new node group to the cluster

func (*Cluster) Addresses added in v0.2.3

func (c *Cluster) Addresses(ctx context.Context) (addrs map[string]NodeGroupAddresses, err error)

Addresses returns ClusterAddresses

func (*Cluster) Balances added in v0.2.20

func (c *Cluster) Balances(ctx context.Context) (balances ClusterBalances, err error)

Balances returns ClusterBalances

func (*Cluster) FlattenBalances added in v0.6.0

func (c *Cluster) FlattenBalances(ctx context.Context) (balances NodeGroupBalances, err error)

FlattenBalances returns aggregated NodeGroupBalances

func (*Cluster) FlattenOverlays added in v0.6.0

func (c *Cluster) FlattenOverlays(ctx context.Context, include ...string) (map[string]swarm.Address, error)

FlattenOverlays returns aggregated ClusterOverlays

func (*Cluster) FlattenSettlements added in v0.6.0

func (c *Cluster) FlattenSettlements(ctx context.Context) (settlements NodeGroupSettlements, err error)

FlattenSettlements returns aggregated NodeGroupSettlements

func (*Cluster) FlattenTopologies added in v0.6.0

func (c *Cluster) FlattenTopologies(ctx context.Context) (topologies map[string]Topology, err error)

FlattenTopologies returns an aggregate of Topologies

func (*Cluster) GlobalReplicationFactor added in v0.2.12

func (c *Cluster) GlobalReplicationFactor(ctx context.Context, a swarm.Address) (grf int, err error)

GlobalReplicationFactor returns the total number of nodes in the cluster that contain given chunk

func (*Cluster) Name added in v0.4.0

func (c *Cluster) Name() string

Name returns name of the cluster

func (*Cluster) NodeGroup added in v0.4.0

func (c *Cluster) NodeGroup(name string) *NodeGroup

NodeGroup returns node group

func (*Cluster) NodeGroups added in v0.4.0

func (c *Cluster) NodeGroups() (l map[string]*NodeGroup)

NodeGroups returns map of node groups in the cluster

func (*Cluster) NodeGroupsSorted added in v0.4.0

func (c *Cluster) NodeGroupsSorted() (l []string)

NodeGroupsSorted returns sorted list of node names in the node group

func (*Cluster) NodeNames added in v0.6.0

func (c *Cluster) NodeNames() (names []string)

NodeNamess returns a list of node names in the cluster across all node groups

func (*Cluster) Nodes

func (c *Cluster) Nodes() map[string]*Node

Nodes returns map of nodes in the cluster

func (*Cluster) NodesClients added in v0.5.0

func (c *Cluster) NodesClients(ctx context.Context) (map[string]*Client, error)

NodesClients returns map of node's clients in the cluster excluding stopped nodes

func (*Cluster) NodesClientsAll added in v0.5.0

func (c *Cluster) NodesClientsAll(ctx context.Context) (map[string]*Client, error)

NodesClientsAll returns map of node's clients in the cluster

func (*Cluster) Overlays

func (c *Cluster) Overlays(ctx context.Context) (overlays ClusterOverlays, err error)

Overlays returns ClusterOverlays

func (*Cluster) Peers added in v0.2.3

func (c *Cluster) Peers(ctx context.Context) (peers ClusterPeers, err error)

Peers returns peers of all nodes in the cluster

func (*Cluster) RandomNode added in v0.5.6

func (c *Cluster) RandomNode(ctx context.Context, r *rand.Rand) (node *Node, err error)

RandomNode returns random running node from a cluster

func (*Cluster) Settlements added in v0.3.0

func (c *Cluster) Settlements(ctx context.Context) (settlements ClusterSettlements, err error)

Settlements returns

func (*Cluster) Size

func (c *Cluster) Size() (size int)

Size returns size of the cluster

func (*Cluster) Topologies added in v0.2.3

func (c *Cluster) Topologies(ctx context.Context) (topologies ClusterTopologies, err error)

Topologies returns ClusterTopologies

type ClusterAddresses added in v0.4.0

type ClusterAddresses map[string]NodeGroupAddresses

ClusterAddresses represents addresses of all nodes in the cluster

type ClusterBalances added in v0.4.0

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
}

ClusterOptions represents Bee cluster options

type ClusterOverlays added in v0.4.0

type ClusterOverlays map[string]NodeGroupOverlays

ClusterOverlays represents overlay addresses of all nodes in the cluster

func (ClusterOverlays) Random added in v0.5.6

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 added in v0.4.0

type ClusterPeers map[string]NodeGroupPeers

ClusterPeers represents peers of all nodes in the cluster

type ClusterSettlements added in v0.4.0

type ClusterSettlements map[string]NodeGroupSettlements

ClusterSettlements represents settlements of all nodes in the cluster

type ClusterTopologies added in v0.4.0

type ClusterTopologies map[string]NodeGroupTopologies

ClusterTopologies represents Kademlia topology of all nodes in the cluster

type File added in v0.2.11

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

File represents Bee file

func NewBufferFile added in v0.2.18

func NewBufferFile(name string, buffer *bytes.Buffer) File

NewBufferFile returns new file with specified buffer

func NewRandomFile added in v0.2.11

func NewRandomFile(r *rand.Rand, name string, size int64) File

NewRandomFile returns new pseudorandom file

func (*File) Address added in v0.2.11

func (f *File) Address() swarm.Address

Address returns file's address

func (*File) CalculateHash added in v0.2.18

func (f *File) CalculateHash() error

CalculateHash calculates hash from dataReader. It replaces dataReader with another that will contain the data.

func (*File) ClosestNode added in v0.2.11

func (f *File) ClosestNode(nodes []swarm.Address) (closest swarm.Address, err error)

ClosestNode returns file's closest node of a given set of nodes

func (*File) DataReader added in v0.2.12

func (f *File) DataReader() io.Reader

DataReader returns file's data reader

func (*File) Hash added in v0.2.12

func (f *File) Hash() []byte

Hash returns file's hash

func (*File) Name added in v0.2.11

func (f *File) Name() string

Name returns file's name

func (*File) Size added in v0.2.11

func (f *File) Size() int64

Size returns file size

type HasChunkStreamMsg added in v0.2.12

type HasChunkStreamMsg struct {
	Name  string
	Found bool
	Error error
}

HasChunkStreamMsg represents message sent over the HasChunkStream channel

type Node

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

Node represents Bee node

func NewNode

func NewNode(name string, opts NodeOptions) (n *Node)

NewNode returns Bee node

func (*Node) ClefKey added in v0.4.2

func (n *Node) ClefKey() string

ClefKey returns node's clefKey

func (*Node) ClefPassword added in v0.4.2

func (n *Node) ClefPassword() string

ClefPassword returns node's clefPassword

func (*Node) Client added in v0.4.2

func (n *Node) Client() *Client

Client returns node's name

func (*Node) Config added in v0.4.2

func (n *Node) Config() *k8s.Config

Config returns node's config

func (*Node) LibP2PKey added in v0.4.2

func (n *Node) LibP2PKey() string

LibP2PKey returns node's libP2PKey

func (*Node) Name added in v0.4.2

func (n *Node) Name() string

Name returns node's name

func (*Node) SwarmKey added in v0.4.2

func (n *Node) SwarmKey() string

SwarmKey returns node's swarmKey

type NodeGroup added in v0.4.0

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

NodeGroup represents group of Bee nodes

func NewNodeGroup added in v0.4.0

func NewNodeGroup(name string, o NodeGroupOptions) *NodeGroup

NewNodeGroup returns new node group

func (*NodeGroup) AddNode added in v0.4.0

func (g *NodeGroup) AddNode(name string, o NodeOptions) (err error)

AddNode adss new node to the node group

func (*NodeGroup) Addresses added in v0.4.0

func (g *NodeGroup) Addresses(ctx context.Context) (addrs NodeGroupAddresses, err error)

Addresses returns NodeGroupAddresses

func (*NodeGroup) AddressesStream added in v0.4.0

func (g *NodeGroup) AddressesStream(ctx context.Context) (<-chan AddressesStreamMsg, error)

AddressesStream returns stream of addresses of all nodes in the node group

func (*NodeGroup) Balances added in v0.4.0

func (g *NodeGroup) Balances(ctx context.Context) (balances NodeGroupBalances, err error)

Balances returns NodeGroupBalances

func (*NodeGroup) BalancesStream added in v0.4.0

func (g *NodeGroup) BalancesStream(ctx context.Context) (<-chan BalancesStreamMsg, error)

BalancesStream returns stream of balances of all nodes in the cluster

func (*NodeGroup) CreateNode added in v0.4.3

func (g *NodeGroup) CreateNode(ctx context.Context, name string) (err error)

CreateNode creates new node in the k8s cluster

func (*NodeGroup) DeleteNode added in v0.4.1

func (g *NodeGroup) DeleteNode(ctx context.Context, name string) (err error)

DeleteNode deletes node from the k8s cluster and removes it from the node group

func (*NodeGroup) Fund added in v0.7.0

func (g *NodeGroup) Fund(ctx context.Context, name string) (err error)

Fund adds funds to the node

func (*NodeGroup) GroupReplicationFactor added in v0.4.0

func (g *NodeGroup) GroupReplicationFactor(ctx context.Context, a swarm.Address) (grf int, err error)

GroupReplicationFactor returns the total number of nodes in the node group that contain given chunk

func (*NodeGroup) HasChunkStream added in v0.4.0

func (g *NodeGroup) HasChunkStream(ctx context.Context, a swarm.Address) (<-chan HasChunkStreamMsg, error)

HasChunkStream returns stream of HasChunk requests for all nodes in the node group

func (*NodeGroup) Name added in v0.4.0

func (g *NodeGroup) Name() string

Name returns name of the node group

func (*NodeGroup) Node added in v0.4.0

func (g *NodeGroup) Node(name string) *Node

Node returns node

func (*NodeGroup) NodeClient added in v0.4.2

func (g *NodeGroup) NodeClient(name string) *Client

NodeClient returns node's client

func (*NodeGroup) NodeReady added in v0.4.2

func (g *NodeGroup) NodeReady(ctx context.Context, name string) (ok bool, err error)

NodeReady returns node's readiness

func (*NodeGroup) Nodes added in v0.4.0

func (g *NodeGroup) Nodes() map[string]*Node

Nodes returns map of nodes in the node group

func (*NodeGroup) NodesClients added in v0.4.2

func (g *NodeGroup) NodesClients(ctx context.Context) (map[string]*Client, error)

NodesClients returns map of node's clients in the node group excluding stopped nodes

func (*NodeGroup) NodesClientsAll added in v0.4.3

func (g *NodeGroup) NodesClientsAll(ctx context.Context) map[string]*Client

NodesClientsAll returns map of node's clients in the node group

func (*NodeGroup) NodesSorted added in v0.4.0

func (g *NodeGroup) NodesSorted() (l []string)

NodesSorted returns sorted list of node names in the node group

func (*NodeGroup) Overlays added in v0.4.0

func (g *NodeGroup) Overlays(ctx context.Context) (overlays NodeGroupOverlays, err error)

Overlays returns NodeGroupOverlays

func (*NodeGroup) OverlaysStream added in v0.4.0

func (g *NodeGroup) OverlaysStream(ctx context.Context) (<-chan OverlaysStreamMsg, error)

OverlaysStream returns stream of overlay addresses of all nodes in the node group TODO: add semaphore

func (*NodeGroup) Peers added in v0.4.0

func (g *NodeGroup) Peers(ctx context.Context) (peers NodeGroupPeers, err error)

Peers returns NodeGroupPeers

func (*NodeGroup) PeersStream added in v0.4.0

func (g *NodeGroup) PeersStream(ctx context.Context) (<-chan PeersStreamMsg, error)

PeersStream returns stream of peers of all nodes in the node group

func (*NodeGroup) RunningNodes added in v0.4.7

func (g *NodeGroup) RunningNodes(ctx context.Context) (running []string, err error)

RunningNodes returns list of running nodes

func (*NodeGroup) Settlements added in v0.4.0

func (g *NodeGroup) Settlements(ctx context.Context) (settlements NodeGroupSettlements, err error)

Settlements returns NodeGroupSettlements

func (*NodeGroup) SettlementsStream added in v0.4.0

func (g *NodeGroup) SettlementsStream(ctx context.Context) (<-chan SettlementsStreamMsg, error)

SettlementsStream returns stream of settlements of all nodes in the cluster

func (*NodeGroup) SetupNode added in v0.7.0

func (g *NodeGroup) SetupNode(ctx context.Context, name string, o NodeOptions, fund bool) (err error)

SetupNode creates new node in the node group, starts it in the k8s cluster and funds it

func (*NodeGroup) Size added in v0.4.0

func (g *NodeGroup) Size() int

Size returns size of the node group

func (*NodeGroup) StartNode added in v0.4.0

func (g *NodeGroup) StartNode(ctx context.Context, name string) (err error)

StartNode start node by scaling its statefulset to 1

func (*NodeGroup) StopNode added in v0.4.2

func (g *NodeGroup) StopNode(ctx context.Context, name string) (err error)

StopNode stops node by scaling down its statefulset to 0

func (*NodeGroup) StoppedNodes added in v0.4.2

func (g *NodeGroup) StoppedNodes(ctx context.Context) (stopped []string, err error)

StoppedNodes returns list of stopped nodes

func (*NodeGroup) Topologies added in v0.4.0

func (g *NodeGroup) Topologies(ctx context.Context) (topologies NodeGroupTopologies, err error)

Topologies returns NodeGroupTopologies

func (*NodeGroup) TopologyStream added in v0.4.0

func (g *NodeGroup) TopologyStream(ctx context.Context) (<-chan TopologyStreamMsg, error)

TopologyStream returns stream of Kademlia topologies of all nodes in the node group

type NodeGroupAddresses added in v0.4.0

type NodeGroupAddresses map[string]Addresses

NodeGroupAddresses represents addresses of all nodes in the node group

type NodeGroupBalances added in v0.4.0

type NodeGroupBalances map[string]map[string]int64

NodeGroupBalances represents balances of all nodes in the node group

type NodeGroupOptions added in v0.4.0

type NodeGroupOptions struct {
	Annotations               map[string]string
	ClefImage                 string
	ClefImagePullPolicy       string
	BeeConfig                 *k8s.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 added in v0.4.0

type NodeGroupOverlays map[string]swarm.Address

NodeGroupOverlays represents overlay addresses of all nodes in the node group

type NodeGroupPeers added in v0.4.0

type NodeGroupPeers map[string][]swarm.Address

NodeGroupPeers represents peers of all nodes in the node group

type NodeGroupSettlements added in v0.4.0

type NodeGroupSettlements map[string]map[string]SentReceived

NodeGroupSettlements represents settlements of all nodes in the node group

type NodeGroupTopologies added in v0.4.0

type NodeGroupTopologies map[string]Topology

NodeGroupTopologies represents Kademlia topology of all nodes in the node group

type NodeOptions

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

NodeOptions holds optional parameters for the Node.

type OverlaysStreamMsg added in v0.2.3

type OverlaysStreamMsg struct {
	Name    string
	Address swarm.Address
	Error   error
}

OverlaysStreamMsg represents message sent over the OverlaysStream channel

type PeersStreamMsg added in v0.2.3

type PeersStreamMsg struct {
	Name  string
	Peers []swarm.Address
	Error error
}

PeersStreamMsg represents message sent over the PeersStream channel

type PingStreamMsg added in v0.2.4

type PingStreamMsg struct {
	Node  swarm.Address
	RTT   string
	Index int
	Error error
}

PingStreamMsg represents message sent over the PingStream channel

type SentReceived added in v0.3.0

type SentReceived struct {
	Received int64
	Sent     int64
}

SentReceived object

type Settlement added in v0.3.0

type Settlement struct {
	Peer     string
	Received int64
	Sent     int64
}

Settlement represents node's settlement with peer

type Settlements added in v0.3.0

type Settlements struct {
	Settlements   []Settlement
	TotalReceived int64
	TotalSent     int64
}

Settlements represents Settlements's response

type SettlementsStreamMsg added in v0.3.0

type SettlementsStreamMsg struct {
	Name        string
	Settlements Settlements
	Error       error
}

SettlementsStreamMsg represents message sent over the SettlementsStream channel

type Topology added in v0.2.2

type Topology struct {
	Overlay        swarm.Address
	Connected      int
	Population     int
	NnLowWatermark int
	Depth          int
	Bins           map[string]Bin
	LightNodes     Bin
}

Topology represents Kademlia topology

type TopologyStreamMsg added in v0.2.3

type TopologyStreamMsg struct {
	Name     string
	Topology Topology
	Error    error
}

TopologyStreamMsg represents message sent over the TopologyStream channel

Jump to

Keyboard shortcuts

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