22 enum ValueType : uint8_t {
27 using Key = std::string;
28 using Value = std::variant<int, float, bool, std::string>;
29 using ValueAndTimestamp = std::tuple<Value, uint64_t>;
30 using ValueTimestampAndType = std::tuple<Value, uint64_t, ValueType>;
31 using ValueAndType = std::tuple<Value, ValueType>;
33 using Attributes = std::vector<std::tuple<NodeData::Key, NodeData::Value>>;
34 using NodesWithAttributes = std::unordered_map<NodeInfo, Attributes, NodeInfoHasher>;
36 using AttributesAndTypes =
37 std::vector<std::tuple<NodeData::Key, NodeData::Value, NodeData::ValueType>>;
38 using NodesWithAttributesAndTypes =
39 std::unordered_map<NodeInfo, AttributesAndTypes, NodeInfoHasher>;
43 virtual bool insert(Key key, ValueTimestampAndType value_timestamp_and_type);
44 virtual bool update(Key key, ValueTimestampAndType value_timestamp_and_type);
45 virtual void remove(Key key);
47 bool hasKey(
const Key &key);
48 Value getValue(Key key);
49 ValueAndTimestamp getValueAndTimestamp(Key key);
50 ValueTimestampAndType getValueTimestampAndType(Key key);
52 std::unordered_map<Key, ValueTimestampAndType> getData()
const;
54 virtual bool isValueUpToDate(
const NodeData::Key &key, uint64_t validity_threshold_timestamp);
56 virtual bool isLocal()
const = 0;
58 std::vector<Key> getAllCurrentKeys();
63 std::unordered_map<Key, ValueTimestampAndType> data_;