Moving some logic of dealing with sequence numbers to SyncAppDataFetch
Adding recursive mutexes to SyncLogic, so hopefully it is now thread-safe
Small modification of publishing/retrieval names. Now session ID is
appended by SyncAppDataFetch / SyncAppDataPublish
diff --git a/model/sync-seq-no.h b/model/sync-seq-no.h
index 93013a5..b4329d2 100644
--- a/model/sync-seq-no.h
+++ b/model/sync-seq-no.h
@@ -36,6 +36,16 @@
{
public:
/**
+ * @brief Default constructor. Creates an zero sequence number with zero session ID (basically is an invalid object)
+ */
+ SeqNo ()
+ : m_valid (false)
+ , m_session (0)
+ , m_seq (0)
+ {
+ }
+
+ /**
* @brief Copy constructor
* @param seq sequence number object to copy from
*/
@@ -51,6 +61,7 @@
SeqNo &
operator = (const SeqNo &seq)
{
+ m_valid = seq.m_valid;
m_session = seq.m_session;
m_seq = seq.m_seq;
@@ -62,7 +73,8 @@
* @param seq Sequence number
*/
SeqNo (uint32_t seq)
- : m_session (0)
+ : m_valid (true)
+ , m_session (0)
, m_seq (seq)
{ }
@@ -72,7 +84,8 @@
* @param seq Sequence number
*/
SeqNo (uint32_t session, uint32_t seq)
- : m_session (session)
+ : m_valid (true)
+ , m_session (session)
, m_seq (seq)
{ }
@@ -108,6 +121,12 @@
return m_session == seq.m_session && m_seq == seq.m_seq;
}
+ bool
+ isValid () const
+ {
+ return m_valid;
+ }
+
/**
* @brief Get session id
*/
@@ -121,6 +140,8 @@
{ return m_seq; }
private:
+ bool m_valid;
+
/**
* @brief Session ID (e.g., after crash, application will choose new session ID.
*