bee

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 Chunk

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

Chunk represents Bee chunk

func NewChunk

func NewChunk(data []byte) (Chunk, error)

NewChunk returns new chunk

func NewRandomChunk

func NewRandomChunk(r *rand.Rand) (c Chunk, err 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) Data

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

Data returns chunk's data

func (*Chunk) Size

func (c *Chunk) Size() int

Size returns chunk size

type Cluster

type Cluster struct {
	Nodes []Node
}

Cluster represents cluster of Bee nodes

func NewCluster

func NewCluster(o ClusterOptions) (c Cluster, err error)

NewCluster returns new cluster

func (*Cluster) Overlays

func (c *Cluster) Overlays(ctx context.Context) (overlays []swarm.Address, err error)

Overlays returns overlay addresses of all nodes in the cluster

func (*Cluster) Size

func (c *Cluster) Size() int

Size returns size of the cluster

type ClusterOptions

type ClusterOptions struct {
	APIScheme               string
	APIHostnamePattern      string
	APIDomain               string
	APIInsecureTLS          bool
	DebugAPIScheme          string
	DebugAPIHostnamePattern string
	DebugAPIDomain          string
	DebugAPIInsecureTLS     bool
	Namespace               string
	Size                    int
}

ClusterOptions represents Bee cluster options

type Node

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

Node represents Bee node

func NewNode

func NewNode(opts NodeOptions) Node

NewNode returns new node

func (*Node) DownloadChunk added in v0.2.2

func (n *Node) DownloadChunk(ctx context.Context, a swarm.Address) (data []byte, err error)

DownloadChunk downloads chunk from the node

func (*Node) HasChunk

func (n *Node) HasChunk(ctx context.Context, c Chunk) (bool, error)

HasChunk returns true/false if node has a chunk

func (*Node) Overlay

func (n *Node) Overlay(ctx context.Context) (swarm.Address, error)

Overlay returns node's overlay address

func (*Node) Peers

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

Peers returns addresses of node's peers

func (*Node) Ping

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

Ping pings other node

func (*Node) Topology added in v0.2.2

func (n *Node) Topology(ctx context.Context) (topology Topology, err error)

Topology returns Kademlia topology

func (*Node) UploadChunk

func (n *Node) UploadChunk(ctx context.Context, c *Chunk) (err error)

UploadChunk uploads chunk to the node

type NodeOptions

type NodeOptions struct {
	APIURL              *url.URL
	APIInsecureTLS      bool
	DebugAPIURL         *url.URL
	DebugAPIInsecureTLS bool
}

NodeOptions represents Bee node options

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
}

Topology represents Kademlia topology

Jump to

Keyboard shortcuts

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