proto

package
v0.0.0-...-303e327 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 9 Imported by: 7

Documentation

Index

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 CheckVunitLocations

func CheckVunitLocations(locations []VunitLocation) bool

for task check

func EncodeToken

func EncodeToken(host string, vid Vid) (token string)

EncodeToken encode host and vid to a string token.

func IsSysConfigKey

func IsSysConfigKey(key string) bool

func IsValidEpoch

func IsValidEpoch(epoch uint32) bool

func IsValidIndex

func IsValidIndex(index uint8) bool

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 BlobID

type BlobID uint64

basic type for all module

type ClusterID

type ClusterID uint32

basic type for all module

func (ClusterID) ToString

func (id ClusterID) ToString() string

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) IsValid

func (msg *DeleteMsg) IsValid() bool

func (*DeleteMsg) SetDeleteStage

func (msg *DeleteMsg) SetDeleteStage(stage BlobDeleteStage)

type DeleteStage

type DeleteStage byte
const (
	InitStage DeleteStage = iota
	MarkDelStage
	DelStage
)

type DiskID

type DiskID uint32

basic type for all module

func (*DiskID) Decode

func (id *DiskID) Decode(b []byte) DiskID

func (DiskID) Encode

func (id DiskID) Encode() []byte

func (DiskID) ToString

func (id DiskID) ToString() string

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 MissedShard struct {
	Vuid Vuid   `json:"vuid"`
	Bid  BlobID `json:"bid"`
}

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"
)

func (TaskType) String

func (t TaskType) String() string

func (TaskType) Valid

func (t TaskType) Valid() bool

type Vid

type Vid uint32

basic type for all module

func DecodeToken

func DecodeToken(token string) (host string, vid Vid, err error)

DecodeToken decode host and vid from the token.

func (Vid) ToString

func (vid Vid) ToString() string

type VolumeInspectCheckPoint

type VolumeInspectCheckPoint struct {
	StartVid Vid    `json:"start_vid"` // min vid in current batch volumes
	Ctime    string `json:"ctime"`
}

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 NewVuid

func NewVuid(vid Vid, idx uint8, epoch uint32) (Vuid, error)

func (Vuid) Epoch

func (v Vuid) Epoch() uint32

func (Vuid) Index

func (v Vuid) Index() uint8

func (Vuid) IsValid

func (vu Vuid) IsValid() bool

func (Vuid) ToString

func (v Vuid) ToString() string

func (Vuid) Vid

func (v Vuid) Vid() Vid

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

type VunitLocation struct {
	Vuid   Vuid   `json:"vuid" bson:"vuid"`
	Host   string `json:"host" bson:"host"`
	DiskID DiskID `json:"disk_id" bson:"disk_id"`
}

Jump to

Keyboard shortcuts

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