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

ocimysql

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 36 Imported by: 0

README

OCI MySQL HeatWave Database Service

Parity grade: B · SDK github.com/oracle/oci-go-sdk/v65@v65.126.2 · last audited 2026-10-29 (0ac1daf25)

Coverage

Metric Value
PARITY entries audited 32 (30 ok, 2 partial)
Feature families 7 (5 ok, 2 partial)
Known gaps 9
Deferred items 0
Resource leaks unknown
Known gaps
  • HeatWave cluster operations (AddHeatWaveCluster, GetHeatWaveCluster, UpdateHeatWaveCluster, DeleteHeatWaveCluster, Start/Stop/RestartHeatWaveCluster, the memory estimate operations) are not routed; isHeatWaveClusterAttached is always false.
  • Read replicas (CreateReplica and friends), blue/green deployments, ControlledUpdateDbSystem, GenerateDbSystemStatus/GetDbSystemStatus, ListMaintenanceEvents, CopyBackup, ExportBackup, ValidateBackup, CancelBackupDeletion, GenerateChannelStatus/GetChannelStatus and CancelWorkRequest are not routed.
  • Source types PITR and IMPORTURL for CreateDbSystem are rejected 400; the PITR policy flag is stored and pointInTimeRecoveryDetails reports creation time to now, but no point-in-time restore exists.
  • Channels are state only: no replication is configured on the target server, the source is never contacted and statuses are not generated.
  • Configuration variables are validated and stored but not applied to the MySQL server, even under the docker engine; shutdownType, crashRecovery, databaseMode, accessMode, isHighlyAvailable (a single container), secureConnections, rest, databaseConsole, readEndpoint and maintenance schedules are stored and echoed only.
  • Backups are logical dumps (mysqldump of user schemas, no accounts) held in the service state and in persistence snapshots, not in Object Storage; INCREMENTAL backups are full dumps; softDelete/DELETE_SCHEDULED is not modelled. A backup taken before the docker engine was enabled restores to an empty server.
  • Under the docker engine the endpoint is 127.0.0.1 with a random published port; portX (X protocol) is not published and the configured port/portX only apply to the state-only endpoint.
  • Shape and version catalogues are representative (documented shape names; 8.0.39-8.0.42, 8.4.3-8.4.6, 9.1.0-9.4.0), the free-shape HA rule, the 1 to 35 day automatic and 1 to 365 day manual retention ranges, the 50 to 131072 GB storage range and the reserved administrator names come from the Oracle documentation and SDK comments on 2026-10-29; default ordering, DELETED visibility in lists and the exact 400 versus 404 for dangling references are unverified.
  • opc-retry-token idempotency, service limits, IAM policy checks, resource principals and instance principals are not applied; only API-key signatures are verified.

More

Documentation

Index

Constants

View Source
const (
	EngineStub   = "stub"
	EngineDocker = "docker"
)

Engine modes (OCI_MYSQL_ENGINE).

View Source
const DefaultPort = 8159

DefaultPort is the dedicated listener's default TCP port.

View Source
const (
	// Region is the emulated region name.
	Region = "us-ashburn-1"
)

Variables

View Source
var ErrNilAppContext = errors.New("ocimysql: nil app context")

ErrNilAppContext is returned when Init is called with a nil AppContext.

View Source
var ErrSnapshotNull = errors.New("ocimysql: null entry in snapshot")

ErrSnapshotNull is returned when a snapshot contains a null entry.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    string
	Message string
	Status  int
}

APIError is an OCI error response: HTTP status plus the `code` and `message` body fields.

func (*APIError) Error

func (e *APIError) Error() string

type Backup

type Backup struct {
	TimeCreated   time.Time  `json:"timeCreated"`
	TimeUpdated   time.Time  `json:"timeUpdated"`
	TransitionAt  *time.Time `json:"transitionAt,omitempty"`
	Snapshot      *DBSystem  `json:"snapshot,omitempty"`
	Tags          Tags       `json:"tags"`
	ID            string     `json:"id"`
	CompartmentID string     `json:"compartmentId"`
	DBSystemID    string     `json:"dbSystemId"`
	Name          string     `json:"displayName"`
	Description   string     `json:"description,omitempty"`
	State         string     `json:"state"`
	Details       string     `json:"details,omitempty"`
	BackupType    string     `json:"backupType"`
	CreationType  string     `json:"creationType"`
	SoftDelete    string     `json:"softDelete"`
	Etag          string     `json:"etag"`
	Dump          []byte     `json:"dump,omitempty"`
	Retention     int        `json:"retentionInDays"`
	SizeGB        int        `json:"backupSizeInGBs"`
	Seq           int64      `json:"seq"`
}

