Help us shape the future of Go! Take the 2026 Go Developer Survey

mysql

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

Package mysql implements the Percona Server for MySQL control-plane core.

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArtifactPins

func ArtifactPins(version string) (server, backup string, err error)

ArtifactPins resolves a supported server release to its immutable server and backup catalog keys.

func GeneratePassword

func GeneratePassword() (string, error)

func PrepareCommands

func PrepareCommands(version, owner string) ([]string, error)

PrepareCommands verifies and installs the locked server and matching backup tools.

func ValidateDatabaseName

func ValidateDatabaseName(name string) error

func ValidateGrant

func ValidateGrant(grant Grant) error

func ValidatePassword

func ValidatePassword(password string) error

func ValidateUserName

func ValidateUserName(name string) error

func ValidateUserPatch

func ValidateUserPatch(patch UserPatch) error

func ValidateUserWrite

func ValidateUserWrite(user UserWrite) error

Types

type Access

Access is the native MySQL account API, also shared by compatible providers.

Implementations must resolve the live writable member on every call and send bounded AccessRequests to /v1/mysql/access-{users,databases,grants}. All users are at host '%' and REQUIRE SSL. Hidden native accounts/schemas cannot be read or changed. RoutableThroughProxy is true only for accounts whose current credentials are owned by the sealed managed-user index, never for SQL-created accounts discovered by observation.

Before any user mutation, seal a pending intent containing the exact request, any generated password, stable random RequestID, prior credential/index snapshot, and intended proxy revision. Never put these secrets in cluster state, logs, operation status, or receipts. Replay this SAME intent until the member's AccessResult proves applied or rejected; an unknown outcome preserves it and blocks subsequent credential mutations. MySQL account DDL implicitly commits: the member atomically attaches an operation marker to the account DDL and reconciles its receipt table from that marker, not a fictitious SQL transaction. After application, seal current (and retained secondary, if requested) credentials and managed-user index before publishing the matching ProxySQL configuration revision. Resume interrupted publication before new mutations. Definitive rejection restores the prior sealed snapshot. Creation must not adopt a foreign native account. Retained passwords require both credentials to remain usable through every proxy until discard completes; reject the operation before SQL if the deployed proxy cannot represent that contract. Delete waits for its durable account tombstone before removing sealed credentials and the managed index and publishing a new proxy revision. Pending deletion can drop only the original native marker; an applied tombstone never removes a subsequently recreated account. Serialize access mutations with lifecycle changes, and never report success before required proxy configuration acknowledgements.

CreateUser returns the generated password (empty when supplied by the caller). RotateUserPassword always returns the new generated password exactly once. DeleteDatabase refuses a nonempty database unless force is true. ListGrants requires at least one of the user and database filters.

type BinlogOptions

type BinlogOptions struct {
	ArchiveInterval int `json:"archiveInterval,omitempty"`
	ExpireSeconds   int `json:"expireSeconds,omitempty"`
}

type Core

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

func New

func New(o Options) *Core

func (*Core) ApplyDefaults

func (p *Core) ApplyDefaults(s *domain.ClusterSpec)

func (*Core) Balancer

func (*Core) CanCancelOperation

func (*Core) CanCancelOperation(_ context.Context, op *domain.Operation) error

func (*Core) CanClaimOperation

func (*Core) CanClaimOperation(c *domain.Cluster) (bool, error)

func (*Core) CancelOperation

func (p *Core) CancelOperation(_ context.Context, rc *engine.Context, op *domain.Operation) (engine.OpResult, error)

CancelOperation is also invoked for terminal queue failure. The saved source, group UUID and receipt remain owned by reconciliation rather than un-fencing partially restored data or choosing another source after a crash.

func (*Core) Cleanup

func (p *Core) Cleanup(ctx context.Context, rc *engine.Context, opts domain.DeleteOptions) (done bool, err error)

func (*Core) Connection

func (p *Core) Connection(ctx context.Context, rc *engine.Context) (domain.ConnectionDetails, error)

func (*Core) CreateDatabase

func (p *Core) CreateDatabase(ctx context.Context, rc *engine.Context, db Database) error

func (*Core) CreateDatabaseRole

func (*Core) CreateDatabaseRole(context.Context, *engine.Context, domain.DatabaseRole) error

func (*Core) CreateDatabaseUser

func (*Core) CreateDatabaseUser(context.Context, *engine.Context, domain.DatabaseUser, string) (string, error)

