store

package
v0.0.0-...-8d07dea Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNativeZeroLengthFiles

func CreateNativeZeroLengthFiles(info *metainfo.Info, dir string) (err error)

Creates natives files for any zero-length file entries in the info. This is a helper for file-based storages, which don't address or write to zero- length files because they have no corresponding pieces.

func NewFile

func NewFile(baseDir string) storage.ClientImpl

All Torrent data stored in this baseDir

func NewFileByInfoHash

func NewFileByInfoHash(baseDir string) storage.ClientImpl

File storage with data partitioned by infohash.

func NewFileWithCompletion

func NewFileWithCompletion(baseDir string, completion PieceCompletion) storage.ClientImpl

func NewFileWithCustomPathMaker

func NewFileWithCustomPathMaker(baseDir string, pathMaker func(baseDir string, info *metainfo.Info, infoHash metainfo.Hash) string) storage.ClientImpl

Allows passing a function to determine the path for storing torrent data

Types

type PieceCompletion

type PieceCompletion interface {
	PieceCompletionGetSetter
	Close() error
}

Implementations track the completion of pieces. It must be concurrent-safe.

func NewBoltPieceCompletion

func NewBoltPieceCompletion(dir string) (ret PieceCompletion, err error)

func NewMapPieceCompletion

func NewMapPieceCompletion() PieceCompletion

type PieceCompletionGetSetter

type PieceCompletionGetSetter interface {
	Get(metainfo.PieceKey) (storage.Completion, error)
	Set(_ metainfo.PieceKey, complete bool) error
}

Jump to

Keyboard shortcuts

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