Documentation ¶
Index ¶
- func GenMigrateTaskID(taskType proto.TaskType, diskID proto.DiskID, volumeID proto.Vid) string
- func GenMigrateTaskPrefix(taskType proto.TaskType) string
- func GenMigrateTaskPrefixByDiskID(taskType proto.TaskType, diskID proto.DiskID) string
- func ValidMigrateTask(taskType proto.TaskType, taskID string) bool
- type AllocVunitInfo
- type BlobnodeAPI
- type ClusterMgrAPI
- type ClusterMgrConfigAPI
- type ClusterMgrDiskAPI
- type ClusterMgrServiceAPI
- type ClusterMgrTaskAPI
- type ClusterMgrVolumeAPI
- type ConsumeOffset
- type DiskInfoSimple
- type IClusterManager
- type IVolumeUpdater
- type MigratingDiskMeta
- type ProxyAPI
- type RegisterInfo
- type VolumeInfoSimple
- type VunitInfoSimple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenMigrateTaskID ¶
GenMigrateTaskID return uniq task id
func GenMigrateTaskPrefix ¶
Types ¶
type AllocVunitInfo ¶
type AllocVunitInfo struct {
proto.VunitLocation
}
AllocVunitInfo volume unit info for alloc
func (*AllocVunitInfo) Location ¶
func (vunit *AllocVunitInfo) Location() proto.VunitLocation
Location returns volume unit location
type BlobnodeAPI ¶
type BlobnodeAPI interface { MarkDelete(ctx context.Context, location proto.VunitLocation, bid proto.BlobID) error Delete(ctx context.Context, location proto.VunitLocation, bid proto.BlobID) error RepairShard(ctx context.Context, host string, task proto.ShardRepairTask) error }
BlobnodeAPI interface of blobnode client deleter api
func NewBlobnodeClient ¶
func NewBlobnodeClient(cfg *api.Config) BlobnodeAPI
NewBlobnodeClient returns blobnode client
type ClusterMgrAPI ¶
type ClusterMgrAPI interface { ClusterMgrConfigAPI ClusterMgrVolumeAPI ClusterMgrDiskAPI ClusterMgrServiceAPI ClusterMgrTaskAPI }
ClusterMgrAPI define the interface of clustermgr used by scheduler
func NewClusterMgrClient ¶
func NewClusterMgrClient(conf *cmapi.Config) ClusterMgrAPI
type ClusterMgrConfigAPI ¶
type ClusterMgrDiskAPI ¶
type ClusterMgrDiskAPI interface { ListClusterDisks(ctx context.Context) (disks []*DiskInfoSimple, err error) ListBrokenDisks(ctx context.Context) (disks []*DiskInfoSimple, err error) ListRepairingDisks(ctx context.Context) (disks []*DiskInfoSimple, err error) ListDropDisks(ctx context.Context) (disks []*DiskInfoSimple, err error) SetDiskRepairing(ctx context.Context, diskID proto.DiskID) (err error) SetDiskRepaired(ctx context.Context, diskID proto.DiskID) (err error) SetDiskDropped(ctx context.Context, diskID proto.DiskID) (err error) GetDiskInfo(ctx context.Context, diskID proto.DiskID) (ret *DiskInfoSimple, err error) }
type ClusterMgrServiceAPI ¶
type ClusterMgrTaskAPI ¶
type ClusterMgrTaskAPI interface { UpdateMigrateTask(ctx context.Context, value *proto.MigrateTask) (err error) AddMigrateTask(ctx context.Context, value *proto.MigrateTask) (err error) GetMigrateTask(ctx context.Context, taskType proto.TaskType, key string) (task *proto.MigrateTask, err error) DeleteMigrateTask(ctx context.Context, key string) (err error) ListMigrateTasks(ctx context.Context, taskType proto.TaskType, args *cmapi.ListKvOpts) (tasks []*proto.MigrateTask, marker string, err error) ListAllMigrateTasks(ctx context.Context, taskType proto.TaskType) (tasks []*proto.MigrateTask, err error) ListAllMigrateTasksByDiskID(ctx context.Context, taskType proto.TaskType, diskID proto.DiskID) (tasks []*proto.MigrateTask, err error) AddMigratingDisk(ctx context.Context, value *MigratingDiskMeta) (err error) DeleteMigratingDisk(ctx context.Context, taskType proto.TaskType, diskID proto.DiskID) (err error) GetMigratingDisk(ctx context.Context, taskType proto.TaskType, diskID proto.DiskID) (meta *MigratingDiskMeta, err error) ListMigratingDisks(ctx context.Context, taskType proto.TaskType) (disks []*MigratingDiskMeta, err error) GetVolumeInspectCheckPoint(ctx context.Context) (ck *proto.VolumeInspectCheckPoint, err error) SetVolumeInspectCheckPoint(ctx context.Context, startVid proto.Vid) (err error) GetConsumeOffset(taskType proto.TaskType, topic string, partition int32) (offset int64, err error) SetConsumeOffset(taskType proto.TaskType, topic string, partition int32, offset int64) (err error) }
type ClusterMgrVolumeAPI ¶
type ClusterMgrVolumeAPI interface { GetVolumeInfo(ctx context.Context, Vid proto.Vid) (ret *VolumeInfoSimple, err error) LockVolume(ctx context.Context, Vid proto.Vid) (err error) UnlockVolume(ctx context.Context, Vid proto.Vid) (err error) UpdateVolume(ctx context.Context, newVuid, oldVuid proto.Vuid, newDiskID proto.DiskID) (err error) AllocVolumeUnit(ctx context.Context, vuid proto.Vuid) (ret *AllocVunitInfo, err error) ReleaseVolumeUnit(ctx context.Context, vuid proto.Vuid, diskID proto.DiskID) (err error) ListDiskVolumeUnits(ctx context.Context, diskID proto.DiskID) (ret []*VunitInfoSimple, err error) ListVolume(ctx context.Context, marker proto.Vid, count int) (volInfo []*VolumeInfoSimple, retVid proto.Vid, err error) }
type ConsumeOffset ¶
type DiskInfoSimple ¶
type DiskInfoSimple struct { ClusterID proto.ClusterID `json:"cluster_id"` DiskID proto.DiskID `json:"disk_id"` Idc string `json:"idc"` Rack string `json:"rack"` Host string `json:"host"` Status proto.DiskStatus `json:"status"` Readonly bool `json:"readonly"` UsedChunkCnt int64 `json:"used_chunk_cnt"` MaxChunkCnt int64 `json:"max_chunk_cnt"` FreeChunkCnt int64 `json:"free_chunk_cnt"` }
DiskInfoSimple disk simple info
func (*DiskInfoSimple) CanDropped ¶
func (disk *DiskInfoSimple) CanDropped() bool
CanDropped disk can drop when disk is normal or has repaired or has dropped for simplicity we not allow to set disk status dropped when disk is repairing
func (*DiskInfoSimple) IsBroken ¶
func (disk *DiskInfoSimple) IsBroken() bool
IsBroken return true if disk is broken
func (*DiskInfoSimple) IsDropped ¶
func (disk *DiskInfoSimple) IsDropped() bool
IsDropped return true if disk is dropped
func (*DiskInfoSimple) IsHealth ¶
func (disk *DiskInfoSimple) IsHealth() bool
IsHealth return true if disk is health
func (*DiskInfoSimple) IsRepaired ¶
func (disk *DiskInfoSimple) IsRepaired() bool
IsRepaired return true if disk is repaired
type IClusterManager ¶
type IClusterManager interface { GetConfig(ctx context.Context, key string) (ret string, err error) GetVolumeInfo(ctx context.Context, args *cmapi.GetVolumeArgs) (ret *cmapi.VolumeInfo, err error) LockVolume(ctx context.Context, args *cmapi.LockVolumeArgs) (err error) UnlockVolume(ctx context.Context, args *cmapi.UnlockVolumeArgs) (err error) UpdateVolume(ctx context.Context, args *cmapi.UpdateVolumeArgs) (err error) AllocVolumeUnit(ctx context.Context, args *cmapi.AllocVolumeUnitArgs) (ret *cmapi.AllocVolumeUnit, err error) ReleaseVolumeUnit(ctx context.Context, args *cmapi.ReleaseVolumeUnitArgs) (err error) ListVolumeUnit(ctx context.Context, args *cmapi.ListVolumeUnitArgs) ([]*cmapi.VolumeUnitInfo, error) ListVolume(ctx context.Context, args *cmapi.ListVolumeArgs) (ret cmapi.ListVolumes, err error) ListDisk(ctx context.Context, args *cmapi.ListOptionArgs) (ret cmapi.ListDiskRet, err error) ListDroppingDisk(ctx context.Context) (ret []*blobnode.DiskInfo, err error) SetDisk(ctx context.Context, id proto.DiskID, status proto.DiskStatus) (err error) DiskInfo(ctx context.Context, id proto.DiskID) (ret *blobnode.DiskInfo, err error) DroppedDisk(ctx context.Context, id proto.DiskID) (err error) RegisterService(ctx context.Context, node cmapi.ServiceNode, tickInterval, heartbeatTicks, expiresTicks uint32) (err error) GetService(ctx context.Context, args cmapi.GetServiceArgs) (info cmapi.ServiceInfo, err error) GetKV(ctx context.Context, key string) (ret cmapi.GetKvRet, err error) DeleteKV(ctx context.Context, key string) (err error) SetKV(ctx context.Context, key string, value []byte) (err error) ListKV(ctx context.Context, args *cmapi.ListKvOpts) (ret cmapi.ListKvRet, err error) }
IClusterManager define the interface of clustermgr
type IVolumeUpdater ¶
type IVolumeUpdater interface { UpdateFollowerVolumeCache(ctx context.Context, host string, vid proto.Vid) (err error) UpdateLeaderVolumeCache(ctx context.Context, vid proto.Vid) (err error) }
IVolumeUpdater update volume cache
func NewVolumeUpdater ¶
func NewVolumeUpdater(cfg *api.Config, host string) IVolumeUpdater
type MigratingDiskMeta ¶
type MigratingDiskMeta struct { Disk *DiskInfoSimple `json:"disk"` TaskType proto.TaskType `json:"task_type"` Ctime string `json:"ctime"` }
func (*MigratingDiskMeta) ID ¶
func (d *MigratingDiskMeta) ID() string
type ProxyAPI ¶
type ProxyAPI interface {
SendShardRepairMsg(ctx context.Context, vid proto.Vid, bid proto.BlobID, badIdx []uint8) error
}
ProxyAPI define the interface of proxy used by scheduler
type RegisterInfo ¶
type RegisterInfo struct { ClusterID uint64 `json:"cluster_id"` Name string `json:"name"` Host string `json:"host"` Idc string `json:"idc"` HeartbeatIntervalS uint32 `json:"heartbeat_interval_s"` HeartbeatTicks uint32 `json:"heartbeat_ticks"` ExpiresTicks uint32 `json:"expires_ticks"` }
RegisterInfo register info use for clustermgr
type VolumeInfoSimple ¶
type VolumeInfoSimple struct { Vid proto.Vid `json:"vid"` CodeMode codemode.CodeMode `json:"code_mode"` Status proto.VolumeStatus `json:"status"` VunitLocations []proto.VunitLocation `json:"vunit_locations"` }
VolumeInfoSimple volume info used by scheduler
func (*VolumeInfoSimple) EqualWith ¶
func (vol *VolumeInfoSimple) EqualWith(volInfo *VolumeInfoSimple) bool
EqualWith returns whether equal with another.
func (*VolumeInfoSimple) IsActive ¶
func (vol *VolumeInfoSimple) IsActive() bool
IsActive returns true if volume is active
func (*VolumeInfoSimple) IsIdle ¶
func (vol *VolumeInfoSimple) IsIdle() bool
IsIdle returns true if volume is idle