Backup is a DB system backup. Dump holds the logical dump when the docker engine took it.

type BackupListIn

type BackupListIn struct {
	Compartment  string
	ID           string
	DBSystemID   string
	Name         string
	State        string
	CreationType string
	ListOpts
}

BackupListIn are the ListBackups filters.

type BackupPolicy

type BackupPolicy struct {
	Tags            Tags            `json:"tags"`
	WindowStartTime string          `json:"windowStartTime"`
	SoftDelete      string          `json:"softDelete"`
	CopyPolicies    json.RawMessage `json:"copyPolicies,omitempty"`
	RetentionInDays int             `json:"retentionInDays"`
	IsEnabled       bool            `json:"isEnabled"`
	PitrEnabled     bool            `json:"pitrEnabled"`
}

BackupPolicy is the automatic backup policy of a DB system.

type BackupPolicyIn

type BackupPolicyIn struct {
	Tags
	IsEnabled       *bool                      `json:"isEnabled"`
	PitrPolicy      *struct{ IsEnabled *bool } `json:"pitrPolicy"`
	WindowStartTime *string                    `json:"windowStartTime"`
	RetentionInDays *int                       `json:"retentionInDays"`
	SoftDelete      string                     `json:"softDelete"`
	CopyPolicies    json.RawMessage            `json:"copyPolicies"`
}

BackupPolicyIn is the create/update backup policy.

type Channel

type Channel struct {
	TimeCreated   time.Time     `json:"timeCreated"`
	TimeUpdated   time.Time     `json:"timeUpdated"`
	Tags          Tags          `json:"tags"`
	TransitionAt  *time.Time    `json:"transitionAt,omitempty"`
	Details       string        `json:"details,omitempty"`
	ID            string        `json:"id"`
	CompartmentID string        `json:"compartmentId"`
	Name          string        `json:"displayName"`
	Description   string        `json:"description,omitempty"`
	State         string        `json:"state"`
	After         string        `json:"after,omitempty"`
	Etag          string        `json:"etag"`
	Target        ChannelTarget `json:"target"`
	Source        ChannelSource `json:"source"`
	Seq           int64         `json:"seq"`
	Enabled       bool          `json:"isEnabled"`
}

Channel is a replication channel. It records configuration and lifecycle only; no data is replicated.

type ChannelListIn

type ChannelListIn struct {
	Compartment string
	DBSystemID  string
	ID          string
	Name        string
	State       string
	IsEnabled   *bool
	ListOpts
}

ChannelListIn are the ListChannels filters.

type ChannelSource

type ChannelSource struct {
	Extra       map[string]json.RawMessage `json:"extra,omitempty"`
	SourceType  string                     `json:"sourceType"`
	Hostname    string                     `json:"hostname"`
	Username    string                     `json:"username"`
	SslMode     string                     `json:"sslMode"`
	Port        int                        `json:"port"`
	HasPassword bool                       `json:"hasPassword"`
}

ChannelSource is the replication source of a channel; the password is never stored.

type ChannelSourceIn

