rootcoord

package
v0.10.3-0...-06d73cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var (
	// SuffixSnapshotTombstone special value for tombstone mark
	SuffixSnapshotTombstone = []byte{0xE2, 0x9B, 0xBC}
	PaginationSize          = 5000
)

Functions

func BuildAliasKey

func BuildAliasKey(aliasName string) string

func BuildAliasKey210

func BuildAliasKey210(alias string) string

func BuildAliasKeyWithDB

func BuildAliasKeyWithDB(dbID int64, aliasName string) string

func BuildAliasPrefixWithDB

func BuildAliasPrefixWithDB(dbID int64) string

func BuildCollectionKey

func BuildCollectionKey(dbID typeutil.UniqueID, collectionID typeutil.UniqueID) string

func BuildCollectionKeyWithDBID

func BuildCollectionKeyWithDBID(dbID int64, collectionID int64) string

func BuildDatabaseKey

func BuildDatabaseKey(dbID int64) string

func BuildDatabasePrefixWithDBID

func BuildDatabasePrefixWithDBID(dbID int64) string

func BuildFieldKey

func BuildFieldKey(collectionID typeutil.UniqueID, fieldID int64) string

func BuildFieldPrefix

func BuildFieldPrefix(collectionID typeutil.UniqueID) string

func BuildFunctionKey

func BuildFunctionKey(collectionID typeutil.UniqueID, functionID int64) string

func BuildFunctionPrefix

func BuildFunctionPrefix(collectionID typeutil.UniqueID) string

func BuildPartitionKey

func BuildPartitionKey(collectionID, partitionID typeutil.UniqueID) string

func BuildPartitionPrefix

func BuildPartitionPrefix(collectionID typeutil.UniqueID) string

func BuildPrivilegeGroupkey

func BuildPrivilegeGroupkey(groupName string) string

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.

func IsTombstone

func IsTombstone(value string) bool

IsTombstone used in migration tool also.

Types

type Catalog

type Catalog struct {
	Txn      kv.TxnKV
	Snapshot kv.SnapShotKV
}

func (*Catalog) AlterAlias

func (kc *Catalog) AlterAlias(ctx context.Context, alias *model.Alias, ts typeutil.Timestamp) error

func (*Catalog) AlterCollection

func (kc *Catalog) AlterCollection(ctx context.Context, oldColl *model.Collection, newColl *model.Collection, alterType metastore.AlterType, ts typeutil.Timestamp) error

func (*Catalog) AlterCredential

func (kc *Catalog) AlterCredential(ctx context.Context, credential *model.Credential) error

func (*Catalog) AlterDatabase

func (kc *Catalog) AlterDatabase(ctx context.Context, newColl *model.Database, ts typeutil.Timestamp) error

func (*Catalog) AlterGrant

func (kc *Catalog) AlterGrant(ctx context.Context, tenant string, entity *milvuspb.GrantEntity, operateType milvuspb.OperatePrivilegeType) error

func (*Catalog) AlterPartition

func (kc *Catalog) AlterPartition(ctx context.Context, dbID int64, oldPart *model.Partition, newPart *model.Partition, alterType metastore.AlterType, ts typeutil.Timestamp) error

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 (kc *Catalog) BackupRBAC(ctx context.Context, tenant string) (*milvuspb.RBACMeta, error)

func (*Catalog) Close

func (kc *Catalog) Close()

func (*Catalog) CollectionExists

func (kc *Catalog) CollectionExists(ctx context.Context, dbID int64, collectionID typeutil.UniqueID, ts typeutil.Timestamp) bool

func (*Catalog) CreateAlias

func (kc *Catalog) CreateAlias(ctx context.Context, alias *model.Alias, ts typeutil.Timestamp) error

func (*Catalog) CreateCollection

func (kc *Catalog) CreateCollection(ctx context.Context, coll *model.Collection, ts typeutil.Timestamp) error

func (*Catalog) CreateCredential

func (kc *Catalog) CreateCredential(ctx context.Context, credential *model.Credential) error

func (*Catalog) CreateDatabase

func (kc *Catalog) CreateDatabase(ctx context.Context, db *model.Database, ts typeutil.Timestamp) error

func (*Catalog) CreatePartition

func (kc *Catalog) CreatePartition(ctx context.Context, dbID int64, partition *model.Partition, ts typeutil.Timestamp) error

func (*Catalog) CreateRole

func (kc *Catalog) CreateRole(ctx context.Context, tenant string, entity *milvuspb.RoleEntity) error

