mirror of
https://github.com/matrix-construct/construct
synced 2024-11-18 16:00:57 +01:00
ircd:Ⓜ️:dbs: Split event_refs related into file.
This commit is contained in:
parent
62f1b5a539
commit
f044b447e2
4 changed files with 46 additions and 18 deletions
|
@ -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"
|
||||
|
|
|
@ -92,15 +92,6 @@ namespace ircd::m::dbs::desc
|
|||
extern conf::item<size_t> events__event_json__bloom__bits;
|
||||
extern const db::descriptor events__event_json;
|
||||
|
||||
// events graphing
|
||||
extern conf::item<size_t> events__event_refs__block__size;
|
||||
extern conf::item<size_t> events__event_refs__meta_block__size;
|
||||
extern conf::item<size_t> events__event_refs__cache__size;
|
||||
extern conf::item<size_t> 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<size_t> events__event_horizon__block__size;
|
||||
extern conf::item<size_t> events__event_horizon__meta_block__size;
|
||||
|
|
|
@ -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<ref, event::idx>
|
||||
event_refs_key(const string_view &amalgam);
|
||||
|
||||
string_view
|
||||
reflect(const ref &);
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern conf::item<size_t> events__event_refs__block__size;
|
||||
extern conf::item<size_t> events__event_refs__meta_block__size;
|
||||
extern conf::item<size_t> events__event_refs__cache__size;
|
||||
extern conf::item<size_t> 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
|
|
@ -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<ref, event::idx> 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 &);
|
||||
|
|
Loading…
Reference in a new issue