resources

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: AGPL-3.0 Imports: 4 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 EphemeralUser

type EphemeralUser struct {
	// TODO(anatoly): Were private fields. How to keep them private?
	Name        string `json:"name"`
	Password    string `json:"password"`
	Restricted  bool   `json:"restricted"`
	AvailableDB string `json:"availableDB"`
}

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

type Pool

type Pool struct {
	Name           string
	Mode           string
	DSA            time.Time
	PoolDirName    string
	MountDir       string
	CloneSubDir    string
	DataSubDir     string
	SocketSubDir   string
	ObserverSubDir string
	// contains filtered or unexported fields
}

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

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) SetStatus

func (p *Pool) SetStatus(status PoolStatus)

SetStatus sets a status to the pool.

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.

func (*Pool) Status

func (p *Pool) Status() PoolStatus

Status gets the pool status.

type PoolStatus

type PoolStatus string

PoolStatus represents a pool status.

const (
	// ActivePool defines an active pool status.
	ActivePool PoolStatus = "active"
	// RefreshingPool defines the status of a pool when data retrieval in progress.
	RefreshingPool PoolStatus = "refreshing"
	// EmptyPool defines the status of an inactive pool.
	EmptyPool PoolStatus = "empty"
)

type Session

type Session struct {
	ID   string `json:"id"`
	Pool string `json:"pool"`

	// Database.
	Port          uint              `json:"port"`
	User          string            `json:"user"`
	SocketHost    string            `json:"socketHost"`
	EphemeralUser EphemeralUser     `json:"ephemeralUser"`
	ExtraConfig   map[string]string `json:"extraConfig"`
}

Session defines clone provision information and connection info.

type SessionState

type SessionState struct {
	CloneDiffSize     uint64
	LogicalReferenced uint64
}

SessionState defines current state of a Session.

type Snapshot

type Snapshot struct {
	ID                string
	CreatedAt         time.Time
	DataStateAt       time.Time
	Used              uint64
	LogicalReferenced uint64
	Pool              string
}

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