Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef DBMS_VECTOR_INTERNAL_HPP
#define DBMS_VECTOR_INTERNAL_HPP
 
#include <string>
 
extern "C"
{
 
#include "postgres.h"
#include "fmgr.h"
#include "utils/jsonb.h"
 
/*
 * Cluster-wide default of the vector index build checkpointing, mirrored
 * in the dbms_vector.vector_index_checkpointing GUC (registered in
 * guc_parameters.dat); per-index overrides live in
 * SYS.vector_index_checkpointing and the index reloption.
 */
extern bool dbms_vector_vector_index_checkpointing;
 
// UTL_TO_EMBEDDING / UTL_TO_EMBEDDINGS
Datum dbms_vector_utl_to_embedding(PG_FUNCTION_ARGS);
Datum dbms_vector_utl_to_embeddings(PG_FUNCTION_ARGS);
Datum dbms_vector_utl_to_embeddings_array(PG_FUNCTION_ARGS);
 
// QUERY
Datum dbms_vector_query(PG_FUNCTION_ARGS);
Datum dbms_vector_query_text(PG_FUNCTION_ARGS);
 
// LOAD_ONNX_MODEL / DROP_ONNX_MODEL
Datum dbms_vector_load_onnx_model_dir(PG_FUNCTION_ARGS);
Datum dbms_vector_load_onnx_model(PG_FUNCTION_ARGS);
Datum dbms_vector_drop_onnx_model(PG_FUNCTION_ARGS);
 
// CREATE_CREDENTIAL / DROP_CREDENTIAL
Datum dbms_vector_create_credential(PG_FUNCTION_ARGS);
Datum dbms_vector_drop_credential(PG_FUNCTION_ARGS);
 
// Internal helper shared between the wrappers
Datum dbms_vector_get_credential(PG_FUNCTION_ARGS);
 
// ONNX runtime flavor probe: true on --with-onnxruntime builds
Datum dbms_vector_onnx_enabled(PG_FUNCTION_ARGS);
 
// Contract-phase stubs: frozen v1 SQL surface.  All of these are stubs
// raising the unified "not implemented yet" error until implemented.
// UTL_TO_CHUNKS (clob / varchar2 overloads) - shared text core
Datum dbms_vector_utl_to_chunks(PG_FUNCTION_ARGS);
Datum dbms_vector_utl_to_chunks_1(PG_FUNCTION_ARGS);
 
// UTL_TO_GENERATE_TEXT - shared text core
Datum dbms_vector_utl_to_generate_text(PG_FUNCTION_ARGS);
 
// CREATE_INDEX / REBUILD_INDEX
Datum dbms_vector_create_index(PG_FUNCTION_ARGS);
Datum dbms_vector_rebuild_index(PG_FUNCTION_ARGS);
 
// GET_INDEX_STATUS
Datum dbms_vector_get_index_status(PG_FUNCTION_ARGS);
 
// INDEX_VECTOR_MEMORY_ADVISOR
Datum dbms_vector_index_vector_memory_advisor(PG_FUNCTION_ARGS);
 
// INMEMORY_ONNX_MODEL
Datum dbms_vector_inmemory_onnx_model(PG_FUNCTION_ARGS);
 
// ENABLE_CHECKPOINT / DISABLE_CHECKPOINT
Datum dbms_vector_enable_checkpoint(PG_FUNCTION_ARGS);
Datum dbms_vector_disable_checkpoint(PG_FUNCTION_ARGS);
 
} // extern "C"
 
/*
 * Public C++ API for other modules (e.g. DBMS_VECTOR_CHAIN): the credential
 * management core behind the SQL entry points.  Both validate exactly like
 * the SQL wrappers (qualified name rules, owner-or-superuser checks, params
 * shape, duplicate/missing rows) and ereport(ERROR) on failure.  A nullptr
 * params is the SQL NULL case.  Credential resolution for REST consumers
 * (raw stored params, secrets included) lives in dbms_vector_rest.hpp.
 */
void dbms_vector_credential_create(const std::string &credential_name,
                                   Jsonb *params);
void dbms_vector_credential_drop(const std::string &credential_name);
 
#endif // DBMS_VECTOR_INTERNAL_HPP