mirror of
https://github.com/matrix-construct/construct
synced 2025-01-16 09:36:54 +01:00
ircd:Ⓜ️:dbs: Split into headers by column.
This commit is contained in:
parent
3ec009bf6d
commit
305e02db7c
14 changed files with 449 additions and 237 deletions
|
@ -28,33 +28,32 @@ namespace ircd::m::dbs
|
|||
// Database instance
|
||||
extern std::shared_ptr<db::database> events;
|
||||
|
||||
// Event property columns
|
||||
constexpr const auto event_columns{event::size()};
|
||||
extern std::array<db::column, event_columns> event_column;
|
||||
|
||||
// Event metadata columns
|
||||
extern db::column event_idx; // event_id => event_idx
|
||||
extern db::column event_json; // event_idx => full json
|
||||
extern db::index event_refs; // event_idx | ref_type, event_idx
|
||||
extern db::index event_horizon; // event_id | event_idx
|
||||
extern db::index event_type; // type | event_idx
|
||||
extern db::index event_sender; // host | local, event_idx
|
||||
extern db::index room_head; // room_id | event_id => event_idx
|
||||
extern db::index room_events; // room_id | depth, event_idx => node_id
|
||||
extern db::index room_joined; // room_id | origin, member => event_idx
|
||||
extern db::index room_state; // room_id | type, state_key => event_idx
|
||||
extern db::column state_node; // node_id => state::node
|
||||
|
||||
// [SET (txn)] Basic write suite
|
||||
string_view write(db::txn &, const event &, const write_opts &);
|
||||
void blacklist(db::txn &, const event::id &, const write_opts &);
|
||||
}
|
||||
|
||||
#include "event_refs.h"
|
||||
/// Database description
|
||||
///
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern const db::description events;
|
||||
}
|
||||
|
||||
#include "appendix.h"
|
||||
#include "write_opts.h"
|
||||
#include "util.h"
|
||||
#include "desc.h"
|
||||
#include "event_column.h"
|
||||
#include "event_idx.h"
|
||||
#include "event_json.h"
|
||||
#include "event_refs.h"
|
||||
#include "event_horizon.h"
|
||||
#include "event_type.h"
|
||||
#include "event_sender.h"
|
||||
#include "room_head.h"
|
||||
#include "room_events.h"
|
||||
#include "room_joined.h"
|
||||
#include "room_state.h"
|
||||
#include "state_node.h"
|
||||
|
||||
struct ircd::m::dbs::init
|
||||
{
|
||||
|
|
|
@ -1,160 +0,0 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_DESC_H
|
||||
|
||||
/// Database Schema Descriptors
|
||||
///
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
// Full description
|
||||
extern const db::description events;
|
||||
|
||||
//
|
||||
// Direct columns
|
||||
//
|
||||
|
||||
extern conf::item<size_t> events___event__bloom__bits;
|
||||
|
||||
extern conf::item<size_t> events__content__block__size;
|
||||
extern conf::item<size_t> events__content__meta_block__size;
|
||||
extern conf::item<size_t> events__content__cache__size;
|
||||
extern conf::item<size_t> events__content__cache_comp__size;
|
||||
extern const db::descriptor events_content;
|
||||
|
||||
extern conf::item<size_t> events__depth__block__size;
|
||||
extern conf::item<size_t> events__depth__meta_block__size;
|
||||
extern conf::item<size_t> events__depth__cache__size;
|
||||
extern conf::item<size_t> events__depth__cache_comp__size;
|
||||
extern const db::descriptor events_depth;
|
||||
|
||||
extern conf::item<size_t> events__event_id__block__size;
|
||||
extern conf::item<size_t> events__event_id__meta_block__size;
|
||||
extern conf::item<size_t> events__event_id__cache__size;
|
||||
extern conf::item<size_t> events__event_id__cache_comp__size;
|
||||
extern const db::descriptor events_event_id;
|
||||
|
||||
extern conf::item<size_t> events__origin_server_ts__block__size;
|
||||
extern conf::item<size_t> events__origin_server_ts__meta_block__size;
|
||||
extern conf::item<size_t> events__origin_server_ts__cache__size;
|
||||
extern conf::item<size_t> events__origin_server_ts__cache_comp__size;
|
||||
extern const db::descriptor events_origin_server_ts;
|
||||
|
||||
extern conf::item<size_t> events__room_id__block__size;
|
||||
extern conf::item<size_t> events__room_id__meta_block__size;
|
||||
extern conf::item<size_t> events__room_id__cache__size;
|
||||
extern conf::item<size_t> events__room_id__cache_comp__size;
|
||||
extern const db::descriptor events_room_id;
|
||||
|
||||
extern conf::item<size_t> events__sender__block__size;
|
||||
extern conf::item<size_t> events__sender__meta_block__size;
|
||||
extern conf::item<size_t> events__sender__cache__size;
|
||||
extern conf::item<size_t> events__sender__cache_comp__size;
|
||||
extern const db::descriptor events_sender;
|
||||
|
||||
extern conf::item<size_t> events__state_key__block__size;
|
||||
extern conf::item<size_t> events__state_key__meta_block__size;
|
||||
extern conf::item<size_t> events__state_key__cache__size;
|
||||
extern conf::item<size_t> events__state_key__cache_comp__size;
|
||||
extern const db::descriptor events_state_key;
|
||||
|
||||
extern conf::item<size_t> events__type__block__size;
|
||||
extern conf::item<size_t> events__type__meta_block__size;
|
||||
extern conf::item<size_t> events__type__cache__size;
|
||||
extern conf::item<size_t> events__type__cache_comp__size;
|
||||
extern const db::descriptor events_type;
|
||||
|
||||
//
|
||||
// Metadata columns
|
||||
//
|
||||
|
||||
// events index
|
||||
extern conf::item<size_t> events__event_idx__block__size;
|
||||
extern conf::item<size_t> events__event_idx__meta_block__size;
|
||||
extern conf::item<size_t> events__event_idx__cache__size;
|
||||
extern conf::item<size_t> events__event_idx__cache_comp__size;
|
||||
extern conf::item<size_t> events__event_idx__bloom__bits;
|
||||
extern const db::descriptor events__event_idx;
|
||||
|
||||
// events cache
|
||||
extern conf::item<size_t> events__event_json__block__size;
|
||||
extern conf::item<size_t> events__event_json__meta_block__size;
|
||||
extern conf::item<size_t> events__event_json__cache__size;
|
||||
extern conf::item<size_t> events__event_json__cache_comp__size;
|
||||
extern conf::item<size_t> events__event_json__bloom__bits;
|
||||
extern const db::descriptor events__event_json;
|
||||
|
||||
// event horizon
|
||||
extern conf::item<size_t> events__event_horizon__block__size;
|
||||
extern conf::item<size_t> events__event_horizon__meta_block__size;
|
||||
extern conf::item<size_t> events__event_horizon__cache__size;
|
||||
extern conf::item<size_t> events__event_horizon__cache_comp__size;
|
||||
extern const db::prefix_transform events__event_horizon__pfx;
|
||||
extern const db::descriptor events__event_horizon;
|
||||
|
||||
// events sender
|
||||
extern conf::item<size_t> events__event_sender__block__size;
|
||||
extern conf::item<size_t> events__event_sender__meta_block__size;
|
||||
extern conf::item<size_t> events__event_sender__cache__size;
|
||||
extern conf::item<size_t> events__event_sender__cache_comp__size;
|
||||
extern const db::prefix_transform events__event_sender__pfx;
|
||||
extern const db::descriptor events__event_sender;
|
||||
|
||||
// events type
|
||||
extern conf::item<size_t> events__event_type__block__size;
|
||||
extern conf::item<size_t> events__event_type__meta_block__size;
|
||||
extern conf::item<size_t> events__event_type__cache__size;
|
||||
extern conf::item<size_t> events__event_type__cache_comp__size;
|
||||
extern const db::prefix_transform events__event_type__pfx;
|
||||
extern const db::descriptor events__event_type;
|
||||
|
||||
// room head mapping sequence
|
||||
extern conf::item<size_t> events__room_head__block__size;
|
||||
extern conf::item<size_t> events__room_head__meta_block__size;
|
||||
extern conf::item<size_t> events__room_head__cache__size;
|
||||
extern const db::prefix_transform events__room_head__pfx;
|
||||
extern const db::descriptor events__room_head;
|
||||
|
||||
// room events sequence
|
||||
extern conf::item<size_t> events__room_events__block__size;
|
||||
extern conf::item<size_t> events__room_events__meta_block__size;
|
||||
extern conf::item<size_t> events__room_events__cache__size;
|
||||
extern conf::item<size_t> events__room_events__cache_comp__size;
|
||||
extern const db::prefix_transform events__room_events__pfx;
|
||||
extern const db::comparator events__room_events__cmp;
|
||||
extern const db::descriptor events__room_events;
|
||||
|
||||
// room present joined members sequence
|
||||
extern conf::item<size_t> events__room_joined__block__size;
|
||||
extern conf::item<size_t> events__room_joined__meta_block__size;
|
||||
extern conf::item<size_t> events__room_joined__cache__size;
|
||||
extern conf::item<size_t> events__room_joined__cache_comp__size;
|
||||
extern conf::item<size_t> events__room_joined__bloom__bits;
|
||||
extern const db::prefix_transform events__room_joined__pfx;
|
||||
extern const db::descriptor events__room_joined;
|
||||
|
||||
// room present state mapping sequence
|
||||
extern conf::item<size_t> events__room_state__block__size;
|
||||
extern conf::item<size_t> events__room_state__meta_block__size;
|
||||
extern conf::item<size_t> events__room_state__cache__size;
|
||||
extern conf::item<size_t> events__room_state__cache_comp__size;
|
||||
extern conf::item<size_t> events__room_state__bloom__bits;
|
||||
extern const db::prefix_transform events__room_state__pfx;
|
||||
extern const db::descriptor events__room_state;
|
||||
|
||||
// state btree node key-value store
|
||||
extern conf::item<size_t> events__state_node__block__size;
|
||||
extern conf::item<size_t> events__state_node__meta_block__size;
|
||||
extern conf::item<size_t> events__state_node__cache__size;
|
||||
extern conf::item<size_t> events__state_node__cache_comp__size;
|
||||
extern conf::item<size_t> events__state_node__bloom__bits;
|
||||
extern const db::descriptor events__state_node;
|
||||
}
|
77
include/ircd/m/dbs/event_column.h
Normal file
77
include/ircd/m/dbs/event_column.h
Normal file
|
@ -0,0 +1,77 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_EVENT_COLUMN_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
// Event property column max-count. The number of event columns may be
|
||||
// less by not initializing positions in the event_column array.
|
||||
constexpr const auto event_columns
|
||||
{
|
||||
event::size()
|
||||
};
|
||||
|
||||
extern std::array<db::column, event_columns> event_column;
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern conf::item<size_t> events___event__bloom__bits;
|
||||
|
||||
extern conf::item<size_t> events__content__block__size;
|
||||
extern conf::item<size_t> events__content__meta_block__size;
|
||||
extern conf::item<size_t> events__content__cache__size;
|
||||
extern conf::item<size_t> events__content__cache_comp__size;
|
||||
extern const db::descriptor events_content;
|
||||
|
||||
extern conf::item<size_t> events__depth__block__size;
|
||||
extern conf::item<size_t> events__depth__meta_block__size;
|
||||
extern conf::item<size_t> events__depth__cache__size;
|
||||
extern conf::item<size_t> events__depth__cache_comp__size;
|
||||
extern const db::descriptor events_depth;
|
||||
|
||||
extern conf::item<size_t> events__event_id__block__size;
|
||||
extern conf::item<size_t> events__event_id__meta_block__size;
|
||||
extern conf::item<size_t> events__event_id__cache__size;
|
||||
extern conf::item<size_t> events__event_id__cache_comp__size;
|
||||
extern const db::descriptor events_event_id;
|
||||
|
||||
extern conf::item<size_t> events__origin_server_ts__block__size;
|
||||
extern conf::item<size_t> events__origin_server_ts__meta_block__size;
|
||||
extern conf::item<size_t> events__origin_server_ts__cache__size;
|
||||
extern conf::item<size_t> events__origin_server_ts__cache_comp__size;
|
||||
extern const db::descriptor events_origin_server_ts;
|
||||
|
||||
extern conf::item<size_t> events__room_id__block__size;
|
||||
extern conf::item<size_t> events__room_id__meta_block__size;
|
||||
extern conf::item<size_t> events__room_id__cache__size;
|
||||
extern conf::item<size_t> events__room_id__cache_comp__size;
|
||||
extern const db::descriptor events_room_id;
|
||||
|
||||
extern conf::item<size_t> events__sender__block__size;
|
||||
extern conf::item<size_t> events__sender__meta_block__size;
|
||||
extern conf::item<size_t> events__sender__cache__size;
|
||||
extern conf::item<size_t> events__sender__cache_comp__size;
|
||||
extern const db::descriptor events_sender;
|
||||
|
||||
extern conf::item<size_t> events__state_key__block__size;
|
||||
extern conf::item<size_t> events__state_key__meta_block__size;
|
||||
extern conf::item<size_t> events__state_key__cache__size;
|
||||
extern conf::item<size_t> events__state_key__cache_comp__size;
|
||||
extern const db::descriptor events_state_key;
|
||||
|
||||
extern conf::item<size_t> events__type__block__size;
|
||||
extern conf::item<size_t> events__type__meta_block__size;
|
||||
extern conf::item<size_t> events__type__cache__size;
|
||||
extern conf::item<size_t> events__type__cache_comp__size;
|
||||
extern const db::descriptor events_type;
|
||||
}
|
37
include/ircd/m/dbs/event_horizon.h
Normal file
37
include/ircd/m/dbs/event_horizon.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_EVENT_HORIZON_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
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 &);
|
||||
std::tuple<event::idx> event_horizon_key(const string_view &amalgam);
|
||||
|
||||
// event_id | event_idx
|
||||
extern db::index event_horizon;
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern conf::item<size_t> events__event_horizon__block__size;
|
||||
extern conf::item<size_t> events__event_horizon__meta_block__size;
|
||||
extern conf::item<size_t> events__event_horizon__cache__size;
|
||||
extern conf::item<size_t> events__event_horizon__cache_comp__size;
|
||||
extern const db::prefix_transform events__event_horizon__pfx;
|
||||
extern const db::descriptor events__event_horizon;
|
||||
}
|
27
include/ircd/m/dbs/event_idx.h
Normal file
27
include/ircd/m/dbs/event_idx.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_EVENT_IDX_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
extern db::column event_idx; // event_id => event_idx
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern conf::item<size_t> events__event_idx__block__size;
|
||||
extern conf::item<size_t> events__event_idx__meta_block__size;
|
||||
extern conf::item<size_t> events__event_idx__cache__size;
|
||||
extern conf::item<size_t> events__event_idx__cache_comp__size;
|
||||
extern conf::item<size_t> events__event_idx__bloom__bits;
|
||||
extern const db::descriptor events__event_idx;
|
||||
}
|
28
include/ircd/m/dbs/event_json.h
Normal file
28
include/ircd/m/dbs/event_json.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_EVENT_JSON_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
// event_idx => full json
|
||||
extern db::column event_json;
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern conf::item<size_t> events__event_json__block__size;
|
||||
extern conf::item<size_t> events__event_json__meta_block__size;
|
||||
extern conf::item<size_t> events__event_json__cache__size;
|
||||
extern conf::item<size_t> events__event_json__cache_comp__size;
|
||||
extern conf::item<size_t> events__event_json__bloom__bits;
|
||||
extern const db::descriptor events__event_json;
|
||||
}
|
37
include/ircd/m/dbs/event_sender.h
Normal file
37
include/ircd/m/dbs/event_sender.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_EVENT_SENDER_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
constexpr size_t EVENT_SENDER_KEY_MAX_SIZE
|
||||
{
|
||||
id::MAX_SIZE + 1 + 8
|
||||
};
|
||||
|
||||
string_view event_sender_key(const mutable_buffer &out, const string_view &origin, const string_view &localpart = {}, const event::idx & = 0);
|
||||
string_view event_sender_key(const mutable_buffer &out, const id::user &, const event::idx &);
|
||||
std::tuple<string_view, event::idx> event_sender_key(const string_view &amalgam);
|
||||
|
||||
// host | local, event_idx
|
||||
extern db::index event_sender;
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern conf::item<size_t> events__event_sender__block__size;
|
||||
extern conf::item<size_t> events__event_sender__meta_block__size;
|
||||
extern conf::item<size_t> events__event_sender__cache__size;
|
||||
extern conf::item<size_t> events__event_sender__cache_comp__size;
|
||||
extern const db::prefix_transform events__event_sender__pfx;
|
||||
extern const db::descriptor events__event_sender;
|
||||
}
|
37
include/ircd/m/dbs/event_type.h
Normal file
37
include/ircd/m/dbs/event_type.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_EVENT_TYPE_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
constexpr size_t EVENT_TYPE_KEY_MAX_SIZE
|
||||
{
|
||||
event::TYPE_MAX_SIZE + 1 + 8
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
// type | event_idx => -
|
||||
extern db::index event_type;
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
// events type
|
||||
extern conf::item<size_t> events__event_type__block__size;
|
||||
extern conf::item<size_t> events__event_type__meta_block__size;
|
||||
extern conf::item<size_t> events__event_type__cache__size;
|
||||
extern conf::item<size_t> events__event_type__cache_comp__size;
|
||||
extern const db::prefix_transform events__event_type__pfx;
|
||||
extern const db::descriptor events__event_type;
|
||||
}
|
39
include/ircd/m/dbs/room_events.h
Normal file
39
include/ircd/m/dbs/room_events.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_ROOM_EVENTS_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
constexpr size_t ROOM_EVENTS_KEY_MAX_SIZE
|
||||
{
|
||||
id::MAX_SIZE + 1 + 8 + 8
|
||||
};
|
||||
|
||||
string_view room_events_key(const mutable_buffer &out, const id::room &, const uint64_t &depth, const event::idx &);
|
||||
string_view room_events_key(const mutable_buffer &out, const id::room &, const uint64_t &depth);
|
||||
std::pair<uint64_t, event::idx> room_events_key(const string_view &amalgam);
|
||||
|
||||
// room_id | depth, event_idx => node_id
|
||||
extern db::index room_events;
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
// room events sequence
|
||||
extern conf::item<size_t> events__room_events__block__size;
|
||||
extern conf::item<size_t> events__room_events__meta_block__size;
|
||||
extern conf::item<size_t> events__room_events__cache__size;
|
||||
extern conf::item<size_t> events__room_events__cache_comp__size;
|
||||
extern const db::prefix_transform events__room_events__pfx;
|
||||
extern const db::comparator events__room_events__cmp;
|
||||
extern const db::descriptor events__room_events;
|
||||
}
|
35
include/ircd/m/dbs/room_head.h
Normal file
35
include/ircd/m/dbs/room_head.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_ROOM_HEAD_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
constexpr size_t ROOM_HEAD_KEY_MAX_SIZE
|
||||
{
|
||||
id::MAX_SIZE + 1 + id::MAX_SIZE
|
||||
};
|
||||
|
||||
string_view room_head_key(const mutable_buffer &out, const id::room &, const id::event &);
|
||||
string_view room_head_key(const string_view &amalgam);
|
||||
|
||||
// room_id | event_id => event_idx
|
||||
extern db::index room_head;
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern conf::item<size_t> events__room_head__block__size;
|
||||
extern conf::item<size_t> events__room_head__meta_block__size;
|
||||
extern conf::item<size_t> events__room_head__cache__size;
|
||||
extern const db::prefix_transform events__room_head__pfx;
|
||||
extern const db::descriptor events__room_head;
|
||||
}
|
38
include/ircd/m/dbs/room_joined.h
Normal file
38
include/ircd/m/dbs/room_joined.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_ROOM_JOINED_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
constexpr size_t ROOM_JOINED_KEY_MAX_SIZE
|
||||
{
|
||||
id::MAX_SIZE + event::ORIGIN_MAX_SIZE + id::MAX_SIZE
|
||||
};
|
||||
|
||||
string_view room_joined_key(const mutable_buffer &out, const id::room &, const string_view &origin, const id::user &member);
|
||||
string_view room_joined_key(const mutable_buffer &out, const id::room &, const string_view &origin);
|
||||
std::pair<string_view, string_view> room_joined_key(const string_view &amalgam);
|
||||
|
||||
// room_id | origin, member => event_idx
|
||||
extern db::index room_joined;
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern conf::item<size_t> events__room_joined__block__size;
|
||||
extern conf::item<size_t> events__room_joined__meta_block__size;
|
||||
extern conf::item<size_t> events__room_joined__cache__size;
|
||||
extern conf::item<size_t> events__room_joined__cache_comp__size;
|
||||
extern conf::item<size_t> events__room_joined__bloom__bits;
|
||||
extern const db::prefix_transform events__room_joined__pfx;
|
||||
extern const db::descriptor events__room_joined;
|
||||
}
|
38
include/ircd/m/dbs/room_state.h
Normal file
38
include/ircd/m/dbs/room_state.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_ROOM_STATE_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
constexpr size_t ROOM_STATE_KEY_MAX_SIZE
|
||||
{
|
||||
id::MAX_SIZE + event::TYPE_MAX_SIZE + event::STATE_KEY_MAX_SIZE
|
||||
};
|
||||
|
||||
string_view room_state_key(const mutable_buffer &out, const id::room &, const string_view &type, const string_view &state_key);
|
||||
string_view room_state_key(const mutable_buffer &out, const id::room &, const string_view &type);
|
||||
std::pair<string_view, string_view> room_state_key(const string_view &amalgam);
|
||||
|
||||
// room_id | type, state_key => event_idx
|
||||
extern db::index room_state;
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern conf::item<size_t> events__room_state__block__size;
|
||||
extern conf::item<size_t> events__room_state__meta_block__size;
|
||||
extern conf::item<size_t> events__room_state__cache__size;
|
||||
extern conf::item<size_t> events__room_state__cache_comp__size;
|
||||
extern conf::item<size_t> events__room_state__bloom__bits;
|
||||
extern const db::prefix_transform events__room_state__pfx;
|
||||
extern const db::descriptor events__room_state;
|
||||
}
|
37
include/ircd/m/dbs/state_node.h
Normal file
37
include/ircd/m/dbs/state_node.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_STATE_NODE_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
// [GET] the state root for an event (with as much information as you have)
|
||||
string_view state_root(const mutable_buffer &out, const id::room &, const event::idx &, const uint64_t &depth);
|
||||
string_view state_root(const mutable_buffer &out, const id::room &, const event::id &, const uint64_t &depth);
|
||||
string_view state_root(const mutable_buffer &out, const id::room &, const event::idx &);
|
||||
string_view state_root(const mutable_buffer &out, const id::room &, const event::id &);
|
||||
string_view state_root(const mutable_buffer &out, const event::idx &);
|
||||
string_view state_root(const mutable_buffer &out, const event::id &);
|
||||
string_view state_root(const mutable_buffer &out, const event &);
|
||||
|
||||
// node_id => state::node
|
||||
extern db::column state_node;
|
||||
}
|
||||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern conf::item<size_t> events__state_node__block__size;
|
||||
extern conf::item<size_t> events__state_node__meta_block__size;
|
||||
extern conf::item<size_t> events__state_node__cache__size;
|
||||
extern conf::item<size_t> events__state_node__cache_comp__size;
|
||||
extern conf::item<size_t> events__state_node__bloom__bits;
|
||||
extern const db::descriptor events__state_node;
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2019 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_UTIL_H
|
||||
|
||||
namespace ircd::m::dbs
|
||||
{
|
||||
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 &);
|
||||
std::tuple<event::idx> event_horizon_key(const string_view &amalgam);
|
||||
|
||||
constexpr size_t EVENT_SENDER_KEY_MAX_SIZE {id::MAX_SIZE + 1 + 8};
|
||||
string_view event_sender_key(const mutable_buffer &out, const string_view &origin, const string_view &localpart = {}, const event::idx & = 0);
|
||||
string_view event_sender_key(const mutable_buffer &out, const id::user &, const event::idx &);
|
||||
std::tuple<string_view, event::idx> event_sender_key(const string_view &amalgam);
|
||||
|
||||
constexpr size_t EVENT_TYPE_KEY_MAX_SIZE {event::TYPE_MAX_SIZE + 1 + 8};
|
||||
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);
|
||||
|
||||
constexpr size_t ROOM_HEAD_KEY_MAX_SIZE {id::MAX_SIZE + 1 + id::MAX_SIZE};
|
||||
string_view room_head_key(const mutable_buffer &out, const id::room &, const id::event &);
|
||||
string_view room_head_key(const string_view &amalgam);
|
||||
|
||||
constexpr size_t ROOM_STATE_KEY_MAX_SIZE {id::MAX_SIZE + event::TYPE_MAX_SIZE + event::STATE_KEY_MAX_SIZE};
|
||||
string_view room_state_key(const mutable_buffer &out, const id::room &, const string_view &type, const string_view &state_key);
|
||||
string_view room_state_key(const mutable_buffer &out, const id::room &, const string_view &type);
|
||||
std::pair<string_view, string_view> room_state_key(const string_view &amalgam);
|
||||
|
||||
constexpr size_t ROOM_JOINED_KEY_MAX_SIZE {id::MAX_SIZE + event::ORIGIN_MAX_SIZE + id::MAX_SIZE};
|
||||
string_view room_joined_key(const mutable_buffer &out, const id::room &, const string_view &origin, const id::user &member);
|
||||
string_view room_joined_key(const mutable_buffer &out, const id::room &, const string_view &origin);
|
||||
std::pair<string_view, string_view> room_joined_key(const string_view &amalgam);
|
||||
|
||||
constexpr size_t ROOM_EVENTS_KEY_MAX_SIZE {id::MAX_SIZE + 1 + 8 + 8};
|
||||
string_view room_events_key(const mutable_buffer &out, const id::room &, const uint64_t &depth, const event::idx &);
|
||||
string_view room_events_key(const mutable_buffer &out, const id::room &, const uint64_t &depth);
|
||||
std::pair<uint64_t, event::idx> room_events_key(const string_view &amalgam);
|
||||
|
||||
// [GET] the state root for an event (with as much information as you have)
|
||||
string_view state_root(const mutable_buffer &out, const id::room &, const event::idx &, const uint64_t &depth);
|
||||
string_view state_root(const mutable_buffer &out, const id::room &, const event::id &, const uint64_t &depth);
|
||||
string_view state_root(const mutable_buffer &out, const id::room &, const event::idx &);
|
||||
string_view state_root(const mutable_buffer &out, const id::room &, const event::id &);
|
||||
string_view state_root(const mutable_buffer &out, const event::idx &);
|
||||
string_view state_root(const mutable_buffer &out, const event::id &);
|
||||
string_view state_root(const mutable_buffer &out, const event &);
|
||||
}
|
Loading…
Reference in a new issue