resources

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package resources defines models used for provisioning.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	CloneName   string
	DockerImage string
	Pool        Pool
	Host        string
	Port        uint
	DB          *DB
	NetworkID   string

	ContainerConf map[string]string
	// contains filtered or unexported fields
}

AppConfig currently stores Postgres configuration (other application in the future too).

func (*AppConfig) DataDir

func (c *AppConfig) DataDir() string

DataDir returns the path of clone data.

func (*AppConfig) ExtraConf

func (c *AppConfig) ExtraConf() map[string]string

ExtraConf returns a map with an extra configuration.

func (*AppConfig) SetExtraConf

func (c *AppConfig) SetExtraConf(extraConf map[string]string)

SetExtraConf sets a map with an extra configuration.

type DB

type DB struct {
	Username string
	DBName   string
}

DB describes a default database configuration.

type Disk

type Disk struct {
	Size     uint64
	Free     uint64
	Used     uint64
	DataSize uint64
}

Disk defines disk status. TODO(anatoly): Merge with disk from models?

type EphemeralUser

type EphemeralUser struct {
	// TODO(anatoly): Were private fields. How to keep them private?
	Name        string
	Password    string
	Restricted  bool
	AvailableDB string
}

EphemeralUser describes an ephemeral database user defined by Database Lab users.

type Pool

type Pool struct {
	Name           string
	Mode           string
	DSA            time.Time
	MountDir       string
	CloneSubDir    string
	DataSubDir     string
	SocketSubDir   string
	ObserverSubDir string
}

Pool describes a storage pool.

func NewPool

func NewPool(name string) *Pool

NewPool creates a new Pool.

func (Pool) ClonePath

func (p Pool) ClonePath(port uint) string

ClonePath returns a path to the initialized clone directory.

func (Pool) ClonesDir

func (p Pool) ClonesDir() string

ClonesDir returns a path to the clones directory of the storage pool.

func (Pool) DataDir

func (p Pool) DataDir() string

DataDir returns a path to the data directory of the storage pool.

func (Pool) IsEmpty

func (p Pool) IsEmpty() bool

IsEmpty checks if Pool is empty.

func (Pool) ObserverDir added in v2.4.0

func (p Pool) ObserverDir(port uint) string

ObserverDir returns a path to the observer directory of the storage pool.

func (Pool) SetDSA

func (p Pool) SetDSA(dsa time.Time)

SetDSA sets a dataStateAt value.

func (Pool) SocketCloneDir

func (p Pool) SocketCloneDir(name string) string

SocketCloneDir returns a path to the socket clone directory.

func (Pool) SocketDir

func (p Pool) SocketDir() string

SocketDir returns a path to the sockets directory of the storage pool.

type Session

type Session struct {
	ID   string
	Pool string

	// Database.
	Port          uint
	User          string
	SocketHost    string
	EphemeralUser EphemeralUser
	ExtraConfig   map[string]string
}

Session defines clone provision information and connection info.

type SessionState

type SessionState struct {
	CloneDiffSize uint64
}

SessionState defines current state of a Session.

type Snapshot

type Snapshot struct {
	ID          string
	CreatedAt   time.Time
	DataStateAt time.Time
}

Snapshot defines snapshot of the data with related meta-information.

Jump to

Keyboard shortcuts

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