Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeChunk(id ChunkId) string
- func IsValidChunkId(id ChunkId) bool
- func IsValidChunkStatus(status ChunkStatus) bool
- func IsValidDiskID(id proto.DiskID) bool
- func Setiotype(ctx context.Context, iot IOType) context.Context
- type BadShard
- type ChangeChunkStatusArgs
- type ChunkId
- func (c *ChunkId) Marshal() ([]byte, error)
- func (c ChunkId) MarshalJSON() ([]byte, error)
- func (c ChunkId) String() string
- func (c ChunkId) UnixTime() uint64
- func (c *ChunkId) Unmarshal(data []byte) error
- func (c *ChunkId) UnmarshalJSON(data []byte) (err error)
- func (c ChunkId) VolumeUnitId() proto.Vuid
- type ChunkInfo
- type ChunkInspectArgs
- type ChunkStatus
- type CompactChunkArgs
- type Config
- type ConfigReloadArgs
- type CreateChunkArgs
- type DeleteShardArgs
- type DiskHeartBeatInfo
- type DiskInfo
- type DiskProbeArgs
- type DiskStatArgs
- type GetShardArgs
- type IOType
- type ListChunkArgs
- type ListChunkRet
- type ListShardsArgs
- type ListShardsRet
- type PutShardArgs
- type PutShardRet
- type RangeGetShardArgs
- type ShardInfo
- type ShardStatus
- type StatChunkArgs
- type StatShardArgs
- type StorageAPI
- type WorkerAPI
- type WorkerStats
Constants ¶
View Source
const ( ReleaseForUser = "release for user" ReleaseForCompact = "release for compact" )
View Source
const (
ChunkIdLength = chunkVuidLen + chunkTimestmapLen
)
Chunk ID vuid + timestamp
View Source
const (
MaxShardSize = math.MaxUint32
)
View Source
const (
ShardDataInline = 0x80 // 1000 0000
)
Variables ¶
View Source
var (
ChunkIdEncodeLen = _vuidHexLen + _timestampHexLen + len(delimiter)
)
View Source
var IOtypemap = [...]string{
"normal",
"shardRepair",
"diskRepair",
"migrate",
"compact",
"delete",
"internal",
"inspect",
}
Functions ¶
func EncodeChunk ¶
func IsValidChunkId ¶
func IsValidChunkStatus ¶
func IsValidChunkStatus(status ChunkStatus) bool
func IsValidDiskID ¶
Types ¶
type ChangeChunkStatusArgs ¶
type ChunkId ¶
type ChunkId [ChunkIdLength]byte
var InvalidChunkId ChunkId = [ChunkIdLength]byte{}
func DecodeChunk ¶
func NewChunkId ¶
func (ChunkId) MarshalJSON ¶
func (*ChunkId) UnmarshalJSON ¶
func (ChunkId) VolumeUnitId ¶
type ChunkInfo ¶
type ChunkInfo struct { Id ChunkId `json:"id"` Vuid proto.Vuid `json:"vuid"` DiskID proto.DiskID `json:"diskid"` Total uint64 `json:"total"` // ChunkSize Used uint64 `json:"used"` // user data size Free uint64 `json:"free"` // ChunkSize - Used Size uint64 `json:"size"` // Chunk File Size (logic size) Status ChunkStatus `json:"status"` // normal、readOnly Compacting bool `json:"compacting"` }
type ChunkInspectArgs ¶
type ChunkStatus ¶
type ChunkStatus uint8
const ( ChunkStatusDefault ChunkStatus = iota // 0 ChunkStatusNormal // 1 ChunkStatusReadOnly // 2 ChunkStatusRelease // 3 ChunkNumStatus // 4 )
type CompactChunkArgs ¶
type ConfigReloadArgs ¶
type CreateChunkArgs ¶
type DeleteShardArgs ¶
type DiskHeartBeatInfo ¶
type DiskHeartBeatInfo struct { DiskID proto.DiskID `json:"disk_id"` Used int64 `json:"used"` // disk used space Free int64 `json:"free"` // remaining free space on the disk Size int64 `json:"size"` // total physical disk space MaxChunkCnt int64 `json:"max_chunk_cnt"` // note: maintained by clustermgr FreeChunkCnt int64 `json:"free_chunk_cnt"` // note: maintained by clustermgr UsedChunkCnt int64 `json:"used_chunk_cnt"` // current number of chunks on the disk }
type DiskInfo ¶
type DiskInfo struct { ClusterID proto.ClusterID `json:"cluster_id"` Idc string `json:"idc"` Rack string `json:"rack"` Host string `json:"host"` Path string `json:"path"` Status proto.DiskStatus `json:"status"` // normal、broken、repairing、repaired、dropped Readonly bool `json:"readonly"` CreateAt time.Time `json:"create_time"` LastUpdateAt time.Time `json:"last_update_time"` DiskHeartBeatInfo }
type DiskProbeArgs ¶
type DiskProbeArgs struct {
Path string `json:"path"`
}
type DiskStatArgs ¶
type GetShardArgs ¶
type IOType ¶
type IOType uint64
const ( NormalIO IOType = iota // From: external: user io: read/write ShardRepairIO // From: external: shard repair DiskRepairIO // From: external: disk repair MigrateIO // From: external: chunk transfer, drop, manualMigrate CompactIO // From: internal: chunk compact DeleteIO // From: external: delete io InternalIO // From: internal: io, such rubbish clean, batch delete InspectIO // From: internal: inspect io IOTypeMax )
func Task2IOType ¶
type ListChunkArgs ¶
type ListChunkRet ¶
type ListChunkRet struct {
ChunkInfos []*ChunkInfo `json:"chunk_infos"`
}
type ListShardsArgs ¶
type ListShardsRet ¶
type PutShardArgs ¶
type PutShardRet ¶
type PutShardRet struct {
Crc uint32 `json:"crc"`
}
type RangeGetShardArgs ¶
type RangeGetShardArgs struct { GetShardArgs Offset int64 `json:"offset"` Size int64 `json:"size"` }
type ShardStatus ¶
type ShardStatus uint8
const ( ShardStatusDefault ShardStatus = 0x0 // 0 ; 0000 ShardStatusNormal ShardStatus = 0x1 // 1 ; 0001 ShardStatusMarkDelete ShardStatus = 0x2 // 2 ; 0010 )
type StatChunkArgs ¶
type StatShardArgs ¶
type StorageAPI ¶
type StorageAPI interface { String(ctx context.Context, host string) string IsOnline(ctx context.Context, host string) bool Close(ctx context.Context, host string) error Stat(ctx context.Context, host string) (infos []*DiskInfo, err error) DiskInfo(ctx context.Context, host string, args *DiskStatArgs) (di *DiskInfo, err error) // chunks CreateChunk(ctx context.Context, host string, args *CreateChunkArgs) (err error) StatChunk(ctx context.Context, host string, args *StatChunkArgs) (ci *ChunkInfo, err error) ReleaseChunk(ctx context.Context, host string, args *ChangeChunkStatusArgs) (err error) SetChunkReadonly(ctx context.Context, host string, args *ChangeChunkStatusArgs) (err error) SetChunkReadwrite(ctx context.Context, host string, args *ChangeChunkStatusArgs) (err error) ListChunks(ctx context.Context, host string, args *ListChunkArgs) (cis []*ChunkInfo, err error) // shard GetShard(ctx context.Context, host string, args *GetShardArgs) (body io.ReadCloser, shardCrc uint32, err error) RangeGetShard(ctx context.Context, host string, args *RangeGetShardArgs) (body io.ReadCloser, shardCrc uint32, err error) PutShard(ctx context.Context, host string, args *PutShardArgs) (crc uint32, err error) StatShard(ctx context.Context, host string, args *StatShardArgs) (si *ShardInfo, err error) MarkDeleteShard(ctx context.Context, host string, args *DeleteShardArgs) (err error) DeleteShard(ctx context.Context, host string, args *DeleteShardArgs) (err error) ListShards(ctx context.Context, host string, args *ListShardsArgs) (sis []*ShardInfo, next proto.BlobID, err error) WorkerAPI }
func New ¶
func New(cfg *Config) StorageAPI
type WorkerAPI ¶
type WorkerAPI interface { RepairShard(ctx context.Context, host string, args *proto.ShardRepairTask) (err error) WorkerStats(ctx context.Context, host string) (ret WorkerStats, err error) }
WorkerAPI woker api on blobnode.
type WorkerStats ¶
Click to show internal directories.
Click to hide internal directories.