Versions in this module Expand all Collapse all v0 v0.4.0 May 4, 2026 v0.3.0 Apr 25, 2026 Changes in this version + var ErrAlreadyExists = errors.New("omnistorage: already exists") + var ErrBackendClosed = errors.New("omnistorage: backend closed") + var ErrInvalidPath = errors.New("omnistorage: invalid path") + var ErrNotFound = errors.New("omnistorage: not found") + var ErrNotSupported = errors.New("omnistorage: operation not supported") + var ErrPermissionDenied = errors.New("omnistorage: permission denied") + var ErrReaderClosed = errors.New("omnistorage: reader closed") + var ErrUnknownBackend = errors.New("omnistorage: unknown backend") + var ErrWriterClosed = errors.New("omnistorage: writer closed") + func Backends() []string + func CopyPath(ctx context.Context, srcBackend Backend, srcPath string, dstBackend Backend, ...) error + func CopyPathWithHash(ctx context.Context, srcBackend Backend, srcPath string, dstBackend Backend, ...) (string, error) + func HashBytes(data []byte, t HashType) string + func HashBytesFromSum(sum []byte) string + func HashReader(r io.Reader, t HashType) (string, error) + func IsNotFound(err error) bool + func IsNotSupported(err error) bool + func IsPermissionDenied(err error) bool + func IsRegistered(name string) bool + func MovePath(ctx context.Context, srcBackend Backend, srcPath string, dstBackend Backend, ...) error + func NewHash(t HashType) hash.Hash + func Register(name string, factory BackendFactory) + func SmartCopy(ctx context.Context, srcBackend Backend, srcPath string, dstBackend Backend, ...) error + func SmartMove(ctx context.Context, srcBackend Backend, srcPath string, dstBackend Backend, ...) error + func Unregister(name string) bool + type Backend interface + Close func() error + Delete func(ctx context.Context, path string) error + Exists func(ctx context.Context, path string) (bool, error) + List func(ctx context.Context, prefix string) ([]string, error) + NewReader func(ctx context.Context, path string, opts ...ReaderOption) (io.ReadCloser, error) + NewWriter func(ctx context.Context, path string, opts ...WriterOption) (io.WriteCloser, error) + func Open(name string, config map[string]string) (Backend, error) + type BackendFactory func(config map[string]string) (Backend, error) + type BasicObjectInfo struct + ObjectContentType string + ObjectHashes map[HashType]string + ObjectIsDir bool + ObjectMetadata map[string]string + ObjectModTime time.Time + ObjectPath string + ObjectSize int64 + func (o *BasicObjectInfo) ContentType() string + func (o *BasicObjectInfo) Hash(t HashType) string + func (o *BasicObjectInfo) IsDir() bool + func (o *BasicObjectInfo) Metadata() map[string]string + func (o *BasicObjectInfo) ModTime() time.Time + func (o *BasicObjectInfo) Path() string + func (o *BasicObjectInfo) Size() int64 + type ExtendedBackend interface + Copy func(ctx context.Context, src, dst string) error + Features func() Features + Mkdir func(ctx context.Context, path string) error + Move func(ctx context.Context, src, dst string) error + Rmdir func(ctx context.Context, path string) error + Stat func(ctx context.Context, path string) (ObjectInfo, error) + func AsExtended(b Backend) (ExtendedBackend, bool) + func MustExtended(b Backend) ExtendedBackend + type Features struct + CanStream bool + Copy bool + CustomMetadata bool + Hashes []HashType + ListPrefix bool + Mkdir bool + Move bool + RangeRead bool + Rmdir bool + ServerSideEncryption bool + SetModTime bool + Stat bool + Versioning bool + func (f Features) CommonHash(other Features) HashType + func (f Features) PreferredHash() HashType + func (f Features) SupportsHash(t HashType) bool + type HashSet map[HashType]string + func (hs HashSet) Equal(other HashSet) bool + func (hs HashSet) Get(t HashType) string + func (hs HashSet) Has(t HashType) bool + func (hs HashSet) Set(t HashType, value string) + type HashType string + const HashCRC32C + const HashMD5 + const HashNone + const HashSHA1 + const HashSHA256 + func SupportedHashes() []HashType + func (h HashType) String() string + type ObjectInfo interface + ContentType func() string + Hash func(HashType) string + IsDir func() bool + Metadata func() map[string]string + ModTime func() time.Time + Path func() string + Size func() int64 + type ReaderConfig struct + BufferSize int + Limit int64 + Offset int64 + func ApplyReaderOptions(opts ...ReaderOption) *ReaderConfig + type ReaderOption func(*ReaderConfig) + func WithLimit(limit int64) ReaderOption + func WithOffset(offset int64) ReaderOption + func WithReaderBufferSize(size int) ReaderOption + type RecordReader interface + Close func() error + Read func() ([]byte, error) + type RecordWriter interface + Close func() error + Flush func() error + Write func(data []byte) error + type WriterConfig struct + BufferSize int + ContentType string + Metadata map[string]string + func ApplyWriterOptions(opts ...WriterOption) *WriterConfig + type WriterOption func(*WriterConfig) + func WithBufferSize(size int) WriterOption + func WithContentType(contentType string) WriterOption + func WithMetadata(metadata map[string]string) WriterOption