databasecontrol

package
v0.3.0-alpha.1 Latest Latest
Warning

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

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

Documentation

Overview

Package databasecontrol owns Modary's privileged database assembly boundary. It is internal so consumers can receive database.Access but cannot construct, install, resolve, or operate migration and transaction control.

Index

Constants

View Source
const (
	SchemaRoleApplication = "application"
	SchemaRoleQueue       = "queue"
)
View Source
const SchemaProfileTable = "modary_schema_profile"

SchemaProfileTable is the framework-owned physical-schema role marker used by official database components to reject incompatible reuse.

View Source
const ServiceName = "modary.database-control"

ServiceName is the reserved internal service name used to install Control through the Module Host's typed service registry. It is internal to this repository; consumers cannot name Control or obtain the matching service key.

Variables

View Source
var ErrControlUnavailable = errors.New("database control is unavailable")

ErrControlUnavailable reports an invalid or unavailable privileged control.

Functions

func ContainsDependencyPanic

func ContainsDependencyPanic(err error) bool

ContainsDependencyPanic reports whether err contains the database dependency panic sentinel without dispatching caller-defined error methods.

func SchemaAdvisoryLockKey

func SchemaAdvisoryLockKey(driver, schema string) int64

SchemaAdvisoryLockKey gives every official component the same lock identity for a physical schema. PostgreSQL scopes advisory locks to one database, so the driver and schema name are sufficient within a connection.

Types

type Backend

type Backend interface {
	Driver() string
	ValidateMigration(string) error
	ReadExecutor(context.Context) (database.Executor, error)
	WriteExecutor(context.Context) (database.Executor, error)
	AdminExecutor(context.Context) (database.Executor, error)
	WithinTransaction(context.Context, func(context.Context) error) error
}

Backend is the complete privileged contract implemented by an official durable adapter. ReadExecutor and WriteExecutor supply the framework-owned consumer facade; the remaining methods own migration, administration, and transaction control. WithinTransaction follows the synchronous exactly-once private Runtime transaction contract and returns an exact framework outcome correlated with the callback error after rollback, or with the completion failure after commit or rollback fails. A nested failure may instead return rollback-pending proof after marking the outer transaction rollback-only. The callback is never retained, retried, overlapped, or called after return. A callback panic is rolled back and propagated without exposing its value.

type Control

type Control interface {
	Driver() string
	Access() database.Access
	Store() database.Store
	Executor(context.Context) (database.Executor, error)
	WithinTransaction(context.Context, func(context.Context) error) error
	ApplyMigrations(context.Context, string, fs.FS) error
	// contains filtered or unexported methods
}

Control is the internal capability used by Host assembly and official durable adapters. It is deliberately absent from package database.

func New

func New(backend Backend) (Control, error)

New validates one privileged adapter Backend and constructs its sole framework-owned public Access facade.

Jump to

Keyboard shortcuts

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