Documentation
¶
Index ¶
- Constants
- Variables
- type APIError
- type Backup
- type BackupListIn
- type BackupPolicy
- type BackupPolicyIn
- type Channel
- type ChannelListIn
- type ChannelSource
- type ChannelSourceIn
- type ChannelTarget
- type ChannelTargetIn
- type ConfigListIn
- type ConfigProvider
- type Configuration
- type CreateBackupIn
- type CreateChannelIn
- type CreateConfigurationIn
- type CreateDBSystemIn
- type DBSystem
- type DBSystemListIn
- type DataStorageIn
- type DeletionPolicy
- type DeletionPolicyIn
- type Doc
- type DockerConfig
- type EngineConfigProvider
- type Handler
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Shutdown(ctx context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- func (h *Handler) Trusted() echo.HandlerFunc
- type InMemoryBackend
- func (b *InMemoryBackend) ChangeBackupCompartment(id, ifMatch, compartment string) error
- func (b *InMemoryBackend) Close()
- func (b *InMemoryBackend) Compartments() []string
- func (b *InMemoryBackend) CreateBackup(in CreateBackupIn) (Doc, string, string, error)
- func (b *InMemoryBackend) CreateChannel(in CreateChannelIn) (Doc, string, string, error)
- func (b *InMemoryBackend) CreateConfiguration(in CreateConfigurationIn) (Doc, string, error)
- func (b *InMemoryBackend) CreateDBSystem(in CreateDBSystemIn) (Doc, string, string, error)
- func (b *InMemoryBackend) DeleteBackup(id, ifMatch string) (string, error)
- func (b *InMemoryBackend) DeleteChannel(id, ifMatch string) (string, error)
- func (b *InMemoryBackend) DeleteConfiguration(id, ifMatch string) error
- func (b *InMemoryBackend) DeleteDBSystem(id, ifMatch string) (string, error)
- func (b *InMemoryBackend) EnableDockerEngine(cfg DockerConfig) error
- func (b *InMemoryBackend) GetBackup(id string) (Doc, string, error)
- func (b *InMemoryBackend) GetChannel(id string) (Doc, string, error)
- func (b *InMemoryBackend) GetConfiguration(id string) (Doc, string, error)
- func (b *InMemoryBackend) GetDBSystem(id string) (Doc, string, error)
- func (b *InMemoryBackend) GetWorkRequest(id string) (WorkRequestWire, error)
- func (b *InMemoryBackend) ListBackups(in BackupListIn) (page.Page[Doc], error)
- func (b *InMemoryBackend) ListChannels(in ChannelListIn) (page.Page[Doc], error)
- func (b *InMemoryBackend) ListConfigurations(in ConfigListIn) (page.Page[Doc], error)
- func (b *InMemoryBackend) ListDBSystems(in DBSystemListIn) (page.Page[Doc], error)
- func (b *InMemoryBackend) ListShapes(compartment string, supportedFor []string, name string) ([]Doc, error)
- func (b *InMemoryBackend) ListVersions(compartment string) ([]Doc, error)
- func (b *InMemoryBackend) ListWorkRequests(compartment string, o ListOpts) (page.Page[WorkRequestWire], error)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) ResetChannel(id, ifMatch string) (string, error)
- func (b *InMemoryBackend) RestartDBSystem(id, ifMatch string) (string, error)
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) ResumeChannel(id, ifMatch string) (string, error)
- func (b *InMemoryBackend) SetClock(now func() time.Time)
- func (b *InMemoryBackend) SetCompartmentChecker(fn func(string) bool)
- func (b *InMemoryBackend) SetLauncher(l Launcher, image string)
- func (b *InMemoryBackend) SetNetwork(n Network)
- func (b *InMemoryBackend) SetTransition(d time.Duration)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) StartDBSystem(id, ifMatch string) (string, error)
- func (b *InMemoryBackend) StopDBSystem(id, ifMatch string) (string, error)
- func (b *InMemoryBackend) Sweep()
- func (b *InMemoryBackend) UpdateBackup(id, ifMatch string, in UpdateBackupIn) (Doc, string, error)
- func (b *InMemoryBackend) UpdateChannel(id, ifMatch string, in UpdateChannelIn) (string, error)
- func (b *InMemoryBackend) UpdateConfiguration(id, ifMatch string, in UpdateConfigurationIn) (Doc, string, error)
- func (b *InMemoryBackend) UpdateDBSystem(id, ifMatch string, in UpdateDBSystemIn) (string, error)
- func (b *InMemoryBackend) WorkRequestErrors(id string, o ListOpts) (page.Page[wrErrorWire], error)
- func (b *InMemoryBackend) WorkRequestLogs(id string, o ListOpts) (page.Page[wrLogWire], error)
- type Instance
- type LaunchSpec
- type Launcher
- type ListOpts
- type Network
- type Provider
- type Settings
- type Source
- type SourceIn
- type SubnetInfo
- type Tags
- type UpdateBackupIn
- type UpdateChannelIn
- type UpdateConfigurationIn
- type UpdateDBSystemIn
- type WorkRequest
- type WorkRequestWire
Constants ¶
const ( EngineStub = "stub" EngineDocker = "docker" )
Engine modes (OCI_MYSQL_ENGINE).
const DefaultPort = 8159
DefaultPort is the dedicated listener's default TCP port.
const (
// Region is the emulated region name.
Region = "us-ashburn-1"
)
Variables ¶
var ErrNilAppContext = errors.New("ocimysql: nil app context")
ErrNilAppContext is returned when Init is called with a nil AppContext.
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 ¶
APIError is an OCI error response: HTTP status plus the `code` and `message` body fields.
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 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 ¶
ExtractOperation returns the operation name for metrics.
func (*Handler) ExtractResource ¶
ExtractResource returns the addressed resource id for metrics.
func (*Handler) GetSupportedOperations ¶
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 ¶
MatchPriority is irrelevant because RouteMatcher never matches.
func (*Handler) RouteMatcher ¶
RouteMatcher never matches: OCIMySQL runs on its own listener.
func (*Handler) Snapshot ¶
Snapshot implements persistence.Persistable by delegating to the backend.
func (*Handler) StartWorker ¶
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 ¶
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 ¶
WorkRequestErrors returns the errors of a work request.
func (*InMemoryBackend) WorkRequestLogs ¶
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 ¶
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 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 ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init creates the backend and handler; the port is bound in StartWorker.
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 SubnetInfo ¶
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.