bee

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: BSD-3-Clause Imports: 10 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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) 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) 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

Jump to

Keyboard shortcuts

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