fsstore

package
v0.7.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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 New

func New(dir string) (*Store, error)

New returns a store over dir, creating the folder if it is missing.

func (*Store) CreateMount

func (s *Store) CreateMount(ctx context.Context, m mounts.Mount) error

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

func (s *Store) DeleteMount(ctx context.Context, name string) error

DeleteMount removes the record named name. A missing record is not an error.

func (*Store) Generation

func (s *Store) Generation(ctx context.Context) (string, error)

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) GetMount

func (s *Store) GetMount(ctx context.Context, name string) (mounts.Mount, error)

GetMount reads the record named name, or returns ErrNotFound.

func (*Store) ListMounts

func (s *Store) ListMounts(ctx context.Context) ([]mounts.Mount, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL