0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 02:02:38 +01:00

ircd:Ⓜ️:dbs: Upgrade descriptors to designated initializers.

This commit is contained in:
Jason Volk 2022-07-29 20:10:01 -07:00
parent e38825030f
commit c76aec69a9
8 changed files with 166 additions and 629 deletions

View file

@ -85,11 +85,8 @@ ircd::m::dbs::desc::event_id__cache_comp__size
const ircd::db::descriptor
ircd::m::dbs::desc::event_id
{
// name
"event_id",
// explanation
R"(Stores the event_id property of an event.
.name = "event_id",
.explain = R"(Stores the event_id property of an event.
As with all direct event columns the key is an event_idx and the value
is the data for the event. It should be mentioned for this column
@ -102,43 +99,18 @@ ircd::m::dbs::desc::event_id
)",
// typing (key, value)
.type =
{
typeid(uint64_t), typeid(string_view)
},
// options
{},
// comparator
{},
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0,
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
size_t(_event__bloom__bits),
// expect queries hit
true,
// block size
size_t(event_id__block__size),
// meta_block size
size_t(event_id__meta_block__size),
// compression
string_view{event_id__comp},
.cache_size = bool(cache_enable)? -1 : 0,
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = size_t(_event__bloom__bits),
.expect_queries_hit = true,
.block_size = size_t(event_id__block__size),
.meta_block_size = size_t(event_id__meta_block__size),
.compression = string_view{event_id__comp},
};
//
@ -197,11 +169,8 @@ ircd::m::dbs::desc::type__cache_comp__size
const ircd::db::descriptor
ircd::m::dbs::desc::type
{
// name
"type",
// explanation
R"(Stores the type property of an event.
.name = "type",
.explain = R"(Stores the type property of an event.
10.1
The type of event. This SHOULD be namespaced similar to Java package naming conventions
@ -214,43 +183,18 @@ ircd::m::dbs::desc::type
key is event_idx number.
)",
// typing (key, value)
.type =
{
typeid(uint64_t), typeid(string_view)
},
// options
{},
// comparator
{},
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0,
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
size_t(_event__bloom__bits),
// expect queries hit
true,
// block size
size_t(type__block__size),
// meta_block size
size_t(type__meta_block__size),
// compression
string_view{type__comp},
.cache_size = bool(cache_enable)? -1 : 0,
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = size_t(_event__bloom__bits),
.expect_queries_hit = true,
.block_size = size_t(type__block__size),
.meta_block_size = size_t(type__meta_block__size),
.compression = string_view{type__comp},
};
//
@ -316,11 +260,8 @@ ircd::m::dbs::desc::content__file__size__max
const ircd::db::descriptor
ircd::m::dbs::desc::content
{
// name
"content",
// explanation
R"(Stores the content property of an event.
.name = "content",
.explain = R"(Stores the content property of an event.
10.1
The fields in this object will vary depending on the type of event. When interacting
@ -333,55 +274,20 @@ ircd::m::dbs::desc::content
key is event_idx number.
)",
// typing (key, value)
.type =
{
typeid(uint64_t), typeid(string_view)
},
// options
{},
// comparator
{},
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0,
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
size_t(_event__bloom__bits),
// expect queries hit
true,
// block size
size_t(content__block__size),
// meta_block size
size_t(content__meta_block__size),
// compression
string_view{content__comp},
// compactor
{},
// compaction priority algorithm,
"Universal"s,
// target_file_size
{
size_t(content__file__size__max),
1L,
},
.cache_size = bool(cache_enable)? -1 : 0,
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = size_t(_event__bloom__bits),
.expect_queries_hit = true,
.block_size = size_t(content__block__size),
.meta_block_size = size_t(content__meta_block__size),
.compression = string_view{content__comp},
.compaction_pri = "Universal"s,
.target_file_size = { size_t(content__file__size__max), 1L, },
};
//
@ -440,11 +346,8 @@ ircd::m::dbs::desc::room_id__cache_comp__size
const ircd::db::descriptor
ircd::m::dbs::desc::room_id
{
// name
"room_id",
// explanation
R"(Stores the room_id property of an event.
.name = "room_id",
.explain = R"(Stores the room_id property of an event.
10.2 (apropos room events)
Required. The ID of the room associated with this event.
@ -456,43 +359,18 @@ ircd::m::dbs::desc::room_id
key is event_idx number.
)",
// typing (key, value)
.type =
{
typeid(uint64_t), typeid(string_view)
},
// options
{},
// comparator
{},
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0,
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
size_t(_event__bloom__bits),
// expect queries hit
true,
// block size
size_t(room_id__block__size),
// meta_block size
size_t(room_id__meta_block__size),
// compression
string_view{room_id__comp},
.cache_size = bool(cache_enable)? -1 : 0,
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = size_t(_event__bloom__bits),
.expect_queries_hit = true,
.block_size = size_t(room_id__block__size),
.meta_block_size = size_t(room_id__meta_block__size),
.compression = string_view{room_id__comp},
};
//
@ -551,11 +429,8 @@ ircd::m::dbs::desc::sender__cache_comp__size
const ircd::db::descriptor
ircd::m::dbs::desc::sender
{
// name
"sender",
// explanation
R"(Stores the sender property of an event.
.name = "sender",
.explain = R"(Stores the sender property of an event.
10.2 (apropos room events)
Required. Contains the fully-qualified ID of the user who sent this event.
@ -567,43 +442,18 @@ ircd::m::dbs::desc::sender
key is event_idx number.
)",
// typing (key, value)
.type =
{
typeid(uint64_t), typeid(string_view)
},
// options
{},
// comparator
{},
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0,
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
size_t(_event__bloom__bits),
// expect queries hit
true,
// block size
size_t(sender__block__size),
// meta_block size
size_t(sender__meta_block__size),
// compression
string_view{sender__comp},
.cache_size = bool(cache_enable)? -1 : 0,
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = size_t(_event__bloom__bits),
.expect_queries_hit = true,
.block_size = size_t(sender__block__size),
.meta_block_size = size_t(sender__meta_block__size),
.compression = string_view{sender__comp},
};
//
@ -662,11 +512,8 @@ ircd::m::dbs::desc::state_key__cache_comp__size
const ircd::db::descriptor
ircd::m::dbs::desc::state_key
{
// name
"state_key",
// explanation
R"(Stores the state_key property of an event.
.name = "state_key",
.explain = R"(Stores the state_key property of an event.
10.3 (apropos room state events)
A unique key which defines the overwriting semantics for this piece of room state.
@ -680,43 +527,18 @@ ircd::m::dbs::desc::state_key
key is event_idx number.
)",
// typing (key, value)
.type =
{
typeid(uint64_t), typeid(string_view)
},
// options
{},
// comparator
{},
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0,
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
size_t(_event__bloom__bits),
// expect queries hit
true,
// block size
size_t(state_key__block__size),
// meta_block size
size_t(state_key__meta_block__size),
// compression
string_view{state_key__comp},
.cache_size = bool(cache_enable)? -1 : 0,
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = size_t(_event__bloom__bits),
.expect_queries_hit = true,
.block_size = size_t(state_key__block__size),
.meta_block_size = size_t(state_key__meta_block__size),
.compression = string_view{state_key__comp},
};
//
@ -775,11 +597,8 @@ ircd::m::dbs::desc::origin_server_ts__cache_comp__size
const ircd::db::descriptor
ircd::m::dbs::desc::origin_server_ts
{
// name
"origin_server_ts",
// explanation
R"(Stores the origin_server_ts property of an event.
.name = "origin_server_ts",
.explain = R"(Stores the origin_server_ts property of an event.
FEDERATION 4.1
Timestamp in milliseconds on origin homeserver when this PDU was created.
@ -792,43 +611,18 @@ ircd::m::dbs::desc::origin_server_ts
)",
// typing (key, value)
.type =
{
typeid(uint64_t), typeid(time_t)
},
// options
{},
// comparator
{},
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0,
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
size_t(_event__bloom__bits),
// expect queries hit
true,
// block size
size_t(origin_server_ts__block__size),
// meta_block size
size_t(origin_server_ts__meta_block__size),
// compression
string_view{origin_server_ts__comp},
.cache_size = bool(cache_enable)? -1 : 0,
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = size_t(_event__bloom__bits),
.expect_queries_hit = true,
.block_size = size_t(origin_server_ts__block__size),
.meta_block_size = size_t(origin_server_ts__meta_block__size),
.compression = string_view{origin_server_ts__comp},
};
//
@ -887,53 +681,25 @@ ircd::m::dbs::desc::depth__cache_comp__size
const ircd::db::descriptor
ircd::m::dbs::desc::depth
{
// name
"depth",
// explanation
R"(Stores the depth property of an event.
.name = "depth",
.explain = R"(Stores the depth property of an event.
### developer note:
key is event_idx number. value is long integer
)",
// typing (key, value)
.type =
{
typeid(uint64_t), typeid(int64_t)
},
// options
{},
// comparator
{},
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0,
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
size_t(_event__bloom__bits),
// expect queries hit
true,
// block size
size_t(depth__block__size),
// meta_block size
size_t(depth__meta_block__size),
// compression
string_view{depth__comp},
.cache_size = bool(cache_enable)? -1 : 0,
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = size_t(_event__bloom__bits),
.expect_queries_hit = true,
.block_size = size_t(depth__block__size),
.meta_block_size = size_t(depth__meta_block__size),
.compression = string_view{depth__comp},
};
void

