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

models

package
v2.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package models provides Database Lab struct.

Index

Constants

View Source
const (
	StatusOK        StatusCode = "OK"
	StatusCreating  StatusCode = "CREATING"
	StatusResetting StatusCode = "RESETTING"
	StatusDeleting  StatusCode = "DELETING"
	StatusExporting StatusCode = "EXPORTING"
	StatusFatal     StatusCode = "FATAL"

	CloneMessageOK        = "Clone is ready to accept Postgres connections."
	CloneMessageCreating  = "Clone is being created."
	CloneMessageResetting = "Clone is being reset."
	CloneMessageDeleting  = "Clone is being deleted."
	CloneMessageFatal     = "Cloning failure."

	InstanceMessageOK = "Instance is ready"
)

Constants declares available status codes and messages.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checklist

type Checklist struct {
	Duration bool `json:"session_duration_acceptable"`
	Locks    bool `json:"no_long_dangerous_locks"`
}

Checklist represents a list of observation checks.

type Clone

type Clone struct {
	ID        string        `json:"id"`
	Snapshot  *Snapshot     `json:"snapshot"`
	Protected bool          `json:"protected"`
	DeleteAt  string        `json:"deleteAt"`
	CreatedAt string        `json:"createdAt"`
	Status    Status        `json:"status"`
	DB        Database      `json:"db"`
	Metadata  CloneMetadata `json:"metadata"`
}

Clone defines a clone model.

type CloneMetadata

type CloneMetadata struct {
	CloneDiffSize   uint64  `json:"cloneDiffSize"`
	CloneDiffSizeHR string  `json:"cloneDiffSizeHR"`
	CloningTime     float64 `json:"cloningTime"`
	MaxIdleMinutes  uint    `json:"maxIdleMinutes"`
}

CloneMetadata contains fields describing a clone model.

type Database

type Database struct {
	ConnStr  string `json:"connStr"`
	Host     string `json:"host"`
	Port     string `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type Error

type Error struct {
	Code    ErrorCode `json:"code"`
	Message string    `json:"message"`
}

Error struct represents a response error.

func New

func New(code ErrorCode, message string) *Error

New creates ClientError instance with given code and message.

func (Error) Error

func (e Error) Error() string

Error prints an error message.

type ErrorCode

type ErrorCode string

ErrorCode defines a response error type.

const (
	ErrCodeInternal     ErrorCode = "INTERNAL_ERROR"
	ErrCodeBadRequest   ErrorCode = "BAD_REQUEST"
	ErrCodeUnauthorized ErrorCode = "UNAUTHORIZED"
	ErrCodeNotFound     ErrorCode = "NOT_FOUND"
)

ErrCode constants define a response error codes.

type FileSystem

type FileSystem struct {
	Size   uint64 `json:"size"`
	SizeHR string `json:"sizeHR"`
	Free   uint64 `json:"free"`
	FreeHR string `json:"freeHR"`
	Used   uint64 `json:"used"`
	UsedHR string `json:"usedHR"`
}

FileSystem describes state of a file system.

type Health

type Health struct {
	Version string `json:"engine_version"`
}

Health represents a response for heath-check requests.

type InstanceStatus

type InstanceStatus struct {
	Status              *Status     `json:"status"`
	FileSystem          *FileSystem `json:"fileSystem"`
	DataSize            uint64      `json:"dataSize"`
	DataSizeHR          string      `json:"dataSizeHR"`
	ExpectedCloningTime float64     `json:"expectedCloningTime"`
	NumClones           uint64      `json:"numClones"`
	Clones              []*Clone    `json:"clones"`
}

type Interval

type Interval struct {
	StartedAt time.Time `json:"started_at"`
	Duration  float64   `json:"duration"`
	Warning   string    `json:"warning"`
}

Interval represents data of an observation interval.

type ObservationResult

type ObservationResult struct {
	Status    string     `json:"status"`
	Intervals []Interval `json:"intervals"`
	Summary   Summary    `json:"summary"`
}

ObservationResult represents a result of observation session.

type PatchCloneRequest

type PatchCloneRequest struct {
	Protected bool `json:"protected"`
}

PatchCloneRequest defines a struct for clone updating.

type Snapshot

type Snapshot struct {
	ID          string `json:"id"`
	CreatedAt   string `json:"createdAt"`
	DataStateAt string `json:"dataStateAt"`
}

type Status

type Status struct {
	Code    StatusCode `json:"code"`
	Message string     `json:"message"`
}

Status defines the status of clones and instance.

type StatusCode

type StatusCode string

StatusCode defines the status code of clones and instance.

type Summary

type Summary struct {
	TotalDuration    float64   `json:"total_duration"`
	TotalIntervals   uint      `json:"total_intervals"`
	WarningIntervals uint      `json:"warning_intervals"`
	Checklist        Checklist `json:"checklist"`
}

Summary represents a summary of observation.

Jump to

Keyboard shortcuts

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