milvus/internal/metastore/kv/rootcoord/rootcoord_constant.go
jaime 18df2ba6fd
[Cherry-Pick] Support Database (#24769)
Support Database(#23742)
Fix db nonexists error for FlushAll (#24222)
Fix check collection limits fails (#24235)
backward compatibility with empty DB name (#24317)
Fix GetFlushAllState with DB (#24347)
Remove db from global meta cache after drop database (#24474)
Fix db name is empty for describe collection response (#24603)
Add RBAC for Database API (#24653)
Fix miss load the same name collection during recover stage (#24941)

RBAC supports Database validation (#23609)
Fix to list grant with db return empty (#23922)
Optimize PrivilegeAll permission check (#23972)
Add the default db value for the rbac request (#24307)

Signed-off-by: jaime <yun.zhang@zilliz.com>
Co-authored-by: SimFG <bang.fu@zilliz.com>
Co-authored-by: longjiquan <jiquan.long@zilliz.com>
2023-06-25 17:20:43 +08:00

72 lines
2.2 KiB
Go

package rootcoord
import (
"fmt"
"github.com/milvus-io/milvus/pkg/util"
)
const (
// ComponentPrefix prefix for rootcoord component
ComponentPrefix = "root-coord"
DatabaseMetaPrefix = ComponentPrefix + "/database"
DBInfoMetaPrefix = DatabaseMetaPrefix + "/db-info"
CollectionInfoMetaPrefix = DatabaseMetaPrefix + "/collection-info"
// CollectionMetaPrefix prefix for collection meta
CollectionMetaPrefix = ComponentPrefix + "/collection"
PartitionMetaPrefix = ComponentPrefix + "/partitions"
AliasMetaPrefix = ComponentPrefix + "/aliases"
FieldMetaPrefix = ComponentPrefix + "/fields"
// CollectionAliasMetaPrefix210 prefix for collection alias meta
CollectionAliasMetaPrefix210 = ComponentPrefix + "/collection-alias"
SnapshotsSep = "_ts"
SnapshotPrefix = "snapshots"
Aliases = "aliases"
// CommonCredentialPrefix subpath for common credential
/* #nosec G101 */
CommonCredentialPrefix = "/credential"
// UserSubPrefix subpath for credential user
UserSubPrefix = CommonCredentialPrefix + "/users"
// CredentialPrefix prefix for credential user
CredentialPrefix = ComponentPrefix + UserSubPrefix
// RolePrefix prefix for role
RolePrefix = ComponentPrefix + CommonCredentialPrefix + "/roles"
// RoleMappingPrefix prefix for mapping between user and role
RoleMappingPrefix = ComponentPrefix + CommonCredentialPrefix + "/user-role-mapping"
// GranteePrefix prefix for mapping among role, resource type, resource name
GranteePrefix = ComponentPrefix + CommonCredentialPrefix + "/grantee-privileges"
// GranteeIDPrefix prefix for mapping among privilege and grantor
GranteeIDPrefix = ComponentPrefix + CommonCredentialPrefix + "/grantee-id"
)
func BuildDatabasePrefixWithDBID(dbID int64) string {
return fmt.Sprintf("%s/%d", CollectionInfoMetaPrefix, dbID)
}
func BuildCollectionKeyWithDBID(dbID int64, collectionID int64) string {
return fmt.Sprintf("%s/%d/%d", CollectionInfoMetaPrefix, dbID, collectionID)
}
func BuildDatabaseKey(dbID int64) string {
return fmt.Sprintf("%s/%d", DBInfoMetaPrefix, dbID)
}
func getDatabasePrefix(dbID int64) string {
if dbID != util.NonDBID {
return BuildDatabasePrefixWithDBID(dbID)
}
return CollectionMetaPrefix
}