Documentation
¶
Overview ¶
Package plugin defines the integration contract for vector index algorithms.
Every vector index algorithm (HNSW, IVFFLAT, IVF-PQ, CAGRA, …) provides one AlgoPlugin that bundles the three per-algorithm callback surfaces (catalog, compile, plan). The SQL layer resolves algorithm-specific behaviour exclusively through Get(algo); there is no per-algorithm switch statement.
Adding a new algorithm means: implement the three Hooks interfaces, return them from a single AlgoPlugin, call Register() in an init(), and blank- import the package from plugin/all. If the new plugin compiles, every dispatch point is already wired.
Index ¶
- func AlgoParamFloat(flat string, resolve ResolveVarFunc, sessionVar string, def float64) (float64, error)
- func AlgoParamInt(flat string, resolve ResolveVarFunc, sessionVar string, def int64) (int64, error)
- func IsFullTextIndexAlgo(algo string) bool
- func IsPluginAlgo(algo string) bool
- func IsVectorIndexAlgo(algo string) bool
- func Register(p AlgoPlugin)
- type AlgoPlugin
- type ResolveVarFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlgoParamFloat ¶
func AlgoParamFloat(flat string, resolve ResolveVarFunc, sessionVar string, def float64) (float64, error)
AlgoParamFloat is AlgoParamInt for float64 params (kmeans_train_percent).
func AlgoParamInt ¶
AlgoParamInt resolves an int build param (e.g. *_max_index_capacity, kmeans_max_iteration) with precedence:
- flat — the value from the index's algo_params, present only when the option was given in CREATE INDEX (ParamsFromTree writes it).
- resolve(sessionVar) — the session/system variable, so `SET <var>=...` still controls the build when the option is omitted from the DDL. The variable carries its own system default, so this is the normal path.
- def — used only when no resolver is available (internal SQL procs).
func IsFullTextIndexAlgo ¶
IsFullTextIndexAlgo reports whether algo is the fulltext index algorithm AND the fulltext plugin is registered.
func IsPluginAlgo ¶
IsPluginAlgo reports whether algo is registered with the plugin system, regardless of kind (vector or fulltext). Use this at dispatch sites that route through the plugin's HandleCreateIndex / Plan() hooks; use IsVectorIndexAlgo / IsFullTextIndexAlgo when the kind matters.
func IsVectorIndexAlgo ¶
IsVectorIndexAlgo reports whether algo is a registered vector index algorithm (HNSW, CAGRA, IVF-PQ, IVF-FLAT) — i.e. plugin- registered AND not the fulltext algorithm. Replaces the chain
catalog.IsIvfIndexAlgo(a) || catalog.IsHnswIndexAlgo(a) || catalog.IsCagraIndexAlgo(a) || catalog.IsIvfpqIndexAlgo(a)
at every site that needs to gate "is this a multi-table vector index?". Use IsFullTextIndexAlgo for fulltext and IsPluginAlgo for "registered with the plugin system, vector OR fulltext".
func Register ¶
func Register(p AlgoPlugin)
Register installs a plugin. Panics on duplicate registration; intended for init() bodies.
Types ¶
type AlgoPlugin ¶
type AlgoPlugin interface {
// Algo returns the algorithm token used in `INDEX … USING <algo>`. It
// must match catalog.MoIndex<X>Algo.ToString() (already lower-cased).
Algo() string
Catalog() catalogplugin.Hooks
Compile() compileplugin.Hooks
Plan() planplugin.Hooks
// Idxcron returns the cron-side hooks used by
// pkg/vectorindex/idxcron/executor.go to decide whether a
// scheduled rebuild should fire for a given (table, index).
// Algorithms with no minimum-size constraint (HNSW, fulltext)
// return a trivial Hooks impl whose Updatable always says yes;
// IVF-FLAT / CAGRA / IVF-PQ implementations consult the storage
// table to enforce their respective minimums.
Idxcron() idxcronplugin.Hooks
}
AlgoPlugin is the integration contract for a vector index algorithm. One implementation per algorithm; registered at package init() time.
func All ¶
func All() []AlgoPlugin
All returns every registered plugin. Useful for catalog enumeration.
func Get ¶
func Get(algo string) (AlgoPlugin, bool)
Get returns the plugin for an algo string, or (nil, false) if no plugin is registered. The match is case-insensitive and trims whitespace.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package all is the central registration list for every vector-index plugin.
|
Package all is the central registration list for every vector-index plugin. |
|
Package catalog defines the catalog-layer hooks every vector index plugin must implement: parameter parsing, hidden-table layout, and op-type set.
|
Package catalog defines the catalog-layer hooks every vector index plugin must implement: parameter parsing, hidden-table layout, and op-type set. |
|
Package compile defines the compile-layer (DDL) hooks every vector index plugin must implement: create / reindex / drop / alter.
|
Package compile defines the compile-layer (DDL) hooks every vector index plugin must implement: create / reindex / drop / alter. |
|
Package idxcron defines the cron-side hook layer every index algorithm plugin implements.
|
Package idxcron defines the cron-side hook layer every index algorithm plugin implements. |
|
Package iscp is the central wiring point for per-algorithm ISCP hooks.
|
Package iscp is the central wiring point for per-algorithm ISCP hooks. |
|
Package plan defines the plan-layer contract every vector-index plugin implements: hidden-table schema construction, table-function builders, plus thin redirects for the ANN rewrite (which actually lives in pkg/sql/plan).
|
Package plan defines the plan-layer contract every vector-index plugin implements: hidden-table schema construction, table-function builders, plus thin redirects for the ANN rewrite (which actually lives in pkg/sql/plan). |