ultipa 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/client.d.ts +194 -0
- package/dist/client.js +390 -0
- package/dist/config.d.ts +65 -0
- package/dist/config.js +135 -0
- package/dist/connection.d.ts +30 -0
- package/dist/connection.js +190 -0
- package/dist/errors.d.ts +99 -0
- package/dist/errors.js +237 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +88 -0
- package/dist/printers.d.ts +33 -0
- package/dist/printers.js +312 -0
- package/dist/proto/gqldb.proto +632 -0
- package/dist/response.d.ts +256 -0
- package/dist/response.js +723 -0
- package/dist/services/admin-service.d.ts +40 -0
- package/dist/services/admin-service.js +115 -0
- package/dist/services/bulk-import-service.d.ts +35 -0
- package/dist/services/bulk-import-service.js +108 -0
- package/dist/services/converters.d.ts +57 -0
- package/dist/services/converters.js +254 -0
- package/dist/services/data-service.d.ts +44 -0
- package/dist/services/data-service.js +206 -0
- package/dist/services/graph-service.d.ts +32 -0
- package/dist/services/graph-service.js +127 -0
- package/dist/services/health-service.d.ts +50 -0
- package/dist/services/health-service.js +78 -0
- package/dist/services/index.d.ts +13 -0
- package/dist/services/index.js +30 -0
- package/dist/services/query-service.d.ts +39 -0
- package/dist/services/query-service.js +112 -0
- package/dist/services/service-context.d.ts +39 -0
- package/dist/services/service-context.js +73 -0
- package/dist/services/session-service.d.ts +24 -0
- package/dist/services/session-service.js +66 -0
- package/dist/services/transaction-service.d.ts +33 -0
- package/dist/services/transaction-service.js +100 -0
- package/dist/services.d.ts +28 -0
- package/dist/services.js +122 -0
- package/dist/session.d.ts +45 -0
- package/dist/session.js +75 -0
- package/dist/transaction.d.ts +42 -0
- package/dist/transaction.js +89 -0
- package/dist/types/bulk_import.d.ts +53 -0
- package/dist/types/bulk_import.js +6 -0
- package/dist/types/data_types.d.ts +116 -0
- package/dist/types/data_types.js +122 -0
- package/dist/types/enums.d.ts +59 -0
- package/dist/types/enums.js +67 -0
- package/dist/types/graph_models.d.ts +54 -0
- package/dist/types/graph_models.js +6 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.js +36 -0
- package/dist/types/metadata.d.ts +60 -0
- package/dist/types/metadata.js +6 -0
- package/dist/types/schema.d.ts +31 -0
- package/dist/types/schema.js +6 -0
- package/dist/types/typed_value.d.ts +25 -0
- package/dist/types/typed_value.js +1176 -0
- package/dist/types/wrappers.d.ts +23 -0
- package/dist/types/wrappers.js +39 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.js +24 -0
- package/package.json +50 -0
|
@@ -0,0 +1,632 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package gqldb;
|
|
4
|
+
|
|
5
|
+
option go_package = "github.com/zhangjsff/gqldb-grpc/proto";
|
|
6
|
+
|
|
7
|
+
// =============================================================================
|
|
8
|
+
// Enums
|
|
9
|
+
// =============================================================================
|
|
10
|
+
|
|
11
|
+
// PropertyType defines the type of a property value.
|
|
12
|
+
enum PropertyType {
|
|
13
|
+
PROPERTY_TYPE_UNSET = 0;
|
|
14
|
+
PROPERTY_TYPE_INT32 = 1;
|
|
15
|
+
PROPERTY_TYPE_UINT32 = 2;
|
|
16
|
+
PROPERTY_TYPE_INT64 = 3;
|
|
17
|
+
PROPERTY_TYPE_UINT64 = 4;
|
|
18
|
+
PROPERTY_TYPE_FLOAT = 5;
|
|
19
|
+
PROPERTY_TYPE_DOUBLE = 6;
|
|
20
|
+
PROPERTY_TYPE_STRING = 7;
|
|
21
|
+
PROPERTY_TYPE_DATETIME = 8; // Deprecated, use TIMESTAMP
|
|
22
|
+
PROPERTY_TYPE_TIMESTAMP = 9;
|
|
23
|
+
PROPERTY_TYPE_TEXT = 10;
|
|
24
|
+
PROPERTY_TYPE_BLOB = 11;
|
|
25
|
+
PROPERTY_TYPE_POINT = 12;
|
|
26
|
+
PROPERTY_TYPE_DECIMAL = 13;
|
|
27
|
+
PROPERTY_TYPE_LIST = 14;
|
|
28
|
+
PROPERTY_TYPE_SET = 15;
|
|
29
|
+
PROPERTY_TYPE_MAP = 16;
|
|
30
|
+
PROPERTY_TYPE_NULL = 17;
|
|
31
|
+
PROPERTY_TYPE_BOOL = 18;
|
|
32
|
+
PROPERTY_TYPE_LOCAL_DATETIME = 19;
|
|
33
|
+
PROPERTY_TYPE_ZONED_DATETIME = 20;
|
|
34
|
+
PROPERTY_TYPE_DATE = 21;
|
|
35
|
+
PROPERTY_TYPE_ZONED_TIME = 22;
|
|
36
|
+
PROPERTY_TYPE_LOCAL_TIME = 23;
|
|
37
|
+
PROPERTY_TYPE_YEAR_TO_MONTH = 24;
|
|
38
|
+
PROPERTY_TYPE_DAY_TO_SECOND = 25;
|
|
39
|
+
PROPERTY_TYPE_RECORD = 26;
|
|
40
|
+
PROPERTY_TYPE_POINT3D = 27;
|
|
41
|
+
PROPERTY_TYPE_VECTOR = 28;
|
|
42
|
+
PROPERTY_TYPE_TABLE = 29;
|
|
43
|
+
PROPERTY_TYPE_PATH = 30; // Graph path with nodes and edges
|
|
44
|
+
PROPERTY_TYPE_ERROR = 31; // Error value for TRY/CATCH handling
|
|
45
|
+
PROPERTY_TYPE_NODE = 32; // Graph node
|
|
46
|
+
PROPERTY_TYPE_EDGE = 33; // Graph edge
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// GraphType defines the type of a graph.
|
|
50
|
+
enum GraphType {
|
|
51
|
+
GRAPH_TYPE_OPEN = 0; // Schema-less graph
|
|
52
|
+
GRAPH_TYPE_CLOSED = 1; // Schema-enforced graph
|
|
53
|
+
GRAPH_TYPE_ONTOLOGY = 2; // Ontology-enabled graph
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// HealthStatus for health check responses.
|
|
57
|
+
enum HealthStatus {
|
|
58
|
+
HEALTH_STATUS_UNKNOWN = 0;
|
|
59
|
+
HEALTH_STATUS_SERVING = 1;
|
|
60
|
+
HEALTH_STATUS_NOT_SERVING = 2;
|
|
61
|
+
HEALTH_STATUS_SERVICE_UNKNOWN = 3;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// =============================================================================
|
|
65
|
+
// Core Messages
|
|
66
|
+
// =============================================================================
|
|
67
|
+
|
|
68
|
+
// TypedValue represents a typed value for wire transmission.
|
|
69
|
+
message TypedValue {
|
|
70
|
+
PropertyType type = 1;
|
|
71
|
+
bytes data = 2;
|
|
72
|
+
bool is_null = 3;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Parameter represents a named parameter for queries.
|
|
76
|
+
message Parameter {
|
|
77
|
+
string name = 1;
|
|
78
|
+
TypedValue value = 2;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Row represents a single row in query results.
|
|
82
|
+
message Row {
|
|
83
|
+
repeated TypedValue values = 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// =============================================================================
|
|
87
|
+
// Session Service
|
|
88
|
+
// =============================================================================
|
|
89
|
+
|
|
90
|
+
service SessionService {
|
|
91
|
+
// Login authenticates a user and creates a session.
|
|
92
|
+
rpc Login(LoginRequest) returns (LoginResponse);
|
|
93
|
+
// Logout terminates a session.
|
|
94
|
+
rpc Logout(LogoutRequest) returns (LogoutResponse);
|
|
95
|
+
// Ping keeps a session alive and checks connectivity.
|
|
96
|
+
rpc Ping(PingRequest) returns (PingResponse);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
message LoginRequest {
|
|
100
|
+
string username = 1;
|
|
101
|
+
string password = 2;
|
|
102
|
+
string default_graph = 3; // Optional default graph
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
message LoginResponse {
|
|
106
|
+
uint64 session_id = 1;
|
|
107
|
+
string server_version = 2;
|
|
108
|
+
repeated string roles = 3;
|
|
109
|
+
// Cluster extensions (field numbers 10+ for backward compatibility)
|
|
110
|
+
bool is_cluster = 10;
|
|
111
|
+
string cluster_id = 11;
|
|
112
|
+
int32 partition_count = 12;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
message LogoutRequest {
|
|
116
|
+
// Session is identified from metadata header
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
message LogoutResponse {
|
|
120
|
+
bool success = 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
message PingRequest {
|
|
124
|
+
// Session is identified from metadata header
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
message PingResponse {
|
|
128
|
+
int64 latency_ns = 1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// =============================================================================
|
|
132
|
+
// Query Service
|
|
133
|
+
// =============================================================================
|
|
134
|
+
|
|
135
|
+
service QueryService {
|
|
136
|
+
// Gql executes a GQL query and returns results.
|
|
137
|
+
rpc Gql(GqlRequest) returns (GqlResponse);
|
|
138
|
+
// GqlStream executes a GQL query and streams results.
|
|
139
|
+
rpc GqlStream(GqlRequest) returns (stream GqlResponse);
|
|
140
|
+
// Explain returns the execution plan for a query.
|
|
141
|
+
rpc Explain(GqlRequest) returns (ExplainResponse);
|
|
142
|
+
// Profile executes a query with profiling and returns statistics.
|
|
143
|
+
rpc Profile(GqlRequest) returns (ProfileResponse);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
message GqlRequest {
|
|
147
|
+
string gql = 1;
|
|
148
|
+
string graph_name = 2;
|
|
149
|
+
repeated Parameter parameters = 3;
|
|
150
|
+
uint64 session_id = 4;
|
|
151
|
+
uint64 transaction_id = 5;
|
|
152
|
+
int32 timeout = 6; // Timeout in seconds
|
|
153
|
+
bool read_only = 7;
|
|
154
|
+
int64 max_path_results = 8; // Max paths from path queries (0 = unlimited)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
message GqlResponse {
|
|
158
|
+
repeated string columns = 1;
|
|
159
|
+
repeated Row rows = 2;
|
|
160
|
+
int64 row_count = 3;
|
|
161
|
+
bool has_more = 4;
|
|
162
|
+
repeated string warnings = 5;
|
|
163
|
+
int64 rows_affected = 6; // For DML operations (INSERT/UPDATE/DELETE)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
message ExplainResponse {
|
|
167
|
+
string plan = 1;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
message ProfileResponse {
|
|
171
|
+
string profile = 1;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// =============================================================================
|
|
175
|
+
// Data Service
|
|
176
|
+
// =============================================================================
|
|
177
|
+
|
|
178
|
+
service DataService {
|
|
179
|
+
// InsertNodes inserts multiple nodes into a graph.
|
|
180
|
+
rpc InsertNodes(InsertNodesRequest) returns (InsertNodesResponse);
|
|
181
|
+
// InsertEdges inserts multiple edges into a graph.
|
|
182
|
+
rpc InsertEdges(InsertEdgesRequest) returns (InsertEdgesResponse);
|
|
183
|
+
// DeleteNodes deletes nodes from a graph.
|
|
184
|
+
rpc DeleteNodes(DeleteNodesRequest) returns (DeleteNodesResponse);
|
|
185
|
+
// DeleteEdges deletes edges from a graph.
|
|
186
|
+
rpc DeleteEdges(DeleteEdgesRequest) returns (DeleteEdgesResponse);
|
|
187
|
+
// Export streams graph data in JSON Lines format (nodes and/or edges).
|
|
188
|
+
rpc Export(ExportRequest) returns (stream ExportResponse);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
message NodeData {
|
|
192
|
+
string id = 1; // Optional custom node ID (if empty, auto-generated)
|
|
193
|
+
repeated string labels = 2;
|
|
194
|
+
map<string, TypedValue> properties = 3;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
message EdgeData {
|
|
198
|
+
string label = 1;
|
|
199
|
+
string from_node_id = 2;
|
|
200
|
+
string to_node_id = 3;
|
|
201
|
+
map<string, TypedValue> properties = 4;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// BulkCreateNodesOptions configures bulk node creation behavior.
|
|
205
|
+
message BulkCreateNodesOptions {
|
|
206
|
+
bool overwrite = 1; // Skip existence check and overwrite if node ID already exists
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// BulkCreateEdgesOptions configures bulk edge creation behavior.
|
|
210
|
+
message BulkCreateEdgesOptions {
|
|
211
|
+
bool skip_invalid_nodes = 1; // Skip edges where source/target node doesn't exist
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
message InsertNodesRequest {
|
|
215
|
+
string graph_name = 1;
|
|
216
|
+
repeated NodeData nodes = 2;
|
|
217
|
+
BulkCreateNodesOptions options = 3; // Optional: overwrite option (not supported in bulk import)
|
|
218
|
+
string bulk_import_session_id = 4; // Required: use StartBulkImport to get a session
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
message InsertNodesResponse {
|
|
222
|
+
bool success = 1;
|
|
223
|
+
repeated string node_ids = 2;
|
|
224
|
+
int64 node_count = 3;
|
|
225
|
+
string message = 4;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
message InsertEdgesRequest {
|
|
229
|
+
string graph_name = 1;
|
|
230
|
+
repeated EdgeData edges = 2;
|
|
231
|
+
BulkCreateEdgesOptions options = 3; // Optional: skip_invalid_nodes option
|
|
232
|
+
string bulk_import_session_id = 4; // Required: use StartBulkImport to get a session
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
message InsertEdgesResponse {
|
|
236
|
+
bool success = 1;
|
|
237
|
+
repeated string edge_ids = 2;
|
|
238
|
+
int64 edge_count = 3;
|
|
239
|
+
string message = 4;
|
|
240
|
+
int64 skipped_count = 5; // Number of edges skipped due to invalid nodes
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
message DeleteNodesRequest {
|
|
244
|
+
string graph_name = 1;
|
|
245
|
+
repeated string node_ids = 2;
|
|
246
|
+
repeated string labels = 3;
|
|
247
|
+
string where = 4; // Optional WHERE clause
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
message DeleteNodesResponse {
|
|
251
|
+
bool success = 1;
|
|
252
|
+
int64 deleted_count = 2;
|
|
253
|
+
string message = 3;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
message DeleteEdgesRequest {
|
|
257
|
+
string graph_name = 1;
|
|
258
|
+
repeated string edge_ids = 2;
|
|
259
|
+
string label = 3;
|
|
260
|
+
string where = 4; // Optional WHERE clause
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
message DeleteEdgesResponse {
|
|
264
|
+
bool success = 1;
|
|
265
|
+
int64 deleted_count = 2;
|
|
266
|
+
string message = 3;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// ExportRequest configures the streaming export.
|
|
270
|
+
message ExportRequest {
|
|
271
|
+
string graph_name = 1; // Required: graph to export
|
|
272
|
+
int32 batch_size = 2; // Items per context check (default: 1000)
|
|
273
|
+
bool export_nodes = 3; // Export nodes (default: true)
|
|
274
|
+
bool export_edges = 4; // Export edges (default: true)
|
|
275
|
+
repeated string node_labels = 5; // Filter nodes by labels (empty = all)
|
|
276
|
+
repeated string edge_labels = 6; // Filter edges by labels (empty = all)
|
|
277
|
+
bool include_metadata = 7; // Include metadata header (default: true)
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// ExportResponse streams JSON Lines data.
|
|
281
|
+
message ExportResponse {
|
|
282
|
+
bytes data = 1; // JSON Lines chunk
|
|
283
|
+
bool is_final = 2; // True for final message with stats
|
|
284
|
+
ExportStats stats = 3; // Populated in final message
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// ExportStats contains export statistics.
|
|
288
|
+
message ExportStats {
|
|
289
|
+
int64 nodes_exported = 1;
|
|
290
|
+
int64 edges_exported = 2;
|
|
291
|
+
int64 bytes_written = 3;
|
|
292
|
+
int64 duration_ms = 4;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// =============================================================================
|
|
296
|
+
// Graph Service
|
|
297
|
+
// =============================================================================
|
|
298
|
+
|
|
299
|
+
service GraphService {
|
|
300
|
+
// CreateGraph creates a new graph.
|
|
301
|
+
rpc CreateGraph(CreateGraphRequest) returns (CreateGraphResponse);
|
|
302
|
+
// DropGraph deletes a graph.
|
|
303
|
+
rpc DropGraph(DropGraphRequest) returns (DropGraphResponse);
|
|
304
|
+
// UseGraph sets the current graph for a session.
|
|
305
|
+
rpc UseGraph(UseGraphRequest) returns (UseGraphResponse);
|
|
306
|
+
// ListGraphs returns all available graphs.
|
|
307
|
+
rpc ListGraphs(ListGraphsRequest) returns (ListGraphsResponse);
|
|
308
|
+
// GetGraphInfo returns detailed information about a graph.
|
|
309
|
+
rpc GetGraphInfo(GetGraphInfoRequest) returns (GetGraphInfoResponse);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
message CreateGraphRequest {
|
|
313
|
+
string name = 1;
|
|
314
|
+
GraphType graph_type = 2;
|
|
315
|
+
string description = 3;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
message CreateGraphResponse {
|
|
319
|
+
bool success = 1;
|
|
320
|
+
string message = 2;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
message DropGraphRequest {
|
|
324
|
+
string name = 1;
|
|
325
|
+
bool if_exists = 2;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
message DropGraphResponse {
|
|
329
|
+
bool success = 1;
|
|
330
|
+
string message = 2;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
message UseGraphRequest {
|
|
334
|
+
string name = 1;
|
|
335
|
+
uint64 session_id = 2 [deprecated = true]; // Deprecated: use metadata session-id header instead
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
message UseGraphResponse {
|
|
339
|
+
bool success = 1;
|
|
340
|
+
string message = 2;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
message ListGraphsRequest {}
|
|
344
|
+
|
|
345
|
+
message ListGraphsResponse {
|
|
346
|
+
repeated GraphInfo graphs = 1;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
message GetGraphInfoRequest {
|
|
350
|
+
string name = 1;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
message GetGraphInfoResponse {
|
|
354
|
+
GraphInfo info = 1;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
message GraphInfo {
|
|
358
|
+
string name = 1;
|
|
359
|
+
GraphType graph_type = 2;
|
|
360
|
+
int64 node_count = 3;
|
|
361
|
+
int64 edge_count = 4;
|
|
362
|
+
string description = 5;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// =============================================================================
|
|
366
|
+
// Transaction Service
|
|
367
|
+
// =============================================================================
|
|
368
|
+
|
|
369
|
+
service TransactionService {
|
|
370
|
+
// Begin starts a new transaction.
|
|
371
|
+
rpc Begin(BeginRequest) returns (BeginResponse);
|
|
372
|
+
// Commit commits a transaction.
|
|
373
|
+
rpc Commit(CommitRequest) returns (CommitResponse);
|
|
374
|
+
// Rollback aborts a transaction.
|
|
375
|
+
rpc Rollback(RollbackRequest) returns (RollbackResponse);
|
|
376
|
+
// ListTransactions returns active transactions.
|
|
377
|
+
rpc ListTransactions(ListTransactionsRequest) returns (ListTransactionsResponse);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
message BeginRequest {
|
|
381
|
+
uint64 session_id = 1 [deprecated = true]; // Deprecated: use metadata session-id header instead
|
|
382
|
+
string graph_name = 2;
|
|
383
|
+
bool read_only = 3;
|
|
384
|
+
int32 timeout = 4; // Timeout in seconds, 0 = no timeout
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
message BeginResponse {
|
|
388
|
+
uint64 transaction_id = 1;
|
|
389
|
+
string message = 2;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
message CommitRequest {
|
|
393
|
+
uint64 session_id = 1 [deprecated = true]; // Deprecated: use metadata session-id header instead
|
|
394
|
+
uint64 transaction_id = 2;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
message CommitResponse {
|
|
398
|
+
bool success = 1;
|
|
399
|
+
string message = 2;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
message RollbackRequest {
|
|
403
|
+
uint64 session_id = 1 [deprecated = true]; // Deprecated: use metadata session-id header instead
|
|
404
|
+
uint64 transaction_id = 2;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
message RollbackResponse {
|
|
408
|
+
bool success = 1;
|
|
409
|
+
string message = 2;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
message ListTransactionsRequest {
|
|
413
|
+
uint64 session_id = 1 [deprecated = true]; // Deprecated: use metadata session-id header instead
|
|
414
|
+
bool all_transactions = 2; // If true and user is admin, list all transactions; otherwise list only current session's transactions
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
message ListTransactionsResponse {
|
|
418
|
+
repeated TransactionInfo transactions = 1;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
message TransactionInfo {
|
|
422
|
+
uint64 transaction_id = 1;
|
|
423
|
+
uint64 session_id = 2;
|
|
424
|
+
string graph_name = 3;
|
|
425
|
+
bool read_only = 4;
|
|
426
|
+
int64 created_at = 5; // Unix timestamp
|
|
427
|
+
int64 duration_ms = 6;
|
|
428
|
+
string internal_tx_id = 7; // Internal ultipa-gqldb transaction ID
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// =============================================================================
|
|
432
|
+
// Health Service (gRPC Health Checking Protocol)
|
|
433
|
+
// =============================================================================
|
|
434
|
+
|
|
435
|
+
service Health {
|
|
436
|
+
// Check returns the serving status of the service.
|
|
437
|
+
rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
|
|
438
|
+
// Watch streams serving status changes.
|
|
439
|
+
rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
message HealthCheckRequest {
|
|
443
|
+
string service = 1;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
message HealthCheckResponse {
|
|
447
|
+
HealthStatus status = 1;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// =============================================================================
|
|
451
|
+
// Admin Service
|
|
452
|
+
// =============================================================================
|
|
453
|
+
|
|
454
|
+
service AdminService {
|
|
455
|
+
// WarmupParser pre-allocates parser instances for better performance.
|
|
456
|
+
rpc WarmupParser(WarmupParserRequest) returns (WarmupParserResponse);
|
|
457
|
+
// GetCacheStats returns cache statistics.
|
|
458
|
+
rpc GetCacheStats(GetCacheStatsRequest) returns (CacheStatsResponse);
|
|
459
|
+
// ClearCache clears specified caches.
|
|
460
|
+
rpc ClearCache(ClearCacheRequest) returns (ClearCacheResponse);
|
|
461
|
+
// GetStatistics returns database statistics.
|
|
462
|
+
rpc GetStatistics(GetStatisticsRequest) returns (GetStatisticsResponse);
|
|
463
|
+
// InvalidatePermissionCache invalidates RBAC permission cache.
|
|
464
|
+
rpc InvalidatePermissionCache(InvalidatePermissionCacheRequest) returns (InvalidatePermissionCacheResponse);
|
|
465
|
+
// Compact triggers manual compaction of the database storage.
|
|
466
|
+
rpc Compact(CompactRequest) returns (CompactResponse);
|
|
467
|
+
// WaitForComputeTopology waits for the computing engine topology to be ready.
|
|
468
|
+
rpc WaitForComputeTopology(WaitForComputeTopologyRequest) returns (WaitForComputeTopologyResponse);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
message WarmupParserRequest {
|
|
472
|
+
int32 count = 1; // Number of parser instances to pre-allocate
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
message WarmupParserResponse {
|
|
476
|
+
bool success = 1;
|
|
477
|
+
string message = 2;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// CacheType specifies which cache to query or clear.
|
|
481
|
+
enum CacheType {
|
|
482
|
+
CACHE_TYPE_ALL = 0;
|
|
483
|
+
CACHE_TYPE_AST = 1;
|
|
484
|
+
CACHE_TYPE_PLAN = 2;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
message GetCacheStatsRequest {
|
|
488
|
+
CacheType cache_type = 1;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
message CacheStatsResponse {
|
|
492
|
+
ASTCacheStats ast_stats = 1;
|
|
493
|
+
PlanCacheStats plan_stats = 2;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
message ASTCacheStats {
|
|
497
|
+
uint64 hits = 1;
|
|
498
|
+
uint64 misses = 2;
|
|
499
|
+
uint64 evictions = 3;
|
|
500
|
+
int32 entries = 4;
|
|
501
|
+
double hit_rate = 5;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
message PlanCacheStats {
|
|
505
|
+
int32 size = 1;
|
|
506
|
+
int32 capacity = 2;
|
|
507
|
+
uint64 hits = 3;
|
|
508
|
+
uint64 misses = 4;
|
|
509
|
+
double hit_rate = 5;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
message ClearCacheRequest {
|
|
513
|
+
CacheType cache_type = 1;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
message ClearCacheResponse {
|
|
517
|
+
bool success = 1;
|
|
518
|
+
string message = 2;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
message GetStatisticsRequest {
|
|
522
|
+
string graph_name = 1; // Optional: specific graph, empty = current graph
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
message GetStatisticsResponse {
|
|
526
|
+
uint64 node_count = 1;
|
|
527
|
+
uint64 edge_count = 2;
|
|
528
|
+
map<string, uint64> label_counts = 3;
|
|
529
|
+
map<string, uint64> edge_label_counts = 4;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
message InvalidatePermissionCacheRequest {
|
|
533
|
+
string username = 1; // Optional: specific user, empty = all users
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
message InvalidatePermissionCacheResponse {
|
|
537
|
+
bool success = 1;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
message CompactRequest {
|
|
541
|
+
// Empty - compacts the entire database
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
message CompactResponse {
|
|
545
|
+
bool success = 1;
|
|
546
|
+
string message = 2;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
message WaitForComputeTopologyRequest {
|
|
550
|
+
string graph_name = 1; // Graph to check (required)
|
|
551
|
+
int64 timeout_ms = 2; // Timeout in milliseconds (0 = check current status)
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
message WaitForComputeTopologyResponse {
|
|
555
|
+
bool ready = 1; // true if topology is ready, false if timeout/not enabled
|
|
556
|
+
string message = 2; // Additional status message
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
// =============================================================================
|
|
560
|
+
// Bulk Import Service
|
|
561
|
+
// =============================================================================
|
|
562
|
+
|
|
563
|
+
service BulkImportService {
|
|
564
|
+
// StartBulkImport starts a bulk import session for optimized high-throughput inserts.
|
|
565
|
+
rpc StartBulkImport(StartBulkImportRequest) returns (StartBulkImportResponse);
|
|
566
|
+
// Checkpoint flushes all accumulated data to disk for durability.
|
|
567
|
+
rpc Checkpoint(CheckpointRequest) returns (CheckpointResponse);
|
|
568
|
+
// EndBulkImport ends the session with a final checkpoint.
|
|
569
|
+
rpc EndBulkImport(EndBulkImportRequest) returns (EndBulkImportResponse);
|
|
570
|
+
// AbortBulkImport cancels the session without final sync.
|
|
571
|
+
rpc AbortBulkImport(AbortBulkImportRequest) returns (AbortBulkImportResponse);
|
|
572
|
+
// GetBulkImportStatus returns the current status of a bulk import session.
|
|
573
|
+
rpc GetBulkImportStatus(GetBulkImportStatusRequest) returns (GetBulkImportStatusResponse);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
message StartBulkImportRequest {
|
|
577
|
+
string graph_name = 1;
|
|
578
|
+
int64 checkpoint_every = 2; // Records between auto-checkpoints (0 = manual only)
|
|
579
|
+
int64 estimated_nodes = 3; // Hint for pre-allocating node ID cache
|
|
580
|
+
int64 estimated_edges = 4; // Hint for edge batch sizing
|
|
581
|
+
int64 memtable_size = 5; // Memtable size in bytes before flush (default: 64MB)
|
|
582
|
+
int32 max_memtables = 6; // Max immutable memtables before stall (default: 4)
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
message StartBulkImportResponse {
|
|
586
|
+
bool success = 1;
|
|
587
|
+
string session_id = 2; // UUID for the session
|
|
588
|
+
string message = 3;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
message CheckpointRequest {
|
|
592
|
+
string session_id = 1;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
message CheckpointResponse {
|
|
596
|
+
bool success = 1;
|
|
597
|
+
int64 record_count = 2;
|
|
598
|
+
int64 last_checkpoint_count = 3;
|
|
599
|
+
string message = 4;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
message EndBulkImportRequest {
|
|
603
|
+
string session_id = 1;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
message EndBulkImportResponse {
|
|
607
|
+
bool success = 1;
|
|
608
|
+
int64 total_records = 2;
|
|
609
|
+
string message = 3;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
message AbortBulkImportRequest {
|
|
613
|
+
string session_id = 1;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
message AbortBulkImportResponse {
|
|
617
|
+
bool success = 1;
|
|
618
|
+
string message = 2;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
message GetBulkImportStatusRequest {
|
|
622
|
+
string session_id = 1;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
message GetBulkImportStatusResponse {
|
|
626
|
+
bool is_active = 1;
|
|
627
|
+
string graph_name = 2;
|
|
628
|
+
int64 record_count = 3;
|
|
629
|
+
int64 last_checkpoint_count = 4;
|
|
630
|
+
int64 created_at = 5; // Unix timestamp
|
|
631
|
+
int64 last_activity = 6; // Unix timestamp
|
|
632
|
+
}
|