mirror of
https://github.com/matrix-construct/construct
synced 2024-11-24 15:52:34 +01:00
ircd:Ⓜ️:dbs: Rename write_opts to opts and split into header.
This commit is contained in:
parent
ccfc05709f
commit
8d634fb901
43 changed files with 269 additions and 256 deletions
|
@ -15,7 +15,7 @@
|
|||
namespace ircd::m::dbs
|
||||
{
|
||||
struct init;
|
||||
struct write_opts;
|
||||
struct opts;
|
||||
enum class ref :uint8_t;
|
||||
|
||||
// General confs
|
||||
|
@ -29,8 +29,8 @@ namespace ircd::m::dbs
|
|||
extern std::shared_ptr<db::database> events;
|
||||
|
||||
// [SET (txn)] Basic write suite
|
||||
size_t prefetch(const event &, const write_opts &);
|
||||
size_t write(db::txn &, const event &, const write_opts &);
|
||||
size_t prefetch(const event &, const opts &);
|
||||
size_t write(db::txn &, const event &, const opts &);
|
||||
}
|
||||
|
||||
/// Database description
|
||||
|
@ -60,153 +60,21 @@ namespace ircd::m::dbs::appendix
|
|||
#include "room_joined.h" // room_id | origin, member => event_idx
|
||||
#include "room_head.h" // room_id | event_id => event_idx
|
||||
#include "init.h"
|
||||
#include "opts.h"
|
||||
|
||||
/// Options that affect the dbs::write() of an event to the transaction.
|
||||
struct ircd::m::dbs::write_opts
|
||||
{
|
||||
static const std::bitset<256> event_refs_all;
|
||||
static const std::bitset<64> appendix_all;
|
||||
|
||||
/// Operation code; usually SET or DELETE. Note that we interpret the
|
||||
/// code internally and may set different codes for appendages of the
|
||||
/// actual transaction.
|
||||
db::op op {db::op::SET};
|
||||
|
||||
/// Lower-level write options passed to the transaction's execution.
|
||||
db::sopts sopts;
|
||||
|
||||
/// Principal's index number. Most codepaths do not permit zero. This may
|
||||
/// be zero for blacklisting, but the blacklist option must be set.
|
||||
uint64_t event_idx {0};
|
||||
|
||||
/// Fuse panel to toggle transaction elements.
|
||||
std::bitset<64> appendix {appendix_all};
|
||||
|
||||
/// Selection of what reference types to manipulate in event_refs. Refs
|
||||
/// will not be made if it is not appropriate for the event anyway, so
|
||||
/// this defaults to all bits. User can disable one or more ref types
|
||||
/// by clearing a bit.
|
||||
std::bitset<256> event_refs {event_refs_all};
|
||||
|
||||
/// Selection of what reference types to resolve and delete from the
|
||||
/// event_horizon for this event.
|
||||
std::bitset<256> horizon_resolve {event_refs_all};
|
||||
|
||||
/// Whether the event.source can be used directly for event_json. Defaults
|
||||
/// to false unless the caller wants to avoid a redundant re-stringify.
|
||||
bool json_source {false};
|
||||
|
||||
/// Data in this db::txn is used as a primary source in some cases where
|
||||
/// indexers make a database query. This is useful when the sought data
|
||||
/// has not even been written to the database, and this may even point to
|
||||
/// the same db::txn as the result being composed in the first place. By
|
||||
/// default a database query is made as a fallback after using this.
|
||||
const db::txn *interpose {nullptr};
|
||||
|
||||
/// Whether indexers are allowed to make database queries when composing
|
||||
/// the transaction. note: database queries may yield the ircd::ctx and
|
||||
/// made indepdently; this is slow and requires external synchronization
|
||||
/// to not introduce inconsistent data into the txn.
|
||||
bool allow_queries {true};
|
||||
|
||||
/// Setting to true allows the event_idx to be 0 which allows the insertion
|
||||
/// of the event_id into a "blacklist" to mark it as unprocessable; this
|
||||
/// prevents the server from repeatedly trying to process an event.
|
||||
///
|
||||
/// Note for now this just creates an entry in _event_idx of 0 for the
|
||||
/// event_id which also means "not found" for most codepaths, a reasonable
|
||||
/// default. But for codepaths that must distinguish between "not found"
|
||||
/// and "blacklist" they must know that `event_id => 0` was *found* to be
|
||||
/// zero.
|
||||
bool blacklist {false};
|
||||
};
|
||||
|
||||
/// Values which represent some element(s) included in a transaction or
|
||||
/// codepaths taken to construct a transaction. This enum is generally used
|
||||
/// in a bitset in dbs::write_opts to control the behavior of dbs::write().
|
||||
///
|
||||
enum ircd::m::dbs::appendix::index
|
||||
:std::underlying_type<ircd::m::dbs::appendix::index>::type
|
||||
{
|
||||
/// Involves the event_idx column; translates an event_id to our internal
|
||||
/// index number. This bit can be dark during re-indexing operations.
|
||||
EVENT_ID,
|
||||
|
||||
/// Involves the event_json column; writes a full JSON serialization
|
||||
/// of the event. See the `json_source` write_opts option. This bit can be
|
||||
/// dark during re-indexing operations to avoid rewriting the same data.
|
||||
EVENT_JSON,
|
||||
|
||||
/// Involves any direct event columns; such columns are forward-indexed
|
||||
/// values from the original event data but split into columns for each
|
||||
/// property. Can be dark during re-indexing similar to EVENT_JSON.
|
||||
EVENT_COLS,
|
||||
|
||||
/// Take branch to handle event reference graphing. A separate bitset is
|
||||
/// offered in write_opts for fine-grained control over which reference
|
||||
/// types are involved.
|
||||
EVENT_REFS,
|
||||
|
||||
/// Involves the event_horizon column which saves the event_id of any
|
||||
/// unresolved event_refs at the time of the transaction. This is important
|
||||
/// for out-of-order writes to the database. When the unresolved prev_event
|
||||
/// is encountered later and finds its event_id in event_horizon it can
|
||||
/// properly complete the event_refs graph to all the referencing events.
|
||||
EVENT_HORIZON,
|
||||
|
||||
/// Resolves unresolved references for this event left in event_horizon.
|
||||
EVENT_HORIZON_RESOLVE,
|
||||
|
||||
/// Involves the event_sender column (reverse index on the event sender).
|
||||
EVENT_SENDER,
|
||||
|
||||
/// Involves the event_type column (reverse index on the event type).
|
||||
EVENT_TYPE,
|
||||
|
||||
/// Involves the event_state column.
|
||||
EVENT_STATE,
|
||||
|
||||
/// Involves room_events table.
|
||||
ROOM_EVENTS,
|
||||
|
||||
/// Involves room_type table.
|
||||
ROOM_TYPE,
|
||||
|
||||
/// Whether the event should be added to the room_head, indicating that
|
||||
/// it has not yet been referenced at the time of this write. Defaults
|
||||
/// to true, but if this is an older event this opt should be rethought.
|
||||
ROOM_HEAD,
|
||||
|
||||
/// Whether the event removes the prev_events it references from the
|
||||
/// room_head. This defaults to true and should almost always be true.
|
||||
ROOM_HEAD_RESOLVE,
|
||||
|
||||
/// Involves room_state (present state) table.
|
||||
ROOM_STATE,
|
||||
|
||||
/// Involves room_space (all states) table.
|
||||
ROOM_STATE_SPACE,
|
||||
|
||||
/// Involves room_joined table.
|
||||
ROOM_JOINED,
|
||||
|
||||
/// Take branch to handle room redaction events.
|
||||
ROOM_REDACT,
|
||||
};
|
||||
|
||||
// Internal utils (here for now)
|
||||
// Some internal utils (here for now)
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
size_t prefetch_event_idx(const vector_view<const event::id> &in, const write_opts &);
|
||||
bool prefetch_event_idx(const event::id &, const write_opts &);
|
||||
size_t prefetch_event_idx(const vector_view<const event::id> &in, const opts &);
|
||||
bool prefetch_event_idx(const event::id &, const opts &);
|
||||
|
||||
size_t find_event_idx(const vector_view<event::idx> &out, const vector_view<const event::id> &in, const write_opts &);
|
||||
event::idx find_event_idx(const event::id &, const write_opts &);
|
||||
size_t find_event_idx(const vector_view<event::idx> &out, const vector_view<const event::id> &in, const opts &);
|
||||
event::idx find_event_idx(const event::id &, const opts &);
|
||||
}
|
||||
|
||||
inline ircd::m::event::idx
|
||||
ircd::m::dbs::find_event_idx(const event::id &event_id,
|
||||
const write_opts &wopts)
|
||||
const opts &wopts)
|
||||
{
|
||||
event::idx ret{0};
|
||||
const vector_view<event::idx> out(&ret, 1);
|
||||
|
@ -217,7 +85,7 @@ ircd::m::dbs::find_event_idx(const event::id &event_id,
|
|||
|
||||
inline bool
|
||||
ircd::m::dbs::prefetch_event_idx(const event::id &event_id,
|
||||
const write_opts &wopts)
|
||||
const opts &wopts)
|
||||
{
|
||||
const vector_view<const event::id> in(&event_id, 1);
|
||||
return prefetch_event_idx(in, wopts);
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace ircd::m::dbs
|
|||
event::size()
|
||||
};
|
||||
|
||||
void _index_event_cols(db::txn &, const event &, const write_opts &);
|
||||
void _index_event_cols(db::txn &, const event &, const opts &);
|
||||
|
||||
// There is one position in this array corresponding to each property
|
||||
// in the m::event tuple, however, the db::column in this position may
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace ircd::m::dbs
|
|||
string_view event_horizon_key(const mutable_buffer &out, const id::event &);
|
||||
std::tuple<event::idx> event_horizon_key(const string_view &amalgam);
|
||||
|
||||
size_t _prefetch_event_horizon_resolve(const event &, const write_opts &);
|
||||
void _index_event_horizon_resolve(db::txn &, const event &, const write_opts &); //query
|
||||
void _index_event_horizon(db::txn &, const event &, const write_opts &, const id::event &);
|
||||
size_t _prefetch_event_horizon_resolve(const event &, const opts &);
|
||||
void _index_event_horizon_resolve(db::txn &, const event &, const opts &); //query
|
||||
void _index_event_horizon(db::txn &, const event &, const opts &, const id::event &);
|
||||
|
||||
// event_id | event_idx
|
||||
extern db::domain event_horizon;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
void _index_event_id(db::txn &, const event &, const write_opts &);
|
||||
void _index_event_id(db::txn &, const event &, const opts &);
|
||||
|
||||
extern db::column event_idx; // event_id => event_idx
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
void _index_event_json(db::txn &, const event &, const write_opts &);
|
||||
void _index_event_json(db::txn &, const event &, const opts &);
|
||||
|
||||
// event_idx => full json
|
||||
extern db::column event_json;
|
||||
|
|
|
@ -40,8 +40,8 @@ namespace ircd::m::dbs
|
|||
string_view
|
||||
reflect(const ref &);
|
||||
|
||||
size_t _prefetch_event_refs(const event &, const write_opts &);
|
||||
void _index_event_refs(db::txn &, const event &, const write_opts &);
|
||||
size_t _prefetch_event_refs(const event &, const opts &);
|
||||
void _index_event_refs(db::txn &, const event &, const opts &);
|
||||
|
||||
// event_idx | ref_type, event_idx
|
||||
extern db::domain event_refs;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace ircd::m::dbs
|
|||
string_view event_sender_origin_key(const mutable_buffer &out, const id::user &, const event::idx &);
|
||||
std::tuple<string_view, event::idx> event_sender_origin_key(const string_view &amalgam);
|
||||
|
||||
void _index_event_sender(db::txn &, const event &, const write_opts &);
|
||||
void _index_event_sender(db::txn &, const event &, const opts &);
|
||||
|
||||
// mxid | event_idx
|
||||
// host | local, event_idx (see event_sender_origin.h)
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace ircd::m::dbs
|
|||
string_view event_state_key(const mutable_buffer &out, const event_state_tuple &);
|
||||
event_state_tuple event_state_key(const string_view &);
|
||||
|
||||
void _index_event_state(db::txn &, const event &, const write_opts &);
|
||||
void _index_event_state(db::txn &, const event &, const opts &);
|
||||
|
||||
// state_key, type, room_id, depth, event_idx
|
||||
extern db::domain event_state;
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace ircd::m::dbs
|
|||
string_view event_type_key(const mutable_buffer &out, const string_view &, const event::idx & = 0);
|
||||
std::tuple<event::idx> event_type_key(const string_view &amalgam);
|
||||
|
||||
void _index_event_type(db::txn &, const event &, const write_opts &);
|
||||
void _index_event_type(db::txn &, const event &, const opts &);
|
||||
|
||||
// type | event_idx => -
|
||||
extern db::domain event_type;
|
||||
|
|
145
include/ircd/m/dbs/opts.h
Normal file
145
include/ircd/m/dbs/opts.h
Normal file
|
@ -0,0 +1,145 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2023 Jason Volk <jason@zemos.net>
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice is present in all copies. The
|
||||
// full license for this software is available in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_M_DBS_OPTS_H
|
||||
|
||||
/// Options that affect the dbs::write() of an event to the transaction.
|
||||
struct ircd::m::dbs::opts
|
||||
{
|
||||
static const std::bitset<256> event_refs_all;
|
||||
static const std::bitset<64> appendix_all;
|
||||
|
||||
/// Operation code; usually SET or DELETE. Note that we interpret the
|
||||
/// code internally and may set different codes for appendages of the
|
||||
/// actual transaction.
|
||||
db::op op {db::op::SET};
|
||||
|
||||
/// Lower-level write options passed to the transaction's execution.
|
||||
db::sopts sopts;
|
||||
|
||||
/// Principal's index number. Most codepaths do not permit zero. This may
|
||||
/// be zero for blacklisting, but the blacklist option must be set.
|
||||
uint64_t event_idx {0};
|
||||
|
||||
/// Fuse panel to toggle transaction elements.
|
||||
std::bitset<64> appendix {appendix_all};
|
||||
|
||||
/// Selection of what reference types to manipulate in event_refs. Refs
|
||||
/// will not be made if it is not appropriate for the event anyway, so
|
||||
/// this defaults to all bits. User can disable one or more ref types
|
||||
/// by clearing a bit.
|
||||
std::bitset<256> event_refs {event_refs_all};
|
||||
|
||||
/// Selection of what reference types to resolve and delete from the
|
||||
/// event_horizon for this event.
|
||||
std::bitset<256> horizon_resolve {event_refs_all};
|
||||
|
||||
/// Whether the event.source can be used directly for event_json. Defaults
|
||||
/// to false unless the caller wants to avoid a redundant re-stringify.
|
||||
bool json_source {false};
|
||||
|
||||
/// Data in this db::txn is used as a primary source in some cases where
|
||||
/// indexers make a database query. This is useful when the sought data
|
||||
/// has not even been written to the database, and this may even point to
|
||||
/// the same db::txn as the result being composed in the first place. By
|
||||
/// default a database query is made as a fallback after using this.
|
||||
const db::txn *interpose {nullptr};
|
||||
|
||||
/// Whether indexers are allowed to make database queries when composing
|
||||
/// the transaction. note: database queries may yield the ircd::ctx and
|
||||
/// made indepdently; this is slow and requires external synchronization
|
||||
/// to not introduce inconsistent data into the txn.
|
||||
bool allow_queries {true};
|
||||
|
||||
/// Setting to true allows the event_idx to be 0 which allows the insertion
|
||||
/// of the event_id into a "blacklist" to mark it as unprocessable; this
|
||||
/// prevents the server from repeatedly trying to process an event.
|
||||
///
|
||||
/// Note for now this just creates an entry in _event_idx of 0 for the
|
||||
/// event_id which also means "not found" for most codepaths, a reasonable
|
||||
/// default. But for codepaths that must distinguish between "not found"
|
||||
/// and "blacklist" they must know that `event_id => 0` was *found* to be
|
||||
/// zero.
|
||||
bool blacklist {false};
|
||||
};
|
||||
|
||||
/// Values which represent some element(s) included in a transaction or
|
||||
/// codepaths taken to construct a transaction. This enum is generally used
|
||||
/// in a bitset in dbs::opts to control the behavior of dbs::write().
|
||||
///
|
||||
enum ircd::m::dbs::appendix::index
|
||||
:std::underlying_type<ircd::m::dbs::appendix::index>::type
|
||||
{
|
||||
/// Involves the event_idx column; translates an event_id to our internal
|
||||
/// index number. This bit can be dark during re-indexing operations.
|
||||
EVENT_ID,
|
||||
|
||||
/// Involves the event_json column; writes a full JSON serialization
|
||||
/// of the event. See the `json_source` opts option. This bit can be
|
||||
/// dark during re-indexing operations to avoid rewriting the same data.
|
||||
EVENT_JSON,
|
||||
|
||||
/// Involves any direct event columns; such columns are forward-indexed
|
||||
/// values from the original event data but split into columns for each
|
||||
/// property. Can be dark during re-indexing similar to EVENT_JSON.
|
||||
EVENT_COLS,
|
||||
|
||||
/// Take branch to handle event reference graphing. A separate bitset is
|
||||
/// offered in opts for fine-grained control over which reference
|
||||
/// types are involved.
|
||||
EVENT_REFS,
|
||||
|
||||
/// Involves the event_horizon column which saves the event_id of any
|
||||
/// unresolved event_refs at the time of the transaction. This is important
|
||||
/// for out-of-order writes to the database. When the unresolved prev_event
|
||||
/// is encountered later and finds its event_id in event_horizon it can
|
||||
/// properly complete the event_refs graph to all the referencing events.
|
||||
EVENT_HORIZON,
|
||||
|
||||
/// Resolves unresolved references for this event left in event_horizon.
|
||||
EVENT_HORIZON_RESOLVE,
|
||||
|
||||
/// Involves the event_sender column (reverse index on the event sender).
|
||||
EVENT_SENDER,
|
||||
|
||||
/// Involves the event_type column (reverse index on the event type).
|
||||
EVENT_TYPE,
|
||||
|
||||
/// Involves the event_state column.
|
||||
EVENT_STATE,
|
||||
|
||||
/// Involves room_events table.
|
||||
ROOM_EVENTS,
|
||||
|
||||
/// Involves room_type table.
|
||||
ROOM_TYPE,
|
||||
|
||||
/// Whether the event should be added to the room_head, indicating that
|
||||
/// it has not yet been referenced at the time of this write. Defaults
|
||||
/// to true, but if this is an older event this opt should be rethought.
|
||||
ROOM_HEAD,
|
||||
|
||||
/// Whether the event removes the prev_events it references from the
|
||||
/// room_head. This defaults to true and should almost always be true.
|
||||
ROOM_HEAD_RESOLVE,
|
||||
|
||||
/// Involves room_state (present state) table.
|
||||
ROOM_STATE,
|
||||
|
||||
/// Involves room_space (all states) table.
|
||||
ROOM_STATE_SPACE,
|
||||
|
||||
/// Involves room_joined table.
|
||||
ROOM_JOINED,
|
||||
|
||||
/// Take branch to handle room redaction events.
|
||||
ROOM_REDACT,
|
||||
};
|
|
@ -22,7 +22,7 @@ namespace ircd::m::dbs
|
|||
string_view room_events_key(const mutable_buffer &out, const id::room &, const uint64_t &depth);
|
||||
std::tuple<uint64_t, event::idx> room_events_key(const string_view &amalgam);
|
||||
|
||||
void _index_room_events(db::txn &, const event &, const write_opts &);
|
||||
void _index_room_events(db::txn &, const event &, const opts &);
|
||||
|
||||
// room_id | depth, event_idx => node_id
|
||||
extern db::domain room_events;
|
||||
|
|
|
@ -21,8 +21,8 @@ namespace ircd::m::dbs
|
|||
string_view room_head_key(const mutable_buffer &out, const id::room &, const id::event &);
|
||||
string_view room_head_key(const string_view &amalgam);
|
||||
|
||||
void _index_room_head_resolve(db::txn &, const event &, const write_opts &);
|
||||
void _index_room_head(db::txn &, const event &, const write_opts &);
|
||||
void _index_room_head_resolve(db::txn &, const event &, const opts &);
|
||||
void _index_room_head(db::txn &, const event &, const opts &);
|
||||
|
||||
// room_id | event_id => event_idx
|
||||
extern db::domain room_head;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace ircd::m::dbs
|
|||
string_view room_joined_key(const mutable_buffer &out, const id::room &, const string_view &origin);
|
||||
std::tuple<string_view, string_view> room_joined_key(const string_view &amalgam);
|
||||
|
||||
void _index_room_joined(db::txn &, const event &, const write_opts &);
|
||||
void _index_room_joined(db::txn &, const event &, const opts &);
|
||||
|
||||
// room_id | origin, member => event_idx
|
||||
extern db::domain room_joined;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace ircd::m::dbs
|
|||
string_view room_state_key(const mutable_buffer &out, const id::room &, const string_view &type);
|
||||
std::tuple<string_view, string_view> room_state_key(const string_view &amalgam);
|
||||
|
||||
void _index_room_state(db::txn &, const event &, const write_opts &);
|
||||
void _index_room_state(db::txn &, const event &, const opts &);
|
||||
|
||||
// room_id | type, state_key => event_idx
|
||||
extern db::domain room_state;
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace ircd::m::dbs
|
|||
string_view room_state_space_key(const mutable_buffer &out, const id::room &);
|
||||
room_state_space_key_parts room_state_space_key(const string_view &amalgam);
|
||||
|
||||
void _index_room_state_space(db::txn &, const event &, const write_opts &);
|
||||
void _index_room_state_space(db::txn &, const event &, const opts &);
|
||||
|
||||
// room_id | type, state_key, depth, event_idx => --
|
||||
extern db::domain room_state_space;
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace ircd::m::dbs
|
|||
const uint64_t &depth = -1,
|
||||
const event::idx & = -1);
|
||||
|
||||
void _index_room_type(db::txn &, const event &, const write_opts &);
|
||||
void _index_room_type(db::txn &, const event &, const opts &);
|
||||
|
||||
// room_id | type, depth, event_idx
|
||||
extern db::domain room_type;
|
||||
|
|
|
@ -35,8 +35,8 @@ struct ircd::m::vm::opts
|
|||
/// Enabled phases of evaluation.
|
||||
std::bitset<num_of<vm::phase>()> phase {-1UL};
|
||||
|
||||
/// Custom write_opts to use during write.
|
||||
dbs::write_opts wopts;
|
||||
/// Custom dbs::opts to use during write.
|
||||
dbs::opts wopts;
|
||||
|
||||
/// Broadcast to local clients (/sync stream).
|
||||
bool notify_clients {true};
|
||||
|
|
|
@ -34,7 +34,7 @@ ircd::m::dbs::cache_comp_enable
|
|||
|
||||
/// Coarse toggle for the prefetch phase before the transaction building
|
||||
/// handlers (indexers) are called. If this is false, prefetching will be
|
||||
/// disabled; otherwise the write_opts passed to write() control whether
|
||||
/// disabled; otherwise the opts passed to write() control whether
|
||||
/// prefetching is enabled.
|
||||
decltype(ircd::m::dbs::prefetch_enable)
|
||||
ircd::m::dbs::prefetch_enable
|
||||
|
@ -74,11 +74,11 @@ ircd::m::dbs::sst_write_buffer_size
|
|||
};
|
||||
|
||||
//
|
||||
// write_opts
|
||||
// opts
|
||||
//
|
||||
|
||||
decltype(ircd::m::dbs::write_opts::event_refs_all)
|
||||
ircd::m::dbs::write_opts::event_refs_all{[]
|
||||
decltype(ircd::m::dbs::opts::event_refs_all)
|
||||
ircd::m::dbs::opts::event_refs_all{[]
|
||||
{
|
||||
char full[event_refs_all.size()];
|
||||
memset(full, '1', sizeof(full));
|
||||
|
@ -88,8 +88,8 @@ ircd::m::dbs::write_opts::event_refs_all{[]
|
|||
};
|
||||
}()};
|
||||
|
||||
decltype(ircd::m::dbs::write_opts::appendix_all)
|
||||
ircd::m::dbs::write_opts::appendix_all{[]
|
||||
decltype(ircd::m::dbs::opts::appendix_all)
|
||||
ircd::m::dbs::opts::appendix_all{[]
|
||||
{
|
||||
char full[appendix_all.size()];
|
||||
memset(full, '1', sizeof(full));
|
||||
|
@ -105,15 +105,15 @@ ircd::m::dbs::write_opts::appendix_all{[]
|
|||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
static size_t _prefetch(const event &, const write_opts &);
|
||||
static size_t _index(db::txn &, const event &, const write_opts &);
|
||||
static size_t blacklist(db::txn &txn, const event::id &, const write_opts &);
|
||||
static size_t _prefetch(const event &, const opts &);
|
||||
static size_t _index(db::txn &, const event &, const opts &);
|
||||
static size_t blacklist(db::txn &txn, const event::id &, const opts &);
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::m::dbs::write(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
try
|
||||
{
|
||||
if(opts.event_idx == 0 && opts.blacklist)
|
||||
|
@ -141,7 +141,7 @@ catch(const std::exception &e)
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::prefetch(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
try
|
||||
{
|
||||
if(!prefetch_enable)
|
||||
|
@ -164,7 +164,7 @@ catch(const std::exception &e)
|
|||
size_t
|
||||
ircd::m::dbs::blacklist(db::txn &txn,
|
||||
const event::id &event_id,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
// An entry in the event_idx column with a value 0 is blacklisting
|
||||
// because 0 is not a valid event_idx. Thus a value here can only
|
||||
|
@ -197,20 +197,20 @@ ircd::m::dbs::blacklist(db::txn &txn,
|
|||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
static size_t _prefetch_room_redact(const event &, const write_opts &);
|
||||
static void _index_room_redact(db::txn &, const event &, const write_opts &);
|
||||
static size_t _prefetch_room_redact(const event &, const opts &);
|
||||
static void _index_room_redact(db::txn &, const event &, const opts &);
|
||||
|
||||
static size_t _prefetch_room(const event &, const write_opts &);
|
||||
static void _index_room(db::txn &, const event &, const write_opts &);
|
||||
static size_t _prefetch_room(const event &, const opts &);
|
||||
static void _index_room(db::txn &, const event &, const opts &);
|
||||
|
||||
static size_t _prefetch_event(const event &, const write_opts &);
|
||||
static void _index_event(db::txn &, const event &, const write_opts &);
|
||||
static size_t _prefetch_event(const event &, const opts &);
|
||||
static void _index_event(db::txn &, const event &, const opts &);
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::m::dbs::_index(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
size_t ret(0);
|
||||
_index_event(txn, event, opts);
|
||||
|
@ -223,7 +223,7 @@ ircd::m::dbs::_index(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
size_t ret(0);
|
||||
ret += _prefetch_event(event, opts);
|
||||
|
@ -237,7 +237,7 @@ ircd::m::dbs::_prefetch(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_event(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
if(opts.appendix.test(appendix::EVENT_ID))
|
||||
_index_event_id(txn, event, opts);
|
||||
|
@ -266,7 +266,7 @@ ircd::m::dbs::_index_event(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_event(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
size_t ret(0);
|
||||
if(opts.appendix.test(appendix::EVENT_ID))
|
||||
|
@ -299,7 +299,7 @@ ircd::m::dbs::_prefetch_event(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_room(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(!empty(json::get<"room_id"_>(event)));
|
||||
|
||||
|
@ -330,7 +330,7 @@ ircd::m::dbs::_index_room(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_room(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(!empty(json::get<"room_id"_>(event)));
|
||||
|
||||
|
@ -366,7 +366,7 @@ ircd::m::dbs::_prefetch_room(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_room_redact(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::ROOM_REDACT));
|
||||
assert(json::get<"type"_>(event) == "m.room.redaction");
|
||||
|
@ -431,7 +431,7 @@ ircd::m::dbs::_index_room_redact(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_room_redact(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::ROOM_REDACT));
|
||||
assert(json::get<"type"_>(event) == "m.room.redaction");
|
||||
|
@ -464,7 +464,7 @@ ircd::m::dbs::_prefetch_room_redact(const event &event,
|
|||
size_t
|
||||
ircd::m::dbs::find_event_idx(const vector_view<event::idx> &idx,
|
||||
const vector_view<const event::id> &event_id,
|
||||
const write_opts &wopts)
|
||||
const opts &wopts)
|
||||
{
|
||||
const size_t num
|
||||
{
|
||||
|
@ -501,7 +501,7 @@ ircd::m::dbs::find_event_idx(const vector_view<event::idx> &idx,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::prefetch_event_idx(const vector_view<const event::id> &event_id,
|
||||
const write_opts &wopts)
|
||||
const opts &wopts)
|
||||
{
|
||||
size_t ret(0);
|
||||
for(size_t i(0); i < event_id.size(); ++i)
|
||||
|
|
|
@ -713,7 +713,7 @@ ircd::m::dbs::desc::depth
|
|||
void
|
||||
ircd::m::dbs::_index_event_cols(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_COLS));
|
||||
assert(opts.event_idx);
|
||||
|
|
|
@ -120,14 +120,14 @@ ircd::m::dbs::desc::event_horizon
|
|||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
static void _index_event_horizon_resolve_one(db::txn &, const event &, const write_opts &, const event::idx &);
|
||||
static void _index_event_horizon_resolve_one(db::txn &, const event &, const opts &, const event::idx &);
|
||||
}
|
||||
|
||||
// NOTE: QUERY
|
||||
void
|
||||
ircd::m::dbs::_index_event_horizon_resolve(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_HORIZON_RESOLVE));
|
||||
assert(opts.event_idx != 0);
|
||||
|
@ -159,7 +159,7 @@ ircd::m::dbs::_index_event_horizon_resolve(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_event_horizon_resolve(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_HORIZON_RESOLVE));
|
||||
|
||||
|
@ -191,7 +191,7 @@ ircd::m::dbs::_prefetch_event_horizon_resolve(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_event_horizon_resolve_one(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts,
|
||||
const opts &opts,
|
||||
const event::idx &event_idx)
|
||||
{
|
||||
assert(event_idx != 0);
|
||||
|
@ -225,7 +225,7 @@ ircd::m::dbs::_index_event_horizon_resolve_one(db::txn &txn,
|
|||
};
|
||||
|
||||
// Make the references on behalf of the future event
|
||||
write_opts _opts;
|
||||
dbs::opts _opts;
|
||||
_opts.op = opts.op;
|
||||
_opts.event_idx = event_idx;
|
||||
_opts.appendix.reset();
|
||||
|
@ -258,7 +258,7 @@ ircd::m::dbs::_index_event_horizon_resolve_one(db::txn &txn,
|
|||
void
|
||||
ircd::m::dbs::_index_event_horizon(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts,
|
||||
const opts &opts,
|
||||
const m::event::id &unresolved_id)
|
||||
{
|
||||
thread_local char buf[EVENT_HORIZON_KEY_MAX_SIZE];
|
||||
|
|
|
@ -108,7 +108,7 @@ ircd::m::dbs::desc::event_idx
|
|||
void
|
||||
ircd::m::dbs::_index_event_id(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_ID));
|
||||
assert(opts.event_idx);
|
||||
|
|
|
@ -113,7 +113,7 @@ ircd::m::dbs::desc::event_json
|
|||
void
|
||||
ircd::m::dbs::_index_event_json(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
const ctx::critical_assertion ca;
|
||||
assert(opts.appendix.test(appendix::EVENT_JSON));
|
||||
|
|
|
@ -10,20 +10,20 @@
|
|||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
static size_t _prefetch_event_refs_m_room_redaction(const event &, const write_opts &);
|
||||
static void _index_event_refs_m_room_redaction(db::txn &, const event &, const write_opts &); //query
|
||||
static size_t _prefetch_event_refs_m_receipt_m_read(const event &, const write_opts &);
|
||||
static void _index_event_refs_m_receipt_m_read(db::txn &, const event &, const write_opts &); //query
|
||||
static size_t _prefetch_event_refs_m_relates_m_reply(const event &, const write_opts &);
|
||||
static void _index_event_refs_m_relates_m_reply(db::txn &, const event &, const write_opts &); //query
|
||||
static size_t _prefetch_event_refs_m_relates(const event &, const write_opts &);
|
||||
static void _index_event_refs_m_relates(db::txn &, const event &, const write_opts &); //query
|
||||
static size_t _prefetch_event_refs_state(const event &, const write_opts &);
|
||||
static void _index_event_refs_state(db::txn &, const event &, const write_opts &); // query
|
||||
static size_t _prefetch_event_refs_auth(const event &, const write_opts &);
|
||||
static void _index_event_refs_auth(db::txn &, const event &, const write_opts &); //query
|
||||
static size_t _prefetch_event_refs_prev(const event &, const write_opts &);
|
||||
static void _index_event_refs_prev(db::txn &, const event &, const write_opts &); //query
|
||||
static size_t _prefetch_event_refs_m_room_redaction(const event &, const opts &);
|
||||
static void _index_event_refs_m_room_redaction(db::txn &, const event &, const opts &); //query
|
||||
static size_t _prefetch_event_refs_m_receipt_m_read(const event &, const opts &);
|
||||
static void _index_event_refs_m_receipt_m_read(db::txn &, const event &, const opts &); //query
|
||||
static size_t _prefetch_event_refs_m_relates_m_reply(const event &, const opts &);
|
||||
static void _index_event_refs_m_relates_m_reply(db::txn &, const event &, const opts &); //query
|
||||
static size_t _prefetch_event_refs_m_relates(const event &, const opts &);
|
||||
static void _index_event_refs_m_relates(db::txn &, const event &, const opts &); //query
|
||||
static size_t _prefetch_event_refs_state(const event &, const opts &);
|
||||
static void _index_event_refs_state(db::txn &, const event &, const opts &); // query
|
||||
static size_t _prefetch_event_refs_auth(const event &, const opts &);
|
||||
static void _index_event_refs_auth(db::txn &, const event &, const opts &); //query
|
||||
static size_t _prefetch_event_refs_prev(const event &, const opts &);
|
||||
static void _index_event_refs_prev(db::txn &, const event &, const opts &); //query
|
||||
static bool event_refs__cmp_less(const string_view &a, const string_view &b);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ ircd::m::dbs::desc::event_refs
|
|||
void
|
||||
ircd::m::dbs::_index_event_refs(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
|
||||
|
@ -182,7 +182,7 @@ ircd::m::dbs::_index_event_refs(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_event_refs(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
|
||||
|
@ -216,7 +216,7 @@ ircd::m::dbs::_prefetch_event_refs(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_event_refs_prev(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::NEXT)));
|
||||
|
@ -277,7 +277,7 @@ ircd::m::dbs::_index_event_refs_prev(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_event_refs_prev(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::NEXT)));
|
||||
|
@ -300,7 +300,7 @@ ircd::m::dbs::_prefetch_event_refs_prev(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_event_refs_auth(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::NEXT_AUTH)));
|
||||
|
@ -362,7 +362,7 @@ ircd::m::dbs::_index_event_refs_auth(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_event_refs_auth(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::NEXT_AUTH)));
|
||||
|
@ -388,7 +388,7 @@ ircd::m::dbs::_prefetch_event_refs_auth(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_event_refs_state(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::NEXT_STATE)) ||
|
||||
|
@ -466,7 +466,7 @@ ircd::m::dbs::_index_event_refs_state(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_event_refs_state(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::NEXT_STATE)) ||
|
||||
|
@ -494,7 +494,7 @@ ircd::m::dbs::_prefetch_event_refs_state(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_event_refs_m_receipt_m_read(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::M_RECEIPT__M_READ)));
|
||||
|
@ -556,7 +556,7 @@ ircd::m::dbs::_index_event_refs_m_receipt_m_read(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_event_refs_m_receipt_m_read(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::M_RECEIPT__M_READ)));
|
||||
|
@ -582,7 +582,7 @@ ircd::m::dbs::_prefetch_event_refs_m_receipt_m_read(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_event_refs_m_relates(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::M_RELATES)));
|
||||
|
@ -663,7 +663,7 @@ ircd::m::dbs::_index_event_refs_m_relates(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_event_refs_m_relates(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::M_RELATES)));
|
||||
|
@ -696,7 +696,7 @@ ircd::m::dbs::_prefetch_event_refs_m_relates(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_event_refs_m_relates_m_reply(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::M_RELATES)));
|
||||
|
@ -758,7 +758,7 @@ ircd::m::dbs::_index_event_refs_m_relates_m_reply(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_event_refs_m_relates_m_reply(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::M_RELATES)));
|
||||
|
@ -786,7 +786,7 @@ ircd::m::dbs::_prefetch_event_refs_m_relates_m_reply(const event &event,
|
|||
void
|
||||
ircd::m::dbs::_index_event_refs_m_room_redaction(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::M_ROOM_REDACTION)));
|
||||
|
@ -843,7 +843,7 @@ ircd::m::dbs::_index_event_refs_m_room_redaction(db::txn &txn,
|
|||
|
||||
size_t
|
||||
ircd::m::dbs::_prefetch_event_refs_m_room_redaction(const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_REFS));
|
||||
assert(opts.event_refs.test(uint(ref::M_ROOM_REDACTION)));
|
||||
|
|
|
@ -134,7 +134,7 @@ ircd::m::dbs::desc::event_sender
|
|||
void
|
||||
ircd::m::dbs::_index_event_sender(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_SENDER));
|
||||
assert(json::get<"sender"_>(event));
|
||||
|
|
|
@ -107,7 +107,7 @@ ircd::m::dbs::desc::event_state
|
|||
void
|
||||
ircd::m::dbs::_index_event_state(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_STATE));
|
||||
assert(json::get<"type"_>(event));
|
||||
|
|
|
@ -110,7 +110,7 @@ ircd::m::dbs::desc::event_type
|
|||
void
|
||||
ircd::m::dbs::_index_event_type(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::EVENT_TYPE));
|
||||
assert(json::get<"type"_>(event));
|
||||
|
|
|
@ -175,7 +175,7 @@ ircd::m::dbs::desc::room_events
|
|||
void
|
||||
ircd::m::dbs::_index_room_events(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::ROOM_EVENTS));
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ ircd::m::dbs::desc::room_head
|
|||
void
|
||||
ircd::m::dbs::_index_room_head(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::ROOM_HEAD));
|
||||
assert(opts.event_idx);
|
||||
|
@ -177,7 +177,7 @@ ircd::m::dbs::_index_room_head(db::txn &txn,
|
|||
void
|
||||
ircd::m::dbs::_index_room_head_resolve(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::ROOM_HEAD_RESOLVE));
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ ircd::m::dbs::desc::room_joined
|
|||
void
|
||||
ircd::m::dbs::_index_room_joined(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::ROOM_JOINED));
|
||||
assert(at<"type"_>(event) == "m.room.member");
|
||||
|
|
|
@ -157,7 +157,7 @@ ircd::m::dbs::desc::room_state
|
|||
void
|
||||
ircd::m::dbs::_index_room_state(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::ROOM_STATE));
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ ircd::m::dbs::desc::room_state_space
|
|||
void
|
||||
ircd::m::dbs::_index_room_state_space(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::ROOM_STATE_SPACE));
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ ircd::m::dbs::desc::room_type
|
|||
void
|
||||
ircd::m::dbs::_index_room_type(db::txn &txn,
|
||||
const event &event,
|
||||
const write_opts &opts)
|
||||
const opts &opts)
|
||||
{
|
||||
assert(opts.appendix.test(appendix::ROOM_TYPE));
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
//TODO: XXX remove fwd decl
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
void _index_event_horizon(db::txn &, const event &, const write_opts &, const m::event::id &);
|
||||
void _index_event_horizon(db::txn &, const event &, const opts &, const m::event::id &);
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::m::event::horizon::rebuild()
|
||||
{
|
||||
m::dbs::write_opts opts;
|
||||
m::dbs::opts opts;
|
||||
opts.appendix.reset();
|
||||
opts.appendix.set(dbs::appendix::EVENT_HORIZON);
|
||||
db::txn txn
|
||||
|
|
|
@ -44,7 +44,7 @@ ircd::m::event::purge::purge(db::txn &txn,
|
|||
const event &event)
|
||||
:returns{false}
|
||||
{
|
||||
m::dbs::write_opts opts;
|
||||
m::dbs::opts opts;
|
||||
opts.op = db::op::DELETE;
|
||||
opts.event_idx = event_idx;
|
||||
m::dbs::write(txn, event, opts);
|
||||
|
|
|
@ -53,7 +53,7 @@ ircd::m::event::refs::rebuild()
|
|||
std::string event{it->second};
|
||||
pool([&txn, &dock, &i, &j, event(std::move(event)), event_idx]
|
||||
{
|
||||
m::dbs::write_opts wopts;
|
||||
m::dbs::opts wopts;
|
||||
wopts.event_idx = event_idx;
|
||||
wopts.appendix.reset();
|
||||
wopts.appendix.set(dbs::appendix::EVENT_REFS);
|
||||
|
|
|
@ -38,7 +38,7 @@ ircd::m::events::rebuild()
|
|||
*m::dbs::events
|
||||
};
|
||||
|
||||
dbs::write_opts wopts;
|
||||
dbs::opts wopts;
|
||||
wopts.appendix.reset();
|
||||
wopts.appendix.set(dbs::appendix::EVENT_TYPE);
|
||||
wopts.appendix.set(dbs::appendix::EVENT_SENDER);
|
||||
|
|
|
@ -634,13 +634,13 @@ const
|
|||
//TODO: XXX remove fwd decl
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
void _index_event_horizon(db::txn &, const event &, const write_opts &, const m::event::id &);
|
||||
void _index_event_horizon(db::txn &, const event &, const opts &, const m::event::id &);
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::m::room::events::horizon::rebuild()
|
||||
{
|
||||
m::dbs::write_opts opts;
|
||||
m::dbs::opts opts;
|
||||
opts.appendix.reset();
|
||||
opts.appendix.set(dbs::appendix::EVENT_HORIZON);
|
||||
db::txn txn
|
||||
|
|
|
@ -302,7 +302,7 @@ ircd::m::room::head::reset(const head &head)
|
|||
};
|
||||
|
||||
// Iterate all of the existing heads with a delete operation
|
||||
m::dbs::write_opts opts;
|
||||
m::dbs::opts opts;
|
||||
opts.op = db::op::DELETE;
|
||||
opts.appendix.reset();
|
||||
opts.appendix.set(dbs::appendix::ROOM_HEAD);
|
||||
|
@ -368,7 +368,7 @@ ircd::m::room::head::rebuild(const head &head)
|
|||
*m::dbs::events
|
||||
};
|
||||
|
||||
m::dbs::write_opts opts;
|
||||
m::dbs::opts opts;
|
||||
opts.op = db::op::SET;
|
||||
for(; it; ++it)
|
||||
{
|
||||
|
@ -400,7 +400,7 @@ ircd::m::room::head::modify(const m::event::id &event_id,
|
|||
};
|
||||
|
||||
// Iterate all of the existing heads with a delete operation
|
||||
m::dbs::write_opts opts;
|
||||
m::dbs::opts opts;
|
||||
opts.op = op;
|
||||
opts.event_idx = event.event_idx;
|
||||
opts.appendix.reset();
|
||||
|
|
|
@ -901,7 +901,7 @@ ircd::m::room::state::rebuild::rebuild(const room::id &room_id)
|
|||
!m::internal(room_id)
|
||||
};
|
||||
|
||||
m::dbs::write_opts opts;
|
||||
m::dbs::opts opts;
|
||||
opts.appendix.reset();
|
||||
opts.appendix.set(dbs::appendix::ROOM_STATE);
|
||||
opts.appendix.set(dbs::appendix::ROOM_JOINED);
|
||||
|
|
|
@ -259,7 +259,7 @@ ircd::m::room::state::space::rebuild::rebuild(const room::id &room_id)
|
|||
what(reason_relative),
|
||||
};
|
||||
|
||||
dbs::write_opts opts;
|
||||
dbs::opts opts;
|
||||
opts.event_idx = event_idx;
|
||||
|
||||
opts.appendix.reset();
|
||||
|
|
|
@ -41,7 +41,7 @@ size_t
|
|||
ircd::m::vm::prefetch_refs(const eval &eval)
|
||||
{
|
||||
assert(eval.opts);
|
||||
const dbs::write_opts &wopts
|
||||
const dbs::opts &wopts
|
||||
{
|
||||
eval.opts->wopts
|
||||
};
|
||||
|
|
|
@ -943,7 +943,7 @@ ircd::m::vm::execute_pdu(eval &eval,
|
|||
eval.phase, phase::PREINDEX
|
||||
};
|
||||
|
||||
dbs::write_opts wopts(opts.wopts);
|
||||
dbs::opts wopts(opts.wopts);
|
||||
wopts.event_idx = eval.sequence;
|
||||
const size_t prefetched
|
||||
{
|
||||
|
@ -1251,7 +1251,7 @@ ircd::m::vm::write_append(eval &eval,
|
|||
*eval.txn
|
||||
};
|
||||
|
||||
m::dbs::write_opts wopts(opts.wopts);
|
||||
m::dbs::opts wopts(opts.wopts);
|
||||
wopts.interpose = eval.txn.get();
|
||||
wopts.event_idx = eval.sequence;
|
||||
wopts.json_source = true;
|
||||
|
|
|
@ -8582,7 +8582,7 @@ console_cmd__event__rewrite(opt &out, const string_view &line)
|
|||
event_id
|
||||
};
|
||||
|
||||
m::dbs::write_opts opts;
|
||||
m::dbs::opts opts;
|
||||
opts.op = db::op::SET;
|
||||
opts.event_idx = event.event_idx;
|
||||
|
||||
|
|
Loading…
Reference in a new issue