Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Storage ¶
type Storage interface {
io.Closer
// ReadObjectAt returns a Reader for reading the object at the requested name
// and offset, along with the total size of the object.
ReadObjectAt(basename string, offset int64) (_ io.ReadCloser, totalSize int64, _ error)
// CreateObject returns a writer for the object at the request name. A new
// empty object is created if CreateObject is called on an existing object.
//
// A Writer *must* be closed via either Close, and if closing returns a
// non-nil error, that error should be handled or reported to the user -- an
// implementation may buffer written data until Close and only then return
// an error, or Write may return an opaque io.EOF with the underlying cause
// returned by the subsequent Close().
//
// TODO(radu): if we encounter some unrelated error while writing to the
// WriteCloser, we'd want to abort the whole thing rather than letting Close
// finalize the upload.
CreateObject(basename string) (io.WriteCloser, error)
// List enumerates files within the supplied prefix, returning a list of
// objects within that prefix. If delimiter is non-empty, names which have the
// same prefix, prior to the delimiter but after the prefix, are grouped into a
// single result which is that prefix. The order that results are returned is
// undefined. If a prefix is specified, the prefix is trimmed from the result
// list.
//
// An example would be, if the storage contains objects a, b/4, b/5 and b/6,
// these would be the return values:
// List("", "") -> ["a", "b/4", "b/5", "b/6"]
// List("", "/") -> ["a", "b"]
// List("b", "/") -> ["4", "5", "6"]
// List("b", "") -> ["/4", "/5", "/6"]
List(prefix, delimiter string) ([]string, error)
// Delete removes the named object from the store.
//
// TODO(radu): do we get an error when the object isn't there? How can we
// check for that error?
Delete(basename string) error
// Size returns the length of the named object in bytesWritten.
//
// TODO(radu): same as above - how can we tell if it's a "no such object" error?
Size(basename string) (int64, error)
}
Storage is an interface for a blob storage driver. This is lower-level than an FS-like interface, however FS/File-like abstractions can be built on top of these methods.
TODO(bilal): Consider pushing shared file obsoletion as well as path generation behind this interface.
func NewInMem ¶
func NewInMem() Storage
NewInMem returns an in-memory implementation of the shared.Storage interface (for testing).
func WithLogging ¶
WithLogging wraps the given Storage implementation and emits logs for various operations.
Click to show internal directories.
Click to hide internal directories.