Documentation
¶
Overview ¶
Package objstore is the object store seam of the store service. One Store or Bucket is one bucket. Implementations: Google Cloud Storage (internal/objstore/gcs), a filesystem directory (internal/objstore/fs) and Memory, a Store only.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("objstore: object not found")
Functions ¶
This section is empty.
Types ¶
type Attrs ¶
type Attrs struct {
Size int64
ContentType string
Metadata map[string]string
MD5 []byte
Generation int64
}
Attrs describes one stored object; MD5 holds raw bytes.
type Bucket ¶
type Bucket interface {
Store
// Attrs answers ErrNotFound for a missing object.
Attrs(ctx context.Context, key string) (Attrs, error)
// Open reads one generation of key (0: the live one); ErrNotFound if
// missing. Its Attrs hold Size, ContentType and Generation only.
Open(ctx context.Context, key string, generation int64) (io.ReadCloser, Attrs, error)
List(ctx context.Context, prefix string) ([]string, error)
// Delete removes the live object. A missing object is not an error.
Delete(ctx context.Context, key string) error
// Copy copies one generation of Source (0: the live one) and returns the
// generation it wrote; ErrNotFound for a missing source.
Copy(ctx context.Context, c Copy) (int64, error)
}
Bucket is the whole object API of one bucket.
type Copy ¶
type Copy struct {
Source string
Generation int64
Destination string
Metadata map[string]string
CreateOnly bool
}
Copy copies one object generation; Metadata replaces that of the source.
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory is an in-memory Store.
type Store ¶
type Store interface {
// Create writes data when key is absent and reports whether it wrote. A
// stored object is never replaced.
Create(ctx context.Context, key string, data []byte) (created bool, err error)
Get(ctx context.Context, key string) ([]byte, error)
// GetRange returns up to n bytes from off, fewer at the end of the object.
GetRange(ctx context.Context, key string, off, n int64) ([]byte, error)
}