storage

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 3 Imported by: 0

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