types

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 7 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"

	CIFSUsername = "CIFS_USERNAME"
	CIFSPassword = "CIFS_PASSWORD"

	AZBlobAccountName = "AZBLOB_ACCOUNT_NAME"
	AZBlobAccountKey  = "AZBLOB_ACCOUNT_KEY"
	AZBlobEndpoint    = "AZBLOB_ENDPOINT"
	AZBlobCert        = "AZBLOB_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"

	VolumeHeadName = "volume-head"
)
View Source
const (
	DataServerProtocolTCP  = DataServerProtocol("tcp")
	DataServerProtocolUNIX = DataServerProtocol("unix")
)
View Source
const (
	ReplicaStateInitial    = ReplicaState("initial")
	ReplicaStateOpen       = ReplicaState("open")
	ReplicaStateClosed     = ReplicaState("closed")
	ReplicaStateDirty      = ReplicaState("dirty")
	ReplicaStateRebuilding = ReplicaState("rebuilding")
	ReplicaStateError      = ReplicaState("error")
)
View Source
const (
	EventTypeVolume  = "volume"
	EventTypeReplica = "replica"
	EventTypeMetrics = "metrics"
)
View Source
const (
	CannotRequestHashingSnapshotPrefix = "cannot request hashing snapshot"
)

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 ReplicaModeToGRPCReplicaMode added in v1.7.0

func ReplicaModeToGRPCReplicaMode(mode Mode) enginerpc.ReplicaMode

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 {
	ReaderWriterUnmapperAt
	io.Closer
	Snapshot(name string, userCreated bool, created string, labels map[string]string) error
	Expand(size int64) error
	Size() (int64, error)
	SectorSize() (int64, error)
	GetRevisionCounter() (int64, error)
	SetRevisionCounter(counter int64) error
	GetState() (string, error)
	GetMonitorChannel() MonitorChannel
	StopMonitoring()
	IsRevisionCounterDisabled() (bool, error)
	GetLastModifyTime() (int64, error)
	GetHeadFileSize() (int64, error)
	GetUnmapMarkSnapChainRemoved() (bool, error)
	SetUnmapMarkSnapChainRemoved(enabled bool) error
	ResetRebuild() error
	SetSnapshotMaxCount(count int) error
	SetSnapshotMaxSize(size int64) error
	GetSnapshotCountAndSizeUsage() (int, int64, error)
}

type BackendFactory

type BackendFactory interface {
	Create(volumeName, address string, dataServerProtocol DataServerProtocol,
		sharedTimeouts SharedTimeouts) (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 {
	ReaderWriterUnmapperAt
	PingResponse() error
}

type DataServerProtocol added in v1.4.0

type DataServerProtocol string

type DiffDisk

type DiffDisk interface {
	ReaderWriterUnmapperAt
	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 FileLocalSync added in v1.7.0

type FileLocalSync struct {
	SourcePath string
	TargetPath string
}

type Frontend

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

type Metrics

type Metrics struct {
	Throughput   RWMetrics // in byte
	TotalLatency RWMetrics // in nanoseconds
	IOPS         RWMetrics
}

type Mode

type Mode string

func GRPCReplicaModeToReplicaMode added in v1.7.0

func GRPCReplicaModeToReplicaMode(replicaMode enginerpc.ReplicaMode) Mode

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 ReaderWriterUnmapperAt added in v1.4.0

type ReaderWriterUnmapperAt interface {
	io.ReaderAt
	io.WriterAt
	UnmapperAt
}

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"`
	UnmapMarkDiskChainRemoved bool                `json:"unmapMarkDiskChainRemoved"`
	SnapshotCountUsage        int                 `json:"snapshotCountUsage"`
	SnapshotSizeUsage         int64               `json:"snapshotSizeUsage"`
}

type ReplicaSalvageInfo added in v1.1.0

type ReplicaSalvageInfo struct {
	Address        string
	LastModifyTime time.Time
	HeadFileSize   int64
}

type ReplicaState added in v1.3.3

type ReplicaState string

type Server

type Server interface {
	ReaderWriterUnmapperAt
	Controller
}

type SharedTimeouts added in v1.7.1

type SharedTimeouts interface {
	Increment()
	Decrement()
	CheckAndDecrement(duration time.Duration) time.Duration
}

type State

type State string

type SyncFileInfo

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

type UnmapperAt added in v1.4.0

type UnmapperAt interface {
	UnmapAt(length uint32, off int64) (n int, err error)
}

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"`
	UnmapMarkSnapChainRemoved bool   `json:"unmapMarkSnapChainRemoved"`
	SnapshotMaxCount          int    `json:"snapshotMaxCount"`
	SnapshotMaxSize           int64  `json:"SnapshotMaxSize"`
}

Jump to

Keyboard shortcuts

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