Documentation
¶
Index ¶
- type Copies
- type Memory
- type Recent
- type Store
- func (s *Store) Delete(ctx context.Context, ref *proto.Ref) error
- func (s *Store) Get(ctx context.Context, ref *proto.Ref) (*proto.Object, error)
- func (s *Store) GetTree(ctx context.Context, ref *proto.Ref, maxDepth uint32) ([]*proto.Object, error)
- func (s *Store) Has(ctx context.Context, ref *proto.Ref) (bool, error)
- func (s *Store) Keep(ctx context.Context, obj *proto.Object)
- func (s *Store) Kept(ref *proto.Ref) bool
- func (s *Store) Missing(ctx context.Context, refs []*proto.Ref) ([]*proto.Ref, error)
- func (s *Store) Put(ctx context.Context, object *proto.Object) error
- func (s *Store) PutCommits(ctx context.Context, commits []*proto.Object) error
- func (s *Store) PutObjects(ctx context.Context, objects []*proto.Object) error
- func (s *Store) Unwrap() backup.ObjectStore
- func (s *Store) Walk(ctx context.Context, b bool, objectType proto.ObjectType, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Copies ¶
type Copies interface {
// Get returns the copy of ref, if there is one.
Get(ref *proto.Ref) (*proto.Object, bool)
// Put keeps obj as the copy of ref.
Put(ref *proto.Ref, obj *proto.Object) error
// Drop forgets the copy of ref.
Drop(ref *proto.Ref)
}
Copies holds a Store's copies of objects by ref. *blobcache.Cache is one on disk, Memory one for a single process, and InStore adapts an object store.
func InStore ¶
func InStore(store backup.ObjectStore) Copies
InStore keeps Copies in an object store such as a local badger store.
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory is Copies held in memory for as long as it is referenced.
type Recent ¶ added in v1.96.0
type Recent struct {
// contains filtered or unexported fields
}
Recent is Copies in memory that hold what was kept or read since the generation before the current one: Rotate starts a generation and drops every copy the one before it neither kept nor read. Rotated once per commit, it holds what the last commit wrote and what it read of the one before, and nothing older.
func (*Recent) Get ¶ added in v1.96.0
Get implements Copies; a copy of the previous generation joins the current one.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store serves metadata objects from its copies before wrapped, filling them on reads and writes; failures to keep a copy are ignored. Objects are immutable by ref, so a copy is never stale; what is newest is still the wrapped store's to say.
func New ¶
func New(copies Copies, wrapped backup.ObjectStore) *Store
New layers copies over wrapped for its commits, trees and files.
func (*Store) GetTree ¶
func (s *Store) GetTree(ctx context.Context, ref *proto.Ref, maxDepth uint32) ([]*proto.Object, error)
GetTree serves the tree at ref and its splits from the copies when it holds them all, and otherwise forwards to the wrapped store's prefetch, if it has one, keeping what it fetched. Trees below are left to later calls.
func (*Store) Kept ¶ added in v1.96.0
Kept implements backup.Keeper: a copy of ref is kept here, or by the wrapped store where it is a Keeper.
func (*Store) Missing ¶ added in v1.96.0
Missing implements backup.Batcher through the wrapped store.
func (*Store) PutCommits ¶ added in v1.92.0
PutCommits implements backup.CommitBatcher through the wrapped store.
func (*Store) PutObjects ¶ added in v1.96.0
PutObjects implements backup.Batcher through the wrapped store.
func (*Store) Unwrap ¶
func (s *Store) Unwrap() backup.ObjectStore
Unwrap implements wrapped.Wrapper.