fetcher

package
v0.0.0-...-e836074 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

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

func New

func New(maxConcurrentConnections int, allowInsecureTavern bool) *Fetcher

func (*Fetcher) Fetch

func (fetcher *Fetcher) Fetch(path string, tracker *trackerv1.Tracker) error

Fetch downloads a file to the given destination.

func (*Fetcher) ListPeers

func (fetcher *Fetcher) ListPeers(hash []byte, addr string) ([]Peer, error)

ListPeers contacts a tracker looking for a given hash.

func (*Fetcher) Resolve

func (fetcher *Fetcher) Resolve(tracker *trackerv1.Tracker) ([]Peer, error)

Resolve fetches a list of serving peer from the tracker.

type Peer

type Peer struct {
	Address  string
	Hash     []byte
	Chunkset *bitset.BitSet
	Client   seederv1connect.SeederServiceClient
}

func (*Peer) HasChunks

func (peer *Peer) HasChunks(hash []byte) (*bitset.BitSet, error)

HasChunks fetches the set of chunks served by the peer.

func (*Peer) Refresh

func (peer *Peer) Refresh()

type Task

type Task struct {
	Fetched     chan int64
	Tracker     *trackerv1.Tracker
	Peers       []Peer
	Peer        int
	Hash        []byte
	ChunkHash   []byte
	Chunk       int64
	Destination string
}

func (Task) Fetch

func (task Task) Fetch() (int64, error)

Jump to

Keyboard shortcuts

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