engineapi

package
v1.1.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackingImageManagerDefaultPort = 8000

	CurrentBackingImageManagerAPIVersion = 1
	MinBackingImageManagerAPIVersion     = 1
	UnknownBackingImageManagerAPIVersion = 0
)
View Source
const (
	CurrentInstanceManagerAPIVersion = 1
	UnknownInstanceManagerAPIVersion = 0

	DefaultEnginePortCount  = 1
	DefaultReplicaPortCount = 15

	DefaultPortArg         = "--listen,0.0.0.0:"
	DefaultTerminateSignal = "SIGHUP"

	// IncompatibleInstanceManagerAPIVersion means the instance manager version in v0.7.0
	IncompatibleInstanceManagerAPIVersion = -1
	DeprecatedInstanceManagerBinaryName   = "longhorn-instance-manager"
)
View Source
const (
	// CurrentCLIVersion indicates the default API version manager used to talk with the
	// engine, including `longhorn-engine` and `longhorn-instance-manager`
	CurrentCLIVersion = 4
	// MinCLIVersion indicates the Min API version manager used to talk with the
	// engine.
	MinCLIVersion = 3

	CLIVersionFour = 4

	InstanceManagerDefaultPort = 8500

	DefaultISCSIPort = "3260"
	DefaultISCSILUN  = "1"

	BackupStateComplete   = "complete"
	BackupStateError      = "error"
	BackupStateInProgress = "in_progress"

	MaxPollCount = 60
	MinPollCount = 1
	PollInterval = 1 * time.Second

	MaxStreamingRecvRetryCount = 10
)
View Source
const (
	VolumeHeadName = "volume-head"
)

Variables

This section is empty.

Functions

func CheckBackingImageManagerCompatibilty added in v1.1.1

func CheckBackingImageManagerCompatibilty(bimMinVersion, bimVersion int) error

func CheckCLICompatibilty

func CheckCLICompatibilty(cliVersion, cliMinVersion int) error

func CheckInstanceManagerCompatibilty added in v0.8.0

func CheckInstanceManagerCompatibilty(imMinVersion, imVersion int) error

func GetAddressFromBackendReplicaURL added in v0.6.0

func GetAddressFromBackendReplicaURL(url string) string

func GetBackendReplicaURL added in v0.6.0

func GetBackendReplicaURL(address string) string

func GetBackupURL

func GetBackupURL(backupTarget, backupName, volName string) string

func GetDeprecatedInstanceManagerBinary added in v0.8.0

func GetDeprecatedInstanceManagerBinary(image string) string

func GetEngineProcessFrontend added in v0.8.0

func GetEngineProcessFrontend(volumeFrontend types.VolumeFrontend) (string, error)

func ValidateReplicaURL

func ValidateReplicaURL(url string) error

Types

type BackingImageManagerClient added in v1.1.1

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

func NewBackingImageManagerClient added in v1.1.1

func NewBackingImageManagerClient(bim *longhorn.BackingImageManager) (*BackingImageManagerClient, error)

func (*BackingImageManagerClient) Delete added in v1.1.1

func (c *BackingImageManagerClient) Delete(name string) error

func (*BackingImageManagerClient) Get added in v1.1.1

func (*BackingImageManagerClient) List added in v1.1.1

func (*BackingImageManagerClient) Pull added in v1.1.1

func (c *BackingImageManagerClient) Pull(name, url, uuid string) (*types.BackingImageFileInfo, error)

func (*BackingImageManagerClient) Sync added in v1.1.1

func (c *BackingImageManagerClient) Sync(name, url, uuid, fromHost, toHost string, size int64) (*types.BackingImageFileInfo, error)

func (*BackingImageManagerClient) VersionGet added in v1.1.1

func (c *BackingImageManagerClient) VersionGet() (int, int, error)

func (*BackingImageManagerClient) Watch added in v1.1.1

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"`
	VolumeBackingImageName string                             `json:"volumeBackingImageName"`
	VolumeBackingImageURL  string                             `json:"volumeBackingImageURL"`
	Messages               map[backupstore.MessageType]string `json:"messages"`
}

type BackupCreateInfo added in v0.6.0

type BackupCreateInfo struct {
	BackupID      string
	IsIncremental bool
}

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) DeleteVolume added in v0.6.0

func (b *BackupTarget) DeleteVolume(volumeName string) error

func (*BackupTarget) ExecuteEngineBinary

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

