db

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Key           ed25519.PrivateKey
	ListenAddr    string
	ExternalIP    string
	DownloadsPath string
}

type Event added in v0.4.0

type Event int
const (
	EventTorrentUpdated Event = iota
	EventUploadUpdated
)

type Node

type Node struct {
	Id       string
	Children []*Node
}

type OsFs added in v0.2.0

type OsFs struct{}

func (*OsFs) Delete added in v0.6.0

func (o *OsFs) Delete(name string) error

func (*OsFs) Exists added in v0.2.0

func (o *OsFs) Exists(name string) bool

func (*OsFs) Open added in v0.2.0

func (o *OsFs) Open(name string, mode storage.OpenMode) (storage.FSFile, error)

type Storage

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

func NewStorage

func NewStorage(db *leveldb.DB, connector storage.NetConnector, startWithoutActiveFilesToo bool, notifier chan Event) (*Storage, error)

func (*Storage) DetectFileRefs added in v0.2.0

func (s *Storage) DetectFileRefs(path string) (rootPath string, dirName string, _ []storage.FileRef, _ error)

func (*Storage) GetActiveFiles

func (s *Storage) GetActiveFiles(bagId []byte) ([]uint32, error)

func (*Storage) GetAll

func (s *Storage) GetAll() []*storage.Torrent

func (*Storage) GetAllFilesRefsInDir added in v0.2.0

func (s *Storage) GetAllFilesRefsInDir(path string) ([]storage.FileRef, error)

func (*Storage) GetFS added in v0.2.0

func (s *Storage) GetFS() storage.FS

func (*Storage) GetPiece

func (s *Storage) GetPiece(bagId []byte, id uint32) (*storage.PieceInfo, error)

func (*Storage) GetSingleFileRef added in v0.2.0

func (s *Storage) GetSingleFileRef(path string) (storage.FileRef, error)

func (*Storage) GetSpeedLimits

func (s *Storage) GetSpeedLimits() (download uint64, upload uint64, err error)

func (*Storage) GetTorrent

func (s *Storage) GetTorrent(hash []byte) *storage.Torrent

func (*Storage) GetTorrentByOverlay

func (s *Storage) GetTorrentByOverlay(overlay []byte) *storage.Torrent

func (*Storage) PiecesMask

func (s *Storage) PiecesMask(bagId []byte, num uint32) []byte

func (*Storage) RemovePiece

func (s *Storage) RemovePiece(bagId []byte, id uint32) error

func (*Storage) RemoveTorrent

func (s *Storage) RemoveTorrent(t *storage.Torrent, withFiles bool) error

func (*Storage) SetActiveFiles

func (s *Storage) SetActiveFiles(bagId []byte, ids []uint32) error

func (*Storage) SetPiece

func (s *Storage) SetPiece(bagId []byte, id uint32, p *storage.PieceInfo) error

func (*Storage) SetSpeedLimits

func (s *Storage) SetSpeedLimits(download, upload uint64) error

func (*Storage) SetTorrent

func (s *Storage) SetTorrent(t *storage.Torrent) error

func (*Storage) UpdateUploadStats added in v0.3.0

func (s *Storage) UpdateUploadStats(bagId []byte, val uint64) error

type TorrentStored

type TorrentStored struct {
	BagID     []byte
	Path      string
	Info      *storage.TorrentInfo
	Header    *storage.TorrentHeader
	CreatedAt time.Time

	ActiveUpload    bool
	ActiveDownload  bool
	DownloadAll     bool
	DownloadOrdered bool
}

Jump to

Keyboard shortcuts

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