diff --git a/client b/client index a46ff110..70241e22 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit a46ff11093302dfaea766cf09067c9a4011b7501 +Subproject commit 70241e22c4064bcbc43cd27aa6d54dbf4e226b68 diff --git a/client-gui2 b/client-gui2 index fbb19315..6af9d5a1 160000 --- a/client-gui2 +++ b/client-gui2 @@ -1 +1 @@ -Subproject commit fbb193158022958de058f268cf425578fa6005b8 +Subproject commit 6af9d5a1277aad3f0888c4ceb6861540a2cea8e1 diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index a4df95ee..1c686310 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -66,6 +66,10 @@ service TableDefinition { // presentation metadata and may be changed after rows have been stored. rpc SetRowDisplayColumns(SetRowDisplayColumnsRequest) returns (SetRowDisplayColumnsResponse); + // Replaces the user-managed indexes of an existing dynamic table. Physical + // indexes are created or dropped even when rows have already been stored. + rpc SetTableIndexes(SetTableIndexesRequest) returns (SetTableIndexesResponse); + // Replaces the optional user-visible aliases for a fixed-option column. // Stored values remain stable machine values and scripts never depend on labels. rpc SetColumnOptionAliases(SetColumnOptionAliasesRequest) returns (SetColumnOptionAliasesResponse); @@ -529,6 +533,9 @@ message TableDetail { // soft-deleted row. Populated tables are append-only: PutTableDefinition is // no longer available, while AddTableColumns remains available. bool has_data = 12; + + // User-managed single-column indexes. Backend-managed indexes are omitted. + repeated string indexes = 13; } // Server-owned behavior for one logical column returned in table details. @@ -608,6 +615,23 @@ message SetRowDisplayColumnsResponse { int64 row_version = 3; } +// Atomically replaces the table's user-managed single-column indexes. Indexes +// owned by the backend, including link and navigation indexes, are unchanged. +message SetTableIndexesRequest { + string profile_name = 1; + string table_name = 2; + repeated string indexes = 3; + // Row version returned by GetProfileDetails when the indexes were read. + int64 expected_row_version = 4; +} + +message SetTableIndexesResponse { + bool success = 1; + repeated string indexes = 2; + // New row version after the update, or the current version for a no-op. + int64 row_version = 3; +} + // One public option name. `value` identifies the option by its current public // alias and `alias` is its desired public alias; stored values remain internal. message OptionValueAlias { diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 0ef56abb..d947dc12 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/komp_ac.table_definition.rs b/common/src/proto/komp_ac.table_definition.rs index 6cad1562..a037f145 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -546,6 +546,9 @@ pub struct TableDetail { /// no longer available, while AddTableColumns remains available. #[prost(bool, tag = "12")] pub has_data: bool, + /// User-managed single-column indexes. Backend-managed indexes are omitted. + #[prost(string, repeated, tag = "13")] + pub indexes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// Server-owned behavior for one logical column returned in table details. #[derive(serde::Serialize, serde::Deserialize)] @@ -654,6 +657,32 @@ pub struct SetRowDisplayColumnsResponse { #[prost(int64, tag = "3")] pub row_version: i64, } +/// Atomically replaces the table's user-managed single-column indexes. Indexes +/// owned by the backend, including link and navigation indexes, are unchanged. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct SetTableIndexesRequest { + #[prost(string, tag = "1")] + pub profile_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub table_name: ::prost::alloc::string::String, + #[prost(string, repeated, tag = "3")] + pub indexes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Row version returned by GetProfileDetails when the indexes were read. + #[prost(int64, tag = "4")] + pub expected_row_version: i64, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct SetTableIndexesResponse { + #[prost(bool, tag = "1")] + pub success: bool, + #[prost(string, repeated, tag = "2")] + pub indexes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// New row version after the update, or the current version for a no-op. + #[prost(int64, tag = "3")] + pub row_version: i64, +} /// One public option name. `value` identifies the option by its current public /// alias and `alias` is its desired public alias; stored values remain internal. #[derive(serde::Serialize, serde::Deserialize)] @@ -1551,6 +1580,37 @@ pub mod table_definition_client { ); self.inner.unary(req, path, codec).await } + /// Replaces the user-managed indexes of an existing dynamic table. Physical + /// indexes are created or dropped even when rows have already been stored. + pub async fn set_table_indexes( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/komp_ac.table_definition.TableDefinition/SetTableIndexes", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "komp_ac.table_definition.TableDefinition", + "SetTableIndexes", + ), + ); + self.inner.unary(req, path, codec).await + } /// Replaces the optional user-visible aliases for a fixed-option column. /// Stored values remain stable machine values and scripts never depend on labels. pub async fn set_column_option_aliases( @@ -1786,6 +1846,15 @@ pub mod table_definition_server { tonic::Response, tonic::Status, >; + /// Replaces the user-managed indexes of an existing dynamic table. Physical + /// indexes are created or dropped even when rows have already been stored. + async fn set_table_indexes( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Replaces the optional user-visible aliases for a fixed-option column. /// Stored values remain stable machine values and scripts never depend on labels. async fn set_column_option_aliases( @@ -2572,6 +2641,52 @@ pub mod table_definition_server { }; Box::pin(fut) } + "/komp_ac.table_definition.TableDefinition/SetTableIndexes" => { + #[allow(non_camel_case_types)] + struct SetTableIndexesSvc(pub Arc); + impl< + T: TableDefinition, + > tonic::server::UnaryService + for SetTableIndexesSvc { + type Response = super::SetTableIndexesResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::set_table_indexes(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = SetTableIndexesSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } "/komp_ac.table_definition.TableDefinition/SetColumnOptionAliases" => { #[allow(non_camel_case_types)] struct SetColumnOptionAliasesSvc(pub Arc); diff --git a/server b/server index 6b63dde5..6dbaccc8 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 6b63dde568b71c9e651168336660b73b12d3db41 +Subproject commit 6dbaccc8685a2d0db3b4d8687b7673aadf0ba05a