in api/datanode/datanode.go [220:246]
func (dnClient *DatanodeClient) GetBlock(id *dnapi.DatanodeBlockID) ([]ChunkInfo, error) {
result := make([]ChunkInfo, 0)
req := dnapi.GetBlockRequestProto{
BlockID: id,
}
commandType := dnapi.Type_GetBlock
proto := dnapi.ContainerCommandRequestProto{
CmdType: &commandType,
GetBlock: &req,
ContainerID: id.ContainerID,
DatanodeUuid: dnClient.GetCurrentDnUUid(),
}
resp, err := dnClient.sendDatanodeCommand(proto)
if err != nil {
return result, err
}
for _, chunkInfo := range resp.GetGetBlock().GetBlockData().Chunks {
result = append(result, ChunkInfo{
Name: chunkInfo.GetChunkName(),
Offset: chunkInfo.GetOffset(),
Len: chunkInfo.GetLen(),
})
}
return result, nil
}