0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-26 22:08:20 +02:00

ircd:Ⓜ️:state: Proper typedef for value closures.

This commit is contained in:
Jason Volk 2018-02-05 19:02:37 -08:00
parent 57ed24f868
commit af62b5f089
2 changed files with 7 additions and 6 deletions

View file

@ -38,6 +38,7 @@ namespace ircd::m::state
constexpr int8_t MAX_HEIGHT { 16 }; // good for few mil at any degree :)
using id_closure = std::function<void (const string_view &)>;
using val_closure = std::function<void (const string_view &)>;
using node_closure = std::function<void (const json::object &)>;
using search_closure = std::function<bool (const json::array &, const string_view &, const uint &, const uint &)>;
using iter_closure = std::function<void (const json::array &, const string_view &)>;
@ -66,9 +67,9 @@ namespace ircd::m::state
size_t count(const string_view &head, const iter_bool_closure &);
size_t count(const string_view &head);
void get(const string_view &head, const json::array &key, const id_closure &);
void get(const string_view &head, const string_view &type, const string_view &state_key, const id_closure &);
void get__room(const id::room &, const string_view &type, const string_view &state_key, const id_closure &);
void get(const string_view &head, const json::array &key, const val_closure &);
void get(const string_view &head, const string_view &type, const string_view &state_key, const val_closure &);
void get__room(const id::room &, const string_view &type, const string_view &state_key, const val_closure &);
}
/// JSON property name strings specifically for use in m::state

View file

@ -38,7 +38,7 @@ void
ircd::m::state::get__room(const id::room &room_id,
const string_view &type,
const string_view &state_key,
const id_closure &closure)
const val_closure &closure)
{
char head[ID_MAX_SZ];
return get(get_head(head, room_id), type, state_key, closure);
@ -49,7 +49,7 @@ void
ircd::m::state::get(const string_view &head,
const string_view &type,
const string_view &state_key,
const id_closure &closure)
const val_closure &closure)
{
char key[KEY_MAX_SZ];
return get(head, make_key(key, type, state_key), closure);
@ -62,7 +62,7 @@ ircd::m::state::get(const string_view &head,
void
ircd::m::state::get(const string_view &head,
const json::array &key,
const id_closure &closure)
const val_closure &closure)
{
char nextbuf[ID_MAX_SZ];
string_view nextid{head};