From 74074bfc78f026f770c1039541f523e0835c8693 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 7 May 2019 16:03:22 -0700 Subject: [PATCH] modules/console: Add an event rewrite cmd. --- modules/console.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index b9c6e9344..3c15e245a 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -6511,6 +6511,40 @@ console_cmd__event__erase(opt &out, const string_view &line) return true; } +bool +console_cmd__event__rewrite(opt &out, const string_view &line) +{ + const params param{line, " ", + { + "event_id" + }}; + + const m::event::id &event_id + { + param.at("event_id") + }; + + const m::event::fetch event + { + event_id + }; + + m::dbs::write_opts opts; + opts.op = db::op::SET; + opts.event_idx = event.event_idx; + + db::txn txn{*m::dbs::events}; + m::dbs::write(txn, event, opts); + + out << "executing cells:" << txn.size() + << " " + << "size: " << pretty(iec(txn.bytes())) + << " for " << event_id << std::endl; + + txn(); + return true; +} + bool console_cmd__event__fetch(opt &out, const string_view &line) {