From 4ae7c4068f91cedd4291521a5777af00c0ff052f Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 12 Jan 2024 12:46:01 +0100 Subject: [PATCH] add syncedBy and remote state components --- solanaceae/message3/components.hpp | 34 +++++++++++++++++-- solanaceae/message3/components_id.inl | 3 ++ .../message3/registry_message_model.hpp | 1 + 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/solanaceae/message3/components.hpp b/solanaceae/message3/components.hpp index 0741aa0..b37185b 100644 --- a/solanaceae/message3/components.hpp +++ b/solanaceae/message3/components.hpp @@ -5,8 +5,11 @@ //fwd struct FileI; -#include +#include + #include +#include +#include namespace Message::Components { @@ -18,15 +21,17 @@ namespace Message::Components { Contact3 c; }; + // best guess as to how this should be displayed in the global order struct Timestamp { uint64_t ts {0}; }; - struct TimestampProcessed { + struct TimestampWritten { uint64_t ts {0}; }; - struct TimestampWritten { + // local start TODO: namespace ? + struct TimestampProcessed { uint64_t ts {0}; }; @@ -36,6 +41,29 @@ namespace Message::Components { // TODO: too much? uint64_t ts {0}; }; + // local end + + namespace Remote { + // TODO: milliseconds sound excessive + + struct TimestampReceived { + // Due to a lack of info with most protocols, + // this is often the timestamp we heard they already have the message. + entt::dense_map ts; + }; + + struct TimestampRead { + // Due to a lack of info with most protocols, + // this is often the timestamp we heard they have read it the message. + entt::dense_map ts; + }; + + } // Remote + + struct SyncedBy { + // ts is not updated once set + entt::dense_map ts; + }; struct MessageText { std::string text; diff --git a/solanaceae/message3/components_id.inl b/solanaceae/message3/components_id.inl index 2ed9a8f..4def5d3 100644 --- a/solanaceae/message3/components_id.inl +++ b/solanaceae/message3/components_id.inl @@ -19,6 +19,9 @@ DEFINE_COMP_ID(Message::Components::TimestampProcessed) DEFINE_COMP_ID(Message::Components::TimestampWritten) DEFINE_COMP_ID(Message::Components::TagUnread) DEFINE_COMP_ID(Message::Components::Read) +DEFINE_COMP_ID(Message::Components::Remote::TimestampReceived) +DEFINE_COMP_ID(Message::Components::Remote::TimestampRead) +DEFINE_COMP_ID(Message::Components::SyncedBy) DEFINE_COMP_ID(Message::Components::MessageText) DEFINE_COMP_ID(Message::Components::TagMessageIsAction) diff --git a/solanaceae/message3/registry_message_model.hpp b/solanaceae/message3/registry_message_model.hpp index b0dc396..cec5e0b 100644 --- a/solanaceae/message3/registry_message_model.hpp +++ b/solanaceae/message3/registry_message_model.hpp @@ -36,6 +36,7 @@ namespace Events { } // Events // get unix time in milliseconds +// TODO: move to util uint64_t getTimeMS(void); } // Message