engineapi

package
v0.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CurrentCLIVersion indicates the API version manager used to talk with the
	// engine, including `longhorn-engine` and `longhorn-engine-launcher`
	CurrentCLIVersion = 1

	ControllerDefaultPort     = "9501"
	EngineLauncherDefaultPort = "9510"
	ReplicaDefaultPort        = "9502"

	DefaultISCSIPort = "3260"
	DefaultISCSILUN  = "1"

	FrontendISCSI    = "tgt-iscsi"
	FrontendBlockDev = "tgt-blockdev"
)
View Source
const (
	VolumeHeadName = "volume-head"
)

Variables

This section is empty.

Functions

func CheckCLICompatibilty

func CheckCLICompatibilty(cliVersion, cliMinVersion int) error

func GetBackupURL

func GetBackupURL(backupTarget, backupName, volName string) string

func GetControllerDefaultURL

func GetControllerDefaultURL(ip string) string

func GetEngineLauncherDefaultURL

func GetEngineLauncherDefaultURL(ip string) string

func GetIPFromURL

func GetIPFromURL(url string) string

func GetReplicaDefaultURL

func GetReplicaDefaultURL(ip string) string

func ValidateReplicaURL

func ValidateReplicaURL(url string) error

Types

type Backup

type Backup struct {
	Name            string            `json:"name"`
	URL             string            `json:"url"`
	SnapshotName    string            `json:"snapshotName"`
	SnapshotCreated string            `json:"snapshotCreated"`
	Created         string            `json:"created"`
	Size            string            `json:"size"`
	Labels          map[string]string `json:"labels"`
	VolumeName      string            `json:"volumeName"`
	VolumeSize      string            `json:"volumeSize"`
	VolumeCreated   string            `json:"volumeCreated"`
}

type BackupTarget

type BackupTarget struct {
	URL        string
	Image      string
	Credential map[string]string
}

func NewBackupTarget

func NewBackupTarget(backupTarget, engineImage string, credential map[string]string) *BackupTarget

func (*BackupTarget) DeleteBackup

func (b *BackupTarget) DeleteBackup(backupURL string) error

func (*BackupTarget) ExecuteEngineBinary

func (b *BackupTarget) ExecuteEngineBinary(args ...string) (string, error)

func (*BackupTarget) GetBackup

func (b *BackupTarget) GetBackup(backupURL string) (*Backup, error)

func (*BackupTarget) GetVolume

func (b *BackupTarget) GetVolume(volumeName string) (*BackupVolume, error)

func (*BackupTarget) List

func (b *BackupTarget) List(volumeName string) ([]*Backup, error)

func (*BackupTarget) ListVolumes

func (b *BackupTarget) ListVolumes() (map[string]*BackupVolume, error)

func (*BackupTarget) LonghornEngineBinary

func (b *BackupTarget) LonghornEngineBinary() string

type BackupVolume

type BackupVolume struct {
	Name           string                             `json:"name"`
	Size           string                             `json:"size"`
	Created        string                             `json:"created"`
	LastBackupName string                             `json:"lastBackupName"`
	LastBackupAt   string                             `json:"lastBackupAt"`
	DataStored     string                             `json:"dataStored"`
	Messages       map[backupstore.MessageType]string `json:"messages"`
	Backups        map[string]*Backup                 `json:"backups"`
	BaseImage      string                             `json:"baseImage"`
}

type Controller

type Controller struct {
	URL    string
	NodeID string
}

type Engine

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

func (*Engine) BackupRestore

func (e *Engine) BackupRestore(backup string) error

func (*Engine) BackupRestoreIncrementally added in v0.5.0

func (e *Engine) BackupRestoreIncrementally(backupTarget, backupName, backupVolume, lastRestored string) error

func (*Engine) Endpoint

func (e *Engine) Endpoint() (string, error)

func (*Engine) ExecuteEngineBinary

func (e *Engine) ExecuteEngineBinary(args ...string) (string, error)

