pg

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BootstrapCoreRepository

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

func (*BootstrapCoreRepository) LoadBootstrapCore

func (r *BootstrapCoreRepository) LoadBootstrapCore() (bootstrap.BootstrapCoreState, error)

func (*BootstrapCoreRepository) Migrations

func (r *BootstrapCoreRepository) Migrations() []Migration

func (*BootstrapCoreRepository) Reload added in v0.2.0

Reload refreshes the repository snapshot from PostgreSQL without emitting write-side effects. Future online repair flows call this before rehydrating live service caches after direct database mutations.

func (*BootstrapCoreRepository) SaveBootstrapCore

func (r *BootstrapCoreRepository) SaveBootstrapCore(state bootstrap.BootstrapCoreState) error

type CookbookArtifactBundle

type CookbookArtifactBundle struct {
	Artifact CookbookArtifactRecord
	Files    []CookbookArtifactFileRecord
}

type CookbookArtifactFileRecord

type CookbookArtifactFileRecord struct {
	Organization string
	Name         string
	Identifier   string
	Ordinal      int
	FileName     string
	FilePath     string
	Checksum     string
	Specificity  string
}

type CookbookArtifactRecord

type CookbookArtifactRecord struct {
	Organization string
	Name         string
	Identifier   string
	Version      string
	ChefType     string
	Frozen       bool
	MetadataJSON []byte
}

type CookbookOrganizationRecord

type CookbookOrganizationRecord struct {
	Name     string
	FullName string
}

type CookbookRepository

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

func (*CookbookRepository) DecodeCookbookArtifact

func (r *CookbookRepository) DecodeCookbookArtifact(bundle CookbookArtifactBundle) (bootstrap.CookbookArtifact, error)

func (*CookbookRepository) DecodeCookbookVersion

func (r *CookbookRepository) DecodeCookbookVersion(bundle CookbookVersionBundle) (bootstrap.CookbookVersion, error)

func (*CookbookRepository) EncodeCookbookArtifact

func (r *CookbookRepository) EncodeCookbookArtifact(orgName string, artifact bootstrap.CookbookArtifact) (CookbookArtifactBundle, error)

func (*CookbookRepository) EncodeCookbookVersion

func (r *CookbookRepository) EncodeCookbookVersion(orgName string, version bootstrap.CookbookVersion) (CookbookVersionBundle, error)

func (*CookbookRepository) Migrations

func (r *CookbookRepository) Migrations() []Migration

func (*CookbookRepository) OrganizationRecords

func (r *CookbookRepository) OrganizationRecords() []CookbookOrganizationRecord

func (*CookbookRepository) Reload added in v0.2.0

func (r *CookbookRepository) Reload(ctx context.Context) error

Reload refreshes the in-process cookbook repository snapshot from PostgreSQL. This is the cookbook-side cache invalidation seam needed before any direct database repair can safely become online.

type CookbookVersionBundle

type CookbookVersionBundle struct {
	Version CookbookVersionRecord
	Files   []CookbookVersionFileRecord
}

type CookbookVersionFileRecord

type CookbookVersionFileRecord struct {
	Organization string
	CookbookName string
	Version      string
	Ordinal      int
	Name         string
	Path         string
	Checksum     string
	Specificity  string
}

type CookbookVersionRecord

type CookbookVersionRecord struct {
	Organization string
	CookbookName string
	Version      string
	FullName     string
	JSONClass    string
	ChefType     string
	Frozen       bool
	MetadataJSON []byte
}

func (CookbookVersionRecord) CookbookType

func (r CookbookVersionRecord) CookbookType() string

type CoreDataBagItemRecord

type CoreDataBagItemRecord struct {
	Organization string
	BagName      string
	ItemID       string
	PayloadJSON  []byte
}

type CoreObjectACLRecord

type CoreObjectACLRecord struct {
	Organization string
	ACLKey       string
	ACLJSON      []byte
}

type CoreObjectJSONRecord

type CoreObjectJSONRecord struct {
	Organization string
	Name         string
	PayloadJSON  []byte
}

type CoreObjectRepository

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

func (*CoreObjectRepository) DecodeCoreObjects

func (r *CoreObjectRepository) DecodeCoreObjects(rows CoreObjectRows) (bootstrap.CoreObjectState, error)

func (*CoreObjectRepository) EncodeCoreObjects

func (r *CoreObjectRepository) EncodeCoreObjects(state bootstrap.CoreObjectState) (CoreObjectRows, error)

func (*CoreObjectRepository) LoadCoreObjects

func (r *CoreObjectRepository) LoadCoreObjects() (bootstrap.CoreObjectState, error)

func (*CoreObjectRepository) Migrations

func (r *CoreObjectRepository) Migrations() []Migration

func (*CoreObjectRepository) Reload added in v0.2.0

func (r *CoreObjectRepository) Reload(ctx context.Context) error