View file

@ -78,11 +78,8 @@ ircd::m::dbs::desc::event_horizon__pfx
const ircd::db::descriptor
ircd::m::dbs::desc::event_horizon
{
// name
"_event_horizon",
// explanation
R"(Unresolved references in the reverse reference graph of events.
.name = "_event_horizon",
.explain = R"(Unresolved references in the reverse reference graph of events.
event_id | event_idx => --
@ -101,49 +98,20 @@ ircd::m::dbs::desc::event_horizon
)",
// typing (key, value)
.type =
{
typeid(string_view), typeid(string_view)
},
// options
{},
// comparator
{},
// prefix transform
event_horizon__pfx,
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0, //uses conf item
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
0,
// expect queries hit
false,
// block size
size_t(event_horizon__block__size),
// meta_block size
size_t(event_horizon__meta_block__size),
// compression
string_view{event_horizon__comp},
// compactor
{},
// compaction priority algorithm
"kOldestSmallestSeqFirst"s,
.prefix = event_horizon__pfx,
.cache_size = bool(cache_enable)? -1 : 0, //uses conf item
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = 0,
.expect_queries_hit = false,
.block_size = size_t(event_horizon__block__size),
.meta_block_size = size_t(event_horizon__meta_block__size),
.compression = string_view{event_horizon__comp},
.compaction_pri = "kOldestSmallestSeqFirst"s,
};
//

