types

package
v1.1.3-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ErrorCodeResultUnknown                   = ErrorCode("ResultUnknown")
	ErrorCodeFunctionFailedWithoutRollback   = ErrorCode("FunctionFailedWithoutRollback")
	ErrorCodeFunctionFailedRollbackSucceeded = ErrorCode("FunctionFailedRollbackSucceeded")
	ErrorCodeFunctionFailedRollbackFailed    = ErrorCode("FunctionFailedRollbackFailed")
)
View Source
const (
	WO  = Mode("WO")
	RW  = Mode("RW")
	ERR = Mode("ERR")

	ProcessStateComplete   = ProcessState("complete")
	ProcessStateError      = ProcessState("error")
	ProcessStateInProgress = ProcessState("in_progress")

	StateUp   = State("up")
	StateDown = State("down")

	AWSAccessKey = "AWS_ACCESS_KEY_ID"
	AWSSecretKey = "AWS_SECRET_ACCESS_KEY"
	AWSEndPoint  = "AWS_ENDPOINTS"
	AWSCert      = "AWS_CERT"

	HTTPSProxy = "HTTPS_PROXY"
	HTTPProxy  = "HTTP_PROXY"
	NOProxy    = "NO_PROXY"

	VirtualHostedStyle = "VIRTUAL_HOSTED_STYLE"

	RetryCounts   = 30
	RetryInterval = 1 * time.Second

	EngineFrontendBlockDev = "tgt-blockdev"
	EngineFrontendISCSI    = "tgt-iscsi"
)
View Source
const (
	EventTypeVolume  = "volume"
	EventTypeReplica = "replica"
	EventTypeMetrics = "metrics"
)

Variables

This section is empty.

Functions

func CombineErrors added in v0.8.1

func CombineErrors(errorList ...error) (retErr error)

func GenerateFunctionErrorWithRollback added in v0.8.1

func GenerateFunctionErrorWithRollback(functionErr, rollbackErr error) error

func IsAlreadyPurgingError

func IsAlreadyPurgingError(err error) bool

func UnmarshalGRPCError added in v0.8.1

func UnmarshalGRPCError(err error) error

func WrapError added in v0.8.1

func WrapError(in error, format string, args ...interface{}) error

Types

type Backend

type Backend interface {
	ReaderWriterAt
	io.Closer
	Snapshot(name string, userCreated bool, created string, labels map[string]string) error
	Expand(size int64) error
	Size() (int64, error)
	SectorSize() (int64, error)
	RemainSnapshots() (int, error)
	GetRevisionCounter() (int64, error)
	SetRevisionCounter(counter int64) error
	GetMonitorChannel() MonitorChannel
	StopMonitoring()
	IsRevisionCounterDisabled() (bool, error)
	GetLastModifyTime() (int64, error)
	GetHeadFileSize() (int64, error)
}

type BackendFactory

type BackendFactory interface {
	Create(address string) (Backend, error)
}

type Controller

type Controller interface {
	AddReplica(address string) error
	RemoveReplica(address string) error
	SetReplicaMode(address string, mode Mode) error
	ListReplicas() []Replica
	Start(address ...string) error
	Shutdown() error
}

type ControllerReplicaInfo

type ControllerReplicaInfo struct {
	Address string `json:"address"`
	Mode    Mode   `json:"mode"`
}

type DataProcessor

type DataProcessor interface {
	ReaderWriterAt
	PingResponse() error
}

type DiffDisk

type DiffDisk interface {
	ReaderWriterAt
	io.Closer
	Fd() uintptr
	Size() (int64, error)
}

type DiskInfo

type DiskInfo struct {
	Name        string            `json:"name"`
	Parent      string            `json:"parent"`
	Children    map[string]bool   `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 Error added in v0.8.1

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

func NewError added in v0.8.1

func NewError(code ErrorCode, msg, rollbackMsg string) *Error

func (*Error) Error added in v0.8.1

func (e *Error) Error() string

func (*Error) ToJSONString added in v0.8.1

func (e *Error) ToJSONString() string

type ErrorCode added in v0.8.1

type ErrorCode string

type Frontend

type Frontend interface {
	FrontendName() string
	Init(name string, size, sectorSize int64) error
	Startup(rw ReaderWriterAt) error
	Shutdown() error
	State() State
	Endpoint() string
	Upgrade(name string, size, sectorSize int64, rw ReaderWriterAt) error
	Expand(size int64) error
}

type Metrics

type Metrics struct {
	Bandwidth    RWMetrics // in byte
	TotalLatency RWMetrics // in microsecond(us)
	IOPS         RWMetrics
}

type Mode

type Mode string

type MonitorChannel

type MonitorChannel chan error

type PrepareRemoveAction

type PrepareRemoveAction struct {
	Action string `json:"action"`
	Source string `json:"source"`
	Target string `json:"target"`
}

type ProcessState

type ProcessState string

type RWMetrics

type RWMetrics struct {
	Read  uint64
	Write uint64
}

type ReaderWriterAt

type ReaderWriterAt interface {
	io.ReaderAt
	io.WriterAt
}

type Replica

type Replica struct {
	Address string
	Mode    Mode
}

type ReplicaInfo

type ReplicaInfo struct {
	Dirty                   bool                `json:"dirty"`
	Rebuilding              bool                `json:"rebuilding"`
	Head                    string              `json:"head"`
	Parent                  string              `json:"parent"`
	Size                    string              `json:"size"`
	SectorSize              int64               `json:"sectorSize,string"`
	BackingFile             string              `json:"backingFile"`
	State                   string              `json:"state"`
	Chain                   []string            `json:"chain"`
	Disks                   map[string]DiskInfo `json:"disks"`
	RemainSnapshots         int                 `json:"remainsnapshots"`
	RevisionCounter         int64               `json:"revisioncounter,string"`
	LastModifyTime          int64               `json:"lastmodifytime"`
	HeadFileSize            int64               `json:"headfilesize"`
	RevisionCounterDisabled bool                `json:"revisioncounterdisabled"`
}

type ReplicaSalvageInfo added in v1.1.0

type ReplicaSalvageInfo struct {
	LastModifyTime int64
	HeadFileSize   int64
}

type Server

type Server interface {
	ReaderWriterAt
	Controller
}

type State

type State string

type SyncFileInfo

type SyncFileInfo struct {
	FromFileName string `json:"fromFileName"`
	ToFileName   string `json:"toFileName"`
	ActualSize   int64  `json:"actualSize"`
}

type VolumeInfo

type VolumeInfo 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