Documentation
¶
Overview ¶
Package memstore is an in-memory implementation of store.Storage used for tests, demos, and embedded scenarios where durability is not required. It is fully thread-safe.
Index ¶
- type Store
- func (s *Store) AppendReflog(_ context.Context, name string, e store.ReflogEntry) error
- func (s *Store) CASRef(_ context.Context, name string, expected, next store.Hash) error
- func (s *Store) Close() error
- func (s *Store) DeleteRef(_ context.Context, name string, expected store.Hash) error
- func (s *Store) GetObject(_ context.Context, h store.Hash) (store.Object, error)
- func (s *Store) GetRef(_ context.Context, name string) (store.Hash, bool, error)
- func (s *Store) HasObject(_ context.Context, h store.Hash) (bool, error)
- func (s *Store) IterObjects(_ context.Context, fn func(store.Hash, store.Object) error) error
- func (s *Store) ListRefs(_ context.Context, prefix string) ([]store.RefEntry, error)
- func (s *Store) PutObject(_ context.Context, h store.Hash, obj store.Object) error
- func (s *Store) ReadReflog(_ context.Context, name string) ([]store.ReflogEntry, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an in-memory store.Storage. The zero value is NOT usable; call New() to construct one with initialized maps.
func (*Store) AppendReflog ¶
AppendReflog appends e to the named reflog.
func (*Store) CASRef ¶
CASRef updates name iff its current value equals expected.
A zero expected hash means "create only if absent". A zero next hash is rejected (use DeleteRef instead).
func (*Store) IterObjects ¶
IterObjects calls fn for every (hash, object). Iteration order is deterministic (hash-ascending) for test reproducibility.
func (*Store) PutObject ¶
PutObject stores obj under h. Re-puts of an existing hash are accepted silently (the bytes are guaranteed identical by the CAS property of content addressing).
func (*Store) ReadReflog ¶
ReadReflog returns a copy of the reflog entries for name.