backend

package
v0.0.0-...-71dec12 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound     = errors.New("object not found")
	ErrPrecondition = errors.New("precondition failed")
	ErrEOF          = errors.New("end of file")
)

Functions

This section is empty.

Types

type Backend

type Backend interface {
	ReadIfModified(ctx context.Context, path string, version int64) (ReadReply, error)
	Read(ctx context.Context, path string) (ReadReply, error)
	GetMetadata(ctx context.Context, path string) (Metadata, error)
	SetTagsIf(ctx context.Context, path string, expected Version, t Tags) (Metadata, error)
	Write(ctx context.Context, path string, value []byte, t Tags) (Metadata, error)
	WriteIf(ctx context.Context, path string, value []byte, expected Version, t Tags) (Metadata, error)
	WriteIfNotExists(ctx context.Context, path string, value []byte, t Tags) (Metadata, error)
	Delete(ctx context.Context, path string) error
	DeleteIf(ctx context.Context, path string, expected Version) error

	// List returns an iterator over the objects in the bucket within the given
	// directory (path separator is '/'). Objects will be iterated over
	// lexicographically by name.
	//
	// Note: The returned iterator is not safe for concurrent operations without
	// explicit synchronization.
	List(ctx context.Context, dirPath string) (ListIter, error)
}

type ListIter

type ListIter interface {
	Next() (path string, ok bool)
	Err() error
}

type Metadata

type Metadata struct {
	Tags    Tags
	Version Version
}

type ReadReply

type ReadReply struct {
	Contents []byte
	// TODO: Consider only exposing contents version.
	Version Version
}

type Tags

type Tags map[string]string

type Version

type Version struct {
	Contents int64
	Meta     int64
}

func (Version) IsNull

func (v Version) IsNull() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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