func (*Catalog) DeleteGrant

func (kc *Catalog) DeleteGrant(ctx context.Context, tenant string, role *milvuspb.RoleEntity) error

func (*Catalog) DropAlias

func (kc *Catalog) DropAlias(ctx context.Context, dbID int64, alias string, ts typeutil.Timestamp) error

func (*Catalog) DropCollection

func (kc *Catalog) DropCollection(ctx context.Context, collectionInfo *model.Collection, ts typeutil.Timestamp) error

func (*Catalog) DropCredential

func (kc *Catalog) DropCredential(ctx context.Context, username string) error

func (*Catalog) DropDatabase

func (kc *Catalog) DropDatabase(ctx context.Context, dbID int64, ts typeutil.Timestamp) error

func (*Catalog) DropPartition

func (kc *Catalog) DropPartition(ctx context.Context, dbID int64, collectionID typeutil.UniqueID, partitionID typeutil.UniqueID, ts typeutil.Timestamp) error

func (*Catalog) DropPrivilegeGroup

func (kc *Catalog) DropPrivilegeGroup(ctx context.Context, groupName string) error

func (*Catalog) DropRole

func (kc *Catalog) DropRole(ctx context.Context, tenant string, roleName string) error

func (*Catalog) GetCollectionByID

func (kc *Catalog) GetCollectionByID(ctx context.Context, dbID int64, ts typeutil.Timestamp, collectionID typeutil.UniqueID) (*model.Collection, error)

func (*Catalog) GetCollectionByName

func (kc *Catalog) GetCollectionByName(ctx context.Context, dbID int64, collectionName string, ts typeutil.Timestamp) (*model.Collection, error)

func (*Catalog) GetCredential

func (kc *Catalog) GetCredential(ctx context.Context, username string) (*model.Credential, error)

func (*Catalog) GetPrivilegeGroup

func (kc *Catalog) GetPrivilegeGroup(ctx context.Context, groupName string) (*milvuspb.PrivilegeGroupInfo, error)

func (*Catalog) ListAliases

func (kc *Catalog) ListAliases(ctx context.Context, dbID int64, ts typeutil.Timestamp) ([]*model.Alias, error)

func (*Catalog) ListCollections

func (kc *Catalog) ListCollections(ctx context.Context, dbID int64, ts typeutil.Timestamp) ([]*model.Collection, error)

func (*Catalog) ListCredentials

func (kc *Catalog) ListCredentials(ctx context.Context) ([]string, error)

func (*Catalog) ListCredentialsWithPasswd

func (kc *Catalog) ListCredentialsWithPasswd(ctx context.Context) (map[string]string, error)

func (*Catalog) ListDatabases

func (kc *Catalog) ListDatabases(ctx context.Context, ts typeutil.Timestamp) ([]*model.Database, error)

func (*Catalog) ListGrant

func (kc *Catalog) ListGrant(ctx context.Context, tenant string, entity *milvuspb.GrantEntity) ([]*milvuspb.GrantEntity, error)

func (*Catalog) ListPolicy

func (kc *Catalog) ListPolicy(ctx context.Context, tenant string) ([]string, error)

func (*Catalog) ListPrivilegeGroups

func (kc *Catalog) ListPrivilegeGroups(ctx context.Context) ([]*milvuspb.PrivilegeGroupInfo, error)

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 (kc *Catalog) ListUserRole(ctx context.Context, tenant string) ([]string, error)

func (*Catalog) RestoreRBAC

func (kc *Catalog) RestoreRBAC(ctx context.Context, tenant string, meta *milvuspb.RBACMeta) error

func (*Catalog) SavePrivilegeGroup

func (kc *Catalog) SavePrivilegeGroup(ctx context.Context, data *milvuspb.PrivilegeGroupInfo) error

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) Load

func (ss *SuffixSnapshot) Load(key string, ts typeutil.Timestamp) (string, error)

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

func (ss *SuffixSnapshot) MultiSave(kvs map[string]string, ts typeutil.Timestamp) error

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

func (*SuffixSnapshot) Save

func (ss *SuffixSnapshot) Save(key string, value string, ts typeutil.Timestamp) error

Save stores key-value pairs with timestamp if ts == 0, SuffixSnapshot works as a MetaKv otherwise, SuffixSnapshot will store a ts-key as "key[sep]ts"-value pair in snapshot path and for acceleration store original key-value if ts is the latest

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL