Documentation ¶
Index ¶
- Constants
- Variables
- func CheckVunitLocations(locations []VunitLocation) bool
- func EncodeToken(host string, vid Vid) (token string)
- func IsSysConfigKey(key string) bool
- func IsValidEpoch(epoch uint32) bool
- func IsValidIndex(index uint8) bool
- type BlobDeleteStage
- type BlobID
- type ClusterID
- type DeleteMsg
- type DeleteStage
- type DiskID
- type DiskStatus
- type MigrateState
- type MigrateTask
- func (t *MigrateTask) Copy() *MigrateTask
- func (t *MigrateTask) DestinationDiskID() DiskID
- func (t *MigrateTask) GetDestination() VunitLocation
- func (t *MigrateTask) GetSourceDiskID() DiskID
- func (t *MigrateTask) GetSources() []VunitLocation
- func (t *MigrateTask) IsValid() bool
- func (t *MigrateTask) Running() bool
- func (t *MigrateTask) SetDestination(dest VunitLocation)
- func (t *MigrateTask) Vid() Vid
- type MissedShard
- type ShardRepairMsg
- type ShardRepairTask
- type TaskProgress
- type TaskStatistics
- type TaskType
- type Vid
- type VolumeInspectCheckPoint
- type VolumeInspectRet
- type VolumeInspectTask
- type VolumeStatus
- type Vuid
- type VuidPrefix
- type VunitLocation
Constants ¶
View Source
const ( ServiceNameBlobNode = "BLOBNODE" ServiceNameProxy = "PROXY" ServiceNameScheduler = "SCHEDULER" )
service names
View Source
const ( DiskStatusNormal = DiskStatus(iota + 1) // 1 DiskStatusBroken // 2 DiskStatusRepairing // 3 DiskStatusRepaired // 4 DiskStatusDropped // 5 DiskStatusMax // 6 )
disk status
View Source
const ( InvalidDiskID = DiskID(0) InValidBlobID = BlobID(0) InvalidCrc32 = uint32(0) InvalidVid = Vid(0) InvalidVuid = Vuid(0) )
View Source
const ( VolumeStatusIdle VolumeStatusActive VolumeStatusLock VolumeStatusUnlocking )
View Source
const ( CodeModeConfigKey = "code_mode" VolumeReserveSizeKey = "volume_reserve_size" VolumeChunkSizeKey = "volume_chunk_size" )
system config key,not allow delete
View Source
const ( // TaskRenewalPeriodS + RenewalTimeoutS < TaskLeaseExpiredS TaskRenewalPeriodS = 5 // worker alive tasks renewal period RenewalTimeoutS = 1 // timeout of worker task renewal TaskLeaseExpiredS = 10 // task lease duration in scheduler )
View Source
const ( MinEpoch = 1 MaxEpoch = 16777215 MinIndex = 0 MaxIndex = 255 )
View Source
const (
MaxBlobID = BlobID(math.MaxUint64)
)
Variables ¶
View Source
var ( ErrTaskPaused = errors.New("task has paused") ErrTaskEmpty = errors.New("no task to run") )
View Source
var ErrInvalidMsg = errors.New("msg is invalid")
Functions ¶
func EncodeToken ¶
EncodeToken encode host and vid to a string token.
func IsSysConfigKey ¶
func IsValidEpoch ¶
func IsValidIndex ¶
Types ¶
type BlobDeleteStage ¶
type BlobDeleteStage struct {
Stages map[uint8]DeleteStage `json:"stages"`
}
func (*BlobDeleteStage) Copy ¶
func (s *BlobDeleteStage) Copy() BlobDeleteStage
func (*BlobDeleteStage) SetStage ¶
func (s *BlobDeleteStage) SetStage(vuidIdx uint8, stage DeleteStage)
func (*BlobDeleteStage) Stage ¶
func (s *BlobDeleteStage) Stage(vuid Vuid) (DeleteStage, bool)
type DeleteMsg ¶
type DeleteMsg struct { ClusterID ClusterID `json:"cluster_id"` Bid BlobID `json:"bid"` Vid Vid `json:"vid"` Retry int `json:"retry"` Time int64 `json:"time"` ReqId string `json:"req_id"` BlobDelStages BlobDeleteStage `json:"blob_del_stages"` }
func (*DeleteMsg) SetDeleteStage ¶
func (msg *DeleteMsg) SetDeleteStage(stage BlobDeleteStage)
type DeleteStage ¶
type DeleteStage byte
const ( InitStage DeleteStage = iota MarkDelStage DelStage )
type DiskStatus ¶
type DiskStatus uint8
func (DiskStatus) IsValid ¶
func (status DiskStatus) IsValid() bool
func (DiskStatus) String ¶
func (status DiskStatus) String() string
type MigrateState ¶
type MigrateState uint8
const ( MigrateStateInited MigrateState = iota + 1 MigrateStatePrepared MigrateStateWorkCompleted MigrateStateFinished MigrateStateFinishedInAdvance )
type MigrateTask ¶
type MigrateTask struct { TaskID string `json:"task_id"` // task id TaskType TaskType `json:"task_type"` // task type State MigrateState `json:"state"` // task state SourceIDC string `json:"source_idc"` // source idc SourceDiskID DiskID `json:"source_disk_id"` // source disk id SourceVuid Vuid `json:"source_vuid"` // source volume unit id Sources []VunitLocation `json:"sources"` // source volume units location CodeMode codemode.CodeMode `json:"code_mode"` // codemode Destination VunitLocation `json:"destination"` // destination volume unit location Ctime string `json:"ctime"` // create time MTime string `json:"mtime"` // modify time FinishAdvanceReason string `json:"finish_advance_reason"` // task migrate chunk direct download first,if fail will recover chunk by ec repair ForbiddenDirectDownload bool `json:"forbidden_direct_download"` WorkerRedoCnt uint8 `json:"worker_redo_cnt"` // worker redo task count }
func (*MigrateTask) Copy ¶
func (t *MigrateTask) Copy() *MigrateTask
func (*MigrateTask) DestinationDiskID ¶
func (t *MigrateTask) DestinationDiskID() DiskID
func (*MigrateTask) GetDestination ¶
func (t *MigrateTask) GetDestination() VunitLocation
func (*MigrateTask) GetSourceDiskID ¶
func (t *MigrateTask) GetSourceDiskID() DiskID
func (*MigrateTask) GetSources ¶
func (t *MigrateTask) GetSources() []VunitLocation
func (*MigrateTask) IsValid ¶
func (t *MigrateTask) IsValid() bool
func (*MigrateTask) Running ¶
func (t *MigrateTask) Running() bool
func (*MigrateTask) SetDestination ¶
func (t *MigrateTask) SetDestination(dest VunitLocation)
func (*MigrateTask) Vid ¶
func (t *MigrateTask) Vid() Vid
type MissedShard ¶
type ShardRepairMsg ¶
type ShardRepairMsg struct { ClusterID ClusterID `json:"cluster_id"` Bid BlobID `json:"bid"` Vid Vid `json:"vid"` BadIdx []uint8 `json:"bad_idx"` Retry int `json:"retry"` Reason string `json:"reason"` ReqId string `json:"req_id"` }
func (*ShardRepairMsg) IsValid ¶
func (msg *ShardRepairMsg) IsValid() bool
type ShardRepairTask ¶
type ShardRepairTask struct { Bid BlobID `json:"bid"` CodeMode codemode.CodeMode `json:"code_mode"` Sources []VunitLocation `json:"sources"` BadIdxs []uint8 `json:"bad_idxs"` // TODO: BadIdxes Reason string `json:"reason"` }
func (*ShardRepairTask) IsValid ¶
func (task *ShardRepairTask) IsValid() bool
type TaskProgress ¶
type TaskProgress interface { Total(size, count uint64) // reset total size and count. Do(size, count uint64) // update progress. Done() TaskStatistics // returns newest statistics. }
TaskProgress migrate task running progress.
func NewTaskProgress ¶
func NewTaskProgress() TaskProgress
NewTaskProgress returns thread-safe task progress.
type TaskStatistics ¶
type TaskStatistics struct { DoneSize uint64 `json:"done_size"` DoneCount uint64 `json:"done_count"` TotalSize uint64 `json:"total_size"` TotalCount uint64 `json:"total_count"` Progress uint64 `json:"progress"` }
TaskStatistics thread-unsafe task statistics.
type TaskType ¶
type TaskType string
const ( TaskTypeDiskRepair TaskType = "disk_repair" TaskTypeBalance TaskType = "balance" TaskTypeDiskDrop TaskType = "disk_drop" TaskTypeManualMigrate TaskType = "manual_migrate" TaskTypeVolumeInspect TaskType = "volume_inspect" TaskTypeShardRepair TaskType = "shard_repair" TaskTypeBlobDelete TaskType = "blob_delete" )
type Vid ¶
type Vid uint32
basic type for all module
func DecodeToken ¶
DecodeToken decode host and vid from the token.
type VolumeInspectCheckPoint ¶
type VolumeInspectRet ¶
type VolumeInspectRet struct { TaskID string `json:"task_id"` InspectErrStr string `json:"inspect_err_str"` // inspect run success or not MissedShards []*MissedShard `json:"missed_shards"` }
func (*VolumeInspectRet) Err ¶
func (inspect *VolumeInspectRet) Err() error
type VolumeInspectTask ¶
type VolumeInspectTask struct { TaskID string `json:"task_id"` Mode codemode.CodeMode `json:"mode"` Replicas []VunitLocation `json:"replicas"` }
func (*VolumeInspectTask) IsValid ¶
func (t *VolumeInspectTask) IsValid() bool
type VolumeStatus ¶
type VolumeStatus uint8
volume status
func (VolumeStatus) IsValid ¶
func (status VolumeStatus) IsValid() bool
func (VolumeStatus) String ¶
func (status VolumeStatus) String() string
type Vuid ¶
type Vuid uint64
func EncodeVuid ¶
func EncodeVuid(v VuidPrefix, epoch uint32) Vuid
func (Vuid) VuidPrefix ¶
func (v Vuid) VuidPrefix() VuidPrefix
type VuidPrefix ¶
type VuidPrefix uint64
func EncodeVuidPrefix ¶
func EncodeVuidPrefix(vid Vid, idx uint8) VuidPrefix
func (VuidPrefix) Index ¶
func (v VuidPrefix) Index() uint8
func (VuidPrefix) Vid ¶
func (v VuidPrefix) Vid() Vid
type VunitLocation ¶
Click to show internal directories.
Click to hide internal directories.