func (*BackupTarget) ExecuteEngineBinaryWithoutTimeout added in v0.6.0

func (b *BackupTarget) ExecuteEngineBinaryWithoutTimeout(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"`
	Labels           map[string]string                  `json:"labels"`
	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"`
	BackingImageName string                             `json:"backingImageName"`
	BackingImageURL  string                             `json:"backingImageURL"`

	// Deprecated
	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(backupTarget, backupName, backupVolume, lastRestored string, credential map[string]string) error

func (*Engine) BackupRestoreStatus added in v0.6.0

func (e *Engine) BackupRestoreStatus() (map[string]*types.RestoreStatus, 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) ExecuteEngineBinaryWithoutTimeout added in v0.6.0

func (e *Engine) ExecuteEngineBinaryWithoutTimeout(envs []string, args ...string) (string, error)

func (*Engine) Expand added in v0.8.0

func (e *Engine) Expand(size int64) error

func (*Engine) FrontendShutdown added in v0.8.0

func (e *Engine) FrontendShutdown() error

func (*Engine) FrontendStart added in v0.8.0

func (e *Engine) FrontendStart(volumeFrontend types.VolumeFrontend) 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) Name

func (e *Engine) Name() string

func (*Engine) ReplicaAdd

func (e *Engine) ReplicaAdd(url string, isRestoreVolume bool) error

func (*Engine) ReplicaList

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

func (*Engine) ReplicaRebuildStatus added in v0.8.0

func (e *Engine) ReplicaRebuildStatus() (map[string]*types.RebuildStatus, error)

func (*Engine) ReplicaRebuildVerify added in v1.1.0

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

func (*Engine) ReplicaRemove

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

func (*Engine) SnapshotBackup

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

func (*Engine) SnapshotBackupStatus added in v0.6.0

func (e *Engine) SnapshotBackupStatus() (map[string]*types.BackupStatus, 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) (*types.Snapshot, error)

func (*Engine) SnapshotList

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

func (*Engine) SnapshotPurge

func (e *Engine) SnapshotPurge() error

func (*Engine) SnapshotPurgeStatus added in v0.6.0

func (e *Engine) SnapshotPurgeStatus() (map[string]*types.PurgeStatus, error)

func (*Engine) SnapshotRevert

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

func (*Engine) Version

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

type EngineClient

type EngineClient interface {
	Name() string
	Version(clientOnly bool) (*EngineVersion, error)

	Info() (*Volume, error)
	Endpoint() (string, error)
	Expand(size int64) error

	FrontendStart(volumeFrontend types.VolumeFrontend) error
	FrontendShutdown() error

	ReplicaList() (map[string]*Replica, error)
	ReplicaAdd(url string, isRestoreVolume bool) error
	ReplicaRemove(url string) error
	ReplicaRebuildStatus() (map[string]*types.RebuildStatus, error)
	ReplicaRebuildVerify(url string) error

	SnapshotCreate(name string, labels map[string]string) (string, error)
	SnapshotList() (map[string]*types.Snapshot, error)
	SnapshotGet(name string) (*types.Snapshot, error)
	SnapshotDelete(name string) error
	SnapshotRevert(name string) error
	SnapshotPurge() error
	SnapshotPurgeStatus() (map[string]*types.PurgeStatus, error)
	SnapshotBackup(snapName, backupTarget, backingImageName, backingImageURL string, labels map[string]string, credential map[string]string) (string, error)
	SnapshotBackupStatus() (map[string]*types.BackupStatus, error)

	BackupRestore(backupTarget, backupName, backupVolume, lastRestored string, credential map[string]string) error
	BackupRestoreStatus() (map[string]*types.RestoreStatus, error)
}

type EngineClientCollection

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

type EngineClientRequest

type EngineClientRequest struct {
	VolumeName  string
	EngineImage string
	IP          string
	Port        int
}

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) BackupRestore added in v0.6.0

func (e *EngineSimulator) BackupRestore(backupTarget, backupName, backupVolume, lastRestored string, credential map[string]string) error

func (*EngineSimulator) BackupRestoreStatus added in v0.6.0

func (e *EngineSimulator) BackupRestoreStatus() (map[string]*types.RestoreStatus, error)

func (*EngineSimulator) Endpoint

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

func (*EngineSimulator) Expand added in v0.8.0

func (e *EngineSimulator) Expand(size int64) error

func (*EngineSimulator) FrontendShutdown added in v0.8.0

