mirror of https://github.com/milvus-io/milvus.git
Use Set[string] instead of map[string]interface{} ServerType (#22853)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/22863/head
parent
1f718118e9
commit
0317e0458b
|
@ -34,7 +34,7 @@ func (c *stop) execute(args []string, flags *flag.FlagSet) {
|
|||
fmt.Fprintln(os.Stderr, c.getHelp())
|
||||
}
|
||||
c.serverType = args[2]
|
||||
if _, ok := typeutil.ServerTypeMap()[c.serverType]; !ok {
|
||||
if !typeutil.ServerTypeSet().Contain(c.serverType) {
|
||||
fmt.Fprintf(os.Stderr, "Unknown server type = %s\n", c.serverType)
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
|
|
@ -48,27 +48,26 @@ const (
|
|||
IndexNodeRole = "indexnode"
|
||||
)
|
||||
|
||||
var (
|
||||
serverTypeSet = NewSet(
|
||||
StandaloneRole,
|
||||
RootCoordRole,
|
||||
ProxyRole,
|
||||
QueryCoordRole,
|
||||
QueryNodeRole,
|
||||
IndexNodeRole,
|
||||
DataCoordRole,
|
||||
DataNodeRole,
|
||||
)
|
||||
serverTypeList = serverTypeSet.Collect()
|
||||
)
|
||||
|
||||
const Unlimited int64 = -1
|
||||
|
||||
func ServerTypeMap() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
EmbeddedRole: nil,
|
||||
StandaloneRole: nil,
|
||||
RootCoordRole: nil,
|
||||
ProxyRole: nil,
|
||||
QueryCoordRole: nil,
|
||||
QueryNodeRole: nil,
|
||||
IndexNodeRole: nil,
|
||||
DataCoordRole: nil,
|
||||
DataNodeRole: nil,
|
||||
}
|
||||
func ServerTypeSet() Set[string] {
|
||||
return serverTypeSet
|
||||
}
|
||||
|
||||
func ServerTypeList() []string {
|
||||
serverTypeMap := ServerTypeMap()
|
||||
types := make([]string, 0, len(serverTypeMap))
|
||||
for key := range serverTypeMap {
|
||||
types = append(types, key)
|
||||
}
|
||||
return types
|
||||
return serverTypeList
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue