mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
db: check funcs required by dispatcher
This commit is contained in:
@@ -17,6 +17,7 @@ package db
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/utils"
|
||||
@@ -74,6 +75,40 @@ func mustCheckModelManager(modelMan IModelManager) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if false {
|
||||
requiredManagerFuncNames := []string{
|
||||
"ListItemFilter",
|
||||
"OrderByExtraFields",
|
||||
"FetchCustomizeColumns",
|
||||
}
|
||||
for _, name := range requiredManagerFuncNames {
|
||||
manV := reflect.ValueOf(modelMan)
|
||||
methV := manV.MethodByName(name)
|
||||
if !methV.IsValid() {
|
||||
msg := fmt.Sprintf("model manager %T: has no valid %s, likely caused by ambiguity",
|
||||
modelMan, name)
|
||||
panic(msg)
|
||||
}
|
||||
}
|
||||
requiredModelFuncNames := []string{
|
||||
"GetExtraDetails",
|
||||
}
|
||||
for _, name := range requiredModelFuncNames {
|
||||
model, err := NewModelObject(modelMan)
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("model manager %T: new model object: %v", modelMan, err)
|
||||
panic(msg)
|
||||
}
|
||||
modelV := reflect.ValueOf(model)
|
||||
methV := modelV.MethodByName(name)
|
||||
if !methV.IsValid() {
|
||||
msg := fmt.Sprintf("model %T: has no valid %s, likely caused by ambiguity",
|
||||
model, name)
|
||||
panic(msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func CheckSync(autoSync bool) bool {
|
||||
|
||||
Reference in New Issue
Block a user