0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd:Ⓜ️:event::fetch: Various fixes / minor reorg.

This commit is contained in:
Jason Volk 2019-01-16 17:53:47 -08:00
parent 147ec1763b
commit 1b9e306ff0
2 changed files with 23 additions and 13 deletions

View file

@ -52,7 +52,7 @@ struct ircd::m::event::fetch
fetch(const opts & = default_opts);
fetch(fetch &&) = delete;
fetch(const fetch &) = delete;
fetch &operator=(fetch &&) = default;
fetch &operator=(fetch &&) = delete;
fetch &operator=(const fetch &) = delete;
static bool event_id(const idx &, std::nothrow_t, const id::closure &);

View file

@ -1210,14 +1210,6 @@ const
};
}
//
// event::fetch
//
decltype(ircd::m::event::fetch::default_opts)
ircd::m::event::fetch::default_opts
{};
void
ircd::m::prefetch(const event::id &event_id,
const event::fetch::opts &opts)
@ -1554,9 +1546,13 @@ ircd::m::seek(event::fetch &fetch,
fetch._json.val()
};
event =
{
source, opts.keys
};
assert(data(event.source) == data(source));
assert(fetch.valid);
assert(!empty(source));
event = m::event{source, opts.keys};
return fetch.valid;
}
@ -1576,6 +1572,14 @@ ircd::m::seek(event::fetch &fetch,
return fetch.valid;
}
//
// event::fetch
//
decltype(ircd::m::event::fetch::default_opts)
ircd::m::event::fetch::default_opts
{};
void
ircd::m::event::fetch::event_id(const idx &idx,
const id::closure &closure)
@ -1595,9 +1599,14 @@ ircd::m::event::fetch::event_id(const idx &idx,
return get(std::nothrow, idx, "event_id", closure);
}
//
// event::fetch::fetch
//
/// Seekless constructor.
ircd::m::event::fetch::fetch(const opts &opts)
:_json
:event{}
,_json
{
m::dbs::event_json,
string_view{},
@ -1668,7 +1677,8 @@ ircd::m::event::fetch::fetch(const event::idx &event_idx,
}
{
if(likely(event_idx))
seek(*this, event_idx, std::nothrow, opts);
if(!seek(*this, event_idx, std::nothrow, opts))
assert(!valid);
}
//