filesystem

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPermissions for config files
	DefaultPermissions = 0644
	// DefaultDirPermissions for directories
	DefaultDirPermissions = 0755
	// ConfigFileExtension for config files
	ConfigFileExtension = ".config"
	// MetaFileExtension for metadata files
	MetaFileExtension = ".meta"
	// HashFileExtension for hash files
	HashFileExtension = ".hash"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkpoint

type Checkpoint struct {
	Created   time.Time             `json:"created"`
	Versions  []string              `json:"versions"`
	Checksums map[string]string     `json:"checksums"`
	WALStats  map[string]int64      `json:"wal_stats"`
	AuditLog  []*logging.AuditEntry `json:"audit_log"`
}

Checkpoint represents a complete filesystem checkpoint

func (*Checkpoint) ToJSON

func (c *Checkpoint) ToJSON() (string, error)

ToJSON exports the checkpoint to JSON

type FilesystemConfig

type FilesystemConfig struct {
	BasePath        string
	MaxVersions     int
	MaxAuditEntries int
	WatchInterval   time.Duration
	EnableWatch     bool
	AutoSeal        bool
}

FilesystemConfig configures the immutable filesystem

func DefaultFilesystemConfig

func DefaultFilesystemConfig() *FilesystemConfig

DefaultFilesystemConfig returns default configuration

type FilesystemOptions

type FilesystemOptions struct {
	BasePath         string
	CreateIfNotExist bool
	Permissions      os.FileMode
}

FilesystemOptions for configuring the filesystem provider

func DefaultFilesystemOptions

func DefaultFilesystemOptions() *FilesystemOptions

DefaultFilesystemOptions returns default filesystem options

type FilesystemProvider

type FilesystemProvider struct {
	// contains filtered or unexported fields
}

FilesystemProvider implements Provider using the filesystem

func NewFilesystemProvider

func NewFilesystemProvider(opts *FilesystemOptions) (*FilesystemProvider, error)

NewFilesystemProvider creates a new filesystem-based provider

func (*FilesystemProvider) Close

func (fp *FilesystemProvider) Close() error

Close closes the filesystem provider

func (*FilesystemProvider) DeleteVersion

func (fp *FilesystemProvider) DeleteVersion(version string) error

DeleteVersion deletes a specific version (admin operation)

func (*FilesystemProvider) GetBasePath

func (fp *FilesystemProvider) GetBasePath() string

GetBasePath returns the base path for the filesystem provider

func (*FilesystemProvider) Initialize

func (fp *FilesystemProvider) Initialize() error

Initialize initializes the filesystem provider

func (*FilesystemProvider) ListVersions

func (fp *FilesystemProvider) ListVersions() ([]*immutableconfig.ConfigVersion, error)

ListVersions lists all available versions

func (*FilesystemProvider) Load

Load loads a specific version of the configuration

func (*FilesystemProvider) Save

Save saves a new configuration version to disk

func (*FilesystemProvider) VerifyIntegrity

func (fp *FilesystemProvider) VerifyIntegrity() (map[string]bool, error)

VerifyIntegrity verifies the integrity of all stored configurations

type ImmutableFilesystem

type ImmutableFilesystem struct {
	// contains filtered or unexported fields
}

ImmutableFilesystem provides a complete immutable, read-only filesystem implementation

func NewImmutableFilesystem

func NewImmutableFilesystem(cfg *FilesystemConfig) (*ImmutableFilesystem, error)

NewImmutableFilesystem creates a new immutable filesystem

func (*ImmutableFilesystem) Close

func (fs *ImmutableFilesystem) Close() error

Close closes the immutable filesystem

func (*ImmutableFilesystem) CompactWAL

func (fs *ImmutableFilesystem) CompactWAL() error

CompactWAL compacts the WAL

func (*ImmutableFilesystem) CreateSnapshot

func (fs *ImmutableFilesystem) CreateSnapshot(name string, description string) (*snapshot.Snapshot, error)

CreateSnapshot creates a point-in-time snapshot

func (*ImmutableFilesystem) Delete

func (fs *ImmutableFilesystem) Delete(version string) error

Delete deletes a configuration version (admin operation, requires unsealed)

func (*ImmutableFilesystem) DeleteSnapshot

func (fs *ImmutableFilesystem) DeleteSnapshot(snapshotID string) error

DeleteSnapshot deletes a snapshot

func (*ImmutableFilesystem) ExportCheckpoint

func (fs *ImmutableFilesystem) ExportCheckpoint() (*Checkpoint, error)

ExportCheckpoint exports a complete checkpoint

func (*ImmutableFilesystem) GetAuditLog

func (fs *ImmutableFilesystem) GetAuditLog() []*logging.AuditEntry

GetAuditLog returns the audit log

func (*ImmutableFilesystem) GetWALStats

func (fs *ImmutableFilesystem) GetWALStats() map[string]int64

GetWALStats returns WAL statistics

func (*ImmutableFilesystem) GetWatcherStatus

func (fs *ImmutableFilesystem) GetWatcherStatus() map[string]interface{}

GetWatcherStatus returns watcher status

func (*ImmutableFilesystem) Initialize

func (fs *ImmutableFilesystem) Initialize() error

Initialize initializes the immutable filesystem

func (*ImmutableFilesystem) IsSealed

func (fs *ImmutableFilesystem) IsSealed() bool

IsSealed returns whether the filesystem is sealed

func (*ImmutableFilesystem) ListSnapshots

func (fs *ImmutableFilesystem) ListSnapshots() ([]*snapshot.Snapshot, error)

ListSnapshots lists all snapshots

func (*ImmutableFilesystem) ListVersions

func (fs *ImmutableFilesystem) ListVersions() ([]*immutableconfig.ConfigVersion, error)

ListVersions lists all available versions

func (*ImmutableFilesystem) Load

Load loads a configuration version

func (*ImmutableFilesystem) LoadLatest

func (fs *ImmutableFilesystem) LoadLatest() (*immutableconfig.ConfigData, error)

LoadLatest loads the latest configuration version

func (*ImmutableFilesystem) Recover

func (fs *ImmutableFilesystem) Recover() error

Recover recovers from WAL after a crash

func (*ImmutableFilesystem) RestoreSnapshot

func (fs *ImmutableFilesystem) RestoreSnapshot(snapshotID string) error

RestoreSnapshot restores from a snapshot

func (*ImmutableFilesystem) Save

Save saves a configuration with write-ahead logging

func (*ImmutableFilesystem) Seal

func (fs *ImmutableFilesystem) Seal() error

Seal seals the filesystem, preventing all future modifications

func (*ImmutableFilesystem) SealedAt

func (fs *ImmutableFilesystem) SealedAt() time.Time

SealedAt returns when the filesystem was sealed

func (*ImmutableFilesystem) Unseal

func (fs *ImmutableFilesystem) Unseal() error

Unseal unseals the filesystem (admin operation)

func (*ImmutableFilesystem) VerifyIntegrity

func (fs *ImmutableFilesystem) VerifyIntegrity() (map[string]bool, error)

VerifyIntegrity verifies the integrity of all configurations

Jump to

Keyboard shortcuts

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