#include #ifdef COMPILE_TIME #include "9float.hpp" using scatter_key_t = ninefloat::Q; static const scatter_key_t scatter_key_increment = ninefloat::Q::min_increment(); #else using scatter_key_t = uint64_t; static const scatter_key_t scatter_key_increment = 1; #endif #include namespace StorageTree{ namespace _impl{ template struct subdivision { uint64_t weight; std::vector content; scatter_key_t begin; scatter_key_t end; static const bool divisible = true; }; struct daemon_impl{ uint64_t weight; scatter_key_t begin; scatter_key_t end; static const bool divisible = false; }; template constexpr T max(T any = 0) { if(any>any+scatter_key_increment) return any return max(any+scatter_key_increment); } } using daemon = _impl::daemon_impl; using server = _impl::subdivision; using subrack = _impl::subdivision; using rack = _impl::subdivision; using room = _impl::subdivision; using datacenter = _impl::subdivision; using root = _impl::subdivision; template> void update_weights(T& root, uint64_t sub_ratio=1, scatter_key_t begin=0, scatter_key_t end=_impl::max()) { scatter_key_t address_space = end-begin; scatter_key_t base = begin for(int idx=0:idx> void update_weights(T& root, scatter_key_t begin, scatter_key_t end) { this->begin = begin; this->end = end; } }