type ChannelSourceIn struct {
	Port       *int   `json:"port"`
	SourceType string `json:"sourceType"`
	Hostname   string `json:"hostname"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	SslMode    string `json:"sslMode"`
}

ChannelSourceIn is the channel source details; the password is validated and discarded.

type ChannelTarget

type ChannelTarget struct {
	TargetType                      string          `json:"targetType"`
	DBSystemID                      string          `json:"dbSystemId"`
	ChannelName                     string          `json:"channelName"`
	ApplierUsername                 string          `json:"applierUsername"`
	TablesWithoutPrimaryKeyHandling string          `json:"tablesWithoutPrimaryKeyHandling"`
	Filters                         json.RawMessage `json:"filters,omitempty"`
	DelayInSeconds                  int             `json:"delayInSeconds"`
}

ChannelTarget is the DB system a channel replicates into.

type ChannelTargetIn

type ChannelTargetIn struct {
	DelayInSeconds                  *int            `json:"delayInSeconds"`
	TargetType                      string          `json:"targetType"`
	DBSystemID                      string          `json:"dbSystemId"`
	ChannelName                     string          `json:"channelName"`
	ApplierUsername                 string          `json:"applierUsername"`
	TablesWithoutPrimaryKeyHandling string          `json:"tablesWithoutPrimaryKeyHandling"`
	Filters                         json.RawMessage `json:"filters"`
}

ChannelTargetIn is the channel target details.

type ConfigListIn

type ConfigListIn struct {
	Compartment string
	ID          string
	State       string
	Name        string
	Shape       string
	Types       []string
	ListOpts
}

ConfigListIn are the ListConfigurations filters.

type ConfigProvider

type ConfigProvider interface {
	GetOCIMySQLSettings() Settings
}

ConfigProvider extracts OCI MySQL configuration from the AppContext Config.

type Configuration

type Configuration struct {
	TimeCreated   time.Time      `json:"timeCreated"`
	TimeUpdated   time.Time      `json:"timeUpdated"`
	Variables     map[string]any `json:"variables"`
	Tags          Tags           `json:"tags"`
	ID            string         `json:"id"`
	CompartmentID string         `json:"compartmentId"`
	Shape         string         `json:"shapeName"`
	Type          string         `json:"type"`
	State         string         `json:"state"`
	Name          string         `json:"displayName"`
	Description   string         `json:"description,omitempty"`
	ParentID      string         `json:"parentConfigurationId,omitempty"`
	LowerCase     string         `json:"lowerCaseTableNames,omitempty"`
	Etag          string         `json:"etag"`
	Seq           int64          `json:"seq"`
}

Configuration is a DEFAULT or CUSTOM set of MySQL variables for a shape.

type CreateBackupIn

type CreateBackupIn struct {
	Tags
	Retention   *int   `json:"retentionInDays"`
	DBSystemID  string `json:"dbSystemId"`
	Name        string `json:"displayName"`
	Description string `json:"description"`
	SoftDelete  string `json:"softDelete"`
	BackupType  string `json:"backupType"`
}

CreateBackupIn is the CreateBackup body.

type CreateChannelIn

type CreateChannelIn struct {
	Tags
	IsEnabled     *bool           `json:"isEnabled"`
	Source        ChannelSourceIn `json:"source"`
	CompartmentID string          `json:"compartmentId"`
	DisplayName   string          `json:"displayName"`
	Description   string          `json:"description"`
	Target        ChannelTargetIn `json:"target"`
}

CreateChannelIn is the CreateChannel body.

type CreateConfigurationIn

type CreateConfigurationIn struct {
	Tags
	Variables     map[string]any `json:"variables"`
	InitVariables *struct {
		LowerCaseTableNames string `json:"lowerCaseTableNames"`
	} `json:"initVariables"`
	CompartmentID string `json:"compartmentId"`
	ShapeName     string `json:"shapeName"`
	DisplayName   string `json:"displayName"`
	Description   string `json:"description"`
	ParentID      string `json:"parentConfigurationId"`
}

CreateConfigurationIn is the CreateConfiguration body.

type CreateDBSystemIn

type CreateDBSystemIn struct {
	Tags
	Extra             map[string]json.RawMessage `json:"-"`
	IsHighlyAvailable *bool                      `json:"isHighlyAvailable"`
	DataStorageGBs    *int                       `json:"dataStorageSizeInGBs"`
	Port              *int                       `json:"port"`
	PortX             *int                       `json:"portX"`
	DataStorage       *DataStorageIn             `json:"dataStorage"`
	BackupPolicy      *BackupPolicyIn            `json:"backupPolicy"`
	Source            *SourceIn                  `json:"source"`
	DeletionPolicy    *DeletionPolicyIn          `json:"deletionPolicy"`
	Maintenance       map[string]any             `json:"maintenance"`
	Description       string                     `json:"description"`
	AdminPassword     string                     `json:"adminPassword"`
	DisplayName       string                     `json:"displayName"`
	ShapeName         string                     `json:"shapeName"`
	AvailabilityDom   string                     `json:"availabilityDomain"`
	FaultDomain       string                     `json:"faultDomain"`
	ConfigurationID   string                     `json:"configurationId"`
	MysqlVersion      string                     `json:"mysqlVersion"`
	AdminUsername     string                     `json:"adminUsername"`
	SubnetID          string                     `json:"subnetId"`
	HostnameLabel     string                     `json:"hostnameLabel"`
	IPAddress         string                     `json:"ipAddress"`
	CrashRecovery     string                     `json:"crashRecovery"`
	DBManagement      string                     `json:"databaseManagement"`
	DatabaseMode      string                     `json:"databaseMode"`
	AccessMode        string                     `json:"accessMode"`
	CompartmentID     string                     `json:"compartmentId"`
}

CreateDBSystemIn is the CreateDBSystem body.

type DBSystem

type DBSystem struct {
	TimeCreated    time.Time                  `json:"timeCreated"`
	TimeUpdated    time.Time                  `json:"timeUpdated"`
	LastAutoBackup time.Time                  `json:"lastAutoBackup"`
	Tags           Tags                       `json:"tags"`
	TransitionAt   *time.Time                 `json:"transitionAt,omitempty"`
	Source         *Source                    `json:"source,omitempty"`
	Extra          map[string]json.RawMessage `json:"extra,omitempty"`
	Maintenance    map[string]any             `json:"maintenance,omitempty"`
	FD             string                     `json:"faultDomain"`
	AdminUser      string                     `json:"adminUsername"`
	ID             string                     `json:"id"`
	CompartmentID  string                     `json:"compartmentId"`
	Name           string                     `json:"displayName"`
	Description    string                     `json:"description,omitempty"`
	SubnetID       string                     `json:"subnetId"`
	Shape          string                     `json:"shapeName"`
	Version        string                     `json:"mysqlVersion"`
	ConfigID       string                     `json:"configurationId"`
	Hostname       string                     `json:"hostnameLabel,omitempty"`
	AD             string                     `json:"availabilityDomain"`
	EngineHost     string                     `json:"engineHost,omitempty"`
	State          string                     `json:"state"`
	After          string                     `json:"after,omitempty"`
	Details        string                     `json:"details,omitempty"`
	Etag           string                     `json:"etag"`
	IP             string                     `json:"ipAddress"`
	AdminPass      string                     `json:"adminPassword,omitempty"`
	RootSecret     string                     `json:"rootSecret,omitempty"`
	DatabaseMode   string                     `json:"databaseMode"`
	AccessMode     string                     `json:"accessMode"`
	CrashRecovery  string                     `json:"crashRecovery"`
	DBManagement   string                     `json:"databaseManagement"`
	Deletion       DeletionPolicy             `json:"deletionPolicy"`
	BackupPolicy   BackupPolicy               `json:"backupPolicy"`
	DataGB         int                        `json:"dataStorageSizeInGBs"`
	MaxGB          int                        `json:"maxStorageSizeInGBs,omitempty"`
	Port           int                        `json:"port"`
	PortX          int                        `json:"portX"`
	EnginePort     int                        `json:"enginePort,omitempty"`
	Seq            int64                      `json:"seq"`
	AutoExpand     bool                       `json:"isAutoExpandStorageEnabled"`
	HA             bool                       `json:"isHighlyAvailable"`
}

DBSystem is a MySQL DB system. AdminPassword and RootSecret are never returned by the API.

type DBSystemListIn

type DBSystemListIn struct {
	Compartment     string
	ID              string
	Name            string
	State           string
	ConfigurationID string
	HeatWave        *bool
	ListOpts
}

DBSystemListIn are the ListDBSystems filters.

type DataStorageIn

type DataStorageIn struct {
	IsAutoExpandStorageEnabled *bool `json:"isAutoExpandStorageEnabled"`
	MaxStorageSizeInGBs        *int  `json:"maxStorageSizeInGBs"`
}

DataStorageIn is dataStorage.

type DeletionPolicy

type DeletionPolicy struct {
	AutomaticBackupRetention string `json:"automaticBackupRetention"`
	FinalBackup              string `json:"finalBackup"`
	IsDeleteProtected        bool   `json:"isDeleteProtected"`
}

DeletionPolicy controls what DeleteDBSystem does.

type DeletionPolicyIn

type DeletionPolicyIn struct {
	IsDeleteProtected        *bool  `json:"isDeleteProtected"`
	AutomaticBackupRetention string `json:"automaticBackupRetention"`
	FinalBackup              string `json:"finalBackup"`
}

DeletionPolicyIn is the create/update deletion policy.

type Doc

type Doc = map[string]any

Doc is a JSON object response body.

type DockerConfig

type DockerConfig struct {
	Runtime      mysqlengine.Runtime
	Volumes      container.VolumeRuntime
	Ports        *portalloc.Allocator
	Logger       *slog.Logger
	Image        string
	StartTimeout time.Duration
}

DockerConfig configures the docker engine: each DB system runs a mysql container with a named data volume.

type EngineConfigProvider

type EngineConfigProvider interface {
	GetOCIMySQLEngine() string
}

EngineConfigProvider exposes the effective engine mode (stub or docker).

type Handler

type Handler struct {
	Backend *InMemoryBackend

	Port        int
	EnforceAuth bool
	// contains filtered or unexported fields
}

Handler serves OCI MySQL HeatWave Database Service.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a Handler; callers override Port and EnforceAuth from Settings.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name for metrics.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the addressed resource id for metrics.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations lists the supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler for all OCIMySQL requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority is irrelevant because RouteMatcher never matches.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all in-memory state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher never matches: OCIMySQL runs on its own listener.

func (*Handler) Shutdown

func (h *Handler) Shutdown(ctx context.Context)

Shutdown stops the listener and the sweeper.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

func (*Handler) StartWorker

func (h *Handler) StartWorker(ctx context.Context) error

StartWorker binds the dedicated listener synchronously so a port conflict is returned to the caller.

func (*Handler) Trusted

func (h *Handler) Trusted() echo.HandlerFunc

Trusted returns a handler that skips request-signature verification, for the in-process dashboard proxy.

type InMemoryBackend

type InMemoryBackend struct {
	Auth *ociauth.Registry
	// contains filtered or unexported fields
}

InMemoryBackend holds every DB system, backup, channel, configuration and work request under one lock.

func NewInMemoryBackend

func NewInMemoryBackend() *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) ChangeBackupCompartment

func (b *InMemoryBackend) ChangeBackupCompartment(id, ifMatch, compartment string) error

ChangeBackupCompartment moves a backup to another compartment.

func (*InMemoryBackend) Close

func (b *InMemoryBackend) Close()

Close stops engine goroutines and removes the servers; data volumes are kept.

func (*InMemoryBackend) Compartments

func (b *InMemoryBackend) Compartments() []string

Compartments lists the distinct compartments that hold DB systems.

func (*InMemoryBackend) CreateBackup

func (b *InMemoryBackend) CreateBackup(in CreateBackupIn) (Doc, string, string, error)

CreateBackup starts a manual backup of an ACTIVE DB system.

func (*InMemoryBackend) CreateChannel

func (b *InMemoryBackend) CreateChannel(in CreateChannelIn) (Doc, string, string, error)

CreateChannel creates a replication channel record.

func (*InMemoryBackend) CreateConfiguration

func (b *InMemoryBackend) CreateConfiguration(in CreateConfigurationIn) (Doc, string, error)

CreateConfiguration creates a CUSTOM configuration.

func (*InMemoryBackend) CreateDBSystem

func (b *InMemoryBackend) CreateDBSystem(in CreateDBSystemIn) (Doc, string, string, error)

CreateDBSystem creates a DB system in CREATING state and returns its body, etag and work request.

func (*InMemoryBackend) DeleteBackup

func (b *InMemoryBackend) DeleteBackup(id, ifMatch string) (string, error)

DeleteBackup deletes a backup and returns its work request.

func (*InMemoryBackend) DeleteChannel

func (b *InMemoryBackend) DeleteChannel(id, ifMatch string) (string, error)

DeleteChannel deletes a channel.

func (*InMemoryBackend) DeleteConfiguration

func (b *InMemoryBackend) DeleteConfiguration(id, ifMatch string) error

DeleteConfiguration deletes a custom configuration that no DB system uses.

func (*InMemoryBackend) DeleteDBSystem

func (b *InMemoryBackend) DeleteDBSystem(id, ifMatch string) (string, error)

DeleteDBSystem deletes a DB system, honouring its deletion policy.

func (*InMemoryBackend) EnableDockerEngine

func (b *InMemoryBackend) EnableDockerEngine(cfg DockerConfig) error

EnableDockerEngine switches the backend to docker mode. Call it before serving.

func (*InMemoryBackend) GetBackup

func (b *InMemoryBackend) GetBackup(id string) (Doc, string, error)

GetBackup returns one backup.

func (*InMemoryBackend) GetChannel

func (b *InMemoryBackend) GetChannel(id string) (Doc, string, error)

GetChannel returns one channel.

func (*InMemoryBackend) GetConfiguration

func (b *InMemoryBackend) GetConfiguration(id string) (Doc, string, error)

GetConfiguration returns a default or custom configuration.

func (*InMemoryBackend) GetDBSystem

func (b *InMemoryBackend) GetDBSystem(id string) (Doc, string, error)

GetDBSystem returns one DB system.

func (*InMemoryBackend) GetWorkRequest

func (b *InMemoryBackend) GetWorkRequest(id string) (WorkRequestWire, error)

GetWorkRequest returns one work request.

func (*InMemoryBackend) ListBackups

func (b *InMemoryBackend) ListBackups(in BackupListIn) (page.Page[Doc], error)

ListBackups lists the backups of a compartment.

func (*InMemoryBackend) ListChannels

func (b *InMemoryBackend) ListChannels(in ChannelListIn) (page.Page[Doc], error)

ListChannels lists the channels of a compartment.

func (*InMemoryBackend) ListConfigurations

func (b *InMemoryBackend) ListConfigurations(in ConfigListIn) (page.Page[Doc], error)

ListConfigurations lists the default configurations and the custom ones of a compartment.

func (*InMemoryBackend) ListDBSystems

func (b *InMemoryBackend) ListDBSystems(in DBSystemListIn) (page.Page[Doc], error)

ListDBSystems lists the DB systems of a compartment.

func (*InMemoryBackend) ListShapes

func (b *InMemoryBackend) ListShapes(compartment string, supportedFor []string, name string) ([]Doc, error)

ListShapes lists the documented MySQL shapes.

func (*InMemoryBackend) ListVersions

func (b *InMemoryBackend) ListVersions(compartment string) ([]Doc, error)

ListVersions lists the available MySQL versions by family.

func (*InMemoryBackend) ListWorkRequests

func (b *InMemoryBackend) ListWorkRequests(compartment string, o ListOpts) (page.Page[WorkRequestWire], error)

ListWorkRequests lists the work requests of a compartment.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all state and tears down engine servers.

func (*InMemoryBackend) ResetChannel

func (b *InMemoryBackend) ResetChannel(id, ifMatch string) (string, error)

ResetChannel resets a channel's replication state.

func (*InMemoryBackend) RestartDBSystem

func (b *InMemoryBackend) RestartDBSystem(id, ifMatch string) (string, error)

RestartDBSystem restarts an ACTIVE DB system.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a snapshot and relaunches engine servers.

func (*InMemoryBackend) ResumeChannel

func (b *InMemoryBackend) ResumeChannel(id, ifMatch string) (string, error)

ResumeChannel enables a channel.

func (*InMemoryBackend) SetClock

func (b *InMemoryBackend) SetClock(now func() time.Time)

SetClock injects the time source used for lifecycle transitions, backup windows and retention.

func (*InMemoryBackend) SetCompartmentChecker

func (b *InMemoryBackend) SetCompartmentChecker(fn func(string) bool)

SetCompartmentChecker validates compartmentId arguments against another service (OCI Identity).

func (*InMemoryBackend) SetLauncher

func (b *InMemoryBackend) SetLauncher(l Launcher, image string)

SetLauncher switches the backend to engine mode with a custom Launcher; image overrides the per-version image.

func (*InMemoryBackend) SetNetwork

func (b *InMemoryBackend) SetNetwork(n Network)

SetNetwork wires subnet validation and endpoint address allocation against OCI Core; nil disconnects.

func (*InMemoryBackend) SetTransition

func (b *InMemoryBackend) SetTransition(d time.Duration)

SetTransition sets how long CREATING, UPDATING and DELETING states last without the docker engine.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state, including registered API keys.

func (*InMemoryBackend) StartDBSystem

func (b *InMemoryBackend) StartDBSystem(id, ifMatch string) (string, error)

StartDBSystem starts an INACTIVE DB system.

func (*InMemoryBackend) StopDBSystem

func (b *InMemoryBackend) StopDBSystem(id, ifMatch string) (string, error)

StopDBSystem stops an ACTIVE DB system; data is kept.

func (*InMemoryBackend) Sweep

func (b *InMemoryBackend) Sweep()

Sweep applies due lifecycle transitions, automatic backups and backup retention against the backend clock.

func (*InMemoryBackend) UpdateBackup

func (b *InMemoryBackend) UpdateBackup(id, ifMatch string, in UpdateBackupIn) (Doc, string, error)

UpdateBackup updates a backup in place.

func (*InMemoryBackend) UpdateChannel

func (b *InMemoryBackend) UpdateChannel(id, ifMatch string, in UpdateChannelIn) (string, error)

UpdateChannel updates a channel and returns its work request.

func (*InMemoryBackend) UpdateConfiguration

func (b *InMemoryBackend) UpdateConfiguration(id, ifMatch string, in UpdateConfigurationIn) (Doc, string, error)

UpdateConfiguration updates a custom configuration.

func (*InMemoryBackend) UpdateDBSystem

func (b *InMemoryBackend) UpdateDBSystem(id, ifMatch string, in UpdateDBSystemIn) (string, error)

UpdateDBSystem updates a DB system and returns its work request.

func (*InMemoryBackend) WorkRequestErrors

func (b *InMemoryBackend) WorkRequestErrors(id string, o ListOpts) (page.Page[wrErrorWire], error)

WorkRequestErrors returns the errors of a work request.

func (*InMemoryBackend) WorkRequestLogs

func (b *InMemoryBackend) WorkRequestLogs(id string, o ListOpts) (page.Page[wrLogWire], error)

WorkRequestLogs returns the log entries of a work request.

type Instance

type Instance interface {
	Endpoint() (string, int)
	EnsureAdmin(ctx context.Context, user, password string) error
	DropUser(ctx context.Context, user string) error
	Stop(ctx context.Context) error
	Start(ctx context.Context) error
	Dump(ctx context.Context) ([]byte, error)
	Restore(ctx context.Context, data []byte) error
	// Close removes the server; purge also deletes its data volume.
	Close(ctx context.Context, purge bool)
}

Instance is one running MySQL server of a DB system.

type LaunchSpec

type LaunchSpec struct {
	ID         string
	Image      string
	RootSecret string
	Fresh      bool
}

LaunchSpec describes the server of one DB system. Fresh discards any earlier data volume.

type Launcher

type Launcher interface {
	Launch(ctx context.Context, spec LaunchSpec) (Instance, error)
	RemoveVolume(ctx context.Context, id string)
}

Launcher starts servers.

type ListOpts

type ListOpts struct {
	SortBy string
	Order  string
	Page   string
	Limit  int
}

ListOpts carries the shared list query parameters.

type Network

type Network interface {
	Subnet(id string) (SubnetInfo, bool)
}

Network is the narrow view of OCI Core the service needs.

type Provider

type Provider struct{}

Provider implements service.Provider for OCI MySQL. It runs on its own listener (see Handler.StartWorker) and never matches on the shared AWS router.

func (*Provider) Init

Init creates the backend and handler; the port is bound in StartWorker.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the service provider name.

type Settings

type Settings struct {
	Engine string `` //nolint:lll // config struct tags are intentionally verbose
	/* 201-byte string literal not displayed */
	Port int `` //nolint:lll // config struct tags are intentionally verbose
	/* 204-byte string literal not displayed */
	EnforceAuth bool `` //nolint:lll // config struct tags are intentionally verbose
	/* 221-byte string literal not displayed */
}

Settings holds service-level configuration, embedded in the root CLI as CLI.OCIMySQL.

func DefaultSettings

func DefaultSettings() Settings

DefaultSettings returns the settings used when no ConfigProvider is available.

type Source

type Source struct {
	SourceType string `json:"sourceType"`
	BackupID   string `json:"backupId,omitempty"`
}

Source says where a DB system's data came from.

type SourceIn

type SourceIn struct {
	SourceType string `json:"sourceType"`
	BackupID   string `json:"backupId"`
}

SourceIn is the create source details.

type SubnetInfo

type SubnetInfo struct {
	ID                 string
	VcnID              string
	AvailabilityDomain string
	CIDR               string
}

SubnetInfo is the slice of an OCI Core subnet the service validates references against.

type Tags

type Tags struct {
	FreeformTags map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags  map[string]map[string]any `json:"definedTags,omitempty"`
}

Tags are the shared freeform and defined tag sets of a resource.

type UpdateBackupIn

type UpdateBackupIn struct {
	Tags
	Name        *string `json:"displayName"`
	Description *string `json:"description"`
	Retention   *int    `json:"retentionInDays"`
	SoftDelete  string  `json:"softDelete"`
}

UpdateBackupIn is the UpdateBackup body.

type UpdateChannelIn

type UpdateChannelIn struct {
	Tags
	IsEnabled   *bool           `json:"isEnabled"`
	DisplayName *string         `json:"displayName"`
	Description *string         `json:"description"`
	Source      ChannelSourceIn `json:"source"`
	Target      ChannelTargetIn `json:"target"`
}

UpdateChannelIn is the UpdateChannel body.

type UpdateConfigurationIn

type UpdateConfigurationIn struct {
	DisplayName *string `json:"displayName"`
	Description *string `json:"description"`
	Tags
}

UpdateConfigurationIn is the UpdateConfiguration body.

type UpdateDBSystemIn

type UpdateDBSystemIn struct {
	Tags
	DataStorageGBs *int                       `json:"dataStorageSizeInGBs"`
	HostnameLabel  *string                    `json:"hostnameLabel"`
	SubnetID       *string                    `json:"subnetId"`
	ShapeName      *string                    `json:"shapeName"`
	MysqlVersion   *string                    `json:"mysqlVersion"`
	ConfigID       *string                    `json:"configurationId"`
	AdminUsername  *string                    `json:"adminUsername"`
	Port           *int                       `json:"port"`
	Extra          map[string]json.RawMessage `json:"-"`
	IPAddress      *string                    `json:"ipAddress"`
	Description    *string                    `json:"description"`
	HA             *bool                      `json:"isHighlyAvailable"`
	AdminPassword  *string                    `json:"adminPassword"`
	PortX          *int                       `json:"portX"`
	DataStorage    *DataStorageIn             `json:"dataStorage"`
	BackupPolicy   *BackupPolicyIn            `json:"backupPolicy"`
	Deletion       *DeletionPolicyIn          `json:"deletionPolicy"`
	Maintenance    map[string]any             `json:"maintenance"`
	DisplayName    *string                    `json:"displayName"`
	DBManagement   string                     `json:"databaseManagement"`
	DatabaseMode   string                     `json:"databaseMode"`
	AccessMode     string                     `json:"accessMode"`
	CrashRecovery  string                     `json:"crashRecovery"`
}

UpdateDBSystemIn is the UpdateDBSystem body.

type WorkRequest

type WorkRequest struct {
	Accepted      time.Time  `json:"accepted"`
	FinishAt      *time.Time `json:"finishAt,omitempty"`
	ID            string     `json:"id"`
	Operation     string     `json:"operation"`
	CompartmentID string     `json:"compartmentId"`
	EntityType    string     `json:"entityType"`
	EntityID      string     `json:"entityId"`
	EntityURI     string     `json:"entityUri"`
	Action        string     `json:"action"`
	Failure       string     `json:"failure,omitempty"`
	Seq           int64      `json:"seq"`
}

WorkRequest records an asynchronous operation.

type WorkRequestWire

type WorkRequestWire struct {
	TimeAccepted    time.Time        `json:"timeAccepted"`
	TimeStarted     *time.Time       `json:"timeStarted,omitempty"`
	TimeFinished    *time.Time       `json:"timeFinished,omitempty"`
	OperationType   string           `json:"operationType"`
	Status          string           `json:"status"`
	ID              string           `json:"id"`
	CompartmentID   string           `json:"compartmentId"`
	Resources       []wrResourceWire `json:"resources"`
	PercentComplete float32          `json:"percentComplete"`
}

WorkRequestWire is the WorkRequest and WorkRequestSummary body.

Jump to

Keyboard shortcuts

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