Reload refreshes the repository snapshot from PostgreSQL without indexing or write-path side effects. Live services can use it before reloading their in-memory core object maps after a controlled direct repair.

func (*CoreObjectRepository) SaveCoreObjects

func (r *CoreObjectRepository) SaveCoreObjects(state bootstrap.CoreObjectState) error

type CoreObjectRows

type CoreObjectRows struct {
	Environments     []CoreObjectJSONRecord
	Nodes            []CoreObjectJSONRecord
	Roles            []CoreObjectJSONRecord
	DataBags         []CoreObjectJSONRecord
	DataBagItems     []CoreDataBagItemRecord
	PolicyRevisions  []CorePolicyRevisionRecord
	PolicyGroups     []CoreObjectJSONRecord
	Sandboxes        []CoreSandboxRecord
	SandboxChecksums []CoreSandboxChecksumRecord
	ACLs             []CoreObjectACLRecord
}

type CorePolicyRevisionRecord

type CorePolicyRevisionRecord struct {
	Organization string
	PolicyName   string
	RevisionID   string
	PayloadJSON  []byte
}

type CoreSandboxChecksumRecord

type CoreSandboxChecksumRecord struct {
	Organization string
	SandboxID    string
	Ordinal      int
	Checksum     string
}

type CoreSandboxRecord

type CoreSandboxRecord struct {
	Organization string
	ID           string
	CreatedAt    time.Time
}

type MaintenanceRepository added in v0.2.0

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

func (*MaintenanceRepository) Check added in v0.2.0

Check evaluates whether the persisted maintenance state should currently block writes while preserving expired state for truthful diagnostics.

func (*MaintenanceRepository) Disable added in v0.2.0

Disable clears the singleton active maintenance row. The operation is idempotent so cleanup can be retried safely after interrupted admin flows.

func (*MaintenanceRepository) Enable added in v0.2.0

Enable normalizes and persists an active maintenance window. Active PostgreSQL repositories upsert the singleton row so repeated enable commands are deterministic and cross-process visible.

func (*MaintenanceRepository) Migrations added in v0.2.0

func (r *MaintenanceRepository) Migrations() []Migration

Migrations exposes the maintenance schema migration for startup activation and migration-exposure tests.

func (*MaintenanceRepository) Read added in v0.2.0

Read returns the current maintenance state. Once activated, it reads through PostgreSQL on every call so sibling OpenCook processes observe the same gate.

type Migration

type Migration struct {
	Name string `json:"name"`
	SQL  string `json:"sql"`
}

type Status

type Status struct {
	Driver     string `json:"driver"`
	Configured bool   `json:"configured"`
	Message    string `json:"message"`
}

type Store

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

func New

func New(dsn string) *Store

func (*Store) ActivateCookbookPersistence

func (s *Store) ActivateCookbookPersistence(ctx context.Context) error

func (*Store) ActivateCookbookPersistenceWithDB

func (s *Store) ActivateCookbookPersistenceWithDB(ctx context.Context, db *sql.DB) error

ActivateCookbookPersistenceWithDB activates all PostgreSQL-backed persistence repositories on an existing connection. The historical name remains because callers already use it as the app-wide PostgreSQL activation seam.

func (*Store) BootstrapCore

func (s *Store) BootstrapCore() *BootstrapCoreRepository

func (*Store) BootstrapCorePersistenceActive

func (s *Store) BootstrapCorePersistenceActive() bool

func (*Store) Close

func (s *Store) Close() error

func (*Store) Configured

func (s *Store) Configured() bool

func (*Store) CookbookPersistenceActive

func (s *Store) CookbookPersistenceActive() bool

func (*Store) CookbookStore

func (s *Store) CookbookStore() bootstrap.CookbookStore

func (*Store) Cookbooks

func (s *Store) Cookbooks() *CookbookRepository

func (*Store) CoreObjectPersistenceActive

func (s *Store) CoreObjectPersistenceActive() bool

func (*Store) CoreObjects

func (s *Store) CoreObjects() *CoreObjectRepository

func (*Store) Maintenance added in v0.2.0

func (s *Store) Maintenance() *MaintenanceRepository

Maintenance returns the repository used for operator-visible maintenance state. It is process-local before activation and PostgreSQL-backed after the parent store activates persistence.

func (*Store) MaintenancePersistenceActive added in v0.2.0

func (s *Store) MaintenancePersistenceActive() bool

MaintenancePersistenceActive reports whether the shared PostgreSQL maintenance-state repository is active for this store.

func (*Store) Name

func (s *Store) Name() string

func (*Store) ReloadPersistence added in v0.2.0

func (s *Store) ReloadPersistence(ctx context.Context) error

ReloadPersistence refreshes repository snapshots that are otherwise cached in-process. It loads every snapshot before publishing any of them, preventing future repair flows from mixing fresh cookbook state with stale identity or core-object state after a mid-reload failure.

func (*Store) Status

func (s *Store) Status() Status

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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