Documentation ¶
Index ¶
- Constants
- func AddressOfChunk(chunks ...swarm.Chunk) []swarm.Address
- func EstimatePostageBatchDepth(contentLength int64) uint64
- func GenerateNRandomChunksAt(rnd *rand.Rand, target swarm.Address, n int, po uint8) []swarm.Chunk
- func GenerateRandomChunkAt(rnd *rand.Rand, target swarm.Address, po uint8) swarm.Chunk
- func NewRandSwarmChunk(rnd *rand.Rand) swarm.Chunk
- type Account
- type Accounting
- type Addresses
- type Balance
- type Balances
- type Bin
- type CashoutStatusResponse
- type CashoutStatusResult
- type Cheque
- type ChequebookBalanceResponse
- type Chunk
- func (c *Chunk) Address() swarm.Address
- func (c *Chunk) ClosestNode(nodes []swarm.Address) (closest swarm.Address, err error)
- func (c *Chunk) ClosestNodeFromMap(nodes map[string]swarm.Address, skipNodes ...swarm.Address) (closestName string, closestAddress swarm.Address, err error)
- func (c *Chunk) Data() []byte
- func (c *Chunk) SetAddress() error
- func (c *Chunk) Size() int
- func (c *Chunk) Span() int
- type Client
- func (c *Client) Accounting(ctx context.Context) (resp Accounting, err error)
- func (c *Client) Addresses(ctx context.Context) (resp Addresses, err error)
- func (c *Client) Authenticate(ctx context.Context, role, password string) (string, error)
- func (c *Client) Balance(ctx context.Context, a swarm.Address) (resp Balance, err error)
- func (c *Client) Balances(ctx context.Context) (resp Balances, err error)
- func (c *Client) Cashout(ctx context.Context, a swarm.Address) (resp string, err error)
- func (c *Client) CashoutStatus(ctx context.Context, a swarm.Address) (resp CashoutStatusResponse, err error)
- func (c *Client) ChequebookBalance(ctx context.Context) (resp ChequebookBalanceResponse, err error)
- func (c *Client) Config() ClientOptions
- func (c *Client) CreatePostageBatch(ctx context.Context, amount int64, depth uint64, gasPrice, label string, ...) (string, error)
- func (c *Client) CreateTag(ctx context.Context) (resp api.TagResponse, err error)
- func (c *Client) DilutePostageBatch(ctx context.Context, batchID string, depth uint64, gasPrice string) error
- func (c *Client) DownloadBytes(ctx context.Context, a swarm.Address) (data []byte, err error)
- func (c *Client) DownloadChunk(ctx context.Context, a swarm.Address, targets string) (data []byte, err error)
- func (c *Client) DownloadFile(ctx context.Context, a swarm.Address) (size int64, hash []byte, err error)
- func (c *Client) DownloadManifestFile(ctx context.Context, a swarm.Address, path string) (size int64, hash []byte, err error)
- func (c *Client) GetOrCreateBatch(ctx context.Context, amount int64, depth uint64, gasPrice, label string) (string, error)
- func (c *Client) GetPinnedRootHash(ctx context.Context, ref swarm.Address) (swarm.Address, error)
- func (c *Client) GetPins(ctx context.Context) ([]swarm.Address, error)
- func (c *Client) GetTag(ctx context.Context, tagUID uint32) (resp api.TagResponse, err error)
- func (c *Client) HasChunk(ctx context.Context, a swarm.Address) (bool, error)
- func (c *Client) HasChunks(ctx context.Context, a []swarm.Address) (has []bool, count int, err error)
- func (c *Client) IsRetrievable(ctx context.Context, ref swarm.Address) (bool, error)
- func (c *Client) Overlay(ctx context.Context) (o swarm.Address, err error)
- func (c *Client) Peers(ctx context.Context) (peers []swarm.Address, err error)
- func (c *Client) PinRootHash(ctx context.Context, ref swarm.Address) error
- func (c *Client) Ping(ctx context.Context, node swarm.Address) (rtt string, err error)
- func (c *Client) PingStream(ctx context.Context, nodes []swarm.Address) <-chan PingStreamMsg
- func (c *Client) PostageBatches(ctx context.Context) ([]debugapi.PostageStampResponse, error)
- func (c *Client) PostageStamp(ctx context.Context, batchID string) (debugapi.PostageStampResponse, error)
- func (c *Client) Refresh(ctx context.Context, securityToken string) (string, error)
- func (c *Client) RemoveChunk(ctx context.Context, a swarm.Address) error
- func (c *Client) ReserveState(ctx context.Context) (debugapi.ReserveState, error)
- func (c *Client) Reupload(ctx context.Context, ref swarm.Address) error
- func (c *Client) SendPSSMessage(ctx context.Context, nodeAddress swarm.Address, publicKey string, topic string, ...) error
- func (c *Client) Settlement(ctx context.Context, a swarm.Address) (resp Settlement, err error)
- func (c *Client) Settlements(ctx context.Context) (resp Settlements, err error)
- func (c *Client) TopUpPostageBatch(ctx context.Context, batchID string, amount int64, gasPrice string) error
- func (c *Client) Topology(ctx context.Context) (topology Topology, err error)
- func (c *Client) Underlay(ctx context.Context) ([]string, error)
- func (c *Client) UnpinRootHash(ctx context.Context, ref swarm.Address) error
- func (c *Client) UploadBytes(ctx context.Context, b []byte, o api.UploadOptions) (swarm.Address, error)
- func (c *Client) UploadChunk(ctx context.Context, data []byte, o api.UploadOptions) (swarm.Address, error)
- func (c *Client) UploadCollection(ctx context.Context, f *File, o api.UploadOptions) (err error)
- func (c *Client) UploadFile(ctx context.Context, f *File, o api.UploadOptions) (err error)
- func (c *Client) UploadSOC(ctx context.Context, owner, ID, signature string, data []byte, batchID string) (swarm.Address, error)
- func (c *Client) WaitSync(ctx context.Context, UId uint32) error
- type ClientOptions
- type File
- func (f *File) Address() swarm.Address
- func (f *File) CalculateHash() error
- func (f *File) ClosestNode(nodes []swarm.Address) (closest swarm.Address, err error)
- func (f *File) DataReader() io.Reader
- func (f *File) Hash() []byte
- func (f *File) Name() string
- func (f *File) SetAddress(a swarm.Address)
- func (f *File) SetHash(h []byte)
- func (f *File) Size() int64
- type PingStreamMsg
- type Settlement
- type Settlements
- type Topology
Constants ¶
const (
// MaxChunkSize represents max chunk size in bytes
MaxChunkSize = 4096
)
const MinimumBatchDepth = 2
Variables ¶
This section is empty.
Functions ¶
func AddressOfChunk ¶ added in v0.8.3
AddressOfChunk returns address(es) of the given chunk(s).
func EstimatePostageBatchDepth ¶ added in v0.5.6
func GenerateNRandomChunksAt ¶ added in v0.8.3
GenerateNRandomChunksAt returns n randomly generated chunks for target address.
func GenerateRandomChunkAt ¶ added in v0.5.6
GenerateRandomChunkAt generates a chunk with address of proximity order po wrt target.
Types ¶
type Account ¶ added in v0.11.4
type Account struct { Balance int64 ConsumedBalance int64 GhostBalance int64 Peer string ReservedBalance int64 ShadowReservedBalance int64 SurplusBalance int64 ThresholdGiven int64 ThresholdReceived int64 CurrentThresholdGiven int64 CurrentThresholdReceived int64 }
Account represents node's account with a given peer
type Accounting ¶ added in v0.11.4
type Accounting struct {
Accounting []Account
}
Accounting represents node's accounts with all peers
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 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 { Population int `json:"population"` Connected int `json:"connected"` DisconnectedPeers []debugapi.PeerInfo `json:"disconnectedPeers"` ConnectedPeers []debugapi.PeerInfo `json:"connectedPeers"` }
Bin represents Kademlia bin
type CashoutStatusResponse ¶ added in v0.5.6
type CashoutStatusResult ¶ added in v0.5.6
type ChequebookBalanceResponse ¶ added in v0.5.6
type Chunk ¶
type Chunk struct {
// contains filtered or unexported fields
}
Chunk represents Bee chunk
func NewRandomChunk ¶
NewRandomChunk returns new pseudorandom chunk
func (*Chunk) ClosestNode ¶
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) SetAddress ¶ added in v0.2.17
SetAddress calculates the address of a chunk and assign's it to address field
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, logger logging.Logger) (c *Client)
NewClient returns Bee client
func (*Client) Accounting ¶ added in v0.11.4
func (c *Client) Accounting(ctx context.Context) (resp Accounting, err error)
Accounting returns node's accounts with all peers
func (*Client) Authenticate ¶ added in v0.8.6
Authenticate
func (*Client) CashoutStatus ¶ added in v0.5.6
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) 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
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 (*Client) GetPinnedRootHash ¶ added in v0.6.6
GetPinnedRootHash determines if the root hash of given reference is pinned by returning its reference.
func (*Client) IsRetrievable ¶ added in v0.8.3
IsRetrievable checks whether the content on the given address is retrievable.
func (*Client) PinRootHash ¶ added in v0.6.6
PinRootHash pins root hash of given reference.
func (*Client) PingStream ¶ added in v0.4.0
PingStream returns stream of ping results for given nodes
func (*Client) PostageBatches ¶ added in v0.6.5
PostageBatches returns the list of batches of node
func (*Client) PostageStamp ¶ added in v0.11.3
func (c *Client) PostageStamp(ctx context.Context, batchID string) (debugapi.PostageStampResponse, error)
PostageStamp returns the batch by ID
func (*Client) RemoveChunk ¶ added in v0.4.0
RemoveChunk removes chunk from the node
func (*Client) ReserveState ¶ added in v0.5.6
ReserveState returns reserve radius, available capacity, inner and outer radiuses
func (*Client) Reupload ¶ added in v0.8.3
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
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) UnpinRootHash ¶ added in v0.6.6
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
UploadCollection uploads TAR collection bytes to the node
func (*Client) UploadFile ¶ added in v0.4.0
UploadFile uploads file 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
NewBufferFile returns new file with specified buffer
func NewRandomFile ¶ added in v0.2.11
NewRandomFile returns new pseudorandom file
func (*File) CalculateHash ¶ added in v0.2.18
CalculateHash calculates hash from dataReader. It replaces dataReader with another that will contain the data.
func (*File) ClosestNode ¶ added in v0.2.11
ClosestNode returns file's closest node of a given set of nodes
func (*File) DataReader ¶ added in v0.2.12
DataReader returns file's data reader
func (*File) SetAddress ¶ added in v0.8.5
type PingStreamMsg ¶ added in v0.2.4
PingStreamMsg represents message sent over the PingStream channel
type Settlement ¶ added in v0.3.0
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 Reachability string `json:"reachability"` // current reachability status NetworkAvailability string `json:"networkAvailability"` // network availability }
Topology represents Kademlia topology