readonly

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Modification

type Modification struct {
	Timestamp time.Time
	Operation string
	Version   string
	Blocked   bool
}

Modification tracks attempted modifications

type ReadOnlyLayer

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

ReadOnlyLayer provides an additional abstraction layer for read-only access

func NewReadOnlyLayer

func NewReadOnlyLayer(provider *ReadOnlyProvider) *ReadOnlyLayer

NewReadOnlyLayer creates a new read-only layer

func (*ReadOnlyLayer) Get

func (rol *ReadOnlyLayer) Get(version string) (*immutableconfig.ConfigData, error)

Get retrieves configuration data without allowing modifications

func (*ReadOnlyLayer) GetLatest

func (rol *ReadOnlyLayer) GetLatest() (*immutableconfig.ConfigData, error)

GetLatest retrieves the latest configuration

func (*ReadOnlyLayer) IsSealed

func (rol *ReadOnlyLayer) IsSealed() bool

IsSealed returns whether the layer is sealed

func (*ReadOnlyLayer) ListVersions

func (rol *ReadOnlyLayer) ListVersions() ([]*immutableconfig.ConfigVersion, error)

ListVersions lists all available versions

type ReadOnlyOptions

type ReadOnlyOptions struct {
	AutoSeal        bool
	SealAfterWrites int
}

ReadOnlyOptions for configuring the read-only provider

func DefaultReadOnlyOptions

func DefaultReadOnlyOptions() *ReadOnlyOptions

DefaultReadOnlyOptions returns default read-only options

type ReadOnlyProvider

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

ReadOnlyProvider wraps a Provider with read-only enforcement

func NewReadOnlyProvider

func NewReadOnlyProvider(provider immutableconfig.Provider, opts *ReadOnlyOptions) *ReadOnlyProvider

NewReadOnlyProvider creates a new read-only provider wrapper

func (*ReadOnlyProvider) ClearModificationHistory

func (rop *ReadOnlyProvider) ClearModificationHistory()

ClearModificationHistory clears the modification history

func (*ReadOnlyProvider) Close

func (rop *ReadOnlyProvider) Close() error

Close closes the underlying provider

func (*ReadOnlyProvider) GetBlockedModifications

func (rop *ReadOnlyProvider) GetBlockedModifications() []Modification

GetBlockedModifications returns only blocked modification attempts

func (*ReadOnlyProvider) GetModificationHistory

func (rop *ReadOnlyProvider) GetModificationHistory() []Modification

GetModificationHistory returns the history of modification attempts

func (*ReadOnlyProvider) Initialize

func (rop *ReadOnlyProvider) Initialize() error

Initialize initializes the underlying provider

func (*ReadOnlyProvider) IsModified

func (rop *ReadOnlyProvider) IsModified() bool

IsModified returns whether modifications have been made since sealing

func (*ReadOnlyProvider) IsSealed

func (rop *ReadOnlyProvider) IsSealed() bool

IsSealed returns whether the filesystem is sealed

func (*ReadOnlyProvider) ListVersions

func (rop *ReadOnlyProvider) ListVersions() ([]*immutableconfig.ConfigVersion, error)

ListVersions lists all versions (allowed in read-only mode)

func (*ReadOnlyProvider) Load

func (rop *ReadOnlyProvider) Load(version string) (*immutableconfig.ConfigData, error)

Load loads a configuration (allowed in read-only mode)

func (*ReadOnlyProvider) ResetModified

func (rop *ReadOnlyProvider) ResetModified()

ResetModified resets the modified flag

func (*ReadOnlyProvider) Save

Save attempts to save a configuration (blocked if sealed)

func (*ReadOnlyProvider) Seal

func (rop *ReadOnlyProvider) Seal() error

Seal seals the filesystem, preventing all future modifications

func (*ReadOnlyProvider) SealedAt

func (rop *ReadOnlyProvider) SealedAt() time.Time

SealedAt returns when the filesystem was sealed

func (*ReadOnlyProvider) Unseal

func (rop *ReadOnlyProvider) Unseal() error

Unseal unseals the filesystem, allowing modifications (admin operation)

Jump to

Keyboard shortcuts

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