versioning of FK for archiving2

This commit is contained in:
Priec
2026-08-11 22:02:16 +02:00
parent dcc07ee708
commit d53c28c90a
7 changed files with 105 additions and 104 deletions

2
client

Submodule client updated: a330f74709...5214752ef5

View File

@@ -47,17 +47,15 @@ service TablesData {
// - Updates the row and returns the id; queues search indexing (best effort) // - Updates the row and returns the id; queues search indexing (best effort)
rpc PutTableData(PutTableDataRequest) returns (PutTableDataResponse); rpc PutTableData(PutTableDataRequest) returns (PutTableDataResponse);
// Performs a PUT after the user explicitly accepted its cross-profile impact. // Performs a PUT after the user explicitly accepted changing a referenced version.
// This is meaningful only for global tables; ordinary tables behave exactly rpc PutTableDataConfirmed(PutTableDataConfirmedRequest) returns (PutTableDataResponse);
// like PutTableData.
rpc PutTableDataConfirmed(PutTableDataRequest) returns (PutTableDataResponse);
// Lists the other profiles whose rows currently point at this global row. // Lists profiles whose rows currently point at this row version.
rpc GetGlobalTableUpdateImpact(GlobalTableUpdateImpactRequest) returns (GlobalTableUpdateImpactResponse); rpc GetTableUpdateImpact(TableUpdateImpactRequest) returns (TableUpdateImpactResponse);
// Snapshots the current version of a global row and advances its version. // Snapshots the current version of a row and advances its version.
// Existing references remain immutable; new references use the new version. // Existing references remain immutable; new references use the new version.
rpc ArchiveGlobalTableData(ArchiveGlobalTableDataRequest) returns (ArchiveGlobalTableDataResponse); rpc ArchiveTableData(ArchiveTableDataRequest) returns (ArchiveTableDataResponse);
// Soft-delete a single record (sets deleted = true) if it exists and is not already deleted. // Soft-delete a single record (sets deleted = true) if it exists and is not already deleted.
// //
@@ -80,8 +78,8 @@ service TablesData {
// - If the physical table is missing but the definition exists, returns INTERNAL // - If the physical table is missing but the definition exists, returns INTERNAL
rpc GetTableData(GetTableDataRequest) returns (GetTableDataResponse); rpc GetTableData(GetTableDataRequest) returns (GetTableDataResponse);
// Fetches one exact version of a global row. // Fetches one exact version of a row.
rpc GetGlobalTableDataVersion(GetGlobalTableDataVersionRequest) returns (GetTableDataResponse); rpc GetTableDataVersion(GetTableDataVersionRequest) returns (GetTableDataResponse);
// Count non-deleted rows in a table. // Count non-deleted rows in a table.
// //
@@ -214,6 +212,11 @@ message PutTableDataRequest {
int64 expected_revision = 5; int64 expected_revision = 5;
} }
message PutTableDataConfirmedRequest {
PutTableDataRequest update = 1;
repeated string expected_affected_profiles = 2;
}
// Update response. // Update response.
message PutTableDataResponse { message PutTableDataResponse {
// True if the update succeeded (or no-op on empty data). // True if the update succeeded (or no-op on empty data).
@@ -229,24 +232,24 @@ message PutTableDataResponse {
int64 row_revision = 4; int64 row_revision = 4;
} }
message GlobalTableUpdateImpactRequest { message TableUpdateImpactRequest {
string profile_name = 1; string profile_name = 1;
string table_name = 2; string table_name = 2;
int64 id = 3; int64 id = 3;
} }
message GlobalTableUpdateImpactResponse { message TableUpdateImpactResponse {
repeated string affected_profiles = 1; repeated string affected_profiles = 1;
} }
message ArchiveGlobalTableDataRequest { message ArchiveTableDataRequest {
string profile_name = 1; string profile_name = 1;
string table_name = 2; string table_name = 2;
int64 id = 3; int64 id = 3;
int64 expected_revision = 4; int64 expected_revision = 4;
} }
message ArchiveGlobalTableDataResponse { message ArchiveTableDataResponse {
bool success = 1; bool success = 1;
int64 archived_version = 2; int64 archived_version = 2;
string archived_at = 3; string archived_at = 3;
@@ -289,7 +292,7 @@ message GetTableDataRequest {
} }
message GetGlobalTableDataVersionRequest { message GetTableDataVersionRequest {
string profile_name = 1; string profile_name = 1;
string table_name = 2; string table_name = 2;
int64 id = 3; int64 id = 3;

View File

@@ -1,5 +1,6 @@
pub const ERROR_REASON_METADATA_KEY: &str = "komp-ac-error-reason"; pub const ERROR_REASON_METADATA_KEY: &str = "komp-ac-error-reason";
pub const AFFECTED_PROFILES_METADATA_KEY: &str = "komp-ac-affected-profiles";
pub const COMPUTED_VALUE_MISMATCH_REASON: &str = "computed-value-mismatch"; pub const COMPUTED_VALUE_MISMATCH_REASON: &str = "computed-value-mismatch";
pub const ROW_STALE_REASON: &str = "row-stale"; pub const ROW_STALE_REASON: &str = "row-stale";
pub const ROW_ID_CONFLICT_REASON: &str = "row-id-conflict"; pub const ROW_ID_CONFLICT_REASON: &str = "row-id-conflict";
pub const GLOBAL_UPDATE_CONFIRMATION_REASON: &str = "global-update-confirmation"; pub const VERSIONED_UPDATE_CONFIRMATION_REASON: &str = "versioned-update-confirmation";

Binary file not shown.

View File

@@ -133,6 +133,15 @@ pub struct PutTableDataRequest {
#[prost(int64, tag = "5")] #[prost(int64, tag = "5")]
pub expected_revision: i64, pub expected_revision: i64,
} }
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PutTableDataConfirmedRequest {
#[prost(message, optional, tag = "1")]
pub update: ::core::option::Option<PutTableDataRequest>,
#[prost(string, repeated, tag = "2")]
pub expected_affected_profiles: ::prost::alloc::vec::Vec<
::prost::alloc::string::String,
>,
}
/// Update response. /// Update response.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PutTableDataResponse { pub struct PutTableDataResponse {
@@ -150,7 +159,7 @@ pub struct PutTableDataResponse {
pub row_revision: i64, pub row_revision: i64,
} }
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GlobalTableUpdateImpactRequest { pub struct TableUpdateImpactRequest {
#[prost(string, tag = "1")] #[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String, pub profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")] #[prost(string, tag = "2")]
@@ -159,12 +168,12 @@ pub struct GlobalTableUpdateImpactRequest {
pub id: i64, pub id: i64,
} }
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GlobalTableUpdateImpactResponse { pub struct TableUpdateImpactResponse {
#[prost(string, repeated, tag = "1")] #[prost(string, repeated, tag = "1")]
pub affected_profiles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, pub affected_profiles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
} }
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ArchiveGlobalTableDataRequest { pub struct ArchiveTableDataRequest {
#[prost(string, tag = "1")] #[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String, pub profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")] #[prost(string, tag = "2")]
@@ -175,7 +184,7 @@ pub struct ArchiveGlobalTableDataRequest {
pub expected_revision: i64, pub expected_revision: i64,
} }
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ArchiveGlobalTableDataResponse { pub struct ArchiveTableDataResponse {
#[prost(bool, tag = "1")] #[prost(bool, tag = "1")]
pub success: bool, pub success: bool,
#[prost(int64, tag = "2")] #[prost(int64, tag = "2")]
@@ -226,7 +235,7 @@ pub struct GetTableDataRequest {
pub id: i64, pub id: i64,
} }
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetGlobalTableDataVersionRequest { pub struct GetTableDataVersionRequest {
#[prost(string, tag = "1")] #[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String, pub profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")] #[prost(string, tag = "2")]
@@ -497,12 +506,10 @@ pub mod tables_data_client {
); );
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
/// Performs a PUT after the user explicitly accepted its cross-profile impact. /// Performs a PUT after the user explicitly accepted changing a referenced version.
/// This is meaningful only for global tables; ordinary tables behave exactly
/// like PutTableData.
pub async fn put_table_data_confirmed( pub async fn put_table_data_confirmed(
&mut self, &mut self,
request: impl tonic::IntoRequest<super::PutTableDataRequest>, request: impl tonic::IntoRequest<super::PutTableDataConfirmedRequest>,
) -> std::result::Result< ) -> std::result::Result<
tonic::Response<super::PutTableDataResponse>, tonic::Response<super::PutTableDataResponse>,
tonic::Status, tonic::Status,
@@ -529,12 +536,12 @@ pub mod tables_data_client {
); );
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
/// Lists the other profiles whose rows currently point at this global row. /// Lists profiles whose rows currently point at this row version.
pub async fn get_global_table_update_impact( pub async fn get_table_update_impact(
&mut self, &mut self,
request: impl tonic::IntoRequest<super::GlobalTableUpdateImpactRequest>, request: impl tonic::IntoRequest<super::TableUpdateImpactRequest>,
) -> std::result::Result< ) -> std::result::Result<
tonic::Response<super::GlobalTableUpdateImpactResponse>, tonic::Response<super::TableUpdateImpactResponse>,
tonic::Status, tonic::Status,
> { > {
self.inner self.inner
@@ -547,25 +554,25 @@ pub mod tables_data_client {
})?; })?;
let codec = tonic_prost::ProstCodec::default(); let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static( let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/GetGlobalTableUpdateImpact", "/komp_ac.tables_data.TablesData/GetTableUpdateImpact",
); );
let mut req = request.into_request(); let mut req = request.into_request();
req.extensions_mut() req.extensions_mut()
.insert( .insert(
GrpcMethod::new( GrpcMethod::new(
"komp_ac.tables_data.TablesData", "komp_ac.tables_data.TablesData",
"GetGlobalTableUpdateImpact", "GetTableUpdateImpact",
), ),
); );
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
/// Snapshots the current version of a global row and advances its version. /// Snapshots the current version of a row and advances its version.
/// Existing references remain immutable; new references use the new version. /// Existing references remain immutable; new references use the new version.
pub async fn archive_global_table_data( pub async fn archive_table_data(
&mut self, &mut self,
request: impl tonic::IntoRequest<super::ArchiveGlobalTableDataRequest>, request: impl tonic::IntoRequest<super::ArchiveTableDataRequest>,
) -> std::result::Result< ) -> std::result::Result<
tonic::Response<super::ArchiveGlobalTableDataResponse>, tonic::Response<super::ArchiveTableDataResponse>,
tonic::Status, tonic::Status,
> { > {
self.inner self.inner
@@ -578,15 +585,12 @@ pub mod tables_data_client {
})?; })?;
let codec = tonic_prost::ProstCodec::default(); let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static( let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/ArchiveGlobalTableData", "/komp_ac.tables_data.TablesData/ArchiveTableData",
); );
let mut req = request.into_request(); let mut req = request.into_request();
req.extensions_mut() req.extensions_mut()
.insert( .insert(
GrpcMethod::new( GrpcMethod::new("komp_ac.tables_data.TablesData", "ArchiveTableData"),
"komp_ac.tables_data.TablesData",
"ArchiveGlobalTableData",
),
); );
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
@@ -661,10 +665,10 @@ pub mod tables_data_client {
); );
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
/// Fetches one exact version of a global row. /// Fetches one exact version of a row.
pub async fn get_global_table_data_version( pub async fn get_table_data_version(
&mut self, &mut self,
request: impl tonic::IntoRequest<super::GetGlobalTableDataVersionRequest>, request: impl tonic::IntoRequest<super::GetTableDataVersionRequest>,
) -> std::result::Result< ) -> std::result::Result<
tonic::Response<super::GetTableDataResponse>, tonic::Response<super::GetTableDataResponse>,
tonic::Status, tonic::Status,
@@ -679,14 +683,14 @@ pub mod tables_data_client {
})?; })?;
let codec = tonic_prost::ProstCodec::default(); let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static( let path = http::uri::PathAndQuery::from_static(
"/komp_ac.tables_data.TablesData/GetGlobalTableDataVersion", "/komp_ac.tables_data.TablesData/GetTableDataVersion",
); );
let mut req = request.into_request(); let mut req = request.into_request();
req.extensions_mut() req.extensions_mut()
.insert( .insert(
GrpcMethod::new( GrpcMethod::new(
"komp_ac.tables_data.TablesData", "komp_ac.tables_data.TablesData",
"GetGlobalTableDataVersion", "GetTableDataVersion",
), ),
); );
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
@@ -832,31 +836,29 @@ pub mod tables_data_server {
tonic::Response<super::PutTableDataResponse>, tonic::Response<super::PutTableDataResponse>,
tonic::Status, tonic::Status,
>; >;
/// Performs a PUT after the user explicitly accepted its cross-profile impact. /// Performs a PUT after the user explicitly accepted changing a referenced version.
/// This is meaningful only for global tables; ordinary tables behave exactly
/// like PutTableData.
async fn put_table_data_confirmed( async fn put_table_data_confirmed(
&self, &self,
request: tonic::Request<super::PutTableDataRequest>, request: tonic::Request<super::PutTableDataConfirmedRequest>,
) -> std::result::Result< ) -> std::result::Result<
tonic::Response<super::PutTableDataResponse>, tonic::Response<super::PutTableDataResponse>,
tonic::Status, tonic::Status,
>; >;
/// Lists the other profiles whose rows currently point at this global row. /// Lists profiles whose rows currently point at this row version.
async fn get_global_table_update_impact( async fn get_table_update_impact(
&self, &self,
request: tonic::Request<super::GlobalTableUpdateImpactRequest>, request: tonic::Request<super::TableUpdateImpactRequest>,
) -> std::result::Result< ) -> std::result::Result<
tonic::Response<super::GlobalTableUpdateImpactResponse>, tonic::Response<super::TableUpdateImpactResponse>,
tonic::Status, tonic::Status,
>; >;
/// Snapshots the current version of a global row and advances its version. /// Snapshots the current version of a row and advances its version.
/// Existing references remain immutable; new references use the new version. /// Existing references remain immutable; new references use the new version.
async fn archive_global_table_data( async fn archive_table_data(
&self, &self,
request: tonic::Request<super::ArchiveGlobalTableDataRequest>, request: tonic::Request<super::ArchiveTableDataRequest>,
) -> std::result::Result< ) -> std::result::Result<
tonic::Response<super::ArchiveGlobalTableDataResponse>, tonic::Response<super::ArchiveTableDataResponse>,
tonic::Status, tonic::Status,
>; >;
/// Soft-delete a single record (sets deleted = true) if it exists and is not already deleted. /// Soft-delete a single record (sets deleted = true) if it exists and is not already deleted.
@@ -892,10 +894,10 @@ pub mod tables_data_server {
tonic::Response<super::GetTableDataResponse>, tonic::Response<super::GetTableDataResponse>,
tonic::Status, tonic::Status,
>; >;
/// Fetches one exact version of a global row. /// Fetches one exact version of a row.
async fn get_global_table_data_version( async fn get_table_data_version(
&self, &self,
request: tonic::Request<super::GetGlobalTableDataVersionRequest>, request: tonic::Request<super::GetTableDataVersionRequest>,
) -> std::result::Result< ) -> std::result::Result<
tonic::Response<super::GetTableDataResponse>, tonic::Response<super::GetTableDataResponse>,
tonic::Status, tonic::Status,
@@ -1151,7 +1153,7 @@ pub mod tables_data_server {
struct PutTableDataConfirmedSvc<T: TablesData>(pub Arc<T>); struct PutTableDataConfirmedSvc<T: TablesData>(pub Arc<T>);
impl< impl<
T: TablesData, T: TablesData,
> tonic::server::UnaryService<super::PutTableDataRequest> > tonic::server::UnaryService<super::PutTableDataConfirmedRequest>
for PutTableDataConfirmedSvc<T> { for PutTableDataConfirmedSvc<T> {
type Response = super::PutTableDataResponse; type Response = super::PutTableDataResponse;
type Future = BoxFuture< type Future = BoxFuture<
@@ -1160,7 +1162,7 @@ pub mod tables_data_server {
>; >;
fn call( fn call(
&mut self, &mut self,
request: tonic::Request<super::PutTableDataRequest>, request: tonic::Request<super::PutTableDataConfirmedRequest>,
) -> Self::Future { ) -> Self::Future {
let inner = Arc::clone(&self.0); let inner = Arc::clone(&self.0);
let fut = async move { let fut = async move {
@@ -1192,30 +1194,25 @@ pub mod tables_data_server {
}; };
Box::pin(fut) Box::pin(fut)
} }
"/komp_ac.tables_data.TablesData/GetGlobalTableUpdateImpact" => { "/komp_ac.tables_data.TablesData/GetTableUpdateImpact" => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
struct GetGlobalTableUpdateImpactSvc<T: TablesData>(pub Arc<T>); struct GetTableUpdateImpactSvc<T: TablesData>(pub Arc<T>);
impl< impl<
T: TablesData, T: TablesData,
> tonic::server::UnaryService<super::GlobalTableUpdateImpactRequest> > tonic::server::UnaryService<super::TableUpdateImpactRequest>
for GetGlobalTableUpdateImpactSvc<T> { for GetTableUpdateImpactSvc<T> {
type Response = super::GlobalTableUpdateImpactResponse; type Response = super::TableUpdateImpactResponse;
type Future = BoxFuture< type Future = BoxFuture<
tonic::Response<Self::Response>, tonic::Response<Self::Response>,
tonic::Status, tonic::Status,
>; >;
fn call( fn call(
&mut self, &mut self,
request: tonic::Request< request: tonic::Request<super::TableUpdateImpactRequest>,
super::GlobalTableUpdateImpactRequest,
>,
) -> Self::Future { ) -> Self::Future {
let inner = Arc::clone(&self.0); let inner = Arc::clone(&self.0);
let fut = async move { let fut = async move {
<T as TablesData>::get_global_table_update_impact( <T as TablesData>::get_table_update_impact(&inner, request)
&inner,
request,
)
.await .await
}; };
Box::pin(fut) Box::pin(fut)
@@ -1227,7 +1224,7 @@ pub mod tables_data_server {
let max_encoding_message_size = self.max_encoding_message_size; let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone(); let inner = self.inner.clone();
let fut = async move { let fut = async move {
let method = GetGlobalTableUpdateImpactSvc(inner); let method = GetTableUpdateImpactSvc(inner);
let codec = tonic_prost::ProstCodec::default(); let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec) let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config( .apply_compression_config(
@@ -1243,29 +1240,25 @@ pub mod tables_data_server {
}; };
Box::pin(fut) Box::pin(fut)
} }
"/komp_ac.tables_data.TablesData/ArchiveGlobalTableData" => { "/komp_ac.tables_data.TablesData/ArchiveTableData" => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
struct ArchiveGlobalTableDataSvc<T: TablesData>(pub Arc<T>); struct ArchiveTableDataSvc<T: TablesData>(pub Arc<T>);
impl< impl<
T: TablesData, T: TablesData,
> tonic::server::UnaryService<super::ArchiveGlobalTableDataRequest> > tonic::server::UnaryService<super::ArchiveTableDataRequest>
for ArchiveGlobalTableDataSvc<T> { for ArchiveTableDataSvc<T> {
type Response = super::ArchiveGlobalTableDataResponse; type Response = super::ArchiveTableDataResponse;
type Future = BoxFuture< type Future = BoxFuture<
tonic::Response<Self::Response>, tonic::Response<Self::Response>,
tonic::Status, tonic::Status,
>; >;
fn call( fn call(
&mut self, &mut self,
request: tonic::Request<super::ArchiveGlobalTableDataRequest>, request: tonic::Request<super::ArchiveTableDataRequest>,
) -> Self::Future { ) -> Self::Future {
let inner = Arc::clone(&self.0); let inner = Arc::clone(&self.0);
let fut = async move { let fut = async move {
<T as TablesData>::archive_global_table_data( <T as TablesData>::archive_table_data(&inner, request).await
&inner,
request,
)
.await
}; };
Box::pin(fut) Box::pin(fut)
} }
@@ -1276,7 +1269,7 @@ pub mod tables_data_server {
let max_encoding_message_size = self.max_encoding_message_size; let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone(); let inner = self.inner.clone();
let fut = async move { let fut = async move {
let method = ArchiveGlobalTableDataSvc(inner); let method = ArchiveTableDataSvc(inner);
let codec = tonic_prost::ProstCodec::default(); let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec) let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config( .apply_compression_config(
@@ -1382,14 +1375,13 @@ pub mod tables_data_server {
}; };
Box::pin(fut) Box::pin(fut)
} }
"/komp_ac.tables_data.TablesData/GetGlobalTableDataVersion" => { "/komp_ac.tables_data.TablesData/GetTableDataVersion" => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
struct GetGlobalTableDataVersionSvc<T: TablesData>(pub Arc<T>); struct GetTableDataVersionSvc<T: TablesData>(pub Arc<T>);
impl< impl<
T: TablesData, T: TablesData,
> tonic::server::UnaryService< > tonic::server::UnaryService<super::GetTableDataVersionRequest>
super::GetGlobalTableDataVersionRequest, for GetTableDataVersionSvc<T> {
> for GetGlobalTableDataVersionSvc<T> {
type Response = super::GetTableDataResponse; type Response = super::GetTableDataResponse;
type Future = BoxFuture< type Future = BoxFuture<
tonic::Response<Self::Response>, tonic::Response<Self::Response>,
@@ -1397,16 +1389,11 @@ pub mod tables_data_server {
>; >;
fn call( fn call(
&mut self, &mut self,
request: tonic::Request< request: tonic::Request<super::GetTableDataVersionRequest>,
super::GetGlobalTableDataVersionRequest,
>,
) -> Self::Future { ) -> Self::Future {
let inner = Arc::clone(&self.0); let inner = Arc::clone(&self.0);
let fut = async move { let fut = async move {
<T as TablesData>::get_global_table_data_version( <T as TablesData>::get_table_data_version(&inner, request)
&inner,
request,
)
.await .await
}; };
Box::pin(fut) Box::pin(fut)
@@ -1418,7 +1405,7 @@ pub mod tables_data_server {
let max_encoding_message_size = self.max_encoding_message_size; let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone(); let inner = self.inner.clone();
let fut = async move { let fut = async move {
let method = GetGlobalTableDataVersionSvc(inner); let method = GetTableDataVersionSvc(inner);
let codec = tonic_prost::ProstCodec::default(); let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec) let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config( .apply_compression_config(

View File

@@ -44,6 +44,8 @@ pub const TRAILING_SYSTEM_COLUMNS: [SystemColumn; 1] = [SystemColumn {
/// profile is known rather than spelled out here. /// profile is known rather than spelled out here.
pub const ACCOUNT_REFERENCE_COLUMN: &str = "account_id"; pub const ACCOUNT_REFERENCE_COLUMN: &str = "account_id";
pub const ACCOUNT_API_COLUMN: &str = "account"; pub const ACCOUNT_API_COLUMN: &str = "account";
/// Internal version of a managed row. It is never exposed as editable data.
pub const ROW_VERSION_COLUMN: &str = "version";
/// The longest name any system column carries physically. /// The longest name any system column carries physically.
/// ///
@@ -69,7 +71,14 @@ const fn longest_system_column_name() -> usize {
longest longest
} }
let longest = longest_of(&LEADING_SYSTEM_COLUMNS, ACCOUNT_REFERENCE_COLUMN.len()); let longest = longest_of(
&LEADING_SYSTEM_COLUMNS,
if ACCOUNT_REFERENCE_COLUMN.len() > ROW_VERSION_COLUMN.len() {
ACCOUNT_REFERENCE_COLUMN.len()
} else {
ROW_VERSION_COLUMN.len()
},
);
longest_of(&TRAILING_SYSTEM_COLUMNS, longest) longest_of(&TRAILING_SYSTEM_COLUMNS, longest)
} }
@@ -83,6 +92,7 @@ pub fn system_column_names() -> impl Iterator<Item = &'static str> {
.chain(TRAILING_SYSTEM_COLUMNS.iter()) .chain(TRAILING_SYSTEM_COLUMNS.iter())
.map(|column| column.name) .map(|column| column.name)
.chain(std::iter::once(ACCOUNT_REFERENCE_COLUMN)) .chain(std::iter::once(ACCOUNT_REFERENCE_COLUMN))
.chain(std::iter::once(ROW_VERSION_COLUMN))
} }
/// Whether `name` belongs to the system column vocabulary and is safe to show /// Whether `name` belongs to the system column vocabulary and is safe to show
@@ -145,7 +155,7 @@ mod tests {
fn the_name_list_reads_as_a_sentence_fragment() { fn the_name_list_reads_as_a_sentence_fragment() {
assert_eq!( assert_eq!(
system_column_name_list(), system_column_name_list(),
"'id', 'deleted', 'row_revision', 'created_at', 'account_id', 'account'" "'id', 'deleted', 'row_revision', 'created_at', 'account_id', 'version', 'account'"
); );
} }
} }

2
server

Submodule server updated: ac0c12a7ac...d81308592a