pile

package
v0.0.0-...-05e8eff Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2015 License: MIT Imports: 9 Imported by: 1

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

View Source
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

func NewS3Pile

func NewS3Pile(config *aws.Config, bucket string) Pile

NewS3Pile from an AWS config and bucket name

Jump to

Keyboard shortcuts

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