From 6c906c94e1eea6d4356b8c99b93da39029e8d95d Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Fri, 17 Jan 2025 17:28:50 -0500 Subject: Progress --- include/framework/reconstruction/BSMPolicy.h | 12 +++++------ .../reconstruction/FixedShardCountPolicy.h | 25 +++++++++++++--------- include/framework/reconstruction/FloodL0Policy.h | 11 +++++----- include/framework/reconstruction/LevelingPolicy.h | 14 ++++++------ .../reconstruction/ReconstructionPolicy.h | 4 ++-- include/framework/reconstruction/TieringPolicy.h | 15 +++++++------ 6 files changed, 46 insertions(+), 35 deletions(-) (limited to 'include/framework/reconstruction') diff --git a/include/framework/reconstruction/BSMPolicy.h b/include/framework/reconstruction/BSMPolicy.h index ab8c6e4..c42b928 100644 --- a/include/framework/reconstruction/BSMPolicy.h +++ b/include/framework/reconstruction/BSMPolicy.h @@ -25,10 +25,10 @@ public: : m_scale_factor(2), m_buffer_size(buffer_size) {} ReconstructionVector - get_reconstruction_tasks(const Epoch *epoch, + get_reconstruction_tasks(const Version *version, size_t incoming_reccnt) const override { ReconstructionVector reconstructions; - auto levels = epoch->get_structure()->get_level_vector(); + auto levels = version->get_structure()->get_level_vector(); level_index target_level = find_reconstruction_target(levels); assert(target_level != -1); @@ -53,10 +53,10 @@ public: return reconstructions; } - ReconstructionTask - get_flush_task(const Epoch *epoch) const override { - return ReconstructionTask{ - {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Merge}; + ReconstructionVector + get_flush_tasks(const Version *version) const override { + ReconstructionVector v; + v.add_reconstruction(ReconstructionTask {{buffer_shid}, 0, m_buffer_size, ReconstructionType::Merge}); } private: diff --git a/include/framework/reconstruction/FixedShardCountPolicy.h b/include/framework/reconstruction/FixedShardCountPolicy.h index ec8e4e6..2a3c977 100644 --- a/include/framework/reconstruction/FixedShardCountPolicy.h +++ b/include/framework/reconstruction/FixedShardCountPolicy.h @@ -25,31 +25,36 @@ public: : m_buffer_size(buffer_size), m_shard_count(shard_count), m_max_reccnt(max_record_count) {} ReconstructionVector - get_reconstruction_tasks(const Epoch *epoch, + get_reconstruction_tasks(const Version *version, size_t incoming_reccnt) const override { ReconstructionVector reconstructions; return reconstructions; } - ReconstructionTask - get_flush_task(const Epoch *epoch) const override { + ReconstructionVector + get_flush_tasks(const Version *version) const override { + + auto levels = version->get_structure()->get_level_vector(); - auto levels = epoch->get_structure()->get_level_vector(); + ReconstructionVector v; if (levels.size() == 0) { - return ReconstructionTask{ - {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Append}; + v.add_reconstruction(ReconstructionTask{ + {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Append}); + return v; } ShardID last_shid = {0, (shard_index) (levels[0]->get_shard_count() - 1)}; if (levels[0]->get_shard(last_shid.shard_idx)->get_record_count() + m_buffer_size <= capacity()) { - return ReconstructionTask{ - {{buffer_shid, last_shid}}, 0, m_buffer_size, ReconstructionType::Merge}; + v.add_reconstruction(ReconstructionTask{ + {{buffer_shid, last_shid}}, 0, m_buffer_size, ReconstructionType::Merge}); + return v; } else { - return ReconstructionTask{ - {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Append}; + v.add_reconstruction(ReconstructionTask{ + {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Append}); + return v; } } diff --git a/include/framework/reconstruction/FloodL0Policy.h b/include/framework/reconstruction/FloodL0Policy.h index da4c297..8304d8a 100644 --- a/include/framework/reconstruction/FloodL0Policy.h +++ b/include/framework/reconstruction/FloodL0Policy.h @@ -24,7 +24,7 @@ public: FloodL0Policy(size_t buffer_size) : m_buffer_size(buffer_size) {} ReconstructionVector - get_reconstruction_tasks(const Epoch *epoch, + get_reconstruction_tasks(const Version *version, size_t incoming_reccnt) const override { ReconstructionVector reconstructions; @@ -32,10 +32,11 @@ public: } - ReconstructionTask - get_flush_task(const Epoch *epoch) const override { - return ReconstructionTask{ - {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Append}; + ReconstructionVector + get_flush_tasks(const Version *version) const override { + ReconstructionVector v; + v.add_reconstruction(ReconstructionTask{ + {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Append}); } private: diff --git a/include/framework/reconstruction/LevelingPolicy.h b/include/framework/reconstruction/LevelingPolicy.h index add28ba..176492e 100644 --- a/include/framework/reconstruction/LevelingPolicy.h +++ b/include/framework/reconstruction/LevelingPolicy.h @@ -25,10 +25,10 @@ public: : m_scale_factor(scale_factor), m_buffer_size(buffer_size) {} ReconstructionVector - get_reconstruction_tasks(const Epoch *epoch, + get_reconstruction_tasks(const Version *version, size_t incoming_reccnt) const override { ReconstructionVector reconstructions; - auto levels = epoch->get_structure()->get_level_vector(); + auto levels = version->get_structure()->get_level_vector(); level_index target_level = find_reconstruction_target(levels); assert(target_level != -1); @@ -51,10 +51,12 @@ public: return reconstructions; } - ReconstructionTask - get_flush_task(const Epoch *epoch) const override { - return ReconstructionTask{ - {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Merge}; + ReconstructionVector + get_flush_tasks(const Version *version) const override { + ReconstructionVector v; + v.add_reconstruction(ReconstructionTask{ + {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Merge}); + return v; } private: diff --git a/include/framework/reconstruction/ReconstructionPolicy.h b/include/framework/reconstruction/ReconstructionPolicy.h index aa213df..2c737de 100644 --- a/include/framework/reconstruction/ReconstructionPolicy.h +++ b/include/framework/reconstruction/ReconstructionPolicy.h @@ -23,8 +23,8 @@ class ReconstructionPolicy { public: ReconstructionPolicy() {} - virtual ReconstructionVector get_reconstruction_tasks(const Epoch *epoch, + virtual ReconstructionVector get_reconstruction_tasks(const Version *version, size_t incoming_reccnt) const = 0; - virtual ReconstructionTask get_flush_task(const Epoch *epoch) const = 0; + virtual ReconstructionVector get_flush_tasks(const Version *version) const = 0; }; } diff --git a/include/framework/reconstruction/TieringPolicy.h b/include/framework/reconstruction/TieringPolicy.h index 1443309..63be5fe 100644 --- a/include/framework/reconstruction/TieringPolicy.h +++ b/include/framework/reconstruction/TieringPolicy.h @@ -23,10 +23,10 @@ public: : m_scale_factor(scale_factor), m_buffer_size(buffer_size) {} ReconstructionVector - get_reconstruction_tasks(const Epoch *epoch, + get_reconstruction_tasks(const Version *version, size_t incoming_reccnt) const override { ReconstructionVector reconstructions; - auto levels = epoch->get_structure()->get_level_vector(); + auto levels = version->get_structure()->get_level_vector(); level_index target_level = find_reconstruction_target(levels); assert(target_level != -1); @@ -49,10 +49,13 @@ public: return reconstructions; } - ReconstructionTask - get_flush_task(const Epoch *epoch) const override { - return ReconstructionTask{ - {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Append}; + ReconstructionVector + get_flush_tasks(const Version *version) const override { + ReconstructionVector v; + + v.add_reconstruction(ReconstructionTask{ + {{buffer_shid}}, 0, m_buffer_size, ReconstructionType::Append}); + return v; } private: -- cgit v1.2.3