Documentation ¶
Index ¶
- Constants
- func GetConsulClusterPath(region string) string
- type APIAccess
- type APIProxy
- type APIService
- type AddMemberArgs
- type AdminUpdateUnitArgs
- type AllConfig
- type AllocVolumeArgs
- type AllocVolumeInfo
- type AllocVolumeUnit
- type AllocVolumeUnitArgs
- type AllocatedVolumeInfos
- type BidScopeArgs
- type BidScopeRet
- type Client
- func (c *Client) AddDisk(ctx context.Context, info *blobnode.DiskInfo) (err error)
- func (c *Client) AddMember(ctx context.Context, args *AddMemberArgs) (err error)
- func (c *Client) AllocBid(ctx context.Context, args *BidScopeArgs) (ret *BidScopeRet, err error)
- func (c *Client) AllocDiskID(ctx context.Context) (proto.DiskID, error)
- func (c *Client) AllocVolume(ctx context.Context, args *AllocVolumeArgs) (ret AllocatedVolumeInfos, err error)
- func (c *Client) AllocVolumeUnit(ctx context.Context, args *AllocVolumeUnitArgs) (ret *AllocVolumeUnit, err error)
- func (c *Client) DeleteConfig(ctx context.Context, key string) (err error)
- func (c *Client) DeleteKV(ctx context.Context, key string) (err error)
- func (c *Client) DiskInfo(ctx context.Context, id proto.DiskID) (ret *blobnode.DiskInfo, err error)
- func (c *Client) DropDisk(ctx context.Context, id proto.DiskID) (err error)
- func (c *Client) DroppedDisk(ctx context.Context, id proto.DiskID) (err error)
- func (c *Client) GetConfig(ctx context.Context, key string) (ret string, err error)
- func (c *Client) GetKV(ctx context.Context, key string) (ret GetKvRet, err error)
- func (c *Client) GetService(ctx context.Context, args GetServiceArgs) (info ServiceInfo, err error)
- func (c *Client) GetVolumeInfo(ctx context.Context, args *GetVolumeArgs) (ret *VolumeInfo, err error)
- func (c *Client) HeartbeatDisk(ctx context.Context, infos []*blobnode.DiskHeartBeatInfo) (ret []*DiskHeartbeatRet, err error)
- func (c *Client) ListAllocatedVolumes(ctx context.Context, args *ListAllocatedVolumeArgs) (ret AllocatedVolumeInfos, err error)
- func (c *Client) ListDisk(ctx context.Context, options *ListOptionArgs) (ret ListDiskRet, err error)
- func (c *Client) ListDroppingDisk(ctx context.Context) (ret []*blobnode.DiskInfo, err error)
- func (c *Client) ListHostDisk(ctx context.Context, host string) (ret []*blobnode.DiskInfo, err error)
- func (c *Client) ListKV(ctx context.Context, args *ListKvOpts) (ret ListKvRet, err error)
- func (c *Client) ListService(ctx context.Context) (info ServiceInfo, err error)
- func (c *Client) ListVolume(ctx context.Context, args *ListVolumeArgs) (ret ListVolumes, err error)
- func (c *Client) ListVolumeUnit(ctx context.Context, args *ListVolumeUnitArgs) ([]*VolumeUnitInfo, error)
- func (c *Client) ListVolumeV2(ctx context.Context, args *ListVolumeV2Args) (ret ListVolumes, err error)
- func (c *Client) LockVolume(ctx context.Context, args *LockVolumeArgs) (err error)
- func (c *Client) RegisterService(ctx context.Context, node ServiceNode, ...) (err error)
- func (c *Client) ReleaseVolumeUnit(ctx context.Context, args *ReleaseVolumeUnitArgs) (err error)
- func (c *Client) RemoveMember(ctx context.Context, peerID uint64) (err error)
- func (c *Client) ReportChunk(ctx context.Context, args *ReportChunkArgs) (err error)
- func (c *Client) RetainVolume(ctx context.Context, args *RetainVolumeArgs) (ret RetainVolumes, err error)
- func (c *Client) SetCompactChunk(ctx context.Context, args *SetCompactChunkArgs) (err error)
- func (c *Client) SetConfig(ctx context.Context, args *ConfigSetArgs) (err error)
- func (c *Client) SetDisk(ctx context.Context, id proto.DiskID, status proto.DiskStatus) (err error)
- func (c *Client) SetKV(ctx context.Context, key string, value []byte) (err error)
- func (c *Client) SetReadonlyDisk(ctx context.Context, id proto.DiskID, readonly bool) (err error)
- func (c *Client) Snapshot(ctx context.Context) (*http.Response, error)
- func (c *Client) Stat(ctx context.Context) (ret *StatInfo, err error)
- func (c *Client) TransferLeadership(ctx context.Context, transfereeID uint64) (err error)
- func (c *Client) UnlockVolume(ctx context.Context, args *UnlockVolumeArgs) (err error)
- func (c *Client) UnregisterService(ctx context.Context, args UnregisterArgs) (err error)
- func (c *Client) UpdateVolume(ctx context.Context, args *UpdateVolumeArgs) (err error)
- type ClientAPI
- type ClusterInfo
- type Config
- type ConfigArgs
- type ConfigSetArgs
- type DeleteKvArgs
- type DiskAccessArgs
- type DiskHeartbeatRet
- type DiskIDAllocRet
- type DiskInfoArgs
- type DiskSetArgs
- type DiskStatInfo
- type DisksHeartbeatArgs
- type DisksHeartbeatRet
- type GetKvArgs
- type GetKvRet
- type GetServiceArgs
- type GetVolumeArgs
- type HeartbeatArgs
- type KeyValue
- type ListAllocatedVolumeArgs
- type ListDiskRet
- type ListKvOpts
- type ListKvRet
- type ListOptionArgs
- type ListVolumeArgs
- type ListVolumeUnitArgs
- type ListVolumeUnitInfos
- type ListVolumeV2Args
- type ListVolumes
- type LockVolumeArgs
- type MemberContext
- type MemberType
- type RegisterArgs
- type ReleaseVolumeUnitArgs
- type RemoveMemberArgs
- type ReportChunkArgs
- type RetainVolume
- type RetainVolumeArgs
- type RetainVolumes
- type ServiceInfo
- type ServiceNode
- type SetCompactChunkArgs
- type SetKvArgs
- type SpaceStatInfo
- type StatInfo
- type Unit
- type UnlockVolumeArgs
- type UnregisterArgs
- type UpdateVolumeArgs
- type VolumeInfo
- type VolumeInfoBase
- type VolumeStatInfo
- type VolumeUnitInfo
Constants ¶
const ( MemberTypeMin = MemberType(iota) MemberTypeLearner MemberTypeNormal MemberTypeMax )
const ( ConsulRegisterPath = "ebs/%s/clusters/" RaftSnapshotIndexHeaderKey = "Raft-Snapshot-Index" RaftSnapshotNameHeaderKey = "Raft-Snapshot-Name" )
const (
ListServiceUrl = "/service/list"
)
Variables ¶
This section is empty.
Functions ¶
func GetConsulClusterPath ¶
Types ¶
type APIAccess ¶
type APIAccess interface { GetConfig(ctx context.Context, key string) (string, error) GetService(ctx context.Context, args GetServiceArgs) (ServiceInfo, error) ListDisk(ctx context.Context, options *ListOptionArgs) (ListDiskRet, error) }
APIAccess sub of cluster manager api for access
type APIProxy ¶
type APIProxy interface { GetConfig(ctx context.Context, key string) (string, error) GetVolumeInfo(ctx context.Context, args *GetVolumeArgs) (*VolumeInfo, error) DiskInfo(ctx context.Context, id proto.DiskID) (*blobnode.DiskInfo, error) AllocVolume(ctx context.Context, args *AllocVolumeArgs) (AllocatedVolumeInfos, error) AllocBid(ctx context.Context, args *BidScopeArgs) (*BidScopeRet, error) RetainVolume(ctx context.Context, args *RetainVolumeArgs) (RetainVolumes, error) RegisterService(ctx context.Context, node ServiceNode, tickInterval, heartbeatTicks, expiresTicks uint32) error }
APIProxy sub of cluster manager api for allocator
type APIService ¶
type APIService interface {
GetService(ctx context.Context, args GetServiceArgs) (ServiceInfo, error)
}
APIService sub of cluster manager api for service
type AddMemberArgs ¶
type AddMemberArgs struct { PeerID uint64 `json:"peer_id"` Host string `json:"host"` MemberType MemberType `json:"member_type"` NodeHost string `json:"node_host"` }
type AdminUpdateUnitArgs ¶
type AdminUpdateUnitArgs struct { Epoch uint32 `json:"epoch"` NextEpoch uint32 `json:"next_epoch"` VolumeUnitInfo }
type AllocVolumeArgs ¶
type AllocVolumeInfo ¶
type AllocVolumeInfo struct { VolumeInfo Token string `json:"token"` ExpireTime int64 `json:"expire_time"` }
type AllocVolumeUnit ¶
type AllocVolumeUnitArgs ¶
type AllocatedVolumeInfos ¶
type AllocatedVolumeInfos struct {
AllocVolumeInfos []AllocVolumeInfo `json:"alloc_volume_infos"`
}
type BidScopeArgs ¶
type BidScopeArgs struct {
Count uint64 `json:"count"`
}
type BidScopeRet ¶
type Client ¶
func (*Client) AddMember ¶
func (c *Client) AddMember(ctx context.Context, args *AddMemberArgs) (err error)
AddMember add new member(normal or learner) into raft cluster
func (*Client) AllocBid ¶
func (c *Client) AllocBid(ctx context.Context, args *BidScopeArgs) (ret *BidScopeRet, err error)
BidAlloc return available bid scope
func (*Client) AllocDiskID ¶
DiskIDAlloc alloc diskID from cluster manager
func (*Client) AllocVolume ¶
func (c *Client) AllocVolume(ctx context.Context, args *AllocVolumeArgs) (ret AllocatedVolumeInfos, err error)
func (*Client) AllocVolumeUnit ¶
func (c *Client) AllocVolumeUnit(ctx context.Context, args *AllocVolumeUnitArgs) (ret *AllocVolumeUnit, err error)
func (*Client) DeleteConfig ¶
func (*Client) DroppedDisk ¶
func (*Client) GetService ¶
func (c *Client) GetService(ctx context.Context, args GetServiceArgs) (info ServiceInfo, err error)
func (*Client) GetVolumeInfo ¶
func (c *Client) GetVolumeInfo(ctx context.Context, args *GetVolumeArgs) (ret *VolumeInfo, err error)
func (*Client) HeartbeatDisk ¶
func (c *Client) HeartbeatDisk(ctx context.Context, infos []*blobnode.DiskHeartBeatInfo) (ret []*DiskHeartbeatRet, err error)
HeartbeatDisk report blobnode disk latest capacity info to cluster manager
func (*Client) ListAllocatedVolumes ¶
func (c *Client) ListAllocatedVolumes(ctx context.Context, args *ListAllocatedVolumeArgs) (ret AllocatedVolumeInfos, err error)
list allocated volume return already allocated allocator's volume
func (*Client) ListDisk ¶
func (c *Client) ListDisk(ctx context.Context, options *ListOptionArgs) (ret ListDiskRet, err error)
ListDisk list disk info from cluster manager when ListOptionArgs is default value, defalut return 10 diskInfos
func (*Client) ListDroppingDisk ¶
func (*Client) ListHostDisk ¶
func (c *Client) ListHostDisk(ctx context.Context, host string) (ret []*blobnode.DiskInfo, err error)
ListHostDisk list specified host disk info from cluster manager
func (*Client) ListService ¶
func (c *Client) ListService(ctx context.Context) (info ServiceInfo, err error)
func (*Client) ListVolume ¶
func (c *Client) ListVolume(ctx context.Context, args *ListVolumeArgs) (ret ListVolumes, err error)
func (*Client) ListVolumeUnit ¶
func (c *Client) ListVolumeUnit(ctx context.Context, args *ListVolumeUnitArgs) ([]*VolumeUnitInfo, error)
func (*Client) ListVolumeV2 ¶
func (c *Client) ListVolumeV2(ctx context.Context, args *ListVolumeV2Args) (ret ListVolumes, err error)
func (*Client) LockVolume ¶
func (c *Client) LockVolume(ctx context.Context, args *LockVolumeArgs) (err error)
func (*Client) RegisterService ¶
func (c *Client) RegisterService(ctx context.Context, node ServiceNode, tickInterval, heartbeatTicks, expiresTicks uint32) (err error)
Register service node to cm tickInterval: unit of second HeartbeatInterval = heartbeatTicks * tickInterval expires = expiresTicks * tickInterval
func (*Client) ReleaseVolumeUnit ¶
func (c *Client) ReleaseVolumeUnit(ctx context.Context, args *ReleaseVolumeUnitArgs) (err error)
func (*Client) RemoveMember ¶
RemoveMember remove member from raft cluster
func (*Client) ReportChunk ¶
func (c *Client) ReportChunk(ctx context.Context, args *ReportChunkArgs) (err error)
func (*Client) RetainVolume ¶
func (c *Client) RetainVolume(ctx context.Context, args *RetainVolumeArgs) (ret RetainVolumes, err error)
func (*Client) SetCompactChunk ¶
func (c *Client) SetCompactChunk(ctx context.Context, args *SetCompactChunkArgs) (err error)
func (*Client) SetConfig ¶
func (c *Client) SetConfig(ctx context.Context, args *ConfigSetArgs) (err error)
func (*Client) SetReadonlyDisk ¶
func (*Client) TransferLeadership ¶
RemoveMember remove member from raft cluster
func (*Client) UnlockVolume ¶
func (c *Client) UnlockVolume(ctx context.Context, args *UnlockVolumeArgs) (err error)
func (*Client) UnregisterService ¶
func (c *Client) UnregisterService(ctx context.Context, args UnregisterArgs) (err error)
func (*Client) UpdateVolume ¶
func (c *Client) UpdateVolume(ctx context.Context, args *UpdateVolumeArgs) (err error)
type ClusterInfo ¶
type ConfigArgs ¶
type ConfigArgs struct {
Key string `json:"key"`
}
type ConfigSetArgs ¶
type DeleteKvArgs ¶
type DeleteKvArgs struct {
Key string `json:"key"`
}
type DiskAccessArgs ¶
type DiskHeartbeatRet ¶
type DiskHeartbeatRet struct { DiskID proto.DiskID `json:"disk_id"` Status proto.DiskStatus `json:"status"` ReadOnly bool `json:"read_only"` }
type DiskIDAllocRet ¶
type DiskInfoArgs ¶
type DiskSetArgs ¶
type DiskSetArgs struct { DiskID proto.DiskID `json:"disk_id"` Status proto.DiskStatus `json:"status"` }
type DiskStatInfo ¶
type DiskStatInfo struct { IDC string `json:"idc"` Total int `json:"total"` TotalChunk int64 `json:"total_chunk"` TotalFreeChunk int64 `json:"total_free_chunk"` Available int `json:"available"` Readonly int `json:"readonly"` Expired int `json:"expired"` Broken int `json:"broken"` Repairing int `json:"repairing"` Repaired int `json:"repaired"` Dropping int `json:"dropping"` Dropped int `json:"dropped"` }
type DisksHeartbeatArgs ¶
type DisksHeartbeatArgs struct {
Disks []*blobnode.DiskHeartBeatInfo `json:"disks"`
}
type DisksHeartbeatRet ¶
type DisksHeartbeatRet struct {
Disks []*DiskHeartbeatRet `json:"disks"`
}
type GetServiceArgs ¶
type GetServiceArgs struct {
Name string `json:"name"`
}
type GetVolumeArgs ¶
type HeartbeatArgs ¶
type HeartbeatArgs UnregisterArgs
type ListAllocatedVolumeArgs ¶
type ListDiskRet ¶
type ListKvOpts ¶
type ListOptionArgs ¶
type ListOptionArgs struct { Idc string `json:"idc,omitempty"` Rack string `json:"rack,omitempty"` Host string `json:"host,omitempty"` Status proto.DiskStatus `json:"status,omitempty"` // list disk info after marker Marker proto.DiskID `json:"marker,omitempty"` // one page count Count int `json:"count,omitempty"` }
type ListVolumeArgs ¶
type ListVolumeUnitArgs ¶
type ListVolumeUnitInfos ¶
type ListVolumeUnitInfos struct {
VolumeUnitInfos []*VolumeUnitInfo `json:"volume_unit_infos"`
}
type ListVolumeV2Args ¶
type ListVolumeV2Args struct {
Status proto.VolumeStatus `json:"status"`
}
type ListVolumes ¶
type ListVolumes struct { Volumes []*VolumeInfo `json:"volumes"` Marker proto.Vid `json:"marker"` }
type LockVolumeArgs ¶
type MemberContext ¶
type MemberContext struct {
NodeHost string `json:"node_host"`
}
func (*MemberContext) Marshal ¶
func (mc *MemberContext) Marshal() ([]byte, error)
func (*MemberContext) Unmarshal ¶
func (mc *MemberContext) Unmarshal(data []byte) error
type MemberType ¶
type MemberType uint8
type RegisterArgs ¶
type RegisterArgs struct { ServiceNode Timeout int `json:"timeout"` }
type ReleaseVolumeUnitArgs ¶
type RemoveMemberArgs ¶
type RemoveMemberArgs struct {
PeerID uint64 `json:"peer_id"`
}
type ReportChunkArgs ¶
func (*ReportChunkArgs) Encode ¶
func (r *ReportChunkArgs) Encode() ([]byte, error)
type RetainVolume ¶
type RetainVolumeArgs ¶
type RetainVolumeArgs struct {
Tokens []string `json:"tokens"`
}
type RetainVolumes ¶
type RetainVolumes struct {
RetainVolTokens []RetainVolume `json:"retain_vol_tokens"`
}
type ServiceInfo ¶
type ServiceInfo struct {
Nodes []ServiceNode `json:"nodes"`
}
type ServiceNode ¶
type SetCompactChunkArgs ¶
type SpaceStatInfo ¶
type SpaceStatInfo struct { TotalSpace int64 `json:"total_space"` FreeSpace int64 `json:"free_space"` UsedSpace int64 `json:"used_space"` WritableSpace int64 `json:"writable_space"` TotalBlobNode int64 `json:"total_blob_node"` TotalDisk int64 `json:"total_disk"` DisksStatInfos []DiskStatInfo `json:"disk_stat_infos"` }
type StatInfo ¶
type StatInfo struct { LeaderHost string `json:"leader_host"` ReadOnly bool `json:"read_only"` RaftStatus raftserver.Status `json:"raft_status"` SpaceStat SpaceStatInfo `json:"space_stat"` VolumeStat VolumeStatInfo `json:"volume_stat"` }
type UnlockVolumeArgs ¶
type UnregisterArgs ¶
type UpdateVolumeArgs ¶
type VolumeInfo ¶
type VolumeInfo struct { Units []Unit `json:"units"` VolumeInfoBase }
func (*VolumeInfo) Equal ¶
func (v *VolumeInfo) Equal(expected *VolumeInfo) bool
type VolumeInfoBase ¶
type VolumeInfoBase struct { Vid proto.Vid `json:"vid"` CodeMode codemode.CodeMode `json:"code_mode"` Status proto.VolumeStatus `json:"status"` HealthScore int `json:"health_score"` Total uint64 `json:"total"` Free uint64 `json:"free"` Used uint64 `json:"used"` CreateByNodeID uint64 `json:"create_by_node_id"` }