file

package
v0.0.0-...-fb43f42 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File interface {
	io.ReaderAt
	io.WriterAt
	io.Closer
}

Interface for a file. Multiple goroutines may access a File at the same time.

type FileDict

type FileDict struct {
	Length int64
	Path   []string
	Md5sum string
}

type FileStore

type FileStore interface {
	io.ReaderAt
	io.Closer
	WritePiece(buffer []byte, piece int) (written int, err error)
}

A torrent file store. WritePiece should be called for full, verified pieces only;

func NewFileStore

func NewFileStore(info *InfoDict, fileSystem FileSystem) (FileStore, int64, error)

type FileSystem

type FileSystem interface {
	Open(name []string, length int64) (file File, err error)
	io.Closer
}

Interface for a file system. A file system contains files.

type FsProvider

type FsProvider interface {
	NewFS(directory string) (FileSystem, error)
}

Interface for a provider of filesystems.

type InfoDict

type InfoDict struct {
	PieceLength int64 `bencode:"piece length"`
	Pieces      string
	Private     int64
	Name        string
	// Single File Mode
	Length int64
	Md5sum string
	// Multiple File mode
	Files []FileDict
}

func (*InfoDict) ToMap

func (i *InfoDict) ToMap() (m map[string]interface{})

Copy the non-default values from an InfoDict to a map.

type OsFsProvider

type OsFsProvider struct{}

func (OsFsProvider) NewFS

func (o OsFsProvider) NewFS(directory string) (fs FileSystem, err error)

Jump to

Keyboard shortcuts

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