storage

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Storage returns a read source and optionally a write source.
	// Generally, the write location, if present, should also be a read
	// location.
	Storage() (Storage, WritableStorage)
}

Backend is an encapsulation of a set of read-only and read-write interfaces for reading and writing objects.

type Storage

type Storage interface {
	// Open returns a handle on an existing object keyed by the given object
	// ID.  It returns an error if that file does not already exist.
	Open(oid []byte) (f io.ReadCloser, err error)

	// Close closes the filesystem, after which no more operations are
	// allowed.
	Close() error

	// Compressed indicates whether data read from this storage source will
	// be zlib-compressed.
	IsCompressed() bool
}

Storage implements an interface for reading, but not writing, objects in an object database.

func MultiStorage

func MultiStorage(args ...Storage) Storage

type WritableStorage

type WritableStorage interface {
	Storage

	// Store copies the data given in "r" to the unique object path given by
	// "oid". It returns an error if that file already exists (acting as if
	// the `os.O_EXCL` mode is given in a bitmask to os.Open).
	Store(oid []byte, r io.Reader) (n int64, err error)
}

WritableStorage implements an interface for reading and writing objects in an object database.

Jump to

Keyboard shortcuts

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