18
"github.com/cubefs/cubefs/blobstore/util/errors"
21
var ErrInvalidMsg = errors.New("msg is invalid")
26
InitStage DeleteStage = iota
31
type BlobDeleteStage struct {
32
Stages map[uint8]DeleteStage `json:"stages"`
35
func (s *BlobDeleteStage) SetStage(vuidIdx uint8, stage DeleteStage) {
37
s.Stages = make(map[uint8]DeleteStage)
39
s.Stages[vuidIdx] = stage
42
func (s *BlobDeleteStage) Stage(vuid Vuid) (DeleteStage, bool) {
43
stage, exist := s.Stages[vuid.Index()]
47
func (s *BlobDeleteStage) Copy() BlobDeleteStage {
48
myCopy := BlobDeleteStage{}
49
myCopy.Stages = make(map[uint8]DeleteStage)
50
for k, v := range s.Stages {
56
type DeleteMsg struct {
57
ClusterID ClusterID `json:"cluster_id"`
58
Bid BlobID `json:"bid"`
60
Retry int `json:"retry"`
61
Time int64 `json:"time"`
62
ReqId string `json:"req_id"`
63
BlobDelStages BlobDeleteStage `json:"blob_del_stages"`
66
func (msg *DeleteMsg) IsValid() bool {
67
if msg.Bid == InValidBlobID {
70
if msg.Vid == InvalidVid {
76
func (msg *DeleteMsg) SetDeleteStage(stage BlobDeleteStage) {
77
for idx, s := range stage.Stages {
78
msg.BlobDelStages.SetStage(idx, s)
82
type ShardRepairMsg struct {
83
ClusterID ClusterID `json:"cluster_id"`
84
Bid BlobID `json:"bid"`
86
BadIdx []uint8 `json:"bad_idx"`
87
Retry int `json:"retry"`
88
Reason string `json:"reason"`
89
ReqId string `json:"req_id"`
92
func (msg *ShardRepairMsg) IsValid() bool {
93
if msg.Bid == InValidBlobID {
96
if msg.Vid == InvalidVid {
99
if len(msg.BadIdx) == 0 {