func (*Engine) ExecuteEngineBinaryWithTimeout

func (e *Engine) ExecuteEngineBinaryWithTimeout(timeout time.Duration, args ...string) (string, error)

func (*Engine) ExecuteEngineLauncherBinary

func (e *Engine) ExecuteEngineLauncherBinary(args ...string) (string, error)

func (*Engine) Info added in v0.5.0

func (e *Engine) Info() (*Volume, error)

func (*Engine) LonghornEngineBinary

func (e *Engine) LonghornEngineBinary() string

func (*Engine) LonghornEngineLauncherBinary

func (e *Engine) LonghornEngineLauncherBinary() string

func (*Engine) Name

func (e *Engine) Name() string

func (*Engine) ReplicaAdd

func (e *Engine) ReplicaAdd(url string) error

func (*Engine) ReplicaList

func (e *Engine) ReplicaList() (map[string]*Replica, error)

func (*Engine) ReplicaRemove

func (e *Engine) ReplicaRemove(url string) error

func (*Engine) SnapshotBackup

func (e *Engine) SnapshotBackup(snapName, backupTarget string, labels map[string]string, credential map[string]string) error

func (*Engine) SnapshotCreate

func (e *Engine) SnapshotCreate(name string, labels map[string]string) (string, error)

func (*Engine) SnapshotDelete

func (e *Engine) SnapshotDelete(name string) error

func (*Engine) SnapshotGet

func (e *Engine) SnapshotGet(name string) (*Snapshot, error)

func (*Engine) SnapshotList

func (e *Engine) SnapshotList() (map[string]*Snapshot, error)

func (*Engine) SnapshotPurge

func (e *Engine) SnapshotPurge() error

func (*Engine) SnapshotRevert

func (e *Engine) SnapshotRevert(name string) error

func (*Engine) Upgrade

func (e *Engine) Upgrade(binary string, replicaURLs []string) error

func (*Engine) Version

func (e *Engine) Version(clientOnly bool) (*EngineVersion, error)

type EngineClient

type EngineClient interface {
	Name() string
	Endpoint() (string, error)
	Version(clientOnly bool) (*EngineVersion, error)
	Upgrade(binary string, replicaURLs []string) error

	Info() (*Volume, error)

	ReplicaList() (map[string]*Replica, error)
	ReplicaAdd(url string) error
	ReplicaRemove(url string) error

	SnapshotCreate(name string, labels map[string]string) (string, error)
	SnapshotList() (map[string]*Snapshot, error)
	SnapshotGet(name string) (*Snapshot, error)
	SnapshotDelete(name string) error
	SnapshotRevert(name string) error
	SnapshotPurge() error
	SnapshotBackup(snapName, backupTarget string, labels map[string]string, credential map[string]string) error

	BackupRestoreIncrementally(backupTarget, backupName, backupVolume, lastBackup string) error
}

type EngineClientCollection

type EngineClientCollection interface {
	NewEngineClient(request *EngineClientRequest) (EngineClient, error)
}

type EngineClientRequest

type EngineClientRequest struct {
	VolumeName  string
	EngineImage string
	IP          string
}

type EngineCollection

type EngineCollection struct{}

func (*EngineCollection) NewEngineClient

func (c *EngineCollection) NewEngineClient(request *EngineClientRequest) (EngineClient, error)

type EngineSimulator

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

func (*EngineSimulator) BackupRestoreIncrementally added in v0.5.0

func (e *EngineSimulator) BackupRestoreIncrementally(backupTarget, backupName, backupVolume, lastBackup string) error

func (*EngineSimulator) Endpoint

func (e *EngineSimulator) Endpoint() (string, error)

func (*EngineSimulator) Info added in v0.5.0

func (e *EngineSimulator) Info() (*Volume, error)

func (*EngineSimulator) Name

func (e *EngineSimulator) Name() string

func (*EngineSimulator) ReplicaAdd

