summaryrefslogtreecommitdiffstats
path: root/include/framework/interface/Shard.h
blob: 8c4db34d51d0d0309f6ca105a03861a41ca7a166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * include/framework/interface/Shard.h
 *
 * Copyright (C) 2023 Douglas B. Rumbaugh <drumbaugh@psu.edu> 
 *
 * Distributed under the Modified BSD License.
 *
 */
#pragma once

#include <concepts>

#include "util/types.h"
#include "framework/interface/Record.h"
#include <vector>

namespace de {

// FIXME: The interface is not completely specified yet, as it is pending
//        determining a good way to handle additional template arguments 
//        to get the Record type into play
template <typename S>
concept ShardInterface = requires(S s, std::vector<S*> spp, void *p, bool b, size_t i) {
    {S(spp)};
    /*
    {S(mutable buffer)}
    {s.point_lookup(r, b) } -> std::convertible_to<void*>
    */
    {s.get_data()} -> std::convertible_to<void*>;

    {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> && requires(S s, R r, R *rp) {
    {s.lower_bound(r)} -> std::convertible_to<size_t>;
    {s.upper_bound(r)} -> std::convertible_to<size_t>;
};

}