mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd:Ⓜ️:sync: Add flags component to since token.
This commit is contained in:
parent
d662bdaa3e
commit
9e96863922
3 changed files with 23 additions and 10 deletions
|
@ -13,10 +13,10 @@
|
|||
|
||||
namespace ircd::m::sync
|
||||
{
|
||||
using since = std::tuple<event::idx, event::idx>;
|
||||
using since = std::tuple<event::idx, event::idx, string_view>;
|
||||
|
||||
string_view make_since(const mutable_buffer &, const m::events::range &);
|
||||
string_view make_since(const mutable_buffer &, const int64_t &);
|
||||
string_view make_since(const mutable_buffer &, const m::events::range &, const string_view &flags = {});
|
||||
string_view make_since(const mutable_buffer &, const int64_t &, const string_view &flags = {});
|
||||
|
||||
since make_since(const string_view &);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ ircd::m::sync::for_each(const string_view &prefix,
|
|||
ircd::m::sync::since
|
||||
ircd::m::sync::make_since(const string_view &input)
|
||||
{
|
||||
string_view part[3];
|
||||
string_view part[4];
|
||||
const auto parts
|
||||
{
|
||||
input && input != "0"_sv?
|
||||
|
@ -124,29 +124,42 @@ ircd::m::sync::make_since(const string_view &input)
|
|||
part[2]?
|
||||
lex_cast<event::idx>(part[2]):
|
||||
0UL,
|
||||
|
||||
// flags
|
||||
part[3]
|
||||
};
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::m::sync::make_since(const mutable_buffer &buf,
|
||||
const int64_t &val)
|
||||
const int64_t &val,
|
||||
const string_view &flags)
|
||||
{
|
||||
return fmt::sprintf
|
||||
{
|
||||
buf, "ctor_%lu",
|
||||
val
|
||||
buf, "ctor_%lu%s%s",
|
||||
val,
|
||||
flags?
|
||||
"_0_"_sv:
|
||||
flags,
|
||||
flags,
|
||||
};
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::m::sync::make_since(const mutable_buffer &buf,
|
||||
const m::events::range &val)
|
||||
const m::events::range &val,
|
||||
const string_view &flags)
|
||||
{
|
||||
return fmt::sprintf
|
||||
{
|
||||
buf, "ctor_%lu_%lu",
|
||||
buf, "ctor_%lu_%lu%s%s",
|
||||
val.first,
|
||||
val.second,
|
||||
flags?
|
||||
"_"_sv:
|
||||
flags,
|
||||
flags,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ get__members(client &client,
|
|||
// an event_idx sequence integer, except during phased-polylog sync
|
||||
// when this is a negative integer. If this is phased sync, we can
|
||||
// parse this token for the snapshot integer.
|
||||
const auto &[since, snapshot]
|
||||
const auto &[since, snapshot, flags]
|
||||
{
|
||||
m::sync::make_since(at)
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue