backend

package
v1.0.62 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProgressBarLen = 10
	ScaleBarLen    = 10
)
View Source
const (
	TORRENT = "torrent"

	SEED_PRE = "s-"
)

Variables

View Source
var (
	// ErrInactiveTorrent is for torrent should be actived
	ErrInactiveTorrent = errors.New("torrent is inactive")

	//ErrUnfinished is for the file not downloaded
	ErrUnfinished = errors.New("download not completed")

	ErrTorrentNotFound = errors.New("torrent not found")

	ErrInvalidRawSize = errors.New("invalid raw size")
)

Functions

func GetMessage

func GetMessage(idx int64, units *progress.Units) string

func Hash

func Hash(path string) (ret string, err error)

func IsDirectory

func IsDirectory(path string) (bool, error)

func ProgressBar

func ProgressBar(x, y int64, desc string) string

func ScaleBar

func ScaleBar(from, to, sum int) string

Types

type TorrentManager

type TorrentManager struct {

	//boostFetcher        *BoostDataFetcher
	DataDir    string
	TmpDataDir string

	Updates time.Duration
	// contains filtered or unexported fields
}

func NewTorrentManager

func NewTorrentManager(config *params.Config, fsid uint64, cache, compress bool) (*TorrentManager, error)

func (*TorrentManager) AddLocalSeedFile

func (tm *TorrentManager) AddLocalSeedFile(ih string) bool

can only call by fs.go: 'SeedingLocal()'

func (*TorrentManager) Candidate

func (tm *TorrentManager) Candidate() int

func (*TorrentManager) Close

func (tm *TorrentManager) Close() error

func (*TorrentManager) Congress

func (tm *TorrentManager) Congress() int

func (*TorrentManager) Dropping added in v1.0.55

func (tm *TorrentManager) Dropping(ih string) error

func (*TorrentManager) ExistsOrActive added in v1.0.55

func (tm *TorrentManager) ExistsOrActive(ctx context.Context, ih string, rawSize uint64) (bool, uint64, mclock.AbsTime, error)

func (*TorrentManager) GetFile

func (tm *TorrentManager) GetFile(ctx context.Context, infohash, subpath string) (data []byte, mu *event.TypeMux, err error)

func (*TorrentManager) IsDownloading

func (tm *TorrentManager) IsDownloading(ih string) bool

func (*TorrentManager) IsPending

func (tm *TorrentManager) IsPending(ih string) bool

func (*TorrentManager) IsSeeding

func (tm *TorrentManager) IsSeeding(ih string) bool

func (*TorrentManager) ListAllTorrents

func (tm *TorrentManager) ListAllTorrents() map[string]map[string]int

divide localSeed/on-chain Files return status of torrents

func (*TorrentManager) LocalPort

func (tm *TorrentManager) LocalPort() int

func (*TorrentManager) Metrics

func (tm *TorrentManager) Metrics() time.Duration

func (*TorrentManager) Nominee

func (tm *TorrentManager) Nominee() int

func (*TorrentManager) PauseLocalSeedFile

func (tm *TorrentManager) PauseLocalSeedFile(ih string) error

only files in map:localSeedFile can be paused!

func (*TorrentManager) Pending added in v1.0.55

func (tm *TorrentManager) Pending(t *caffe.Torrent) error

func (*TorrentManager) ResumeLocalSeedFile

func (tm *TorrentManager) ResumeLocalSeedFile(ih string) error

only files in map:localSeedFile can be resumed!

func (*TorrentManager) Running added in v1.0.55

func (tm *TorrentManager) Running(t *caffe.Torrent) error

func (*TorrentManager) Search

func (tm *TorrentManager) Search(ctx context.Context, hex string, request uint64) error

Search and donwload files from torrent

func (*TorrentManager) Seeding added in v1.0.55

func (tm *TorrentManager) Seeding(t *caffe.Torrent) error

func (*TorrentManager) Start

func (tm *TorrentManager) Start() (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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