branching

package
v0.64.4 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package branching defines optional database checkpoint and branching capabilities.

The contracts deliberately live beside dal rather than inside dal.DB. A provider can opt in without widening the mandatory data-access interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedCapability identifies a database configuration a provider
	// cannot safely checkpoint or branch.
	ErrUnsupportedCapability = errors.New("dalgo branching: unsupported capability")

	ErrNilSourceDB     = errors.New("dalgo branching: source database is nil")
	ErrNilBranchDB     = errors.New("dalgo branching: branch database is nil")
	ErrReleased        = errors.New("dalgo branching: checkpoint is released")
	ErrEmptyGeneration = errors.New("dalgo branching: checkpoint generation is empty")
)

Functions

This section is empty.

Types

type Branch

type Branch interface {
	DB() dal.DB
	Close(context.Context) error
}

Branch owns a fresh database handle. Close must be idempotent.

type Capability

type Capability struct {
	Provider string
	Version  string
	Mode     string
}

Capability is stable provider metadata recorded in a state-holder manifest.

type Checkpoint

type Checkpoint interface {
	Generation() string
	Branch(context.Context) (Branch, error)
	Release(context.Context) error
}

Checkpoint is immutable provider state from which fresh branches are created. Release must be idempotent.

type Provider

type Provider interface {
	Capability() Capability
	Capture(context.Context, dal.DB) (Checkpoint, error)
}

Provider captures immutable state from one source database.

type UnsupportedError

type UnsupportedError struct {
	Provider string
	Mode     string
	Reason   string
}

UnsupportedError names the provider mode rejected by an optional capability.

func (*UnsupportedError) Error

func (e *UnsupportedError) Error() string

func (*UnsupportedError) Unwrap

func (e *UnsupportedError) Unwrap() error

Unwrap supports errors.Is(err, ErrUnsupportedCapability).

Jump to

Keyboard shortcuts

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