torrstor

package
v0.0.0-...-78dab50 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	storage.TorrentImpl
	// contains filtered or unexported fields
}

func NewCache

func NewCache(capacity int64, storage *Storage) *Cache

func (*Cache) AdjustRA

func (c *Cache) AdjustRA(readahead int64)

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) CloseReader

func (c *Cache) CloseReader(r *Reader)

func (*Cache) GetCapacity

func (c *Cache) GetCapacity() int64

func (*Cache) GetState

func (c *Cache) GetState() *state.CacheState

func (*Cache) GetUseReaders

func (c *Cache) GetUseReaders() int

func (*Cache) Init

func (c *Cache) Init(info *metainfo.Info, hash metainfo.Hash)

func (*Cache) NewReader

func (c *Cache) NewReader(file *torrent.File) *Reader

func (*Cache) Piece

func (c *Cache) Piece(m metainfo.Piece) storage.PieceImpl

func (*Cache) Readers

func (c *Cache) Readers() int

func (*Cache) SetTorrent

func (c *Cache) SetTorrent(torr *torrent.Torrent)

type DiskPiece

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

func NewDiskPiece

func NewDiskPiece(p *Piece) *DiskPiece

func (*DiskPiece) ReadAt

func (p *DiskPiece) ReadAt(b []byte, off int64) (n int, err error)

func (*DiskPiece) Release

func (p *DiskPiece) Release()

func (*DiskPiece) WriteAt

func (p *DiskPiece) WriteAt(b []byte, off int64) (n int, err error)

type MemPiece

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

func NewMemPiece

func NewMemPiece(p *Piece) *MemPiece

func (*MemPiece) ReadAt

func (p *MemPiece) ReadAt(b []byte, off int64) (n int, err error)

func (*MemPiece) Release

func (p *MemPiece) Release()

func (*MemPiece) WriteAt

func (p *MemPiece) WriteAt(b []byte, off int64) (n int, err error)

type Piece

type Piece struct {
	storage.PieceImpl `json:"-"`

	Id   int   `json:"-"`
	Size int64 `json:"size"`

	Complete bool  `json:"complete"`
	Accessed int64 `json:"accessed"`
	// contains filtered or unexported fields
}

func NewPiece

func NewPiece(id int, cache *Cache) *Piece

func (*Piece) Completion

func (p *Piece) Completion() storage.Completion

func (*Piece) MarkComplete

func (p *Piece) MarkComplete() error

func (*Piece) MarkNotComplete

func (p *Piece) MarkNotComplete() error

func (*Piece) ReadAt

func (p *Piece) ReadAt(b []byte, off int64) (n int, err error)

func (*Piece) Release

func (p *Piece) Release()

func (*Piece) WriteAt

func (p *Piece) WriteAt(b []byte, off int64) (n int, err error)

type PieceFake

type PieceFake struct{}

func (PieceFake) Completion

func (PieceFake) Completion() storage.Completion

func (PieceFake) MarkComplete

func (PieceFake) MarkComplete() error

func (PieceFake) MarkNotComplete

func (PieceFake) MarkNotComplete() error

func (PieceFake) ReadAt

func (PieceFake) ReadAt(p []byte, off int64) (n int, err error)

func (PieceFake) WriteAt

func (PieceFake) WriteAt(p []byte, off int64) (n int, err error)

type Range

type Range struct {
	Start, End int
	File       *torrent.File
}

type Reader

type Reader struct {
	torrent.Reader
	// contains filtered or unexported fields
}

func (*Reader) Close

func (r *Reader) Close()

func (*Reader) Offset

func (r *Reader) Offset() int64

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

func (*Reader) Readahead

func (r *Reader) Readahead() int64

func (*Reader) Seek

func (r *Reader) Seek(offset int64, whence int) (n int64, err error)

func (*Reader) SetReadahead

func (r *Reader) SetReadahead(length int64)

type Storage

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

func NewStorage

func NewStorage(capacity int64) *Storage

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) CloseHash

func (s *Storage) CloseHash(hash metainfo.Hash)

func (*Storage) GetCache

func (s *Storage) GetCache(hash metainfo.Hash) *Cache

func (*Storage) OpenTorrent

func (s *Storage) OpenTorrent(info *metainfo.Info, infoHash metainfo.Hash) (ts.TorrentImpl, error)

Jump to

Keyboard shortcuts

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