file

package
v2.15.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Overview

Package file provides filesystem persistence implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LicenseDir

func LicenseDir(cfg *config.Config) string

func NewDAGRepository added in v2.14.0

func NewDAGRepository(cfg *config.Config, opts ...DAGRepositoryOption) (*persis.DAGRepository, error)

NewDAGRepository connects the file-backed definition store to the shared repository.

func NewDAGRunRepository added in v2.14.0

func NewDAGRunRepository(cfg *config.Config, opts ...DAGRunRepositoryOption) *persis.DAGRunRepository

NewDAGRunRepository connects file storage to the shared DAG-run repository.

func NewDAGSettingsStore

func NewDAGSettingsStore(cfg *config.Config, col persis.Collection) (dagsettings.Store, error)

func NewIncidentStore

func NewIncidentStore(col persis.Collection, enc *crypto.Encryptor) (incident.Store, error)

NewIncidentStore creates an incident store backed by col.

func NewNotificationStore

func NewNotificationStore(col persis.Collection, enc *crypto.Encryptor) (notification.Store, error)

NewNotificationStore creates a notification store backed by col.

func NewProcRepository added in v2.14.0

func NewProcRepository(cfg *config.Config, opts ...procstore.StoreOption) *persis.ProcRepository

NewProcRepository connects the released .proc file layout to the shared repository.

func NewProfileStore

func NewProfileStore(ctx context.Context, cfg *config.Config, col persis.Collection) profile.Store

NewProfileStore wires the file-backed runtime profile store from config paths.

func NewSecretStore

func NewSecretStore(ctx context.Context, cfg *config.Config, col persis.Collection) secret.Store

NewSecretStore wires the encrypted file-backed secret store from config paths.

func NewServiceRegistry

func NewServiceRegistry(cfg *config.Config) serviceregistry.ServiceRegistry

NewServiceRegistry wires the file-backed service registry from application config.

func NewUpgradeCheckStore

func NewUpgradeCheckStore(cfg *config.Config, col persis.Collection) (upgrade.CacheStore, error)

Types

type Backend

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

Backend maps logical control-plane collections to the released file layout.

func NewBackend added in v2.14.0

func NewBackend(paths config.PathsConfig) *Backend

NewBackend creates a file backend from the configured persistence paths. It does not access the filesystem; collections create directories lazily.

func (*Backend) Collection

func (b *Backend) Collection(name string) persis.Collection

Collection returns the collection identified by name.

type Collection

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

Collection implements persis.Collection as a directory of JSON files. "/" in record IDs maps to the OS path separator, so hierarchical IDs become nested subdirectories on disk.

func NewCollection

func NewCollection(dir string, opts ...CollectionOption) *Collection

NewCollection creates a collection backed by dir. The directory is created lazily on the first write.

func (*Collection) CompareAndDelete

func (c *Collection) CompareAndDelete(ctx context.Context, expected *persis.Record) error

CompareAndDelete removes expected.ID only when the current record still matches expected.

func (*Collection) CompareAndSwap

func (c *Collection) CompareAndSwap(ctx context.Context, id string, expected, next []byte) error

CompareAndSwap atomically replaces the record's Data only when the current Data equals expected. Returns persis.ErrConflict on mismatch.

func (*Collection) Create

func (c *Collection) Create(ctx context.Context, rec *persis.Record) error

Create atomically inserts rec. Returns persis.ErrConflict when a record with rec.ID already exists.

func (*Collection) Delete

func (c *Collection) Delete(ctx context.Context, id string) error

func (*Collection) Get

func (c *Collection) Get(_ context.Context, id string) (*persis.Record, error)

func (*Collection) List

func (*Collection) Put

func (c *Collection) Put(ctx context.Context, rec *persis.Record) error

func (*Collection) RecordIDs

func (c *Collection) RecordIDs(_ context.Context, prefix string) ([]string, error)

RecordIDs returns record IDs matching prefix without decoding record payloads.

func (*Collection) RecordVersion

func (c *Collection) RecordVersion(_ context.Context, id string) (string, error)

RecordVersion returns a cheap version token for cache validation.

func (*Collection) RemoveCorrupt

func (c *Collection) RemoveCorrupt(ctx context.Context, id string, staleBefore time.Time) (bool, error)

RemoveCorrupt removes id only when its file is invalid JSON. A non-zero staleBefore restricts removal to files last modified at or before that time.

type CollectionOption

type CollectionOption func(*Collection)

CollectionOption configures a file-backed Collection.

func WithIndentedJSON

func WithIndentedJSON() CollectionOption

WithIndentedJSON stores records as two-space indented JSON on disk.

type DAGRepositoryOption added in v2.14.0

type DAGRepositoryOption func(*DAGRepositoryOptions)

DAGRepositoryOption configures the file-backed DAG repository.

func WithDAGFileCache

func WithDAGFileCache(cache *fileutil.Cache[*ir.DAG]) DAGRepositoryOption

WithDAGFileCache sets the cache used for loading DAG definitions.

func WithDAGSearchPaths

func WithDAGSearchPaths(paths []string) DAGRepositoryOption

WithDAGSearchPaths sets additional directories used to resolve DAG definitions.

func WithDAGSkipDirectoryCreation

func WithDAGSkipDirectoryCreation(skip bool) DAGRepositoryOption

WithDAGSkipDirectoryCreation controls whether the DAG directory is created on startup.

func WithDAGSkipExamples

func WithDAGSkipExamples(skip bool) DAGRepositoryOption

WithDAGSkipExamples controls whether example DAG files are created.

func WithDAGSymlinks(enabled bool) DAGRepositoryOption

WithDAGSymlinks includes file symlinks in recursive discovery and permits external targets.

type DAGRepositoryOptions added in v2.14.0

type DAGRepositoryOptions struct {
	Cache                 *fileutil.Cache[*ir.DAG]
	SearchPaths           []string
	SkipExamples          *bool
	Symlinks              bool
	SkipDirectoryCreation bool
}

DAGRepositoryOptions contains file-backed DAG repository settings.

type DAGRunRepositoryOption added in v2.14.0

type DAGRunRepositoryOption func(*dagRunRepositoryOptions)

DAGRunRepositoryOption configures the file-backed DAG-run repository.

func WithDAGRunHistoryFileCache

func WithDAGRunHistoryFileCache(cache *fileutil.Cache[*ir.DAGRunStatus]) DAGRunRepositoryOption

WithDAGRunHistoryFileCache sets the cache used for reading DAG-run history files.

func WithDAGRunLatestStatusToday

func WithDAGRunLatestStatusToday(latestStatusToday bool) DAGRunRepositoryOption

WithDAGRunLatestStatusToday controls whether latest status lookups are limited to today.

func WithDAGRunRemovalEnqueuer added in v2.14.0

func WithDAGRunRemovalEnqueuer(enqueuer persis.DAGRunRemovalEnqueuer) DAGRunRepositoryOption

WithDAGRunRemovalEnqueuer records provider resources before DAG-run removal.

Directories

Path Synopsis
Package audit provides a file-based implementation of the audit Store interface.
Package audit provides a file-based implementation of the audit Store interface.
dag
Package eventstore provides a file-based implementation of the event store.
Package eventstore provides a file-based implementation of the event store.

Jump to

Keyboard shortcuts

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