blobstore

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Del

func Del(c context.Context, path string) error

Del removes an object from the blobstore.

func Get

func Get(c context.Context, path string) ([]byte, error)

Get retrieves an object from the blobstore.

func GetReader

func GetReader(c context.Context, path string) (io.ReadCloser, error)

GetReader retrieves an object from the blobstore. It is the caller's responsibility to call Close on the ReadCloser when finished reading.

func NewContext

func NewContext(parent context.Context, store Blobstore) context.Context

NewContext returns a Context whose Value method returns the application's Blobstore data.

func Put

func Put(c context.Context, path string, data []byte) error

Put inserts an object into the blobstore.

func PutReader

func PutReader(c context.Context, path string, r io.Reader) error

PutReader inserts an object into the blobstore by consuming data from r until EOF.

Types

type Blobstore

type Blobstore interface {
	// Del removes an object from the blobstore.
	Del(path string) error

	// Get retrieves an object from the blobstore.
	Get(path string) ([]byte, error)

	// GetReader retrieves an object from the blobstore.
	// It is the caller's responsibility to call Close on
	// the ReadCloser when finished reading.
	GetReader(path string) (io.ReadCloser, error)

	// Put inserts an object into the blobstore.
	Put(path string, data []byte) error

	// PutReader inserts an object into the blobstore by
	// consuming data from r until EOF.
	PutReader(path string, r io.Reader) error
}

func FromContext

func FromContext(c context.Context) Blobstore

FromContext returns the Blobstore associated with this context.

Jump to

Keyboard shortcuts

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