func (e *EngineSimulator) ReplicaAdd(url string) error

func (*EngineSimulator) ReplicaList

func (e *EngineSimulator) ReplicaList() (map[string]*Replica, error)

func (*EngineSimulator) ReplicaRemove

func (e *EngineSimulator) ReplicaRemove(addr string) error

func (*EngineSimulator) SimulateStopReplica

func (e *EngineSimulator) SimulateStopReplica(addr string) error

func (*EngineSimulator) SnapshotBackup

func (e *EngineSimulator) SnapshotBackup(snapName, backupTarget string, labels map[string]string, credential map[string]string) error

func (*EngineSimulator) SnapshotCreate

func (e *EngineSimulator) SnapshotCreate(name string, labels map[string]string) (string, error)

func (*EngineSimulator) SnapshotDelete

func (e *EngineSimulator) SnapshotDelete(name string) error

func (*EngineSimulator) SnapshotGet

func (e *EngineSimulator) SnapshotGet(name string) (*Snapshot, error)

func (*EngineSimulator) SnapshotList

func (e *EngineSimulator) SnapshotList() (map[string]*Snapshot, error)

func (*EngineSimulator) SnapshotPurge

func (e *EngineSimulator) SnapshotPurge() error

func (*EngineSimulator) SnapshotRevert

func (e *EngineSimulator) SnapshotRevert(name string) error

func (*EngineSimulator) Upgrade

func (e *EngineSimulator) Upgrade(binary string, replicaURLs []string) error

func (*EngineSimulator) Version

func (e *EngineSimulator) Version(clientOnly bool) (*EngineVersion, error)

type EngineSimulatorCollection

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

func NewEngineSimulatorCollection

func NewEngineSimulatorCollection() *EngineSimulatorCollection

func (*EngineSimulatorCollection) CreateEngineSimulator

func (c *EngineSimulatorCollection) CreateEngineSimulator(request *EngineSimulatorRequest) error

func (*EngineSimulatorCollection) DeleteEngineSimulator

func (c *EngineSimulatorCollection) DeleteEngineSimulator(volumeName string) error

func (*EngineSimulatorCollection) GetEngineSimulator

func (c *EngineSimulatorCollection) GetEngineSimulator(volumeName string) (*EngineSimulator, error)

func (*EngineSimulatorCollection) NewEngineClient

func (c *EngineSimulatorCollection) NewEngineClient(request *EngineClientRequest) (EngineClient, error)

type EngineSimulatorRequest

type EngineSimulatorRequest struct {
	VolumeName     string
	VolumeSize     int64
	ControllerAddr string
	ReplicaAddrs   []string
}

type EngineVersion

type EngineVersion struct {
	ClientVersion *types.EngineVersionDetails `json:"clientVersion"`
	ServerVersion *types.EngineVersionDetails `json:"serverVersion"`
}

type LauncherVolumeInfo

type LauncherVolumeInfo struct {
	Volume   string `json:"volume,omitempty"`
	Frontend string `json:"frontend,omitempty"`
	Endpoint string `json:"endpoint,omitempty"`
}

type Replica

type Replica struct {
	URL  string
	Mode types.ReplicaMode
}

type Snapshot

type Snapshot struct {
	Name        string              `json:"name"`
	Parent      string              `json:"parent"`
	Children    map[string]struct{} `json:"children"`
	Removed     bool                `json:"removed"`
	UserCreated bool                `json:"usercreated"`
	Created     string              `json:"created"`
	Size        string              `json:"size"`
	Labels      map[string]string   `json:"labels"`
}

type Volume

type Volume struct {
	Name         string `json:"name"`
	ReplicaCount int    `json:"replicaCount"`
	Endpoint     string `json:"endpoint"`
	Frontend     string `json:"frontend"`
	IsRestoring  bool   `json:"isRestoring"`
	LastRestored string `json:"lastRestored"`
}

Jump to

Keyboard shortcuts

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