bee

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func AddressOfChunk added in v0.8.3

func AddressOfChunk(chunks ...swarm.Chunk) []swarm.Address

AddressOfChunk returns address(es) of the given chunk(s).

func EstimatePostageBatchDepth added in v0.5.6

func EstimatePostageBatchDepth(contentLength int64) uint64

func GenerateNRandomChunksAt added in v0.8.3

func GenerateNRandomChunksAt(rnd *rand.Rand, target swarm.Address, n int, po uint8) []swarm.Chunk

GenerateNRandomChunksAt returns n randomly generated chunks for target address.

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.

func NewRandSwarmChunk added in v0.8.4

func NewRandSwarmChunk(rnd *rand.Rand) swarm.Chunk

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 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 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) Authenticate added in v0.8.6

func (c *Client) Authenticate(ctx context.Context, role, password string) (string, error)

Authenticate

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, gasPrice, label string, verbose bool) (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) DilutePostageBatch added in v0.8.4

func (c *Client) DilutePostageBatch(ctx context.Context, batchID string, depth uint64, gasPrice string) error

DilutePostageBatch dilutes the given batch by increasing the depth

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, amount int64, depth uint64, gasPrice, label string) (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) HasChunks added in v0.7.12

func (c *Client) HasChunks(ctx context.Context, a []swarm.Address) (has []bool, count int, err error)

func (*Client) IsRetrievable added in v0.8.3

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

IsRetrievable checks whether the content on the given address is retrievable.

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) PostageBatch added in v0.8.4

func (c *Client) PostageBatch(ctx context.Context, batchID string) (debugapi.PostageStampResponse, error)

PostageBatch returns the batch by ID

func (*Client) PostageBatches added in v0.6.5

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

PostageBatches returns the list of batches of node

func (*Client) Refresh added in v0.8.6

func (c *Client) Refresh(ctx context.Context, securityToken string) (string, error)

Refresh

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) Reupload added in v0.8.3

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

Reupload re-uploads root hash and all of its underlying associated chunks to the network.

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) TopUpPostageBatch added in v0.8.4

func (c *Client) TopUpPostageBatch(ctx context.Context, batchID string, amount int64, gasPrice string) error

TopupPostageBatch tops up the given batch with the amount per chunk

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
	Restricted          bool
}

ClientOptions holds optional parameters for the Client.

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) SetAddress added in v0.8.5

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

func (*File) SetHash added in v0.8.5

func (f *File) SetHash(h []byte)

func (*File) Size added in v0.2.11

func (f *File) Size() int64

Size returns file size

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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