mirror of
https://github.com/matrix-construct/construct
synced 2024-09-28 19:58:53 +02:00
ircd:Ⓜ️:state: Proper typedef for value closures.
This commit is contained in:
parent
57ed24f868
commit
af62b5f089
2 changed files with 7 additions and 6 deletions
|
@ -38,6 +38,7 @@ namespace ircd::m::state
|
||||||
constexpr int8_t MAX_HEIGHT { 16 }; // good for few mil at any degree :)
|
constexpr int8_t MAX_HEIGHT { 16 }; // good for few mil at any degree :)
|
||||||
|
|
||||||
using id_closure = std::function<void (const string_view &)>;
|
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 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 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 &)>;
|
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, const iter_bool_closure &);
|
||||||
size_t count(const string_view &head);
|
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 json::array &key, const val_closure &);
|
||||||
void get(const string_view &head, const string_view &type, const string_view &state_key, const id_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 id_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
|
/// JSON property name strings specifically for use in m::state
|
||||||
|
|
|
@ -38,7 +38,7 @@ void
|
||||||
ircd::m::state::get__room(const id::room &room_id,
|
ircd::m::state::get__room(const id::room &room_id,
|
||||||
const string_view &type,
|
const string_view &type,
|
||||||
const string_view &state_key,
|
const string_view &state_key,
|
||||||
const id_closure &closure)
|
const val_closure &closure)
|
||||||
{
|
{
|
||||||
char head[ID_MAX_SZ];
|
char head[ID_MAX_SZ];
|
||||||
return get(get_head(head, room_id), type, state_key, closure);
|
return get(get_head(head, room_id), type, state_key, closure);
|
||||||
|
@ -49,7 +49,7 @@ void
|
||||||
ircd::m::state::get(const string_view &head,
|
ircd::m::state::get(const string_view &head,
|
||||||
const string_view &type,
|
const string_view &type,
|
||||||
const string_view &state_key,
|
const string_view &state_key,
|
||||||
const id_closure &closure)
|
const val_closure &closure)
|
||||||
{
|
{
|
||||||
char key[KEY_MAX_SZ];
|
char key[KEY_MAX_SZ];
|
||||||
return get(head, make_key(key, type, state_key), closure);
|
return get(head, make_key(key, type, state_key), closure);
|
||||||
|
@ -62,7 +62,7 @@ ircd::m::state::get(const string_view &head,
|
||||||
void
|
void
|
||||||
ircd::m::state::get(const string_view &head,
|
ircd::m::state::get(const string_view &head,
|
||||||
const json::array &key,
|
const json::array &key,
|
||||||
const id_closure &closure)
|
const val_closure &closure)
|
||||||
{
|
{
|
||||||
char nextbuf[ID_MAX_SZ];
|
char nextbuf[ID_MAX_SZ];
|
||||||
string_view nextid{head};
|
string_view nextid{head};
|
||||||
|
|
Loading…
Reference in a new issue