bee

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addresses added in v0.2.3

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

Addresses represents node's addresses

type AddressesStreamMsg added in v0.2.3

type AddressesStreamMsg struct {
	Addresses Addresses
	Index     int
	Error     error
}

AddressesStreamMsg represents message sent over the AddressStream 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 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) Addresses added in v0.2.3

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

Addresses returns ordered list of addresses of all nodes in the cluster

func (*Cluster) AddressesStream added in v0.2.3

func (c *Cluster) AddressesStream(ctx context.Context) <-chan AddressesStreamMsg

AddressesStream returns stream of addresses of all nodes in the cluster

func (*Cluster) Overlays

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

Overlays returns ordered list of overlay addresses of all nodes in the cluster

func (*Cluster) OverlaysStream added in v0.2.3

func (c *Cluster) OverlaysStream(ctx context.Context) <-chan OverlaysStreamMsg

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

func (*Cluster) Peers added in v0.2.3

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

Peers returns ordered list of peers of all nodes in the cluster

func (*Cluster) PeersStream added in v0.2.3

func (c *Cluster) PeersStream(ctx context.Context) <-chan PeersStreamMsg

PeersStream returns stream of peers of all nodes in the cluster

func (*Cluster) Size

func (c *Cluster) Size() int

Size returns size of the cluster

func (*Cluster) Topologies added in v0.2.3

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

Topologies returns ordered list of Kademlia topology of all nodes in the cluster

func (*Cluster) TopologyStream added in v0.2.3

func (c *Cluster) TopologyStream(ctx context.Context) <-chan TopologyStreamMsg

TopologyStream returns stream of peers of all nodes in 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) Addresses added in v0.2.3

func (n *Node) Addresses(ctx context.Context) (resp Addresses, err error)

Addresses returns node's addresses

func (*Node) DownloadBzzChunk added in v0.2.6

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

DownloadBzzChunk downloads chunk from the 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, a swarm.Address) (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) PingStream added in v0.2.4

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

PingStream returns stream of ping results for given nodes

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) Underlay added in v0.2.3

func (n *Node) Underlay(ctx context.Context) ([]string, error)

Underlay returns node's underlay addresses

func (*Node) UploadBzzChunk added in v0.2.6

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

UploadBzzChunk uploads chunk to the node

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

type OverlaysStreamMsg struct {
	Address swarm.Address
	Index   int
	Error   error
}

OverlaysStreamMsg represents message sent over the OverlaysStream channel

type PeersStreamMsg added in v0.2.3

type PeersStreamMsg struct {
	Peers []swarm.Address
	Index int
	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 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

type TopologyStreamMsg added in v0.2.3

type TopologyStreamMsg struct {
	Topology Topology
	Index    int
	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