View file

@ -68,11 +68,8 @@ ircd::m::dbs::desc::event_idx__bloom__bits
decltype(ircd::m::dbs::desc::event_idx)
ircd::m::dbs::desc::event_idx
{
// name
"_event_idx",
// explanation
R"(Maps matrix event_id strings into internal index numbers.
.name = "_event_idx",
.explain = R"(Maps matrix event_id strings into internal index numbers.
event_id => event_idx
@ -89,49 +86,19 @@ ircd::m::dbs::desc::event_idx
)",
// typing (key, value)
.type =
{
typeid(string_view), typeid(uint64_t)
},
// options
{},
// comparator
{},
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0, //uses conf item
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
size_t(event_idx__bloom__bits),
// expect queries hit
false,
// block size
size_t(event_idx__block__size),
// meta_block size
size_t(event_idx__meta_block__size),
// compression
string_view{event_idx__comp},
// compactor
{},
// compaction priority algorithm
"kOldestSmallestSeqFirst"s,
.cache_size = bool(cache_enable)? -1 : 0, //uses conf item
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = size_t(event_idx__bloom__bits),
.expect_queries_hit = false,
.block_size = size_t(event_idx__block__size),
.meta_block_size = size_t(event_idx__meta_block__size),
.compression = string_view{event_idx__comp},
.compaction_pri = "kOldestSmallestSeqFirst"s,
};
//

View file

@ -75,65 +75,27 @@ ircd::m::dbs::desc::event_json__file__size__max
const ircd::db::descriptor
ircd::m::dbs::desc::event_json
{
// name
"_event_json",
// explanation
R"(Full JSON object of an event.
.name = "_event_json",
.explain = R"(Full JSON object of an event.
event_idx => event_json
)",
// typing (key, value)
.type =
{
typeid(uint64_t), typeid(string_view)
},
// options
{},
// comparator
{},
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0, //uses conf item
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
size_t(event_json__bloom__bits),
// expect queries hit
true,
// block size
size_t(event_json__block__size),
// meta_block size
size_t(event_json__meta_block__size),
// compression
string_view{event_json__comp},
// compactor
{},
// compaction priority algorithm
"Universal"s,
// target_file_size
{
size_t(event_json__file__size__max), // base
1L, // multiplier
},
.cache_size = bool(cache_enable)? -1 : 0,
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = size_t(event_json__bloom__bits),
.expect_queries_hit = true,
.block_size = size_t(event_json__block__size),
.meta_block_size = size_t(event_json__meta_block__size),
.compression = string_view{event_json__comp},
.compaction_pri = "Universal"s,
.target_file_size = { size_t(event_json__file__size__max), 1L, },
};
//

View file

@ -107,11 +107,8 @@ ircd::m::dbs::desc::event_refs__cmp
const ircd::db::descriptor
ircd::m::dbs::desc::event_refs
{
// name
"_event_refs",
// explanation
R"(Inverse reference graph of events.
.name = "_event_refs",
.explain = R"(Inverse reference graph of events.
event_idx | ref, event_idx => --
@ -132,49 +129,21 @@ ircd::m::dbs::desc::event_refs
)",
// typing (key, value)
.type =
{
typeid(uint64_t), typeid(string_view)
},
// options
{},
// comparator
event_refs__cmp,
// prefix transform
event_refs__pfx,
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0, //uses conf item
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
0,
// expect queries hit
true,
// block size
size_t(event_refs__block__size),
// meta_block size
size_t(event_refs__meta_block__size),
// compression
string_view{event_refs__comp},
// compactor
{},
// compaction priority algorithm
"kOldestSmallestSeqFirst"s,
.cmp = event_refs__cmp,
.prefix = event_refs__pfx,
.cache_size = bool(cache_enable)? -1 : 0, //uses conf item
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = 0,
.expect_queries_hit = true,
.block_size = size_t(event_refs__block__size),
.meta_block_size = size_t(event_refs__meta_block__size),
.compression = string_view{event_refs__comp},
.compaction_pri = "kOldestSmallestSeqFirst"s,
};
//

