ircd:Ⓜ️ Add dbs::opts passed to room::purge and event::purge interfaces.
This commit is contained in:
parent
8d634fb901
commit
08753dc254
|
@ -11,6 +11,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#define HAVE_IRCD_M_EVENT_PURGE_H
|
#define HAVE_IRCD_M_EVENT_PURGE_H
|
||||||
|
|
||||||
|
//XXX fwd decl
|
||||||
|
namespace ircd::m::dbs
|
||||||
|
{
|
||||||
|
struct opts;
|
||||||
|
}
|
||||||
|
|
||||||
/// Erase an event from the database.
|
/// Erase an event from the database.
|
||||||
///
|
///
|
||||||
/// Purging an event will erase its data and metadata, including applying
|
/// Purging an event will erase its data and metadata, including applying
|
||||||
|
@ -30,7 +36,10 @@
|
||||||
struct ircd::m::event::purge
|
struct ircd::m::event::purge
|
||||||
:returns<bool>
|
:returns<bool>
|
||||||
{
|
{
|
||||||
|
purge(db::txn &, const event::idx &, const event &, dbs::opts);
|
||||||
purge(db::txn &, const event::idx &, const event &);
|
purge(db::txn &, const event::idx &, const event &);
|
||||||
|
purge(db::txn &, const event::idx &, dbs::opts);
|
||||||
purge(db::txn &, const event::idx &);
|
purge(db::txn &, const event::idx &);
|
||||||
|
purge(const event::idx &, dbs::opts);
|
||||||
purge(const event::idx &);
|
purge(const event::idx &);
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,6 +42,9 @@ struct ircd::m::room::purge
|
||||||
/// Options for purge
|
/// Options for purge
|
||||||
struct ircd::m::room::purge::opts
|
struct ircd::m::room::purge::opts
|
||||||
{
|
{
|
||||||
|
/// Lower-level options passed to event::purge and dbs::
|
||||||
|
dbs::opts wopts;
|
||||||
|
|
||||||
/// Limit purge to the index window
|
/// Limit purge to the index window
|
||||||
pair<event::idx> idx
|
pair<event::idx> idx
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,17 @@
|
||||||
// full license for this software is available in the LICENSE file.
|
// full license for this software is available in the LICENSE file.
|
||||||
|
|
||||||
ircd::m::event::purge::purge(const event::idx &event_idx)
|
ircd::m::event::purge::purge(const event::idx &event_idx)
|
||||||
|
:purge
|
||||||
|
{
|
||||||
|
event_idx, dbs::opts
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ircd::m::event::purge::purge(const event::idx &event_idx,
|
||||||
|
dbs::opts opts)
|
||||||
:returns{false}
|
:returns{false}
|
||||||
{
|
{
|
||||||
assert(m::dbs::events);
|
assert(m::dbs::events);
|
||||||
|
@ -17,7 +28,7 @@ ircd::m::event::purge::purge(const event::idx &event_idx)
|
||||||
*m::dbs::events
|
*m::dbs::events
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!purge(txn, event_idx))
|
if(!purge(txn, event_idx, opts))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
txn();
|
txn();
|
||||||
|
@ -26,6 +37,18 @@ ircd::m::event::purge::purge(const event::idx &event_idx)
|
||||||
|
|
||||||
ircd::m::event::purge::purge(db::txn &txn,
|
ircd::m::event::purge::purge(db::txn &txn,
|
||||||
const event::idx &event_idx)
|
const event::idx &event_idx)
|
||||||
|
:purge
|
||||||
|
{
|
||||||
|
txn, event_idx, dbs::opts
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ircd::m::event::purge::purge(db::txn &txn,
|
||||||
|
const event::idx &event_idx,
|
||||||
|
dbs::opts opts)
|
||||||
:returns{false}
|
:returns{false}
|
||||||
{
|
{
|
||||||
const m::event::fetch event
|
const m::event::fetch event
|
||||||
|
@ -36,15 +59,27 @@ ircd::m::event::purge::purge(db::txn &txn,
|
||||||
if(!event.valid)
|
if(!event.valid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ret = purge(txn, event_idx, event);
|
ret = purge(txn, event_idx, event, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::m::event::purge::purge(db::txn &txn,
|
ircd::m::event::purge::purge(db::txn &txn,
|
||||||
const event::idx &event_idx,
|
const event::idx &event_idx,
|
||||||
const event &event)
|
const event &event)
|
||||||
|
:purge
|
||||||
|
{
|
||||||
|
txn, event_idx, event, dbs::opts
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ircd::m::event::purge::purge(db::txn &txn,
|
||||||
|
const event::idx &event_idx,
|
||||||
|
const event &event,
|
||||||
|
dbs::opts opts)
|
||||||
:returns{false}
|
:returns{false}
|
||||||
{
|
{
|
||||||
m::dbs::opts opts;
|
|
||||||
opts.op = db::op::DELETE;
|
opts.op = db::op::DELETE;
|
||||||
opts.event_idx = event_idx;
|
opts.event_idx = event_idx;
|
||||||
m::dbs::write(txn, event, opts);
|
m::dbs::write(txn, event, opts);
|
||||||
|
|
|
@ -98,7 +98,7 @@ ircd::m::room::purge::state()
|
||||||
|
|
||||||
const auto purged
|
const auto purged
|
||||||
{
|
{
|
||||||
event::purge(txn, event_idx, event)
|
event::purge(txn, event_idx, event, opts.wopts)
|
||||||
};
|
};
|
||||||
|
|
||||||
ret += purged;
|
ret += purged;
|
||||||
|
@ -133,7 +133,7 @@ ircd::m::room::purge::timeline()
|
||||||
|
|
||||||
const bool purged
|
const bool purged
|
||||||
{
|
{
|
||||||
event::purge(txn, it.event_idx(), event)
|
event::purge(txn, it.event_idx(), event, opts.wopts)
|
||||||
};
|
};
|
||||||
|
|
||||||
ret += purged;
|
ret += purged;
|
||||||
|
|
Loading…
Reference in New Issue