func (e *EngineSimulator) FrontendShutdown() error

func (*EngineSimulator) FrontendStart added in v0.8.0

func (e *EngineSimulator) FrontendStart(volumeFrontend types.VolumeFrontend) 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, isRestoreVolume bool) error

func (*EngineSimulator) ReplicaList

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

func (*EngineSimulator) ReplicaRebuildStatus added in v0.8.0

func (e *EngineSimulator) ReplicaRebuildStatus() (map[string]*types.RebuildStatus, error)

func (*EngineSimulator) ReplicaRebuildVerify added in v1.1.0

func (e *EngineSimulator) ReplicaRebuildVerify(url string) 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, backingImageName, backingImageURL string, labels map[string]string, credential map[string]string) (string, error)

func (*EngineSimulator) SnapshotBackupStatus added in v0.6.0

func (e *EngineSimulator) SnapshotBackupStatus() (map[string]*types.BackupStatus, 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) (*types.Snapshot, error)

func (*EngineSimulator) SnapshotList

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

func (*EngineSimulator) SnapshotPurge

func (e *EngineSimulator) SnapshotPurge() error

func (*EngineSimulator) SnapshotPurgeStatus added in v0.6.0

func (e *EngineSimulator) SnapshotPurgeStatus() (map[string]*types.PurgeStatus, error)

func (*EngineSimulator) SnapshotRevert

func (e *EngineSimulator) SnapshotRevert(name 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 InstanceManagerClient added in v0.8.0

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

func NewInstanceManagerClient added in v0.8.0

func NewInstanceManagerClient(im *longhorn.InstanceManager) (*InstanceManagerClient, error)

func (*InstanceManagerClient) EngineProcessCreate added in v0.8.0

func (c *InstanceManagerClient) EngineProcessCreate(engineName, volumeName, engineImage string, volumeFrontend types.VolumeFrontend, replicaAddressMap map[string]string, revCounterDisabled bool, salvageRequested bool) (*types.InstanceProcess, error)

func (*InstanceManagerClient) EngineProcessUpgrade added in v0.8.0

func (c *InstanceManagerClient) EngineProcessUpgrade(engineName, volumeName, engineImage string, volumeFrontend types.VolumeFrontend, replicaAddressMap map[string]string) (*types.InstanceProcess, error)

func (*InstanceManagerClient) ProcessDelete added in v0.8.0

func (c *InstanceManagerClient) ProcessDelete(name string) error

func (*InstanceManagerClient) ProcessGet added in v0.8.0

func (c *InstanceManagerClient) ProcessGet(name string) (*types.InstanceProcess, error)

func (*InstanceManagerClient) ProcessList added in v0.8.0

func (c *InstanceManagerClient) ProcessList() (map[string]types.InstanceProcess, error)

func (*InstanceManagerClient) ProcessLog added in v0.8.0

func (c *InstanceManagerClient) ProcessLog(name string) (*imapi.LogStream, error)

func (*InstanceManagerClient) ProcessWatch added in v0.8.0

func (c *InstanceManagerClient) ProcessWatch() (*imapi.ProcessStream, error)

func (*InstanceManagerClient) ReplicaProcessCreate added in v0.8.0

func (c *InstanceManagerClient) ReplicaProcessCreate(replicaName, engineImage, dataPath, backingImagePath string, size int64, revCounterDisabled bool) (*types.InstanceProcess, error)

func (*InstanceManagerClient) VersionGet added in v0.8.0

func (c *InstanceManagerClient) VersionGet() (int, int, error)

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 ReplicaError added in v1.0.1

type ReplicaError struct {
	Address string
	Message string
}

func (ReplicaError) Error added in v1.0.1

func (e ReplicaError) Error() string

type TaskError added in v1.0.1

type TaskError struct {
	ReplicaErrors []ReplicaError
}

func (TaskError) Error added in v1.0.1

func (e TaskError) Error() string

type Volume

type Volume struct {
	Name                  string `json:"name"`
	Size                  int64  `json:"size"`
	ReplicaCount          int    `json:"replicaCount"`
	Endpoint              string `json:"endpoint"`
	Frontend              string `json:"frontend"`
	FrontendState         string `json:"frontendState"`
	IsExpanding           bool   `json:"isExpanding"`
	LastExpansionError    string `json:"lastExpansionError"`
	LastExpansionFailedAt string `json:"lastExpansionFailedAt"`
}

Jump to

Keyboard shortcuts

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