diff --git a/client b/client index a7da2562..637eb6a0 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit a7da256200ce1f2b63f7ca6b764f40400a2203cb +Subproject commit 637eb6a04d767bedc459344dad1b4269002e46f6 diff --git a/common/proto/tables_data.proto b/common/proto/tables_data.proto index 7c9d953a..769f1cfa 100644 --- a/common/proto/tables_data.proto +++ b/common/proto/tables_data.proto @@ -299,6 +299,37 @@ message GetTableDataVersionRequest { int64 version = 4; } +// A link resolved exactly as the source row stored it, together with the +// target row's current state. The physical companion version column remains +// an internal implementation detail. +enum ResolvedTableLinkStatus { + CURRENT = 0; + SUPERSEDED = 1; + UNAVAILABLE = 2; + DELETED = 3; +} + +message ResolvedTableLinkVersion { + int64 version = 1; + map data = 2; + repeated string row_display_values = 3; + repeated string row_display_columns = 4; +} + +message ResolvedTableLinkUpdate { + int64 version = 1; + map data = 2; + repeated string row_display_values = 3; + repeated string changed_fields = 4; +} + +message ResolvedTableLink { + int64 id = 1; + ResolvedTableLinkVersion saved = 2; + ResolvedTableLinkStatus status = 3; + ResolvedTableLinkUpdate newer = 4; +} + // Row payload: all columns returned as strings. message GetTableDataResponse { // Map of column_name → stringified value for: @@ -317,8 +348,12 @@ message GetTableDataResponse { repeated string row_display_values = 2; repeated string row_display_columns = 3; - // Version paired with each global-link column in this row. - map link_versions = 4; + // Links keyed by their public column name. Each value contains the row as + // saved by this record and the newest available state of the linked row. + map resolved_links = 4; + + // The generation returned by this response. Zero is never returned. + int64 row_version = 5; } // Count non-deleted rows. diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 429670b6..8d8cb0f1 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.tables_data.rs b/common/src/proto/komp_ac.tables_data.rs index efbb92a8..8876d849 100644 --- a/common/src/proto/komp_ac.tables_data.rs +++ b/common/src/proto/komp_ac.tables_data.rs @@ -245,6 +245,45 @@ pub struct GetTableDataVersionRequest { #[prost(int64, tag = "4")] pub version: i64, } +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResolvedTableLinkVersion { + #[prost(int64, tag = "1")] + pub version: i64, + #[prost(map = "string, string", tag = "2")] + pub data: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + #[prost(string, repeated, tag = "3")] + pub row_display_values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, repeated, tag = "4")] + pub row_display_columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResolvedTableLinkUpdate { + #[prost(int64, tag = "1")] + pub version: i64, + #[prost(map = "string, string", tag = "2")] + pub data: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + #[prost(string, repeated, tag = "3")] + pub row_display_values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, repeated, tag = "4")] + pub changed_fields: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResolvedTableLink { + #[prost(int64, tag = "1")] + pub id: i64, + #[prost(message, optional, tag = "2")] + pub saved: ::core::option::Option, + #[prost(enumeration = "ResolvedTableLinkStatus", tag = "3")] + pub status: i32, + #[prost(message, optional, tag = "4")] + pub newer: ::core::option::Option, +} /// Row payload: all columns returned as strings. #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetTableDataResponse { @@ -269,9 +308,16 @@ 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>, + /// Links keyed by their public column name. Each value contains the row as + /// saved by this record and the newest available state of the linked row. + #[prost(map = "string, message", tag = "4")] + pub resolved_links: ::std::collections::HashMap< + ::prost::alloc::string::String, + ResolvedTableLink, + >, + /// The generation returned by this response. Zero is never returned. + #[prost(int64, tag = "5")] + pub row_version: i64, } /// Count non-deleted rows. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] @@ -296,6 +342,41 @@ pub struct GetTableDataByPositionRequest { #[prost(int32, tag = "3")] pub position: i32, } +/// A link resolved exactly as the source row stored it, together with the +/// target row's current state. The physical companion version column remains +/// an internal implementation detail. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ResolvedTableLinkStatus { + Current = 0, + Superseded = 1, + Unavailable = 2, + Deleted = 3, +} +impl ResolvedTableLinkStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Current => "CURRENT", + Self::Superseded => "SUPERSEDED", + Self::Unavailable => "UNAVAILABLE", + Self::Deleted => "DELETED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "CURRENT" => Some(Self::Current), + "SUPERSEDED" => Some(Self::Superseded), + "UNAVAILABLE" => Some(Self::Unavailable), + "DELETED" => Some(Self::Deleted), + _ => None, + } + } +} /// Generated client implementations. pub mod tables_data_client { #![allow( diff --git a/server b/server index d939afd6..e412608d 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit d939afd69c62ecd940526547157b7ce97fb5e239 +Subproject commit e412608da1a6fd9ff1e74b9719df2d39649eb92b