Documentation
¶
Overview ¶
pile provides abstract chunk storage methods for a ChunkBuffer.
In other words, you can store chunks of a binary file using an arbitrary method. This may be in memory, on the filesystem, over the network, or any other way. As long as the client uses the the Pile interface, it can swap out the methods without worry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("pile could not locate the chunk")
Functions ¶
This section is empty.
Types ¶
type ChunkReader ¶
type ChunkReader interface { io.ReadCloser Last() bool }
ChunkReader enables reading a chunk and checking if it's the last part
type ChunkWriter ¶
type ChunkWriter interface { io.WriteCloser SetLast() error }
ChunkWriter enables writing a chunk and optionally marking it as the last part
type FilePile ¶
type FilePile struct {
// contains filtered or unexported fields
}
FilePile is an instance of a file based pile
func NewTempFilePile ¶
func NewTempFilePile() FilePile
NewTempFilePile creates a file based pile in a temporary directory
func (FilePile) ChunkReader ¶
func (fp FilePile) ChunkReader(name string, part int) (ChunkReader, error)
ChunkReader returns a file based chunk reader
func (FilePile) ChunkWriter ¶
func (fp FilePile) ChunkWriter(name string, part int) (ChunkWriter, error)
type Pile ¶
type Pile interface { ChunkReader(name string, part int) (ChunkReader, error) ChunkWriter(name string, part int) (ChunkWriter, error) }
Pile abstracts an underlying method of storing chunks