func (*Core) CreateUser

func (p *Core) CreateUser(ctx context.Context, rc *engine.Context, user UserWrite) (string, error)

func (*Core) DataMembers

func (*Core) DataMembers(c *domain.Cluster) []string

func (*Core) DeleteDatabase

func (p *Core) DeleteDatabase(ctx context.Context, rc *engine.Context, name string, force bool) error

func (*Core) DeleteDatabaseRole

func (*Core) DeleteDatabaseRole(context.Context, *engine.Context, string, string) error

func (*Core) DeleteDatabaseUser

func (*Core) DeleteDatabaseUser(context.Context, *engine.Context, string, string) error

func (*Core) DeleteRetainedBackup

func (p *Core) DeleteRetainedBackup(ctx context.Context, storage domain.BackupStorage, b domain.Backup) error

func (*Core) DeleteUser

func (p *Core) DeleteUser(ctx context.Context, rc *engine.Context, name string) error

func (*Core) Describe

func (p *Core) Describe() domain.ProviderInfo

func (*Core) DiscardOldPassword

func (p *Core) DiscardOldPassword(ctx context.Context, rc *engine.Context, name string) error

func (*Core) EnqueueFullBackup

func (p *Core) EnqueueFullBackup(ctx context.Context, rc *engine.Context, key string) error

func (*Core) FilterRetention

func (*Core) FilterRetention(backups, candidates []domain.Backup) []domain.Backup

func (*Core) GetDatabase

func (p *Core) GetDatabase(ctx context.Context, rc *engine.Context, name string) (*Database, error)

func (*Core) GetDatabaseRole

func (*Core) GetDatabaseRole(context.Context, *engine.Context, string, string) (*domain.DatabaseRole, error)

func (*Core) GetDatabaseUser

func (*Core) GetDatabaseUser(context.Context, *engine.Context, string, string) (*domain.DatabaseUser, error)

func (*Core) GetUser

func (p *Core) GetUser(ctx context.Context, rc *engine.Context, name string) (*User, error)

func (*Core) Grant

func (p *Core) Grant(ctx context.Context, rc *engine.Context, grant Grant) error

func (*Core) InitialDataSourceApplied added in v0.4.2

func (*Core) InitialDataSourceApplied(c *domain.Cluster) (bool, error)

InitialDataSourceApplied reports the durable initial restore completion receipt. Native health and the observed spec generation do not establish data import.

func (*Core) ListDatabaseRoles

func (*Core) ListDatabaseRoles(context.Context, *engine.Context) ([]domain.DatabaseRole, error)

func (*Core) ListDatabaseUsers

func (*Core) ListDatabaseUsers(context.Context, *engine.Context) ([]domain.DatabaseUser, error)

func (*Core) ListDatabases

func (p *Core) ListDatabases(ctx context.Context, rc *engine.Context) ([]Database, error)

func (*Core) ListGrants

func (p *Core) ListGrants(ctx context.Context, rc *engine.Context, user, database string) ([]Grant, error)

func (*Core) ListUsers

func (p *Core) ListUsers(ctx context.Context, rc *engine.Context) ([]User, error)

func (*Core) MemberConfig

func (p *Core) MemberConfig(ctx context.Context, rc *engine.Context, name string) (agentapi.MemberConfig, error)

func (*Core) MemberLogs

func (*Core) MemberLogs(ctx context.Context, rc *engine.Context, name, process string, lines int) ([]domain.MemberLogLine, error)

func (*Core) Metrics

func (*Core) Metrics() []domain.MetricDescriptor

Metrics maps the native runner's stable vocabulary into canonical series.

func (*Core) Name

func (p *Core) Name() string

func (*Core) PITRWindow

func (p *Core) PITRWindow(ctx context.Context, rc *engine.Context) ([]domain.TimeWindow, error)

func (*Core) PatchUser

func (p *Core) PatchUser(ctx context.Context, rc *engine.Context, name string, patch UserPatch) error

func (*Core) Placement

func (p *Core) Placement(ctx context.Context, rc *engine.Context) (domain.Placement, error)

func (*Core) RelayTargets

func (*Core) RelayTargets(c *domain.Cluster) []string

func (*Core) RequiredCapabilities

func (*Core) RequiredCapabilities(s domain.ClusterSpec) []string

func (*Core) Revoke

