hookutil

package
v0.10.3-0...-d76d92d Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Used in db and collection properties
	EncryptionEnabledKey = "cipher.enabled"
	EncryptionRootKeyKey = "cipher.key"
	EncryptionEzIDKey    = "cipher.ezID"

	// Used in Plugins
	CipherConfigCreateEZ       = "cipher.ez.create"
	CipherConfigRemoveEZ       = "cipher.ez.remove"
	CipherConfigMilvusRoleName = "cipher.milvusRoleName"
	CipherConfigKeyKmsKeyArn   = "cipher.kmsKeyArn"
	CipherConfigUnsafeEZK      = "cipher.ezk"
)

Variables

View Source
var (
	Cipher atomic.Value

	ErrCipherPluginMissing = errors.New("cipher plugin is missing")
)
View Source
var (
	OpTypeKey          = "op_type"
	DatabaseKey        = "database"
	UsernameKey        = "username"
	RequestDataSizeKey = "request_data_size"
	ResultDataSizeKey  = "result_data_size"
	RelatedDataSizeKey = "related_data_size"
	SuccessCntKey      = "success_cnt"
	FailCntKey         = "fail_cnt"
	RelatedCntKey      = "related_cnt"
	NodeIDKey          = "id"

	OpTypeInsert       = "insert"
	OpTypeDelete       = "delete"
	OpTypeUpsert       = "upsert"
	OpTypeQuery        = "query"
	OpTypeSearch       = "search"
	OpTypeHybridSearch = "hybrid_search"
	OpTypeNodeID       = "node_id"
)

Functions

func ContainsCipherProperties

func ContainsCipherProperties(properties []*commonpb.KeyValuePair, deletedKeys []string) bool

func CreateEZByDBProperties

func CreateEZByDBProperties(dbProperties []*commonpb.KeyValuePair) error

func CreateLocalEZByPluginContext

func CreateLocalEZByPluginContext(context []*commonpb.KeyValuePair) (*indexcgopb.StoragePluginContext, error)

func GetCipher

func GetCipher() hook.Cipher

GetCipher returns singleton hook.Cipher instance. If Milvus is not built with cipher plugin, it will return nil If Milvus is built with cipher plugin, it will return hook.Cipher

func GetDBCipherProperties

func GetDBCipherProperties(ezID uint64, kmsKey string) []*commonpb.KeyValuePair

func GetExtension

func GetExtension() hook.Extension

GetHook returns singleton hook.Extension instance.

func GetEzPropByDBProperties

func GetEzPropByDBProperties(dbProperties []*commonpb.KeyValuePair) *commonpb.KeyValuePair

func GetHook

func GetHook() hook.Hook

GetHook returns singleton hook.Hook instance.

func GetStoragePluginContext

func GetStoragePluginContext(properties []*commonpb.KeyValuePair, collectionID int64) []*commonpb.KeyValuePair

GetStoragePluginContext returns the local plugin context for RPC from datacoord to datanode

func InitOnceCipher

func InitOnceCipher()

func InitOnceHook

func InitOnceHook()

func InitTestCipher

func InitTestCipher()

For test only

func IsClusterEncyptionEnabled

func IsClusterEncyptionEnabled() bool

func IsDBEncryptionEnabled

func IsDBEncryptionEnabled(dbProperties []*commonpb.KeyValuePair) bool

func LockHookInit

func LockHookInit()

func RemoveEZByDBProperties

func RemoveEZByDBProperties(dbProperties []*commonpb.KeyValuePair) error

func TidyDBCipherProperties

func TidyDBCipherProperties(ezID int64, dbProperties []*commonpb.KeyValuePair) ([]*commonpb.KeyValuePair, error)

func UnlockHookInit

func UnlockHookInit()

Types

type CipherContext

type CipherContext struct {
	EZ
	// contains filtered or unexported fields
}

type DefaultExtension

type DefaultExtension struct{}

func (DefaultExtension) Report

func (d DefaultExtension) Report(info any) int

func (DefaultExtension) ReportRefused

func (d DefaultExtension) ReportRefused(ctx context.Context, req interface{}, resp interface{}, err error, fullMethod string) error

type DefaultHook

type DefaultHook struct{}

func (DefaultHook) After

func (d DefaultHook) After(ctx context.Context, result interface{}, err error, fullMethod string) error

func (DefaultHook) Before

func (d DefaultHook) Before(ctx context.Context, req interface{}, fullMethod string) (context.Context, error)

func (DefaultHook) Init

func (d DefaultHook) Init(params map[string]string) error

func (DefaultHook) Mock

func (d DefaultHook) Mock(ctx context.Context, req interface{}, fullMethod string) (bool, interface{}, error)

func (DefaultHook) Release

func (d DefaultHook) Release()

func (DefaultHook) VerifyAPIKey

func (d DefaultHook) VerifyAPIKey(key string) (string, error)

type EZ

type EZ struct {
	EzID         int64
	CollectionID int64
}

func GetEzByCollProperties

func GetEzByCollProperties(collProperties []*commonpb.KeyValuePair, collectionID int64) *EZ

func (*EZ) AsMessageConfig

func (ez *EZ) AsMessageConfig() *message.CipherConfig

Jump to

Keyboard shortcuts

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