blobstore

package
v0.0.0-...-88649aa Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2012 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

This package implements a simple disk-persisted content-addressed blobstore.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadFile    = errors.New("a bad file exists in the blobstore directory. unable to create container directores.")
	ErrNoSuchKey  = errors.New("no such key")
	ErrInvalidKey = errors.New("invalid key")
)
View Source
var ErrHashMismatch = errors.New("hash mismatch")

ErrHashMismatch is returned if a blobReader has read a file whose computed hash did not match its key.

Functions

func Close

func Close() (err error)

Close the open default BlobStore. This removes the lockfile allowing other processes to open the BlobStore.

func Get

func Get(key string) (buf []byte, err error)

Lookup a blob by its key and return a buffer containing the contents of the blob.

func Open

func Open(path string) (err error)

Open an existing, or create a new BlobStore at path. Path must point to a directory, and must already exist. See NewBlobStore for more information.

func Put

func Put(buf []byte) (key string, err error)

Store a blob. If the blob was successfully stored, the returned key can be used to retrieve the buf from the BlobStore.

Types

type BlobStore

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

func NewBlobStore

func NewBlobStore(path string) (bs *BlobStore, err error)

Open an existing, or create a new BlobStore residing at path. Path must point to a directory, and must already exist.

func (*BlobStore) Close

func (bs *BlobStore) Close() (err error)

Close an open BlobStore. This removes the lockfile allowing other processes to open the BlobStore.

func (*BlobStore) Get

func (bs *BlobStore) Get(key string) (buf []byte, err error)

Lookup a blob by its key and return a buffer containing the contents of the blob.

func (*BlobStore) Put

func (bs *BlobStore) Put(buf []byte) (key string, err error)

Store a blob. If the blob was successfully stored, the returned key can be used to retrieve the buf from the BlobStore.

Jump to

Keyboard shortcuts

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