diff --git a/client-gui2 b/client-gui2 index 6af9d5a1..a03fce26 160000 --- a/client-gui2 +++ b/client-gui2 @@ -1 +1 @@ -Subproject commit 6af9d5a1277aad3f0888c4ceb6861540a2cea8e1 +Subproject commit a03fce267991cd9f851148d491aaef09fc42146e diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index 1c686310..cf331750 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -70,6 +70,10 @@ service TableDefinition { // indexes are created or dropped even when rows have already been stored. rpc SetTableIndexes(SetTableIndexesRequest) returns (SetTableIndexesResponse); + // Changes whether one existing column is required. Enabling the requirement + // is rejected while an active row has no value for the column. + rpc SetColumnRequired(SetColumnRequiredRequest) returns (SetColumnRequiredResponse); + // 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); @@ -632,6 +636,24 @@ message SetTableIndexesResponse { int64 row_version = 3; } +message SetColumnRequiredRequest { + string profile_name = 1; + string table_name = 2; + // Stable column identity returned in GetProfileDetails.column_behaviors. + int64 column_id = 3; + bool required = 4; + // Row version returned by GetProfileDetails when the column was read. + int64 expected_row_version = 5; +} + +message SetColumnRequiredResponse { + bool success = 1; + int64 column_id = 2; + bool required = 3; + // New row version after the update, or the current version for a no-op. + int64 row_version = 4; +} + // 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 d947dc12..02500878 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 a037f145..a573ed90 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -683,6 +683,35 @@ pub struct SetTableIndexesResponse { #[prost(int64, tag = "3")] pub row_version: i64, } +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct SetColumnRequiredRequest { + #[prost(string, tag = "1")] + pub profile_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub table_name: ::prost::alloc::string::String, + /// Stable column identity returned in GetProfileDetails.column_behaviors. + #[prost(int64, tag = "3")] + pub column_id: i64, + #[prost(bool, tag = "4")] + pub required: bool, + /// Row version returned by GetProfileDetails when the column was read. + #[prost(int64, tag = "5")] + pub expected_row_version: i64, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct SetColumnRequiredResponse { + #[prost(bool, tag = "1")] + pub success: bool, + #[prost(int64, tag = "2")] + pub column_id: i64, + #[prost(bool, tag = "3")] + pub required: bool, + /// New row version after the update, or the current version for a no-op. + #[prost(int64, tag = "4")] + 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)] @@ -1611,6 +1640,37 @@ pub mod table_definition_client { ); self.inner.unary(req, path, codec).await } + /// Changes whether one existing column is required. Enabling the requirement + /// is rejected while an active row has no value for the column. + pub async fn set_column_required( + &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/SetColumnRequired", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "komp_ac.table_definition.TableDefinition", + "SetColumnRequired", + ), + ); + 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( @@ -1855,6 +1915,15 @@ pub mod table_definition_server { tonic::Response, tonic::Status, >; + /// Changes whether one existing column is required. Enabling the requirement + /// is rejected while an active row has no value for the column. + async fn set_column_required( + &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( @@ -2687,6 +2756,52 @@ pub mod table_definition_server { }; Box::pin(fut) } + "/komp_ac.table_definition.TableDefinition/SetColumnRequired" => { + #[allow(non_camel_case_types)] + struct SetColumnRequiredSvc(pub Arc); + impl< + T: TableDefinition, + > tonic::server::UnaryService + for SetColumnRequiredSvc { + type Response = super::SetColumnRequiredResponse; + 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_column_required(&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 = SetColumnRequiredSvc(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 6dbaccc8..f43dc625 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 6dbaccc8685a2d0db3b4d8687b7673aadf0ba05a +Subproject commit f43dc62578245aabad13de2b5336f178d1b5f750