persistence

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package persistence owns deployment settings, state blobs and SQL leases.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRetired     = errors.New("deployment store was retired by an explicit authority switch; select the current store")
	ErrConflict    = errors.New("deployment settings changed; reload before saving")
	ErrLocked      = errors.New("another deployment holds the lock")
	ErrLeaseLost   = errors.New("deployment lease lost; stop and inspect state")
	ErrUnavailable = errors.New("deployment store unavailable; check its connection reference and permissions")
)

Functions

func Authority

func Authority(root string, exclusive bool) (func(), error)

func Configure

func Configure(ctx context.Context, root string, options Options, expectedHash string) error

func ConfigureVersion

func ConfigureVersion(ctx context.Context, root string, options Options, expectedHash string, expectedRevision uint64) error

func Document

func Document(ctx context.Context, root string) (string, uint64, []byte, error)

func Hash

func Hash(raw []byte) string

func MergeDeploy

func MergeDeploy(file, settings []byte) ([]byte, error)

MergeDeploy keeps runtime project and build settings owned by the checkout.

func MetadataName

func MetadataName(path string) bool

Types

type Blob

type Blob struct {
	Scope   string
	Name    string
	Content []byte
}

type DB

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

func Open

func Open(ctx context.Context, root string, options Options) (*DB, error)

func OpenSelected

func OpenSelected(ctx context.Context, root string) (*DB, error)

func (*DB) Acquire

func (d *DB) Acquire(ctx context.Context, scope string) (*Lease, error)

func (*DB) Active

func (d *DB) Active(ctx context.Context) error

func (*DB) Blobs

func (d *DB) Blobs(ctx context.Context) ([]Blob, error)

func (*DB) Close

func (d *DB) Close() error

func (*DB) Read

func (d *DB) Read(ctx context.Context, scope, name string) ([]byte, error)

func (*DB) SaveSettings

func (d *DB) SaveSettings(ctx context.Context, expected uint64, raw []byte) error

func (*DB) Settings

func (d *DB) Settings(ctx context.Context) (uint64, []byte, error)

type Lease

type Lease struct {
	Scope string
	Fence uint64
	// contains filtered or unexported fields
}

func (*Lease) Append

func (l *Lease) Append(ctx context.Context, name string, raw []byte) error

func (*Lease) Context

func (l *Lease) Context(parent context.Context) context.Context

func (*Lease) GuardedBy

func (l *Lease) GuardedBy(gate *Lease) error

func (*Lease) Release

func (l *Lease) Release() error

func (*Lease) Renew

func (l *Lease) Renew(ctx context.Context) error

func (*Lease) SaveSettings

func (l *Lease) SaveSettings(ctx context.Context, expected uint64, raw []byte) error

func (*Lease) Write

func (l *Lease) Write(ctx context.Context, name string, raw []byte) error

type Options

type Options struct {
	Backend   string `json:"backend"`
	Reference string `json:"reference,omitempty"`
	Project   string `json:"project,omitempty"`
}

func Load

func Load(root string) (Options, error)

Jump to

Keyboard shortcuts

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