Documentation
¶
Index ¶
- type Copies
- type Memory
- 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) Put(ctx context.Context, object *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 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) Unwrap ¶
func (s *Store) Unwrap() backup.ObjectStore
Unwrap implements wrapped.Wrapper.