storage

package
v0.0.0-...-57e5bf5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2016 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MMapTorrent

func MMapTorrent(md *metainfo.Info, location string) (mms mmap_span.MMapSpan, err error)

Types

type Client

type Client interface {
	OpenTorrent(info *metainfo.InfoEx) (Torrent, error)
}

Represents data storage for an unspecified torrent.

func NewFile

func NewFile(baseDir string) Client

func NewFileStorePieces

func NewFileStorePieces(fs missinggo.FileStore) Client

func NewMMap

func NewMMap(baseDir string) Client

func NewResourcePieces

func NewResourcePieces(p resource.Provider) Client

type Piece

type Piece interface {
	// Should return io.EOF only at end of torrent. Short reads due to missing
	// data should return io.ErrUnexpectedEOF.
	io.ReaderAt
	io.WriterAt
	// Called when the client believes the piece data will pass a hash check.
	// The storage can move or mark the piece data as read-only as it sees
	// fit.
	MarkComplete() error
	// Returns true if the piece is complete.
	GetIsComplete() bool
}

Interacts with torrent piece data.

type Torrent

type Torrent interface {
	Piece(metainfo.Piece) Piece
	Close() error
}

Data storage bound to a torrent.

Jump to

Keyboard shortcuts

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