Documentation ¶
Index ¶
- Constants
- Variables
- func BuildAliasKey(aliasName string) string
- func BuildAliasKey210(alias string) string
- func BuildAliasKeyWithDB(dbID int64, aliasName string) string
- func BuildAliasPrefixWithDB(dbID int64) string
- func BuildCollectionKey(dbID typeutil.UniqueID, collectionID typeutil.UniqueID) string
- func BuildCollectionKeyWithDBID(dbID int64, collectionID int64) string
- func BuildDatabaseKey(dbID int64) string
- func BuildDatabasePrefixWithDBID(dbID int64) string
- func BuildFieldKey(collectionID typeutil.UniqueID, fieldID int64) string
- func BuildFieldPrefix(collectionID typeutil.UniqueID) string
- func BuildFunctionKey(collectionID typeutil.UniqueID, functionID int64) string
- func BuildFunctionPrefix(collectionID typeutil.UniqueID) string
- func BuildPartitionKey(collectionID, partitionID typeutil.UniqueID) string
- func BuildPartitionPrefix(collectionID typeutil.UniqueID) string
- func BuildPrivilegeGroupkey(groupName string) string
- func ComposeSnapshotKey(snapshotPrefix string, key string, separator string, ts typeutil.Timestamp) string
- func ConstructTombstone() []byte
- func IsTombstone(value string) bool
- type Catalog
- func (kc *Catalog) AlterAlias(ctx context.Context, alias *model.Alias, ts typeutil.Timestamp) error
- func (kc *Catalog) AlterCollection(ctx context.Context, oldColl *model.Collection, newColl *model.Collection, ...) error
- func (kc *Catalog) AlterCredential(ctx context.Context, credential *model.Credential) error
- func (kc *Catalog) AlterDatabase(ctx context.Context, newColl *model.Database, ts typeutil.Timestamp) error
- func (kc *Catalog) AlterGrant(ctx context.Context, tenant string, entity *milvuspb.GrantEntity, ...) error
- func (kc *Catalog) AlterPartition(ctx context.Context, dbID int64, oldPart *model.Partition, ...) error
- func (kc *Catalog) AlterUserRole(ctx context.Context, tenant string, userEntity *milvuspb.UserEntity, ...) error
- func (kc *Catalog) BackupRBAC(ctx context.Context, tenant string) (*milvuspb.RBACMeta, error)
- func (kc *Catalog) Close()
- func (kc *Catalog) CollectionExists(ctx context.Context, dbID int64, collectionID typeutil.UniqueID, ...) bool
- func (kc *Catalog) CreateAlias(ctx context.Context, alias *model.Alias, ts typeutil.Timestamp) error
- func (kc *Catalog) CreateCollection(ctx context.Context, coll *model.Collection, ts typeutil.Timestamp) error
- func (kc *Catalog) CreateCredential(ctx context.Context, credential *model.Credential) error
- func (kc *Catalog) CreateDatabase(ctx context.Context, db *model.Database, ts typeutil.Timestamp) error
- func (kc *Catalog) CreatePartition(ctx context.Context, dbID int64, partition *model.Partition, ...) error
- func (kc *Catalog) CreateRole(ctx context.Context, tenant string, entity *milvuspb.RoleEntity) error
- func (kc *Catalog) DeleteGrant(ctx context.Context, tenant string, role *milvuspb.RoleEntity) error
- func (kc *Catalog) DropAlias(ctx context.Context, dbID int64, alias string, ts typeutil.Timestamp) error
- func (kc *Catalog) DropCollection(ctx context.Context, collectionInfo *model.Collection, ts typeutil.Timestamp) error
- func (kc *Catalog) DropCredential(ctx context.Context, username string) error
- func (kc *Catalog) DropDatabase(ctx context.Context, dbID int64, ts typeutil.Timestamp) error
- func (kc *Catalog) DropPartition(ctx context.Context, dbID int64, collectionID typeutil.UniqueID, ...) error
- func (kc *Catalog) DropPrivilegeGroup(ctx context.Context, groupName string) error
- func (kc *Catalog) DropRole(ctx context.Context, tenant string, roleName string) error
- func (kc *Catalog) GetCollectionByID(ctx context.Context, dbID int64, ts typeutil.Timestamp, ...) (*model.Collection, error)
- func (kc *Catalog) GetCollectionByName(ctx context.Context, dbID int64, collectionName string, ts typeutil.Timestamp) (*model.Collection, error)
- func (kc *Catalog) GetCredential(ctx context.Context, username string) (*model.Credential, error)
- func (kc *Catalog) GetPrivilegeGroup(ctx context.Context, groupName string) (*milvuspb.PrivilegeGroupInfo, error)
- func (kc *Catalog) ListAliases(ctx context.Context, dbID int64, ts typeutil.Timestamp) ([]*model.Alias, error)
- func (kc *Catalog) ListCollections(ctx context.Context, dbID int64, ts typeutil.Timestamp) ([]*model.Collection, error)
- func (kc *Catalog) ListCredentials(ctx context.Context) ([]string, error)
- func (kc *Catalog) ListCredentialsWithPasswd(ctx context.Context) (map[string]string, error)
- func (kc *Catalog) ListDatabases(ctx context.Context, ts typeutil.Timestamp) ([]*model.Database, error)
- func (kc *Catalog) ListGrant(ctx context.Context, tenant string, entity *milvuspb.GrantEntity) ([]*milvuspb.GrantEntity, error)
- func (kc *Catalog) ListPolicy(ctx context.Context, tenant string) ([]string, error)
- func (kc *Catalog) ListPrivilegeGroups(ctx context.Context) ([]*milvuspb.PrivilegeGroupInfo, error)
- func (kc *Catalog) ListRole(ctx context.Context, tenant string, entity *milvuspb.RoleEntity, ...) ([]*milvuspb.RoleResult, error)
- func (kc *Catalog) ListUser(ctx context.Context, tenant string, entity *milvuspb.UserEntity, ...) ([]*milvuspb.UserResult, error)
- func (kc *Catalog) ListUserRole(ctx context.Context, tenant string) ([]string, error)
- func (kc *Catalog) RestoreRBAC(ctx context.Context, tenant string, meta *milvuspb.RBACMeta) error
- func (kc *Catalog) SavePrivilegeGroup(ctx context.Context, data *milvuspb.PrivilegeGroupInfo) error
- type SuffixSnapshot
- func (ss *SuffixSnapshot) Close()
- func (ss *SuffixSnapshot) Load(key string, ts typeutil.Timestamp) (string, error)
- func (ss *SuffixSnapshot) LoadWithPrefix(key string, ts typeutil.Timestamp) ([]string, []string, error)
- func (ss *SuffixSnapshot) MultiSave(kvs map[string]string, ts typeutil.Timestamp) error
- func (ss *SuffixSnapshot) MultiSaveAndRemove(saves map[string]string, removals []string, ts typeutil.Timestamp) error
- func (ss *SuffixSnapshot) MultiSaveAndRemoveWithPrefix(saves map[string]string, removals []string, ts typeutil.Timestamp) error
- func (ss *SuffixSnapshot) Save(key string, value string, ts typeutil.Timestamp) error
Constants ¶
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" FunctionMetaPrefix = ComponentPrefix + "/functions" // 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" // PrivilegeGroupPrefix prefix for privilege group PrivilegeGroupPrefix = ComponentPrefix + "/privilege-group" )
Variables ¶
var ( // SuffixSnapshotTombstone special value for tombstone mark SuffixSnapshotTombstone = []byte{0xE2, 0x9B, 0xBC} PaginationSize = 5000 )
Functions ¶
func BuildAliasKey ¶
func BuildAliasKey210 ¶
func BuildAliasKeyWithDB ¶
func BuildAliasPrefixWithDB ¶
func BuildCollectionKey ¶
func BuildDatabaseKey ¶
func BuildFieldPrefix ¶
func BuildFunctionKey ¶
func BuildFunctionPrefix ¶
func BuildPartitionKey ¶
func BuildPartitionPrefix ¶
func BuildPrivilegeGroupkey ¶
func ComposeSnapshotKey ¶
func ComposeSnapshotKey(snapshotPrefix string, key string, separator string, ts typeutil.Timestamp) string
ComposeSnapshotKey used in migration tool also, in case of any rules change.
func ConstructTombstone ¶
func ConstructTombstone() []byte
ConstructTombstone used in migration tool also.
Types ¶
type Catalog ¶
type Catalog struct { Txn kv.TxnKV Snapshot kv.SnapShotKV }
func (*Catalog) AlterAlias ¶
func (*Catalog) AlterCollection ¶
func (*Catalog) AlterCredential ¶
func (*Catalog) AlterDatabase ¶
func (*Catalog) AlterGrant ¶
func (kc *Catalog) AlterGrant(ctx context.Context, tenant string, entity *milvuspb.GrantEntity, operateType milvuspb.OperatePrivilegeType) error
func (*Catalog) AlterPartition ¶
func (*Catalog) AlterUserRole ¶
func (kc *Catalog) AlterUserRole(ctx context.Context, tenant string, userEntity *milvuspb.UserEntity, roleEntity *milvuspb.RoleEntity, operateType milvuspb.OperateUserRoleType) error
func (*Catalog) BackupRBAC ¶
func (*Catalog) CollectionExists ¶
func (*Catalog) CreateAlias ¶
func (*Catalog) CreateCollection ¶
func (*Catalog) CreateCredential ¶
func (*Catalog) CreateDatabase ¶
func (*Catalog) CreatePartition ¶
func (*Catalog) CreateRole ¶
func (*Catalog) DeleteGrant ¶
func (*Catalog) DropCollection ¶
func (*Catalog) DropCredential ¶
func (*Catalog) DropDatabase ¶
func (*Catalog) DropPartition ¶
func (*Catalog) DropPrivilegeGroup ¶
func (*Catalog) GetCollectionByID ¶
func (*Catalog) GetCollectionByName ¶
func (*Catalog) GetCredential ¶
func (*Catalog) GetPrivilegeGroup ¶
func (*Catalog) ListAliases ¶
func (*Catalog) ListCollections ¶
func (*Catalog) ListCredentials ¶
func (*Catalog) ListCredentialsWithPasswd ¶
func (*Catalog) ListDatabases ¶
func (*Catalog) ListGrant ¶
func (kc *Catalog) ListGrant(ctx context.Context, tenant string, entity *milvuspb.GrantEntity) ([]*milvuspb.GrantEntity, error)
func (*Catalog) ListPolicy ¶
func (*Catalog) ListPrivilegeGroups ¶
func (*Catalog) ListRole ¶
func (kc *Catalog) ListRole(ctx context.Context, tenant string, entity *milvuspb.RoleEntity, includeUserInfo bool) ([]*milvuspb.RoleResult, error)
func (*Catalog) ListUser ¶
func (kc *Catalog) ListUser(ctx context.Context, tenant string, entity *milvuspb.UserEntity, includeRoleInfo bool) ([]*milvuspb.UserResult, error)
func (*Catalog) ListUserRole ¶
func (*Catalog) RestoreRBAC ¶
func (*Catalog) SavePrivilegeGroup ¶
type SuffixSnapshot ¶
type SuffixSnapshot struct { // internal kv which SuffixSnapshot based on kv.MetaKv // rw mutex provided range lock sync.RWMutex // contains filtered or unexported fields }
SuffixSnapshot implements SnapshotKV this is a simple replacement for MetaSnapshot, which is not available due to etcd compaction SuffixSnapshot record timestamp as prefix of a key under the Snapshot prefix path
func NewSuffixSnapshot ¶
func NewSuffixSnapshot(metaKV kv.MetaKv, sep, root, snapshot string) (*SuffixSnapshot, error)
NewSuffixSnapshot creates a NewSuffixSnapshot with provided kv
func (*SuffixSnapshot) Close ¶
func (ss *SuffixSnapshot) Close()
func (*SuffixSnapshot) LoadWithPrefix ¶
func (ss *SuffixSnapshot) LoadWithPrefix(key string, ts typeutil.Timestamp) ([]string, []string, error)
LoadWithPrefix load keys with provided prefix and returns value in the ts
func (*SuffixSnapshot) MultiSave ¶
MultiSave save multiple kvs if ts == 0, act like MetaKv each key-value will be treated using same logic like Save
func (*SuffixSnapshot) MultiSaveAndRemove ¶
func (ss *SuffixSnapshot) MultiSaveAndRemove(saves map[string]string, removals []string, ts typeutil.Timestamp) error
MultiSaveAndRemove save muiltple kvs and remove as well if ts == 0, act like MetaKv each key-value will be treated in same logic like Save
func (*SuffixSnapshot) MultiSaveAndRemoveWithPrefix ¶
func (ss *SuffixSnapshot) MultiSaveAndRemoveWithPrefix(saves map[string]string, removals []string, ts typeutil.Timestamp) error
MultiSaveAndRemoveWithPrefix save muiltple kvs and remove as well if ts == 0, act like MetaKv each key-value will be treated in same logic like Save