func (p *Core) Revoke(ctx context.Context, rc *engine.Context, grant Grant) error

func (*Core) RotateUserPassword

func (p *Core) RotateUserPassword(ctx context.Context, rc *engine.Context, name string, retain bool) (string, error)

func (*Core) RunOperation

func (p *Core) RunOperation(ctx context.Context, rc *engine.Context, op *domain.Operation) (engine.OpResult, error)

RunOperation's closed dispatch prevents unsupported maintenance from mutating data.

func (*Core) SetBalancer

func (*Core) SetBalancer(context.Context, *engine.Context, bool) error

func (*Core) Status

func (p *Core) Status(ctx context.Context, rc *engine.Context) (status domain.ClusterStatus, err error)

func (*Core) SupportsFailureCleanup

func (*Core) SupportsFailureCleanup(op *domain.Operation) bool

func (*Core) Sync

func (p *Core) Sync(ctx context.Context, rc *engine.Context) (result engine.Result, err error)

func (*Core) SyncDuringOperation

func (*Core) SyncDuringOperation(op *domain.Operation) bool

Sync is excluded during queued operations. Their checkpoints alone own holds; after terminal failure the durable backup state transfers ownership to Sync.

func (*Core) SystemUsers

func (*Core) SystemUsers(context.Context, *engine.Context) ([]domain.SystemUser, error)

func (*Core) UpdateDatabaseRole

func (*Core) UpdateDatabaseRole(context.Context, *engine.Context, domain.DatabaseRole) error

func (*Core) UpdateDatabaseUser

func (*Core) UpdateDatabaseUser(context.Context, *engine.Context, domain.DatabaseUser, string) error

func (*Core) UpgradeBackupReady

func (p *Core) UpgradeBackupReady(ctx context.Context, c *domain.Cluster, secrets engine.SecretStore) bool

UpgradeBackupReady admits the prerequisite backup while a major upgrade is parked before its first side effect. The last published configuration digest must match exactly after reverting only the desired version; this is not an exception for arbitrary unobserved changes or other maintenance.

func (*Core) Validate

func (p *Core) Validate(ctx context.Context, old, n *domain.Cluster) error

func (*Core) ValidateBackup

func (p *Core) ValidateBackup(ctx context.Context, rc *engine.Context, backupType string) error

ValidateBackup performs fresh admission independently of cached cluster phase.

func (*Core) ValidateDatabasePassword

func (*Core) ValidateDatabasePassword(password string) error

func (*Core) ValidatePITRRestore

func (p *Core) ValidatePITRRestore(ctx context.Context, rc *engine.Context, target time.Time) ([]domain.TimeWindow, error)

func (*Core) VolumeReferences added in v0.4.1

func (*Core) VolumeReferences(c *domain.Cluster) ([]engine.VolumeReference, error)

VolumeReferences exposes persistent identities for backend sizing observation.

type Database

type Database = myspec.Database

type EngineOptions

type EngineOptions struct {
	Parameters       map[string]string       `json:"parameters,omitempty"`
	Proxy            ProxyOptions            `json:"proxy,omitempty"`
	GroupReplication GroupReplicationOptions `json:"groupReplication,omitempty"`
	Binlog           BinlogOptions           `json:"binlog,omitempty"`
}

func ParseOptions

func ParseOptions(raw json.RawMessage) (EngineOptions, error)

ParseOptions rejects unknown options and settings owned by the orchestrator.

type Grant

type Grant = myspec.Grant

type GroupReplicationOptions

type GroupReplicationOptions struct {
	Consistency                string `json:"consistency,omitempty"`
	UnreachableMajorityTimeout int    `json:"unreachableMajorityTimeout,omitempty"`
}

type Options

type Options struct {
	ControlPlaneURL, InternalCAPEM string
	Store                          engine.ClusterStore
	Logger                         *slog.Logger
	Provider                       string
}

type ProxyOptions

type ProxyOptions struct {
	ReadWriteSplit bool `json:"readWriteSplit,omitempty"`
	ReaderPort     bool `json:"readerPort,omitempty"`
}

type User

type User = myspec.User

type UserPatch

type UserPatch = myspec.UserPatch

type UserWrite

type UserWrite = myspec.UserWrite

Directories

Path Synopsis
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors
SPDX-License-Identifier: Apache-2.0 Copyright 2026 The Karakoram Authors

Jump to

Keyboard shortcuts

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