Răsfoiți Sursa

feat(proto): add CollectionConfig + 3 RPCs for per-collection settings (v1.6.0)

ConfigureCollection, GetCollectionConfig, MigrateCollectionTimestamps RPCs.
CollectionConfig.timestamp_precision: 'ms' (default) or 'ns'.
Existing collections keep ms behaviour — no silent change.
fszontagh 3 luni în urmă
părinte
comite
b0261da6ff
2 a modificat fișierele cu 49 adăugiri și 1 ștergeri
  1. 1 1
      VERSION
  2. 48 0
      proto/database.proto

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.5.0
+1.6.0

+ 48 - 0
proto/database.proto

@@ -64,6 +64,11 @@ service DatabaseService {
     rpc ListViews(ListViewsRequest) returns (ListViewsResponse);
     rpc GetViewInfo(GetViewInfoRequest) returns (GetViewInfoResponse);
 
+    // Collection configuration
+    rpc ConfigureCollection(ConfigureCollectionRequest) returns (ConfigureCollectionResponse);
+    rpc GetCollectionConfig(GetCollectionConfigRequest) returns (GetCollectionConfigResponse);
+    rpc MigrateCollectionTimestamps(MigrateCollectionTimestampsRequest) returns (MigrateCollectionTimestampsResponse);
+
     // File operations
     rpc UploadFile(stream FileChunk) returns (UploadFileResponse);
     rpc DownloadFile(DownloadFileRequest) returns (stream FileChunk);
@@ -738,3 +743,46 @@ message GetViewInfoResponse {
     ViewDefinition view = 1;
     bool found = 2;
 }
+
+// ===== Collection Configuration =====
+
+// Per-collection configuration for timestamp precision and other runtime knobs.
+// Stored in the _collection_meta system collection.
+message CollectionConfig {
+    // "ms" (default) — _created_at/_updated_at stamped in milliseconds since epoch
+    // "ns"            — _created_at/_updated_at stamped in nanoseconds since epoch
+    string timestamp_precision = 1;
+    // Room for future per-collection knobs
+}
+
+message ConfigureCollectionRequest {
+    string collection = 1;
+    CollectionConfig config = 2;
+}
+
+message ConfigureCollectionResponse {
+    bool success = 1;
+    string error = 2;
+}
+
+message GetCollectionConfigRequest {
+    string collection = 1;
+}
+
+message GetCollectionConfigResponse {
+    CollectionConfig config = 1;
+    bool found = 2;
+}
+
+message MigrateCollectionTimestampsRequest {
+    string collection = 1;
+    string from_precision = 2;   // "ms" or "ns"
+    string to_precision = 3;     // "ms" or "ns"
+}
+
+message MigrateCollectionTimestampsResponse {
+    bool success = 1;
+    string error = 2;
+    uint64 rows_migrated = 3;    // how many documents had their timestamps updated
+    uint64 rows_skipped = 4;     // already in target range (idempotent resume)
+}