driver

package
v0.0.0-...-b75375f Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2014 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package driver includes the interfaces required to implement a blobstore driver.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMetadataNotHandled = errors.New("this driver does not handle metadata")
)

Functions

func Register

func Register(name string, o Opener)

Types

type Driver

type Driver interface {
	Create(id string) (WFile, error)
	Open(id string) (RFile, error)
	Remove(id string) error
	Close() error
}

type Iter

type Iter interface {
	Next(id *string) bool
	Err() error
	Close() error
}

Iter is the same interface as gnd.la/blobstore.Iter. See its documentation.

type Iterable

type Iterable interface {
	Iter() (Iter, error)
}

Iterable is the interface implemented by drivers which can iterate over the files stored in them.

type Opener

type Opener func(url *config.URL) (Driver, error)

func Get

func Get(name string) Opener

type RFile

type RFile interface {
	io.ReadSeeker
	io.Closer
	Metadata() ([]byte, error)
}

type Range

type Range interface {
	IsValid() bool
	Range() (*int64, *int64)
	Set(w http.ResponseWriter, total uint64)
	StatusCode() int
	String() string
}

type Server

type Server interface {
	// Serve serves the file directly from the driver to the given
	// http.ResponseWriter. If this function returns (false, nil)
	// the blobstore will request the file to the driver and serve
	// it by copying its contents to w. Any non nil error return
	// will cause the blobstore to return an error to the caller.
	Serve(w http.ResponseWriter, id string, rng Range) (bool, error)
}

type WFile

type WFile interface {
	io.WriteCloser
	SetMetadata([]byte) error
}

Directories

Path Synopsis
Package file implements the file driver for the blobstore.
Package file implements the file driver for the blobstore.
Package gcs provides a Google Cloud Storage driver for the Blobstore.
Package gcs provides a Google Cloud Storage driver for the Blobstore.
Package gridfs implements a GridFS driver for the blobstore.
Package gridfs implements a GridFS driver for the blobstore.
Package leveldb implements the levelb driver for the blobstore.
Package leveldb implements the levelb driver for the blobstore.
Package s3 implements an s3 driver for the blobstore.
Package s3 implements an s3 driver for the blobstore.

Jump to

Keyboard shortcuts

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