provision

package
v3.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

Package provision provides an interface to provision Database Lab clones.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidConfig

func IsValidConfig(cfg Config) error

IsValidConfig defines a method for validation of a configuration.

func NewNoRoomError

func NewNoRoomError(errorMessage string) error

NewNoRoomError instances a new NoRoomError.

Types

type Config

type Config struct {
	PortPool          PortPool          `yaml:"portPool"`
	DockerImage       string            `yaml:"dockerImage"`
	UseSudo           bool              `yaml:"useSudo"`
	KeepUserPasswords bool              `yaml:"keepUserPasswords"`
	ContainerConfig   map[string]string `yaml:"containerConfig"`
}

Config defines configuration for provisioning.

type NoRoomError

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

NoRoomError defines a specific error type.

func (*NoRoomError) Error

func (e *NoRoomError) Error() string

type PortPool

type PortPool struct {
	From uint `yaml:"from"`
	To   uint `yaml:"to"`
}

PortPool describes an available port range for clones.

type Provisioner

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

Provisioner describes a struct for ports and clones management.

func New

func New(ctx context.Context, cfg *Config, dbCfg *resources.DB, docker *client.Client, pm *pool.Manager,
	instanceID, networkID string) (*Provisioner, error)

New creates a new Provisioner instance.

func (*Provisioner) ContainerOptions

func (p *Provisioner) ContainerOptions() models.ContainerOptions

ContainerOptions returns provisioner configuration for running containers.

func (*Provisioner) DetectDBVersion

func (p *Provisioner) DetectDBVersion() string

DetectDBVersion detects version of the database.

func (*Provisioner) FreePort

func (p *Provisioner) FreePort(port uint) error

FreePort marks the port as free.

func (*Provisioner) GetPoolEntryList

func (p *Provisioner) GetPoolEntryList() []models.PoolEntry

GetPoolEntryList provides an ordered list of available pools.

func (*Provisioner) GetSessionState

func (p *Provisioner) GetSessionState(s *resources.Session) (*resources.SessionState, error)

GetSessionState describes the state of the session.

func (*Provisioner) GetSnapshots

func (p *Provisioner) GetSnapshots() ([]resources.Snapshot, error)

GetSnapshots provides a snapshot list from active pools.

func (*Provisioner) Init

func (p *Provisioner) Init() error

Init inits provision.

func (*Provisioner) IsCloneRunning

func (p *Provisioner) IsCloneRunning(ctx context.Context, cloneName string) bool

IsCloneRunning checks if clone is running.

func (*Provisioner) LastSessionActivity

func (p *Provisioner) LastSessionActivity(session *resources.Session, minimumTime time.Time) (*time.Time, error)

LastSessionActivity returns the time of the last session activity.

func (*Provisioner) ReconnectClone

func (p *Provisioner) ReconnectClone(ctx context.Context, cloneName string) error

ReconnectClone disconnects clone from the old instance network and connect to the actual one.

func (*Provisioner) Reload

func (p *Provisioner) Reload(cfg Config, dbCfg resources.DB)

Reload reloads provision configuration.

func (*Provisioner) ResetSession

func (p *Provisioner) ResetSession(session *resources.Session, snapshotID string) (*models.Snapshot, error)

ResetSession resets an existing session.

func (*Provisioner) RevisePortPool

func (p *Provisioner) RevisePortPool() error

RevisePortPool checks and aligns availability of the port range.

func (*Provisioner) StartCloneContainer

func (p *Provisioner) StartCloneContainer(ctx context.Context, containerName string) error

StartCloneContainer starts clone container.

func (*Provisioner) StartSession

func (p *Provisioner) StartSession(snapshotID string, user resources.EphemeralUser,
	extraConfig map[string]string) (*resources.Session, error)

StartSession starts a new session.

func (*Provisioner) StopAllSessions

func (p *Provisioner) StopAllSessions(exceptClones map[string]struct{}) error

StopAllSessions stops all running clone containers.

func (*Provisioner) StopSession

func (p *Provisioner) StopSession(session *resources.Session) error

StopSession stops an existing session.

Directories

Path Synopsis
databases
postgres
Package postgres provides an interface to work Postgres application.
Package postgres provides an interface to work Postgres application.
postgres/pgconfig
Package pgconfig provides tools for work with Postgres configuration.
Package pgconfig provides tools for work with Postgres configuration.
Package docker provides an interface to work with Docker containers.
Package docker provides an interface to work with Docker containers.
Package pool provides components to work with storage pools.
Package pool provides components to work with storage pools.
Package resources defines models used for provisioning.
Package resources defines models used for provisioning.
Package runners provides an interface to execute commands.
Package runners provides an interface to execute commands.
Package thinclones provides an interface to work different thin-clone managers.
Package thinclones provides an interface to work different thin-clone managers.
lvm
Package lvm provides an interface to work with LVM2.
Package lvm provides an interface to work with LVM2.
zfs
Package zfs provides an interface to work with ZFS.
Package zfs provides an interface to work with ZFS.

Jump to

Keyboard shortcuts

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