Documentation ¶
Index ¶
- Constants
- Variables
- type AllocVolumeCtx
- type ChangeVolStatusCtx
- type CreateVolumeCtx
- type DeleteTaskCtx
- type NotifyFunc
- type VolumeMgr
- func (v *VolumeMgr) AllocVolume(ctx context.Context, mode codemode.CodeMode, count int, host string) (ret *cm.AllocatedVolumeInfos, err error)
- func (v *VolumeMgr) AllocVolumeUnit(ctx context.Context, vuid proto.Vuid) (*cmapi.AllocVolumeUnit, error)
- func (v *VolumeMgr) Apply(ctx context.Context, operTypes []int32, datas [][]byte, ...) (err error)
- func (v *VolumeMgr) Close()
- func (v *VolumeMgr) DiskWritableChange(ctx context.Context, diskID proto.DiskID) (err error)
- func (v *VolumeMgr) Flush(ctx context.Context) error
- func (v *VolumeMgr) GetModuleName() string
- func (v *VolumeMgr) GetVolumeInfo(ctx context.Context, vid proto.Vid) (ret *cm.VolumeInfo, err error)
- func (v *VolumeMgr) ListAllocatedVolume(ctx context.Context, host string, mode codemode.CodeMode) (ret *cm.AllocatedVolumeInfos)
- func (v *VolumeMgr) ListVolumeInfo(ctx context.Context, args *cm.ListVolumeArgs) (ret []*cm.VolumeInfo, err error)
- func (v *VolumeMgr) ListVolumeInfoV2(ctx context.Context, status proto.VolumeStatus) (ret []*cm.VolumeInfo, err error)
- func (v *VolumeMgr) ListVolumeUnitInfo(ctx context.Context, args *cmapi.ListVolumeUnitArgs) ([]*cmapi.VolumeUnitInfo, error)
- func (v *VolumeMgr) LoadData(ctx context.Context) error
- func (v *VolumeMgr) LockVolume(ctx context.Context, vid proto.Vid) error
- func (v *VolumeMgr) NotifyLeaderChange(ctx context.Context, leader uint64, host string)
- func (v *VolumeMgr) PreRetainVolume(ctx context.Context, tokens []string, host string) (ret *cm.RetainVolumes, err error)
- func (v *VolumeMgr) PreUpdateVolumeUnit(ctx context.Context, args *cmapi.UpdateVolumeArgs) (err error)
- func (v *VolumeMgr) ReleaseVolumeUnit(ctx context.Context, vuid proto.Vuid, diskID proto.DiskID, force bool) (err error)
- func (v *VolumeMgr) Report(ctx context.Context, region string, clusterID proto.ClusterID)
- func (v *VolumeMgr) SetModuleName(module string)
- func (v *VolumeMgr) SetRaftServer(raftServer raftserver.RaftServer)
- func (v *VolumeMgr) Start()
- func (v *VolumeMgr) Stat(ctx context.Context) (stat cm.VolumeStatInfo)
- func (v *VolumeMgr) UnlockVolume(ctx context.Context, vid proto.Vid) error
- type VolumeMgrAPI
- type VolumeMgrConfig
Constants ¶
View Source
const ( OperTypeCreateVolume int32 = iota + 1 OperTypeAllocVolume OperTypeRetainVolume OperTypeChangeVolumeStatus OperTypeUpdateVolumeUnit OperTypeChunkReport OperTypeChunkSetCompact OperTypeVolumeUnitSetWritable OperTypeAllocVolumeUnit OperTypeDeleteTask OperTypeExpireVolume OperTypeAdminUpdateVolume OperTypeAdminUpdateVolumeUnit OperTypeInitCreateVolume OperTypeIncreaseVolumeUnitsEpoch )
View Source
const (
IncreaseEpochInterval = 3
)
View Source
const (
NoDiskLoadThreshold = int(^uint(0) >> 1)
)
Variables ¶
View Source
var ( VolStatusMetric = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "blobstore", Subsystem: "clusterMgr", Name: "vol_status_vol_count", Help: "vol status volume count", }, []string{"region", "cluster", "status", "is_leader"}, ) VolRetainMetric = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "blobstore", Subsystem: "clusterMgr", Name: "vol_retain_error", Help: "retain volume token error", }, []string{"region", "cluster", "is_leader"}, ) VolAllocMetric = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: "blobstore", Subsystem: "clusterMgr", Name: "vol_alloc_over_disk_load", Help: "alloc volume over disk load", }, []string{"region", "cluster", "is_leader"}, ) )
View Source
var ( ErrVolumeNotExist = apierrors.ErrVolumeNotExist ErrVolumeUnitNotExist = apierrors.ErrVolumeUnitNotExist ErrOldVuidNotMatch = apierrors.ErrOldVuidNotMatch ErrNewVuidNotMatch = apierrors.ErrNewVuidNotMatch ErrNewDiskIDNotMatch = apierrors.ErrNewDiskIDNotMatch ErrInvalidCodeMode = apierrors.ErrInvalidCodeMode ErrVolumeNotAlloc = apierrors.ErrRetainVolumeNotAlloc ErrCreateVolumeAlreadyExist = errors.New("create volume already exist") ErrInvalidVolume = errors.New(" volume is invalid ") ErrInvalidToken = errors.New("retain token is invalid") ErrRepeatUpdateUnit = errors.New("repeat update volume unit") )
View Source
var (
VolFreeHealthChangeNotifyKey = "freeOrHealthChange"
)
notify queue key definition
Functions ¶
This section is empty.
Types ¶
type AllocVolumeCtx ¶
type ChangeVolStatusCtx ¶
type ChangeVolStatusCtx struct { Vid proto.Vid `json:"vid"` TaskID string `json:"task_id"` TaskType base.VolumeTaskType `json:"type"` }
type CreateVolumeCtx ¶
type CreateVolumeCtx struct { VuInfos []*clustermgr.VolumeUnitInfo `json:"vu_infos"` VolInfo clustermgr.VolumeInfoBase `json:"vol_info"` Vid proto.Vid `json:"vid"` }
func (*CreateVolumeCtx) Decode ¶
func (c *CreateVolumeCtx) Decode(raw []byte) error
func (*CreateVolumeCtx) Encode ¶
func (c *CreateVolumeCtx) Encode() (data []byte, err error)
type DeleteTaskCtx ¶
type DeleteTaskCtx struct { Vid proto.Vid `json:"vid"` TaskType base.VolumeTaskType `json:"type"` TaskId string `json:"task_id"` }
type NotifyFunc ¶
type VolumeMgr ¶
type VolumeMgr struct { VolumeMgrConfig // contains filtered or unexported fields }
volumeMgr implements VolumeMgr interface.
func NewVolumeMgr ¶
func NewVolumeMgr(conf VolumeMgrConfig, diskMgr diskmgr.DiskMgrAPI, scopeMgr scopemgr.ScopeMgrAPI, configMgr configmgr.ConfigMgrAPI, volumeDB kvstore.KVStore) (*VolumeMgr, error, )
NewVolumeMgr constructs a new volume manager.
func (*VolumeMgr) AllocVolume ¶
func (*VolumeMgr) AllocVolumeUnit ¶
func (*VolumeMgr) DiskWritableChange ¶
func (*VolumeMgr) GetModuleName ¶
func (*VolumeMgr) GetVolumeInfo ¶
func (*VolumeMgr) ListAllocatedVolume ¶
func (*VolumeMgr) ListVolumeInfo ¶
func (v *VolumeMgr) ListVolumeInfo(ctx context.Context, args *cm.ListVolumeArgs) (ret []*cm.VolumeInfo, err error)
func (*VolumeMgr) ListVolumeInfoV2 ¶
func (v *VolumeMgr) ListVolumeInfoV2(ctx context.Context, status proto.VolumeStatus) (ret []*cm.VolumeInfo, err error)
func (*VolumeMgr) ListVolumeUnitInfo ¶
func (v *VolumeMgr) ListVolumeUnitInfo(ctx context.Context, args *cmapi.ListVolumeUnitArgs) ([]*cmapi.VolumeUnitInfo, error)
ListVolumeUnitInfo return disk's volume unit infos, it use index-table disk-vuid as index this API is lightly operation, it only call when broken disk or some else, so here is just get data from db
func (*VolumeMgr) LockVolume ¶
func (*VolumeMgr) NotifyLeaderChange ¶
Switch manager work when leader change
func (*VolumeMgr) PreRetainVolume ¶
func (*VolumeMgr) PreUpdateVolumeUnit ¶
func (*VolumeMgr) ReleaseVolumeUnit ¶
func (v *VolumeMgr) ReleaseVolumeUnit(ctx context.Context, vuid proto.Vuid, diskID proto.DiskID, force bool) (err error)
ReleaseVolumeUnit release old volumeUnit's old chunk
func (*VolumeMgr) SetModuleName ¶
func (*VolumeMgr) SetRaftServer ¶
func (v *VolumeMgr) SetRaftServer(raftServer raftserver.RaftServer)
type VolumeMgrAPI ¶
type VolumeMgrAPI interface { // GetVolumeInfo get volume details info GetVolumeInfo(ctx context.Context, vid proto.Vid) (ret *cm.VolumeInfo, err error) // ListVolumeInfo list volumes ListVolumeInfo(ctx context.Context, args *cm.ListVolumeArgs) (ret []*cm.VolumeInfo, err error) // ListVolumeV2 list specified status volumes ListVolumeInfoV2(ctx context.Context, status proto.VolumeStatus) (ret []*cm.VolumeInfo, err error) // VolumeAlloc alloc volumes AllocVolume(ctx context.Context, mode codemode.CodeMode, count int, host string) (ret *cm.AllocatedVolumeInfos, err error) // ListAllocatedVolume list allocated volumes ListAllocatedVolume(ctx context.Context, host string, mode codemode.CodeMode) (ret *cm.AllocatedVolumeInfos) // PreUpdateVolumeUnit update volume PreUpdateVolumeUnit(ctx context.Context, args *cm.UpdateVolumeArgs) (err error) // PreRetainVolume retain volume PreRetainVolume(ctx context.Context, tokens []string, host string) (ret *cm.RetainVolumes, err error) // DiskWritableChange call when disk broken or heartbeat timeout or switch readonly, it'll refresh volume's health DiskWritableChange(ctx context.Context, diskID proto.DiskID) (err error) // AllocVolumeUnit alloc a new chunk to volume unit, it will increase volumeUnit's nextEpoch in memory AllocVolumeUnit(ctx context.Context, vuid proto.Vuid) (*cm.AllocVolumeUnit, error) // ReleaseVolumeUnit release old volume unit's chunk ReleaseVolumeUnit(ctx context.Context, vuid proto.Vuid, diskID proto.DiskID, force bool) (err error) // ListVolumeUnitInfo head all volume unit info in the disk ListVolumeUnitInfo(ctx context.Context, args *cm.ListVolumeUnitArgs) ([]*cm.VolumeUnitInfo, error) LockVolume(ctx context.Context, vid proto.Vid) error UnlockVolume(ctx context.Context, vid proto.Vid) error // Stat return volume statistic info Stat(ctx context.Context) (stat cm.VolumeStatInfo) }
VolumeMgr defines volume manager interface
type VolumeMgrConfig ¶
type VolumeMgrConfig struct { LocalHost string `json:"local_host"` BlobNodeConfig blobnode.Config `json:"blob_node_config"` // volume database path,include volumeTbl vuidTbl tokenTbl indexTbl taskTbl VolumeDBPath string `json:"volume_db_path"` VolumeDBOption kvstore.RocksDBOption `json:"volume_db_option"` // retain successful volume add another retainTimeS second RetainTimeS int `json:"retain_time_s"` RetainThreshold int `json:"retain_threshold"` FlushIntervalS int `json:"flush_interval_s"` CheckExpiredVolumeIntervalS int `json:"check_expired_volume_interval_s"` VolumeSliceMapNum uint32 `json:"volume_slice_map_num"` ApplyConcurrency uint32 `json:"apply_concurrency"` MinAllocableVolumeCount int `json:"min_allocable_volume_count"` AllocatableDiskLoadThreshold int `json:"allocatable_disk_load_threshold"` AllocFactor int `json:"alloc_factor"` // the volume free size must big than AllocatableSize can alloc AllocatableSize uint64 `json:"allocatable_size"` // the volume in Proxy which free size small than FreezeThreshold treat filled FreezeThreshold uint64 `json:"-"` IDC []string `json:"-"` ChunkSize uint64 `json:"-"` CodeModePolicies []codemode.Policy `json:"-"` Region string `json:"-"` ClusterID proto.ClusterID `json:"-"` }
VolumeMgrConfig defines volume manager configuration
Click to show internal directories.
Click to hide internal directories.