storage

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type ADNLProofResponse added in v0.2.0

type ADNLProofResponse struct {
	Key       []byte `json:"key"`
	Signature []byte `json:"signature"`
}

type Bag

type Bag struct {
	BagID         string `json:"bag_id"`
	Description   string `json:"description"`
	Downloaded    uint64 `json:"downloaded"`
	Size          uint64 `json:"size"`
	Peers         uint64 `json:"peers"`
	DownloadSpeed uint64 `json:"download_speed"`
	UploadSpeed   uint64 `json:"upload_speed"`
	FilesCount    uint64 `json:"files_count"`
	DirName       string `json:"dir_name"`
	Completed     bool   `json:"completed"`
	HeaderLoaded  bool   `json:"header_loaded"`
	InfoLoaded    bool   `json:"info_loaded"`
	Active        bool   `json:"active"`
	Seeding       bool   `json:"seeding"`
}

type BagDetailed

type BagDetailed struct {
	Bag
	BagPiecesNum  uint32 `json:"bag_pieces_num"`
	HasPiecesMask []byte `json:"has_pieces_mask"`
	Files         []File `json:"files"`
	Peers         []Peer `json:"peers"`

	PieceSize  uint32 `json:"piece_size"`
	BagSize    uint64 `json:"bag_size"`
	MerkleHash string `json:"merkle_hash"`
	Path       string `json:"path"`
}

type Client

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

func NewClient

func NewClient(base string, providerId []byte, credentials *Credentials) *Client

func (*Client) GetBag

func (c *Client) GetBag(ctx context.Context, bagId []byte) (*BagDetailed, error)

func (*Client) GetPieceProof

func (c *Client) GetPieceProof(ctx context.Context, bagId []byte, piece uint64) ([]byte, error)

func (*Client) ProofProvider added in v0.2.0

func (c *Client) ProofProvider(ctx context.Context) (ed25519.PublicKey, []byte, error)

func (*Client) RemoveBag

func (c *Client) RemoveBag(ctx context.Context, bagId []byte, withFiles bool) error

func (*Client) StartDownload

func (c *Client) StartDownload(ctx context.Context, bagId []byte, downloadAll bool) error

type Created

type Created struct {
	BagID string `json:"bag_id"`
}

type Credentials

type Credentials struct {
	Login    string
	Password string
}

type File

type File struct {
	Index uint32 `json:"index"`
	Name  string `json:"name"`
	Size  uint64 `json:"size"`
}

type List

type List struct {
	Bags []Bag `json:"bags"`
}

type Peer

type Peer struct {
	Addr          string `json:"addr"`
	ID            string `json:"id"`
	UploadSpeed   uint64 `json:"upload_speed"`
	DownloadSpeed uint64 `json:"download_speed"`
}

type ProofResponse

type ProofResponse struct {
	Proof []byte `json:"proof"`
}

type Result

type Result struct {
	Ok    bool   `json:"ok"`
	Error string `json:"error"`
}

Jump to

Keyboard shortcuts

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