versioning of FK for archiving
This commit is contained in:
@@ -149,6 +149,46 @@ pub struct PutTableDataResponse {
|
||||
#[prost(int64, tag = "4")]
|
||||
pub row_revision: i64,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct GlobalTableUpdateImpactRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub profile_name: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub table_name: ::prost::alloc::string::String,
|
||||
#[prost(int64, tag = "3")]
|
||||
pub id: i64,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct GlobalTableUpdateImpactResponse {
|
||||
#[prost(string, repeated, tag = "1")]
|
||||
pub affected_profiles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct ArchiveGlobalTableDataRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub profile_name: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub table_name: ::prost::alloc::string::String,
|
||||
#[prost(int64, tag = "3")]
|
||||
pub id: i64,
|
||||
#[prost(int64, tag = "4")]
|
||||
pub expected_revision: i64,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct ArchiveGlobalTableDataResponse {
|
||||
#[prost(bool, tag = "1")]
|
||||
pub success: bool,
|
||||
#[prost(int64, tag = "2")]
|
||||
pub archived_version: i64,
|
||||
#[prost(string, tag = "3")]
|
||||
pub archived_at: ::prost::alloc::string::String,
|
||||
#[prost(string, repeated, tag = "4")]
|
||||
pub affected_profiles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
||||
#[prost(int64, tag = "5")]
|
||||
pub current_version: i64,
|
||||
#[prost(int64, tag = "6")]
|
||||
pub row_revision: i64,
|
||||
}
|
||||
/// Soft-delete a single row.
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct DeleteTableDataRequest {
|
||||
@@ -185,6 +225,17 @@ pub struct GetTableDataRequest {
|
||||
#[prost(int64, tag = "3")]
|
||||
pub id: i64,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct GetGlobalTableDataVersionRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub profile_name: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "2")]
|
||||
pub table_name: ::prost::alloc::string::String,
|
||||
#[prost(int64, tag = "3")]
|
||||
pub id: i64,
|
||||
#[prost(int64, tag = "4")]
|
||||
pub version: i64,
|
||||
}
|
||||
/// Row payload: all columns returned as strings.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetTableDataResponse {
|
||||
@@ -209,6 +260,9 @@ pub struct GetTableDataResponse {
|
||||
pub row_display_values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
||||
#[prost(string, repeated, tag = "3")]
|
||||
pub row_display_columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
||||
/// Version paired with each global-link column in this row.
|
||||
#[prost(map = "string, int64", tag = "4")]
|
||||
pub link_versions: ::std::collections::HashMap<::prost::alloc::string::String, i64>,
|
||||
}
|
||||
/// Count non-deleted rows.
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
@@ -443,6 +497,99 @@ pub mod tables_data_client {
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Performs a PUT after the user explicitly accepted its cross-profile impact.
|
||||
/// This is meaningful only for global tables; ordinary tables behave exactly
|
||||
/// like PutTableData.
|
||||
pub async fn put_table_data_confirmed(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::PutTableDataRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::PutTableDataResponse>,
|
||||
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.tables_data.TablesData/PutTableDataConfirmed",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new(
|
||||
"komp_ac.tables_data.TablesData",
|
||||
"PutTableDataConfirmed",
|
||||
),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Lists the other profiles whose rows currently point at this global row.
|
||||
pub async fn get_global_table_update_impact(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::GlobalTableUpdateImpactRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::GlobalTableUpdateImpactResponse>,
|
||||
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.tables_data.TablesData/GetGlobalTableUpdateImpact",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new(
|
||||
"komp_ac.tables_data.TablesData",
|
||||
"GetGlobalTableUpdateImpact",
|
||||
),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Snapshots the current version of a global row and advances its version.
|
||||
/// Existing references remain immutable; new references use the new version.
|
||||
pub async fn archive_global_table_data(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::ArchiveGlobalTableDataRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::ArchiveGlobalTableDataResponse>,
|
||||
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.tables_data.TablesData/ArchiveGlobalTableData",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new(
|
||||
"komp_ac.tables_data.TablesData",
|
||||
"ArchiveGlobalTableData",
|
||||
),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Soft-delete a single record (sets deleted = true) if it exists and is not already deleted.
|
||||
///
|
||||
/// Behavior:
|
||||
@@ -514,6 +661,36 @@ pub mod tables_data_client {
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Fetches one exact version of a global row.
|
||||
pub async fn get_global_table_data_version(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::GetGlobalTableDataVersionRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::GetTableDataResponse>,
|
||||
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.tables_data.TablesData/GetGlobalTableDataVersion",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new(
|
||||
"komp_ac.tables_data.TablesData",
|
||||
"GetGlobalTableDataVersion",
|
||||
),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Count non-deleted rows in a table.
|
||||
///
|
||||
/// Behavior:
|
||||
@@ -655,6 +832,33 @@ pub mod tables_data_server {
|
||||
tonic::Response<super::PutTableDataResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Performs a PUT after the user explicitly accepted its cross-profile impact.
|
||||
/// This is meaningful only for global tables; ordinary tables behave exactly
|
||||
/// like PutTableData.
|
||||
async fn put_table_data_confirmed(
|
||||
&self,
|
||||
request: tonic::Request<super::PutTableDataRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::PutTableDataResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Lists the other profiles whose rows currently point at this global row.
|
||||
async fn get_global_table_update_impact(
|
||||
&self,
|
||||
request: tonic::Request<super::GlobalTableUpdateImpactRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::GlobalTableUpdateImpactResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Snapshots the current version of a global row and advances its version.
|
||||
/// Existing references remain immutable; new references use the new version.
|
||||
async fn archive_global_table_data(
|
||||
&self,
|
||||
request: tonic::Request<super::ArchiveGlobalTableDataRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::ArchiveGlobalTableDataResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Soft-delete a single record (sets deleted = true) if it exists and is not already deleted.
|
||||
///
|
||||
/// Behavior:
|
||||
@@ -688,6 +892,14 @@ pub mod tables_data_server {
|
||||
tonic::Response<super::GetTableDataResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Fetches one exact version of a global row.
|
||||
async fn get_global_table_data_version(
|
||||
&self,
|
||||
request: tonic::Request<super::GetGlobalTableDataVersionRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::GetTableDataResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Count non-deleted rows in a table.
|
||||
///
|
||||
/// Behavior:
|
||||
@@ -934,6 +1146,152 @@ pub mod tables_data_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.tables_data.TablesData/PutTableDataConfirmed" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct PutTableDataConfirmedSvc<T: TablesData>(pub Arc<T>);
|
||||
impl<
|
||||
T: TablesData,
|
||||
> tonic::server::UnaryService<super::PutTableDataRequest>
|
||||
for PutTableDataConfirmedSvc<T> {
|
||||
type Response = super::PutTableDataResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::PutTableDataRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as TablesData>::put_table_data_confirmed(&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 = PutTableDataConfirmedSvc(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.tables_data.TablesData/GetGlobalTableUpdateImpact" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct GetGlobalTableUpdateImpactSvc<T: TablesData>(pub Arc<T>);
|
||||
impl<
|
||||
T: TablesData,
|
||||
> tonic::server::UnaryService<super::GlobalTableUpdateImpactRequest>
|
||||
for GetGlobalTableUpdateImpactSvc<T> {
|
||||
type Response = super::GlobalTableUpdateImpactResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<
|
||||
super::GlobalTableUpdateImpactRequest,
|
||||
>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as TablesData>::get_global_table_update_impact(
|
||||
&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 = GetGlobalTableUpdateImpactSvc(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.tables_data.TablesData/ArchiveGlobalTableData" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct ArchiveGlobalTableDataSvc<T: TablesData>(pub Arc<T>);
|
||||
impl<
|
||||
T: TablesData,
|
||||
> tonic::server::UnaryService<super::ArchiveGlobalTableDataRequest>
|
||||
for ArchiveGlobalTableDataSvc<T> {
|
||||
type Response = super::ArchiveGlobalTableDataResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::ArchiveGlobalTableDataRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as TablesData>::archive_global_table_data(
|
||||
&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 = ArchiveGlobalTableDataSvc(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.tables_data.TablesData/DeleteTableData" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct DeleteTableDataSvc<T: TablesData>(pub Arc<T>);
|
||||
@@ -1024,6 +1382,58 @@ pub mod tables_data_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.tables_data.TablesData/GetGlobalTableDataVersion" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct GetGlobalTableDataVersionSvc<T: TablesData>(pub Arc<T>);
|
||||
impl<
|
||||
T: TablesData,
|
||||
> tonic::server::UnaryService<
|
||||
super::GetGlobalTableDataVersionRequest,
|
||||
> for GetGlobalTableDataVersionSvc<T> {
|
||||
type Response = super::GetTableDataResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<
|
||||
super::GetGlobalTableDataVersionRequest,
|
||||
>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as TablesData>::get_global_table_data_version(
|
||||
&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 = GetGlobalTableDataVersionSvc(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.tables_data.TablesData/GetTableDataCount" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct GetTableDataCountSvc<T: TablesData>(pub Arc<T>);
|
||||
|
||||
Reference in New Issue
Block a user