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) AddActGrantees(ctx context.Context, f *File, o api.UploadOptions) (err error)
- func (c *Client) Addresses(ctx context.Context) (resp Addresses, err 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, label string, verbose bool) (string, error)
- func (c *Client) CreateTag(ctx context.Context) (resp api.TagResponse, err error)
- func (c *Client) DepositStake(ctx context.Context, amount *big.Int) (string, error)
- func (c *Client) DilutePostageBatch(ctx context.Context, batchID string, depth uint64, gasPrice string) error
- func (c *Client) DownloadActFile(ctx context.Context, a swarm.Address, opts *api.DownloadOptions) (size int64, hash []byte, err error)
- func (c *Client) DownloadBytes(ctx context.Context, a swarm.Address, opts *api.DownloadOptions) (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, opts *api.DownloadOptions) (size int64, hash []byte, err error)
- func (c *Client) DownloadFileBytes(ctx context.Context, a swarm.Address, opts *api.DownloadOptions) (data []byte, err error)
- func (c *Client) DownloadManifestFile(ctx context.Context, a swarm.Address, path string) (size int64, hash []byte, err error)
- func (c *Client) GetActGrantees(ctx context.Context, a swarm.Address) (addresses []string, err error)
- func (c *Client) GetOrCreateBatch(ctx context.Context, amount int64, depth uint64, 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) GetStake(ctx context.Context) (*big.Int, error)
- func (c *Client) GetTag(ctx context.Context, tagUID uint64) (resp api.TagResponse, err error)
- func (c *Client) GetWithdrawableStake(ctx context.Context) (*big.Int, 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) MigrateStake(ctx context.Context) (string, error)
- func (c *Client) Overlay(ctx context.Context) (o swarm.Address, err error)
- func (c *Client) PatchActGrantees(ctx context.Context, pf *File, addr swarm.Address, haddr 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) ([]api.PostageStampResponse, error)
- func (c *Client) PostageStamp(ctx context.Context, batchID string) (api.PostageStampResponse, error)
- func (c *Client) ReserveState(ctx context.Context) (api.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) UploadActFile(ctx context.Context, f *File, o api.UploadOptions) (err 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 uint64) error
- func (c *Client) WalletBalance(ctx context.Context, token string) (*big.Int, error)
- func (c *Client) Withdraw(ctx context.Context, token, addr string, amount int64) 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) HistroryAddress() swarm.Address
- func (f *File) Name() string
- func (f *File) SetAddress(a swarm.Address)
- func (f *File) SetHash(h []byte)
- func (f *File) SetHistroryAddress(a swarm.Address)
- 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 []api.PeerInfo `json:"disconnectedPeers"` ConnectedPeers []api.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, log 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) AddActGrantees ¶ added in v0.17.3
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, label string, verbose bool) (string, error)
CreatePostageBatch returns the batchID of a batch of postage stamps
func (*Client) DepositStake ¶ added in v0.11.11
DepositStake deposits stake
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) DownloadActFile ¶ added in v0.17.3
func (*Client) DownloadBytes ¶ added in v0.4.0
func (c *Client) DownloadBytes(ctx context.Context, a swarm.Address, opts *api.DownloadOptions) (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, opts *api.DownloadOptions) (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, opts *api.DownloadOptions) (size int64, hash []byte, err error)
DownloadFile downloads chunk from the node and returns it's size and hash.
func (*Client) DownloadFileBytes ¶ added in v0.14.3
func (c *Client) DownloadFileBytes(ctx context.Context, a swarm.Address, opts *api.DownloadOptions) (data []byte, err error)
DownloadFileBytes downloads a flie from the node and returns the data.
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) GetActGrantees ¶ added in v0.17.3
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) GetWithdrawableStake ¶ added in v0.17.5
GetWithdrawableStake returns withdrawable amount
func (*Client) IsRetrievable ¶ added in v0.8.3
IsRetrievable checks whether the content on the given address is retrievable.
func (*Client) MigrateStake ¶ added in v0.17.1
MigrateStake withdraws stake
func (*Client) PatchActGrantees ¶ added in v0.17.3
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) (api.PostageStampResponse, error)
PostageStamp returns the batch by ID
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) UploadActFile ¶ added in v0.17.3
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
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) WalletBalance ¶ added in v0.15.7
WalletBalance fetches the balance for the given token
type ClientOptions ¶ added in v0.4.0
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) HistroryAddress ¶ added in v0.17.3
func (*File) SetAddress ¶ added in v0.8.5
func (*File) SetHistroryAddress ¶ added in v0.17.3
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