Renamed structures IndexHealthReply

This commit is contained in:
Trial97
2021-06-17 10:53:41 +03:00
committed by Dan Christian Bogos
parent d76d496a1e
commit 7411db3a31
2 changed files with 25 additions and 25 deletions

View File

@@ -831,14 +831,14 @@ type IndexHealthArgs struct {
ObjectCacheStaticTTL bool
}
type IndexHealthReply struct {
MissingObjects []string // list of object that are referenced in indexes but are not found in the dataDB
MissingIndexes map[string][]string // list of missing indexes for each object (the map has the key as the objectID and a list of indexes)
BrokenReferences map[string][]string // list of broken references (the map has the key as the objectID and a list of indexes)
type AccountActionPlanIHReply struct {
MissingActionPlans []string // list of object that are referenced in indexes but are not found in the dataDB
MissingAccountActionPlans map[string][]string // list of missing indexes for each object (the map has the key as the objectID and a list of indexes)
BrokenReferences map[string][]string // list of broken references (the map has the key as the objectID and a list of indexes)
}
// add cache in args API
func GetAccountActionPlanIndexHealth(dm *DataManager, objLimit, indexLimit int, objTTL, indexTTL time.Duration, objStaticTTL, indexStaticTTL bool) (rply *IndexHealthReply, err error) {
func GetAccountActionPlanIndexHealth(dm *DataManager, objLimit, indexLimit int, objTTL, indexTTL time.Duration, objStaticTTL, indexStaticTTL bool) (rply *AccountActionPlanIHReply, err error) {
// posible errors
missingAP := utils.StringSet{} // the index are present but the action plans are not //missing actionplans
brokenRef := map[string][]string{} // the actionPlans match the index but they are missing the account // broken reference
@@ -943,10 +943,10 @@ func GetAccountActionPlanIndexHealth(dm *DataManager, objLimit, indexLimit int,
}
}
rply = &IndexHealthReply{
MissingObjects: missingAP.AsSlice(),
MissingIndexes: missingIndex,
BrokenReferences: brokenRef,
rply = &AccountActionPlanIHReply{
MissingActionPlans: missingAP.AsSlice(),
MissingAccountActionPlans: missingIndex,
BrokenReferences: brokenRef,
}
return
}

View File

@@ -43,10 +43,10 @@ func TestHealthAccountAction(t *testing.T) {
t.Fatal(err)
}
exp := &IndexHealthReply{
MissingObjects: []string{"AP1"},
MissingIndexes: map[string][]string{"AP2": {"1002"}},
BrokenReferences: map[string][]string{"AP2": {"1001"}},
exp := &AccountActionPlanIHReply{
MissingActionPlans: []string{"AP1"},
MissingAccountActionPlans: map[string][]string{"AP2": {"1002"}},
BrokenReferences: map[string][]string{"AP2": {"1001"}},
}
if rply, err := GetAccountActionPlanIndexHealth(dm, -1, -1, -1, -1, false, false); err != nil {
t.Fatal(err)
@@ -72,10 +72,10 @@ func TestHealthAccountAction2(t *testing.T) {
t.Fatal(err)
}
exp := &IndexHealthReply{
MissingObjects: []string{"AP1"},
MissingIndexes: map[string][]string{},
BrokenReferences: map[string][]string{},
exp := &AccountActionPlanIHReply{
MissingActionPlans: []string{"AP1"},
MissingAccountActionPlans: map[string][]string{},
BrokenReferences: map[string][]string{},
}
if rply, err := GetAccountActionPlanIndexHealth(dm, -1, -1, -1, -1, false, false); err != nil {
t.Fatal(err)
@@ -108,10 +108,10 @@ func TestHealthAccountAction3(t *testing.T) {
t.Fatal(err)
}
exp := &IndexHealthReply{
MissingObjects: []string{},
MissingIndexes: map[string][]string{"AP2": {"1002"}},
BrokenReferences: map[string][]string{},
exp := &AccountActionPlanIHReply{
MissingActionPlans: []string{},
MissingAccountActionPlans: map[string][]string{"AP2": {"1002"}},
BrokenReferences: map[string][]string{},
}
if rply, err := GetAccountActionPlanIndexHealth(dm, -1, -1, -1, -1, false, false); err != nil {
t.Fatal(err)
@@ -147,10 +147,10 @@ func TestHealthAccountAction4(t *testing.T) {
t.Fatal(err)
}
exp := &IndexHealthReply{
MissingObjects: []string{},
MissingIndexes: map[string][]string{},
BrokenReferences: map[string][]string{"AP2": {"1002"}},
exp := &AccountActionPlanIHReply{
MissingActionPlans: []string{},
MissingAccountActionPlans: map[string][]string{},
BrokenReferences: map[string][]string{"AP2": {"1002"}},
}
if rply, err := GetAccountActionPlanIndexHealth(dm, -1, -1, -1, -1, false, false); err != nil {
t.Fatal(err)