feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security, data, app, realtime, supervisor, clients, CLI, example plus enterprise tenancy, audit, operability, governance, supplychain. Postgres via docker compose for tests.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
namespace molo::replication {
|
||||
|
||||
enum class VectorOrder {
|
||||
Equal,
|
||||
Before, // this <= other with at least one strict <
|
||||
After, // this >= other with at least one strict >
|
||||
Concurrent, // neither dominates: a real conflict happened
|
||||
};
|
||||
|
||||
// Version vector over per-instance oplog sequences, exchanged at sync so
|
||||
// each side fetches only what the other has not seen (S7-7).
|
||||
class VersionVector {
|
||||
public:
|
||||
void update(const std::string& instance, std::uint64_t seq);
|
||||
std::uint64_t get(const std::string& instance) const;
|
||||
void merge(const VersionVector& other);
|
||||
VectorOrder compare(const VersionVector& other) const;
|
||||
|
||||
std::string encode() const; // JSON object {instance: seq}
|
||||
static bool decode(const std::string& text, VersionVector& out);
|
||||
|
||||
private:
|
||||
mutable std::mutex mutex_;
|
||||
std::map<std::string, std::uint64_t> versions_;
|
||||
};
|
||||
|
||||
} // namespace molo::replication
|
||||
Reference in New Issue
Block a user