Documentation
¶
Index ¶
- Constants
- Variables
- func NopdataSize(size int)
- type BlobNodeClient
- func (c *BlobNodeClient) GetShard(ctx context.Context, location proto.VunitLocation, bid proto.BlobID, ...) (body io.ReadCloser, crc32 uint32, err error)
- func (c *BlobNodeClient) GetShards(ctx context.Context, location proto.VunitLocation, bids []api.BidInfo, ...) (getter api.ShardGetter, err error)
- func (c *BlobNodeClient) ListShards(ctx context.Context, location proto.VunitLocation) (sis []*ShardInfo, err error)
- func (c *BlobNodeClient) PutShard(ctx context.Context, location proto.VunitLocation, bid proto.BlobID, ...) (err error)
- func (c *BlobNodeClient) StatChunk(ctx context.Context, location proto.VunitLocation) (ci *ChunkInfo, err error)
- func (c *BlobNodeClient) StatShard(ctx context.Context, location proto.VunitLocation, bid proto.BlobID, ...) (si *ShardInfo, err error)
- type ChunkInfo
- type Config
- type IBlobNode
- type IShardNode
- type LeaderTransferArgs
- type ShardInfo
- type ShardNodeClient
- func (c *ShardNodeClient) GetShardLeader(ctx context.Context, leader proto.ShardUnitInfoSimple) (*proto.ShardUnitInfoSimple, error)
- func (c *ShardNodeClient) GetShardStatus(ctx context.Context, suid proto.Suid, leader proto.ShardUnitInfoSimple) (*ShardStatusRet, error)
- func (c *ShardNodeClient) LeaderTransfer(ctx context.Context, args *LeaderTransferArgs) error
- func (c *ShardNodeClient) UpdateShard(ctx context.Context, args *UpdateShardArgs) error
- type ShardStatusRet
- type UpdateShardArgs
Constants ¶
View Source
const (
// ShardStatusNotExist shard not exist code
ShardStatusNotExist = 100
)
Variables ¶
View Source
var ( LeaderOutdatedErr = errors.New("leader outdated") SuidNotMemberOfShardErr = errors.New("suid not member of shard") )
Functions ¶
func NopdataSize ¶
func NopdataSize(size int)
Types ¶
type BlobNodeClient ¶
type BlobNodeClient struct {
// contains filtered or unexported fields
}
BlobNodeClient blobnode client
func (*BlobNodeClient) GetShard ¶
func (c *BlobNodeClient) GetShard(ctx context.Context, location proto.VunitLocation, bid proto.BlobID, ioType api.IOType) (body io.ReadCloser, crc32 uint32, err error)
GetShard returns shard data
func (*BlobNodeClient) GetShards ¶
func (c *BlobNodeClient) GetShards(ctx context.Context, location proto.VunitLocation, bids []api.BidInfo, ioType api.IOType) (getter api.ShardGetter, err error)
GetShards get batch shards
func (*BlobNodeClient) ListShards ¶
func (c *BlobNodeClient) ListShards(ctx context.Context, location proto.VunitLocation) (sis []*ShardInfo, err error)
ListShards return shards info
func (*BlobNodeClient) PutShard ¶
func (c *BlobNodeClient) PutShard(ctx context.Context, location proto.VunitLocation, bid proto.BlobID, size int64, data []byte, ioType api.IOType, ) (err error)
PutShard put data to shard
func (*BlobNodeClient) StatChunk ¶
func (c *BlobNodeClient) StatChunk(ctx context.Context, location proto.VunitLocation) (ci *ChunkInfo, err error)
StatChunk returns chunk stat
type IBlobNode ¶
type IBlobNode interface {
StatChunk(ctx context.Context, location proto.VunitLocation) (ci *ChunkInfo, err error)
StatShard(ctx context.Context, location proto.VunitLocation, bid proto.BlobID, ioType api.IOType) (si *ShardInfo, err error)
ListShards(ctx context.Context, location proto.VunitLocation) (shards []*ShardInfo, err error)
GetShard(ctx context.Context, location proto.VunitLocation, bid proto.BlobID, ioType api.IOType) (body io.ReadCloser, crc32 uint32, err error)
GetShards(ctx context.Context, location proto.VunitLocation, bids []api.BidInfo, ioType api.IOType) (getter api.ShardGetter, err error)
PutShard(ctx context.Context, location proto.VunitLocation, bid proto.BlobID, size int64, data []byte, ioType api.IOType) (err error)
}
IBlobNode define the interface of blobnode used for worker
func NewBlobNodeClient ¶
NewBlobNodeClient returns blobnode client
type IShardNode ¶
type IShardNode interface {
UpdateShard(ctx context.Context, args *UpdateShardArgs) error
GetShardStatus(ctx context.Context, suid proto.Suid, leader proto.ShardUnitInfoSimple) (*ShardStatusRet, error)
LeaderTransfer(ctx context.Context, args *LeaderTransferArgs) error
GetShardLeader(ctx context.Context, leader proto.ShardUnitInfoSimple) (*proto.ShardUnitInfoSimple, error)
}
IShardNode ShardNode client
func NewShardNodeClient ¶
func NewShardNodeClient(cfg shardnode.Config) IShardNode
type LeaderTransferArgs ¶
type LeaderTransferArgs struct {
DiskID proto.DiskID `json:"disk_id"`
Leader proto.ShardUnitInfoSimple `json:"leader"`
}
type ShardInfo ¶
ShardInfo shard info
func (*ShardInfo) MarkDeleted ¶
MarkDeleted return true if shard is mark delete
type ShardNodeClient ¶
type ShardNodeClient struct {
// contains filtered or unexported fields
}
func (*ShardNodeClient) GetShardLeader ¶
func (c *ShardNodeClient) GetShardLeader(ctx context.Context, leader proto.ShardUnitInfoSimple, ) (*proto.ShardUnitInfoSimple, error)
func (*ShardNodeClient) GetShardStatus ¶
func (c *ShardNodeClient) GetShardStatus(ctx context.Context, suid proto.Suid, leader proto.ShardUnitInfoSimple) (*ShardStatusRet, error)
func (*ShardNodeClient) LeaderTransfer ¶
func (c *ShardNodeClient) LeaderTransfer(ctx context.Context, args *LeaderTransferArgs) error
func (*ShardNodeClient) UpdateShard ¶
func (c *ShardNodeClient) UpdateShard(ctx context.Context, args *UpdateShardArgs) error
type ShardStatusRet ¶
type ShardStatusRet struct {
Suid proto.Suid `json:"suid"`
DiskID proto.DiskID `json:"disk_id"`
Leader proto.ShardUnitInfoSimple `json:"leader"` // leader
AppliedIndex uint64 `json:"applied_index"` // applied index of new add node
LeaderAppliedIndex uint64 `json:"leader_index"` // applied index of leader
}
type UpdateShardArgs ¶
type UpdateShardArgs struct {
Unit proto.ShardUnitInfoSimple `json:"unit"`
Type proto.ShardUpdateType `json:"type"`
Leader proto.ShardUnitInfoSimple `json:"leader"`
Learner bool `json:"learner"`
}
Click to show internal directories.
Click to hide internal directories.