From 52a9ca96355a86b96425cbf5c9a1741ddff8e44d Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 15 Jan 2019 15:35:12 -0800 Subject: [PATCH] ircd::m::vm: Add json vm option. --- include/ircd/m/vm.h | 7 +++++++ modules/vm.cc | 1 + 2 files changed, 8 insertions(+) diff --git a/include/ircd/m/vm.h b/include/ircd/m/vm.h index 28472634e..ce6b8bcb8 100644 --- a/include/ircd/m/vm.h +++ b/include/ircd/m/vm.h @@ -157,6 +157,13 @@ struct ircd::m::vm::opts /// true or false for all events in a room. bool history {true}; + /// Toggles whether full json is written to the database. It provides read + /// optimization when all columns of an event are sought. Luckily the + /// database is well- compressed. It must be used if there are possibly + /// unrecognized keys in an event otherwise they will be lost. Note cost + /// in space-amplification and redundant data; true unless you know better. + bool json {true}; + /// Bypass check for event having already been evaluated so it can be /// replayed through the system (not recommended). bool replays {false}; diff --git a/modules/vm.cc b/modules/vm.cc index 5a03e3cc6..d4846ae84 100644 --- a/modules/vm.cc +++ b/modules/vm.cc @@ -686,6 +686,7 @@ ircd::m::vm::_write(eval &eval, wopts.history = opts.history; wopts.head = opts.head; wopts.refs = opts.refs; + wopts.json = opts.json; wopts.event_idx = eval.sequence; if(at<"type"_>(event) == "m.room.create")