From 08d6c84b9d69b500c964a8ff66e726e1f01f2095 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Mon, 22 May 2023 13:25:20 -0400 Subject: Progress towards generalization of shard interface --- include/util/Record.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'include/util') diff --git a/include/util/Record.h b/include/util/Record.h index ce101f4..fc543ed 100644 --- a/include/util/Record.h +++ b/include/util/Record.h @@ -20,27 +20,15 @@ template concept RecordInterface = requires(R r, R s) { r.key; r.value; - r.header; - {r.is_tombstone()} -> std::convertible_to; - {r.is_deleted()} -> std::convertible_to; - r.set_delete(); - r.set_tombstone(std::declval); { r < s } ->std::convertible_to; { r == s } ->std::convertible_to; - { r.header < s.header } -> std::convertible_to; }; -template -concept WeightedRecordInterface = RecordInterface && requires(R r) { - {r.weight} -> std::convertible_to; -}; - -template -struct Record { - K key; - V value; - uint32_t header = 0; +template +struct WrappedRecord { + R rec; + uint32_t header; inline void set_delete() { header |= 2; @@ -61,8 +49,20 @@ struct Record { inline bool is_tombstone() const { return header & 1; } +}; + +template +concept WeightedRecordInterface = RecordInterface && requires(R r) { + {r.weight} -> std::convertible_to; +}; + +template +struct Record { + K key; + V value; + uint32_t header = 0; - inline bool operator<(const Record& other) const { + inline bool operator<(const Record& other) const { return key < other.key || (key == other.key && value < other.value); } -- cgit v1.2.3