Documentation
¶
Overview ¶
Package store implements MountRepository on top of an embedded BadgerDB database, encrypted at rest, so mount intent and credentials survive a daemon restart.
Index ¶
- Constants
- Variables
- type MountRecord
- type MountRepository
- func (repository *MountRepository) Close() error
- func (repository *MountRepository) Create(ctx context.Context, record *MountRecord) error
- func (repository *MountRepository) Delete(ctx context.Context, mountID string) error
- func (repository *MountRepository) Get(ctx context.Context, mountID string) (*MountRecord, error)
- func (repository *MountRepository) List(ctx context.Context) ([]*MountRecord, error)
- func (repository *MountRepository) Update(ctx context.Context, record *MountRecord) error
- type Store
Constants ¶
const CurrentSchemaVersion uint64 = 1
CurrentSchemaVersion is the schema version this build of irodsfsd writes. Bump it and add a corresponding entry to migrations whenever the on-disk record format changes.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type MountRecord ¶
type MountRecord struct {
Info *api.MountInfo
// Tombstone marks a record whose Unmount has been accepted. A
// tombstoned record is never restored as a fresh mount after a daemon
// restart; only its unmount cleanup is resumed.
Tombstone bool
}
MountRecord is the persisted, unredacted representation of one mount. Info.Config retains original iRODS/DAVFS credentials; callers must redact a copy before returning it through any API. Info.Config.MountPath is treated as immutable for the lifetime of a record.
type MountRepository ¶
type MountRepository struct {
// contains filtered or unexported fields
}
MountRepository persists MountRecords in a Store, keeping a canonical mount-path index alongside each record so mount-ID and mount-path uniqueness can be enforced within a single transaction. This is the only implementation of mount persistence, so it is exposed as a concrete type rather than behind an interface.
func NewMountRepository ¶
func NewMountRepository(store *Store) *MountRepository
NewMountRepository returns a MountRepository backed by store.
func (*MountRepository) Close ¶
func (repository *MountRepository) Close() error
Close releases the underlying Store.
func (*MountRepository) Create ¶
func (repository *MountRepository) Create(ctx context.Context, record *MountRecord) error
Create stores a new mount record and reserves its canonical mount path atomically. It returns ErrMountIDConflict or ErrMountPathConflict if the mount ID or mount path is already in use by another record.
func (*MountRepository) Delete ¶
func (repository *MountRepository) Delete(ctx context.Context, mountID string) error
Delete removes the mount record and its path index atomically. Deleting an unknown mount ID is not an error.
func (*MountRepository) Get ¶
func (repository *MountRepository) Get(ctx context.Context, mountID string) (*MountRecord, error)
Get returns the stored record for mountID, or ErrMountNotFound.
func (*MountRepository) List ¶
func (repository *MountRepository) List(ctx context.Context) ([]*MountRecord, error)
List returns every stored mount record in unspecified order.
func (*MountRepository) Update ¶
func (repository *MountRepository) Update(ctx context.Context, record *MountRecord) error
Update replaces the stored record for record.Info.MountId. It returns ErrMountNotFound if no record exists for that ID.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns one embedded, encrypted BadgerDB instance.