mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
feat(server): Convert DbSlice
's AddOr*
to return AutoUpdater
(#2290)
* fix(server): Use AutoUpdater with AddOr* methods * Remove explicit calls * `operator=` * return *this * PostUpdate twice * exp it * bitops * remove explicit `Run()` * Explicitly `delete` copy ops * Remove `AddOrSkip()`
This commit is contained in:
parent
aaf01d4244
commit
dcedd1645e
15 changed files with 208 additions and 245 deletions
|
@ -52,16 +52,13 @@ inline OpStatus JsonReplaceVerifyNoOp(JsonType&) {
|
|||
|
||||
void SetJson(const OpArgs& op_args, string_view key, JsonType&& value) {
|
||||
auto& db_slice = op_args.shard->db_slice();
|
||||
DbIndex db_index = op_args.db_cntx.db_index;
|
||||
auto [it_output, added] = db_slice.AddOrFind(op_args.db_cntx, key);
|
||||
auto res = db_slice.AddOrFind(op_args.db_cntx, key);
|
||||
|
||||
op_args.shard->search_indices()->RemoveDoc(key, op_args.db_cntx, it_output->second);
|
||||
db_slice.PreUpdate(db_index, it_output);
|
||||
op_args.shard->search_indices()->RemoveDoc(key, op_args.db_cntx, res.it->second);
|
||||
|
||||
it_output->second.SetJson(std::move(value));
|
||||
res.it->second.SetJson(std::move(value));
|
||||
|
||||
db_slice.PostUpdate(db_index, it_output, key);
|
||||
op_args.shard->search_indices()->AddDoc(key, op_args.db_cntx, it_output->second);
|
||||
op_args.shard->search_indices()->AddDoc(key, op_args.db_cntx, res.it->second);
|
||||
}
|
||||
|
||||
string JsonTypeToName(const JsonType& val) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue