local

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2015 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package local implements repository storage in a local directory.

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongData = errors.New("wrong data returned by backend, checksum does not match")

Functions

This section is empty.

Types

type Local

type Local struct {
	// contains filtered or unexported fields
}

func Create

func Create(dir string) (*Local, error)

Create creates all the necessary files and directories for a new local backend at dir. Afterwards a new config blob should be created.

func Open

func Open(dir string) (*Local, error)

Open opens the local backend at dir.

func (*Local) Close

func (b *Local) Close() error

Close closes all open files. They may have been closed already, so we ignore all errors.

func (*Local) Create

func (b *Local) Create() (backend.Blob, error)

Create creates a new Blob. The data is available only after Finalize() has been called on the returned Blob.

func (*Local) Delete

func (b *Local) Delete() error

Delete removes the repository and all files.

func (*Local) Get

func (b *Local) Get(t backend.Type, name string) (io.ReadCloser, error)

Get returns a reader that yields the content stored under the given name. The reader should be closed after draining it.

func (*Local) GetReader

func (b *Local) GetReader(t backend.Type, name string, offset, length uint) (io.ReadCloser, error)

GetReader returns an io.ReadCloser for the Blob with the given name of type t at offset and length. If length is 0, the reader reads until EOF.

func (*Local) List

func (b *Local) List(t backend.Type, done <-chan struct{}) <-chan string

List returns a channel that yields all names of blobs of type t. A goroutine is started for this. If the channel done is closed, sending stops.

func (*Local) Location

func (b *Local) Location() string

Location returns this backend's location (the directory name).

func (*Local) Remove

func (b *Local) Remove(t backend.Type, name string) error

Remove removes the blob with the given name and type.

func (*Local) Test

func (b *Local) Test(t backend.Type, name string) (bool, error)

Test returns true if a blob of the given type and name exists in the backend.

Jump to

Keyboard shortcuts

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