Documentation ¶
Index ¶
- func InitCurveNbd()
- type CancelSnapshotResp
- type CleanCloneTaskResp
- type CloneResp
- type CreateSnapshotResp
- type CurveVolume
- func (cv *CurveVolume) Create(ctx context.Context) error
- func (cv *CurveVolume) Delete(ctx context.Context) error
- func (cv *CurveVolume) Extend(ctx context.Context, newSizeGiB int) error
- func (cv *CurveVolume) Map(ctx context.Context, disableInUseChecks bool) (string, error)
- func (cv *CurveVolume) Stat(ctx context.Context) (*CurveVolumeDetail, error)
- func (cv *CurveVolume) UnMap(ctx context.Context) error
- type CurveVolumeDetail
- type CurveVolumeStatus
- type DeleteSnapshotResp
- type FlattenResp
- type GetCloneTaskResp
- type GetSnapshotResp
- type RecoverResp
- type RespCode
- type Snapshot
- type SnapshotCommonResp
- type SnapshotServer
- func (cs *SnapshotServer) CancelSnapshot(ctx context.Context, uuid string) error
- func (cs *SnapshotServer) CleanCloneTask(ctx context.Context, uuid string) error
- func (cs *SnapshotServer) Clone(ctx context.Context, source, destination string, lazy bool) (string, error)
- func (cs *SnapshotServer) CreateSnapshot(ctx context.Context, snapName string) (string, error)
- func (cs *SnapshotServer) DeleteSnapshot(ctx context.Context, uuid string) error
- func (cs *SnapshotServer) EnsureTaskFromSourceDone(ctx context.Context, source string) error
- func (cs *SnapshotServer) Flatten(ctx context.Context, uuid string) error
- func (cs *SnapshotServer) GetCloneTaskOfDestination(ctx context.Context, destination string) (TaskInfo, error)
- func (cs *SnapshotServer) GetCloneTaskOfId(ctx context.Context, uuid string) (TaskInfo, error)
- func (cs *SnapshotServer) GetFileSnapshotOfId(ctx context.Context, uuid string) (Snapshot, error)
- func (cs *SnapshotServer) GetFileSnapshotOfName(ctx context.Context, snapName string) (Snapshot, error)
- func (cs *SnapshotServer) WaitForCloneTaskDone(ctx context.Context, destination string) error
- func (cs *SnapshotServer) WaitForCloneTaskReady(ctx context.Context, destination string) error
- func (cs *SnapshotServer) WaitForSnapshotDone(ctx context.Context, uuid string) (Snapshot, error)
- type SnapshotStatus
- type TaskFileType
- type TaskInfo
- type TaskStatus
- type TaskType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitCurveNbd ¶
func InitCurveNbd()
Types ¶
type CancelSnapshotResp ¶
type CancelSnapshotResp SnapshotCommonResp
type CleanCloneTaskResp ¶
type CleanCloneTaskResp SnapshotCommonResp
type CloneResp ¶
type CloneResp struct { SnapshotCommonResp UUID string `json:"UUID,omitempty"` }
type CreateSnapshotResp ¶
type CreateSnapshotResp struct { SnapshotCommonResp UUID string `json:"UUID,omitempty"` }
type CurveVolume ¶
type CurveVolume struct { FileName string `json:"filename"` FilePath string `json:"filepath"` DirPath string `json:"dirpath"` User string `json:"user"` SizeGiB int `json:"size"` }
func NewCurveVolume ¶
func NewCurveVolume(user, volName string, sizeGiB int) *CurveVolume
func (*CurveVolume) Create ¶
func (cv *CurveVolume) Create(ctx context.Context) error
curve create file, mkdir the dir if not exists
func (*CurveVolume) Delete ¶
func (cv *CurveVolume) Delete(ctx context.Context) error
curve delete [-h] --user USER --filename FILENAME
func (*CurveVolume) Extend ¶
func (cv *CurveVolume) Extend(ctx context.Context, newSizeGiB int) error
curve extend [-h] --user USER --filename FILENAME --length LENGTH
func (*CurveVolume) Stat ¶
func (cv *CurveVolume) Stat(ctx context.Context) (*CurveVolumeDetail, error)
curve stat [-h] --user USER --filename FILENAME
type CurveVolumeDetail ¶
type CurveVolumeDetail struct { Id string `param:"id"` ParentId string `param:"parentid"` FileType string `param:"filetype"` LengthGiB int `param:"length(GB)"` CreateTime string `param:"createtime"` User string `param:"user"` FileName string `param:"filename"` FileStatus CurveVolumeStatus `param:"fileStatus"` }
type CurveVolumeStatus ¶
type CurveVolumeStatus string
const ( // curve file status CurveVolumeStatusNotExist CurveVolumeStatus = "kFileNotExists" CurveVolumeStatusExist CurveVolumeStatus = "kFileExists" CurveVolumeStatusCreated CurveVolumeStatus = "Created" CurveVolumeStatusOwnerAuthFail CurveVolumeStatus = "kOwnerAuthFail" CurveVolumeStatusClonedLazy CurveVolumeStatus = "CloneMetaInstalled" CurveVolumeStatusBeingCloned CurveVolumeStatus = "BeingCloned" CurveVolumeStatusUnknown CurveVolumeStatus = "Unknown" )
type DeleteSnapshotResp ¶
type DeleteSnapshotResp SnapshotCommonResp
type FlattenResp ¶
type FlattenResp SnapshotCommonResp
type GetCloneTaskResp ¶
type GetCloneTaskResp struct { SnapshotCommonResp TotalCount int `json:"TotalCount,omitempty"` TaskInfos []TaskInfo `json:"TaskInfos,omitempty"` }
also use as recover task
type GetSnapshotResp ¶
type GetSnapshotResp struct { SnapshotCommonResp TotalCount int `json:"TotalCount,omitempty"` Snapshots []Snapshot `json:"Snapshots,omitempty"` }
type RecoverResp ¶
type RecoverResp struct { SnapshotCommonResp UUID string `json:"UUID,omitempty"` }
type Snapshot ¶
type Snapshot struct { UUID string `json:"UUID"` User string `json:"User"` File string `json:"File"` SeqNum uint32 `json:"SeqNum"` Name string `json:"Name"` Time int64 `json:"Time"` FileLength uint64 `json:"FileLength"` //unit Byte Status SnapshotStatus `json:"Status"` Progress uint8 `json:"Progress"` }
type SnapshotCommonResp ¶
type SnapshotServer ¶
type SnapshotServer struct { URL string `json:"server"` User string `json:"user"` FilePath string `json:"filepath"` }
func NewSnapshotServer ¶
func NewSnapshotServer(server, user, volName string) *SnapshotServer
func (*SnapshotServer) CancelSnapshot ¶
func (cs *SnapshotServer) CancelSnapshot(ctx context.Context, uuid string) error
CancelSnapshot cancels a snapshot
func (*SnapshotServer) CleanCloneTask ¶
func (cs *SnapshotServer) CleanCloneTask(ctx context.Context, uuid string) error
Clean a clone task, flatten if it is unfinished.
func (*SnapshotServer) Clone ¶
func (cs *SnapshotServer) Clone(ctx context.Context, source, destination string, lazy bool) (string, error)
Clone a volume from source to destination
func (*SnapshotServer) CreateSnapshot ¶
CreateSnapshot creates a snapshot and returns the uuid
func (*SnapshotServer) DeleteSnapshot ¶
func (cs *SnapshotServer) DeleteSnapshot(ctx context.Context, uuid string) error
DeleteSnapshot detetes a snapshot
func (*SnapshotServer) EnsureTaskFromSourceDone ¶
func (cs *SnapshotServer) EnsureTaskFromSourceDone(ctx context.Context, source string) error
func (*SnapshotServer) Flatten ¶
func (cs *SnapshotServer) Flatten(ctx context.Context, uuid string) error
func (*SnapshotServer) GetCloneTaskOfDestination ¶
func (cs *SnapshotServer) GetCloneTaskOfDestination(ctx context.Context, destination string) (TaskInfo, error)
Get task with specific destination
func (*SnapshotServer) GetCloneTaskOfId ¶
Get task with specific uuid
func (*SnapshotServer) GetFileSnapshotOfId ¶
GetSnapshotById gets the snapshot with specific uuid
func (*SnapshotServer) GetFileSnapshotOfName ¶
func (cs *SnapshotServer) GetFileSnapshotOfName(ctx context.Context, snapName string) (Snapshot, error)
GetSnapshotByName gets the snapshot with specific name
func (*SnapshotServer) WaitForCloneTaskDone ¶
func (cs *SnapshotServer) WaitForCloneTaskDone(ctx context.Context, destination string) error
func (*SnapshotServer) WaitForCloneTaskReady ¶
func (cs *SnapshotServer) WaitForCloneTaskReady(ctx context.Context, destination string) error
Wait for the task ready: Done or MetaInstalled
func (*SnapshotServer) WaitForSnapshotDone ¶
Wait for the snapshot ready
type SnapshotStatus ¶
type SnapshotStatus uint8
const ( SnapshotStatusDone SnapshotStatus = iota SnapshotStatusPending SnapshotStatusDeleteing SnapshotStatusErrorDeleting SnapshotStatusCanceling SnapshotStatusError )
SnapshotStatus:
(0:done, 1:pending, 2:deleteing, 3:errorDeleting, 4:canceling, 5:error)
type TaskFileType ¶
type TaskFileType uint8
const ( TaskFileTypeSrcFile TaskFileType = iota TaskFileTypeSrcSnapshot )
TaskFileType: (0:SrcFile 1:SrcSnapshot)
type TaskInfo ¶
type TaskInfo struct { File string `json:"File"` TaskFileType TaskFileType `json:"FileType,omitempty"` IsLazy bool `json:"IsLazy,omitempty"` Progress uint8 `json:"Progress,omitempty"` Src string `json:"Src,omitempty"` TaskStatus TaskStatus `json:"TaskStatus"` TaskType TaskType `json:"TaskType"` Time int64 `json:"Time"` UUID string `json:"UUID"` User string `json:"User"` }
type TaskStatus ¶
type TaskStatus uint8
const ( TaskStatusDone TaskStatus = iota TaskStatusCloning TaskStatusRecovering TaskStatusCleaning TaskStatusErrorCleaning TaskStatusError TaskStatusRetrying TaskStatusMetaInstalled )
TaskStatus
(0:done, 1:cloning, 2:recovering, 3:cleaning, 4:errorCleaning, 5:error,6:retrying, 7:metaInstalled)