memcache

package
v0.0.0-...-22766dc Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStorage

func NewStorage(capacity int64) storage.Storage

Types

type BufferPool

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

func NewBufferPool

func NewBufferPool(bufferLength int64) *BufferPool

func (*BufferPool) GetBuffer

func (b *BufferPool) GetBuffer(p *Piece) (buff []byte, index int)

func (*BufferPool) Len

func (b *BufferPool) Len() int

func (*BufferPool) ReleaseBuffer

func (b *BufferPool) ReleaseBuffer(index int)

func (*BufferPool) Used

func (b *BufferPool) Used() map[int]struct{}

type Cache

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

func NewCache

func NewCache(capacity int64) *Cache

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) GetState

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

func (*Cache) Init

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

func (*Cache) Piece

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

type Piece

type Piece struct {
	storage.PieceImpl

	Id     int
	Hash   string
	Length int64
	Size   int64
	// contains filtered or unexported fields
}

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) Stat

func (p *Piece) Stat() state.ItemState

func (*Piece) WriteAt

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

type Storage

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

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) CloseHash

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

func (*Storage) GetStats

func (s *Storage) GetStats(hash metainfo.Hash) *state.CacheState

func (*Storage) OpenTorrent

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

Jump to

Keyboard shortcuts

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