diff --git a/include/ircd/m/dbs/dbs.h b/include/ircd/m/dbs/dbs.h index b9f55c2b8..4e21a8661 100644 --- a/include/ircd/m/dbs/dbs.h +++ b/include/ircd/m/dbs/dbs.h @@ -50,7 +50,7 @@ namespace ircd::m::dbs void blacklist(db::txn &, const event::id &, const write_opts &); } -#include "ref.h" +#include "event_refs.h" #include "appendix.h" #include "write_opts.h" #include "util.h" diff --git a/include/ircd/m/dbs/desc.h b/include/ircd/m/dbs/desc.h index d95330063..c5c7caea6 100644 --- a/include/ircd/m/dbs/desc.h +++ b/include/ircd/m/dbs/desc.h @@ -92,15 +92,6 @@ namespace ircd::m::dbs::desc extern conf::item events__event_json__bloom__bits; extern const db::descriptor events__event_json; - // events graphing - extern conf::item events__event_refs__block__size; - extern conf::item events__event_refs__meta_block__size; - extern conf::item events__event_refs__cache__size; - extern conf::item events__event_refs__cache_comp__size; - extern const db::prefix_transform events__event_refs__pfx; - extern const db::comparator events__event_refs__cmp; - extern const db::descriptor events__event_refs; - // event horizon extern conf::item events__event_horizon__block__size; extern conf::item events__event_horizon__meta_block__size; diff --git a/include/ircd/m/dbs/ref.h b/include/ircd/m/dbs/event_refs.h similarity index 59% rename from include/ircd/m/dbs/ref.h rename to include/ircd/m/dbs/event_refs.h index 496a78d4a..014827e5f 100644 --- a/include/ircd/m/dbs/ref.h +++ b/include/ircd/m/dbs/event_refs.h @@ -9,7 +9,51 @@ // full license for this software is available in the LICENSE file. #pragma once -#define HAVE_IRCD_M_DBS_REF_H +#define HAVE_IRCD_M_DBS_EVENT_REFS_H + +namespace ircd::m::dbs +{ + constexpr size_t EVENT_REFS_KEY_MAX_SIZE + { + sizeof(event::idx) + sizeof(event::idx) + }; + + constexpr size_t ref_shift + { + 8 * (sizeof(event::idx) - sizeof(ref)) + }; + + constexpr event::idx ref_mask + { + 0xFFUL << ref_shift + }; + + // event_idx | ref_type, event_idx + extern db::index event_refs; + + string_view + event_refs_key(const mutable_buffer &out, + const event::idx &tgt, + const ref &type, + const event::idx &referer); + + std::tuple + event_refs_key(const string_view &amalgam); + + string_view + reflect(const ref &); +} + +namespace ircd::m::dbs::desc +{ + extern conf::item events__event_refs__block__size; + extern conf::item events__event_refs__meta_block__size; + extern conf::item events__event_refs__cache__size; + extern conf::item events__event_refs__cache_comp__size; + extern const db::prefix_transform events__event_refs__pfx; + extern const db::comparator events__event_refs__cmp; + extern const db::descriptor events__event_refs; +} /// Types of references indexed by event_refs. This is a single byte integer, /// which should be plenty of namespace. Internally event_refs_key() and diff --git a/include/ircd/m/dbs/util.h b/include/ircd/m/dbs/util.h index c3cccf499..6920e15f0 100644 --- a/include/ircd/m/dbs/util.h +++ b/include/ircd/m/dbs/util.h @@ -13,13 +13,6 @@ namespace ircd::m::dbs { - constexpr size_t EVENT_REFS_KEY_MAX_SIZE {sizeof(event::idx) + sizeof(event::idx)}; - constexpr size_t ref_shift {8 * (sizeof(event::idx) - sizeof(ref))}; - constexpr event::idx ref_mask {0xFFUL << ref_shift}; - string_view event_refs_key(const mutable_buffer &out, const event::idx &tgt, const ref &type, const event::idx &referer); - std::tuple event_refs_key(const string_view &amalgam); - string_view reflect(const ref &); - constexpr size_t EVENT_HORIZON_KEY_MAX_SIZE {id::MAX_SIZE + 1 + 8}; string_view event_horizon_key(const mutable_buffer &out, const id::event &, const event::idx &); string_view event_horizon_key(const mutable_buffer &out, const id::event &);