View file

@ -89,10 +89,8 @@ const ircd::db::descriptor
ircd::m::dbs::desc::event_sender
{
// name
"_event_sender",
// explanation
R"(Index of senders to their events.
.name = "_event_sender",
.explain = R"(Index of senders to their events.
mxid | event_idx => --
origin | localpart, event_idx => --
@ -113,49 +111,20 @@ ircd::m::dbs::desc::event_sender
of an event. Only the "sender" data is used here.
)",
// typing (key, value)
.type =
{
typeid(string_view), typeid(string_view)
},
// options
{},
// comparator
{},
// prefix transform
event_sender__pfx,
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0, //uses conf item
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
0,
// expect queries hit
false,
// block size
size_t(event_sender__block__size),
// meta_block size
size_t(event_sender__meta_block__size),
// compression
string_view{event_sender__comp},
// compactor
{},
// compaction priority algorithm
"kOldestSmallestSeqFirst"s,
.prefix = event_sender__pfx,
.cache_size = bool(cache_enable)? -1 : 0, //uses conf item
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = 0,
.expect_queries_hit = false,
.block_size = size_t(event_sender__block__size),
.meta_block_size = size_t(event_sender__meta_block__size),
.compression = string_view{event_sender__comp},
.compaction_pri = "kOldestSmallestSeqFirst"s,
};
//

View file

@ -74,11 +74,8 @@ ircd::m::dbs::desc::event_state__cmp
const ircd::db::descriptor
ircd::m::dbs::desc::event_state
{
// name
"_event_state",
// explanation
R"(Index of states of events.
.name = "_event_state",
.explain = R"(Index of states of events.
state_key, type, room_id, depth, event_idx => --
@ -87,49 +84,20 @@ ircd::m::dbs::desc::event_state
)",
// typing (key, value)
.type =
{
typeid(string_view), typeid(string_view)
},
// options
{},
// comparator
event_state__cmp,
// prefix transform
{},
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0, //uses conf item
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
0,
// expect queries hit
false,
// block size
size_t(event_state__block__size),
// meta_block size
size_t(event_state__meta_block__size),
// compression
string_view{event_state__comp},
// compactor
{},
// compaction priority algorithm
"kOldestSmallestSeqFirst"s,
.cmp = event_state__cmp,
.cache_size = bool(cache_enable)? -1 : 0, //uses conf item
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = 0,
.expect_queries_hit = false,
.block_size = size_t(event_state__block__size),
.meta_block_size = size_t(event_state__meta_block__size),
.compression = string_view{event_state__comp},
.compaction_pri = "kOldestSmallestSeqFirst"s,
};
//

View file

@ -77,11 +77,8 @@ ircd::m::dbs::desc::event_type__pfx
const ircd::db::descriptor
ircd::m::dbs::desc::event_type
{
// name
"_event_type",
// explanation
R"(Index of types of events.
.name = "_event_type",
.explain = R"(Index of types of events.
type | event_idx => --
@ -90,49 +87,20 @@ ircd::m::dbs::desc::event_type
)",
// typing (key, value)
.type =
{
typeid(string_view), typeid(string_view)
},
// options
{},
// comparator
{},
// prefix transform
event_type__pfx,
// drop column
false,
// cache size
bool(cache_enable)? -1 : 0, //uses conf item
// cache size for compressed assets
bool(cache_comp_enable)? -1 : 0,
// bloom filter bits
0,
// expect queries hit
false,
// block size
size_t(event_type__block__size),
// meta_block size
size_t(event_type__meta_block__size),
// compression
string_view{event_type__comp},
// compactor
{},
// compaction priority algorithm
"kOldestSmallestSeqFirst"s,
.prefix = event_type__pfx,
.cache_size = bool(cache_enable)? -1 : 0, //uses conf item
.cache_size_comp = bool(cache_comp_enable)? -1 : 0,
.bloom_bits = 0,
.expect_queries_hit = false,
.block_size = size_t(event_type__block__size),
.meta_block_size = size_t(event_type__meta_block__size),
.compression = string_view{event_type__comp},
.compaction_pri = "kOldestSmallestSeqFirst"s,
};
//