summaryrefslogtreecommitdiffstats
path: root/include/framework/structure/InternalLevel.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/framework/structure/InternalLevel.h')
-rw-r--r--include/framework/structure/InternalLevel.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/framework/structure/InternalLevel.h b/include/framework/structure/InternalLevel.h
index c9d1749..5bc891b 100644
--- a/include/framework/structure/InternalLevel.h
+++ b/include/framework/structure/InternalLevel.h
@@ -166,6 +166,17 @@ public:
return (double)tscnt / (double)(tscnt + reccnt);
}
+ size_t get_nonempty_shard_count() const {
+ size_t cnt = 0;
+ for (size_t i = 0; i < m_shards.size(); i++) {
+ if (m_shards[i] && m_shards[i]->get_record_count() > 0) {
+ cnt += 1;
+ }
+ }
+
+ return cnt;
+ }
+
std::shared_ptr<InternalLevel> clone() const {
auto new_level = std::make_shared<InternalLevel>(m_level_no);
for (size_t i = 0; i < m_shards.size(); i++) {
@@ -185,6 +196,14 @@ public:
m_shards.emplace_back(shard);
}
+ const ShardType *get_shard(ShardID shid) const {
+ if (shid < m_shards.size()) {
+ return m_shards[shid].get();
+ }
+
+ return nullptr;
+ }
+
private:
ssize_t m_level_no;
std::vector<std::shared_ptr<ShardType>> m_shards;