diff options
Diffstat (limited to 'include/framework/interface/Shard.h')
| -rw-r--r-- | include/framework/interface/Shard.h | 66 |
1 files changed, 49 insertions, 17 deletions
diff --git a/include/framework/interface/Shard.h b/include/framework/interface/Shard.h index c4a9180..bd980c0 100644 --- a/include/framework/interface/Shard.h +++ b/include/framework/interface/Shard.h @@ -1,7 +1,7 @@ /* * include/framework/interface/Shard.h * - * Copyright (C) 2023 Douglas B. Rumbaugh <drumbaugh@psu.edu> + * Copyright (C) 2023-2024 Douglas B. Rumbaugh <drumbaugh@psu.edu> * * Distributed under the Modified BSD License. * @@ -12,25 +12,57 @@ namespace de { -template <typename S, typename R> -concept ShardInterface = RecordInterface<R> && requires(S s, std::vector<S*> spp, void *p, bool b, size_t i, BufferView<R> bv, R r) { - {S(spp)}; - {S(std::move(bv))}; +template <typename SHARD> +concept ShardInterface = RecordInterface<typename SHARD::RECORD> && + requires(SHARD shard, const std::vector<SHARD *> &shard_vector, bool b, + BufferView<typename SHARD::RECORD> bv, + typename SHARD::RECORD rec) { + /* construct a shard from a vector of shards of the same type */ + {SHARD(shard_vector)}; - {s.point_lookup(r, b) } -> std::same_as<Wrapped<R>*>; - {s.get_data()} -> std::same_as<Wrapped<R>*>; + /* construct a shard from a buffer view (i.e., unsorted array of records) */ + {SHARD(std::move(bv))}; + + /* perform a lookup for a record matching rec and return a pointer to it */ + { + shard.point_lookup(rec, b) + } -> std::same_as<Wrapped<typename SHARD::RECORD> *>; + + /* + * return the number of records in the shard -- used to determine when + * reconstructions occur + */ + { shard.get_record_count() } -> std::convertible_to<size_t>; + + /* + * return the number of tombstones in the shard -- can simply return + * 0 if tombstones are not in use. + */ + { shard.get_tombstone_count() } -> std::convertible_to<size_t>; + + /* + * return the number of bytes of memory used by the main data structure + * within the shard -- informational use only at the moment + */ + { shard.get_memory_usage() } -> std::convertible_to<size_t>; + + /* + * return the number of bytes of memory used by auxilliary data + * structures (bloom filters, etc.) within the shard -- informational + * use only at the moment + */ + { shard.get_aux_memory_usage() } -> std::convertible_to<size_t>; - {s.get_record_count()} -> std::convertible_to<size_t>; - {s.get_tombstone_count()} -> std::convertible_to<size_t>; - {s.get_memory_usage()} -> std::convertible_to<size_t>; - {s.get_aux_memory_usage()} -> std::convertible_to<size_t>; }; -template <typename S, typename R> -concept SortedShardInterface = ShardInterface<S, R> && requires(S s, R r, R *rp, size_t i) { - {s.lower_bound(r)} -> std::convertible_to<size_t>; - {s.upper_bound(r)} -> std::convertible_to<size_t>; - {s.get_record_at(i)} -> std::same_as<Wrapped<R>*>; +template <typename SHARD> +concept SortedShardInterface = ShardInterface<SHARD> && + requires(SHARD shard, typename SHARD::RECORD rec, size_t index) { + { shard.lower_bound(rec) } -> std::convertible_to<size_t>; + { shard.upper_bound(rec) } -> std::convertible_to<size_t>; + { + shard.get_record_at(index) + } -> std::same_as<Wrapped<typename SHARD::RECORD> *>; }; -} +} // namespace de |