beeclient

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2020 Ethersphere. Copyright 2022 Beezim Authors. All rights reserved. Use of this source code is originally governed by BSD 3-Clause and our modifications by GPLv3 license that can be found in the LICENSE file.

This code is based on the beekeeper beeclient api. The http client was split to its own package. The bee api and debug api were modified and simplified to fit the purposes of Beezim.

Index

Constants

View Source
const MinimumBatchDepth = 11

Variables

This section is empty.

Functions

func CalculateNumberOfChunks

func CalculateNumberOfChunks(contentLength int64, isEncrypted bool) int64

CalculateNumberOfChunks calculates the number of chunks in an arbitrary content length.

func EstimatePostageBatchDepth

func EstimatePostageBatchDepth(contentLength int64, isEncrypted bool) (uint64, int64)

Types

type BeeClient

type BeeClient struct {
	// contains filtered or unexported fields
}

func NewBee

func NewBee(opts ClientOptions) (c *BeeClient, err error)

func (*BeeClient) Addresses

func (c *BeeClient) Addresses(ctx context.Context) (debugapi.Addresses, error)

func (*BeeClient) CreatePostageBatch

func (c *BeeClient) CreatePostageBatch(ctx context.Context, amount int64, depth uint64, label string, o debugapi.PostageOptions) (string, error)

CreatePostageBatch returns the batchID of a batch of postage stamps

func (*BeeClient) DownloadBytes

func (c *BeeClient) DownloadBytes(ctx context.Context, addr swarm.Address) (io.ReadCloser, error)

func (*BeeClient) DownloadChunk

func (c *BeeClient) DownloadChunk(ctx context.Context, addr swarm.Address, targets ...string) (io.ReadCloser, error)

func (*BeeClient) DownloadManifestBytes

func (c *BeeClient) DownloadManifestBytes(ctx context.Context, addr swarm.Address, path string) ([]byte, error)

func (*BeeClient) DownloadManifestFile

func (c *BeeClient) DownloadManifestFile(ctx context.Context, addr 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 (*BeeClient) PostageBatches

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

PostageBatches returns the list of batches of node

func (*BeeClient) UploadBytes

func (c *BeeClient) UploadBytes(ctx context.Context, data io.Reader, o api.UploadOptions) (swarm.Address, error)

func (*BeeClient) UploadChunk

func (c *BeeClient) UploadChunk(ctx context.Context, data []byte, o api.UploadOptions) (swarm.Address, error)

func (*BeeClient) UploadCollection

func (c *BeeClient) UploadCollection(ctx context.Context, f *tarball.File, o api.UploadCollectionOptions) (err error)

UploadCollection uploads TAR collection bytes to the node

type ClientOptions

type ClientOptions struct {
	APIURL              *url.URL
	APIInsecureTLS      bool
	DebugAPIURL         *url.URL
	DebugAPIInsecureTLS bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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