platform

package
v0.0.0-...-414c732 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotFoundBackup BackupState = iota
	PreparingBackup
	ProvisingBackup
	ValidatingBackup
	FinishBackup

	DefaultNamespaceToLocateBackupJob = "default"
	DefaultRsyncImageForBackup        = "alpinelinux/rsyncd"
	DefaultHeaderOfBackupHook         = "#!/bin/sh"
	DefaultMountPointOfBackupScript   = "/data/exec"
	DefaultCommandToBackupVolumes     = ""
	DefaultPreHookForBackup           = ""
	DefaultPostHookForaBackup         = ""
)

Variables

View Source
var (
	DefaultExecuterToProvisionBackup = []string{"/bin/sh", "-c", "/data/exec"}
)

Functions

This section is empty.

Types

type Backup

type Backup interface {
	Prepare(uuid string) error
	Backup() error
}

func NewBackup

func NewBackup(
	client kubernetes.Kubernetes,
) Backup

func NewCustomBackup

func NewCustomBackup(
	client kubernetes.Kubernetes,
	hook kubernetes.Hook,
) Backup

type BackupFullSetup

type BackupFullSetup interface {
	Backup

	GetStatus() (map[string]BackupState, error)
	SetStatus(uuid string, status BackupState) error

	SetClient(client kubernetes.Kubernetes)
	SetNamespace(namespace string)
	SetVolumes(volumes []corev1.PersistentVolumeClaim)
	SetCommand(command string)
	SetService(service string)
}

type BackupModel

type BackupModel struct {
	BaseModel

	Namespace string      `gorm:"index:idx_namespace" json:"namespace"`
	Volume    string      `gorm:"primaryKey,index:idx_volume" json:"volume"`
	Service   string      `gorm:"index:idx_service" json:"service"`
	Image     string      `json:"image"`
	State     BackupState `json:"state"`
}

type BackupState

type BackupState int

type BaseModel

type BaseModel struct {
	UUID      string    `gorm:"primaryKey" json:"uuid"`
	CreatedAt time.Time `gorm:"autoCreateTime" json:"create_at"`
	UpdatedAt time.Time `gorm:"autoUpdateTime" json:"update_at"`
}

type Cdc

type Cdc interface {
	Monitor()
}

type Database

type Database interface {
	GetPg(namespace string) ([]Pg, error)
	GetMongo(namespace string) ([]Mongo, error)
	GetElasticsearch(namespace string) ([]Elasticsearch, error)
}

type Elasticsearch

type Elasticsearch interface {
}

type Eventuate

type Eventuate interface {
	GetKafka(namespace string) ([]Kafka, error)
	GetRabbitMQ(namespace string) ([]RabbitMQ, error)
}

type Kafka

type Kafka interface {
}

type Maintenance

type Maintenance interface {
	Expand(percent int) error
	Unlock() error
	Lock() error
}

type Mongo

type Mongo interface {
}

type Monitor

type Monitor interface {
	Log()
	Cpu()
	Memory()
}

type Pg

type Pg interface {
	Monitor
	Backup
	Maintenance
}

func GetPgFromPodList

func GetPgFromPodList(
	client kubernetes.Kubernetes,
	podList ...*corev1.PodList,
) ([]Pg, error)

func NewPg

func NewPg(client kubernetes.Kubernetes, pod corev1.Pod) (Pg, error)

type PgModel

type PgModel struct {
	BaseModel

	Cluster string `gorm:"index:idx_cluster_id" json:"cluster"`
	Volume  string `json:"volume"`
	Label   string `json:"label"`
	Primary bool   `json:"primary"`
	Usage   int    `gorm:"index:idx_usage" json:"usage"`
}

type Platform

type Platform interface {
	Database

	GetCdc(namespace string) ([]Cdc, error)
	GetRedis(namespace string) ([]Redis, error)
}

type RabbitMQ

type RabbitMQ interface {
}

type Redis

type Redis interface {
}

type VersionModel

type VersionModel struct {
	BaseModel

	Kind    string `gorm:"index:idx_kind" json:"kind"`
	Version string `gorm:"index:idx_version" json:"version"`
}

Jump to

Keyboard shortcuts

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