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

ircd:Ⓜ️:event: Document class member related.

This commit is contained in:
Jason Volk 2019-07-25 13:59:12 -07:00
parent cdae254e14
commit ddcce0ef2b
2 changed files with 31 additions and 20 deletions

View file

@ -130,10 +130,21 @@ struct ircd::m::event
static sha256::buf hash(const json::object &);
static json::object hashes(const mutable_buffer &, json::iov &event, const string_view &content);
m::event::id event_id;
json::object source; // Contextual availability only.
/// For json::object constructions, the source JSON (string_view) is
/// carried with the m::event instance. This is important to convey
/// additional keys not enumerated in the m::event tuple. This will be
/// default-initialized for other constructions when no source JSON buffer
/// is available.
json::object source;
explicit operator id() const;
/// Always set for PDU's, not set for EDU's. The reference to the event_id
/// for this event. For v1 events, this may point to somewhere inside the
/// source; otherwise the event source may have been hashed into a buffer
/// near the construction site, or retrieved from db, etc.
id event_id;
/// Convenience morphism
explicit operator const id &() const;
event(const json::object &, const id &, const keys &);
event(const json::object &, const id &);
@ -159,7 +170,7 @@ struct ircd::m::event
#include "pretty.h"
inline ircd::m::event::operator
id()
const id &()
const
{
return event_id;

View file

@ -4117,16 +4117,16 @@ ircd::m::event::event(const json::object &source)
{
source
}
,source
{
source
}
,event_id
{
defined(json::get<"event_id"_>(*this))?
id{json::get<"event_id"_>(*this)}:
id{},
}
,source
{
source
}
{
}
@ -4136,16 +4136,16 @@ ircd::m::event::event(const json::object &source,
{
source, keys
}
,source
{
source
}
,event_id
{
defined(json::get<"event_id"_>(*this))?
id{json::get<"event_id"_>(*this)}:
id{},
}
,source
{
source
}
{
}
@ -4176,6 +4176,10 @@ ircd::m::event::event(const json::object &source,
{
source
}
,source
{
source
}
,event_id
{
event_id?
@ -4184,10 +4188,6 @@ ircd::m::event::event(const json::object &source,
id{json::get<"event_id"_>(*this)}:
id{},
}
,source
{
source
}
{
}
@ -4198,6 +4198,10 @@ ircd::m::event::event(const json::object &source,
{
source, keys
}
,source
{
source
}
,event_id
{
event_id?
@ -4206,9 +4210,5 @@ ircd::m::event::event(const json::object &source,
id{json::get<"event_id"_>(*this)}:
id{},
}
,source
{
source
}
{
}