Documentation
¶
Overview ¶
Package fsstore keeps mount records in a folder, one YAML file per mount, named <name>.yaml. Several processes can share the folder: a create is exclusive across them, and each notices the others' creates and deletes through Generation. It is the first mounts.RecordStore backend, and the one agni uses for its --store folder.
Index ¶
- type Store
- func (s *Store) CreateMount(ctx context.Context, m mounts.Mount) error
- func (s *Store) DeleteMount(ctx context.Context, name string) error
- func (s *Store) Generation(ctx context.Context) (string, error)
- func (s *Store) GetMount(ctx context.Context, name string) (mounts.Mount, error)
- func (s *Store) ListMounts(ctx context.Context) ([]mounts.Mount, 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 a mounts.RecordStore over one folder. Its methods are safe to call from several goroutines and several processes at once.
func (*Store) CreateMount ¶
CreateMount writes m to a temp file, then hard-links the temp file to <name>.yaml. The link fails when the name exists, so of two processes creating one name, exactly one succeeds and the other gets ErrExists. A reader never sees a half-written record.
func (*Store) DeleteMount ¶
DeleteMount removes the record named name. A missing record is not an error.
func (*Store) Generation ¶
Generation hashes each record file's name, size and modification time, so a create or a delete by any process changes it. It reads every file's time because a folder's own modification time doesn't change on every create and delete on Windows.
func (*Store) ListMounts ¶
ListMounts reads every record, in name order. A file whose record names a different mount, or one that doesn't parse, fails the whole list with ErrInvalidArgument, so a hand-edited mistake shows up rather than hiding a mount.