# HG changeset patch # User Kim Alvefur # Date 1455033296 -3600 # Node ID ca64255bf7cd2d4542fb863c5b0f7c4a0e8c03a9 # Parent 584d5229cb91f324a425cd106d4e2a01300c6764 storagemanager: Add set_keys method to map store shim diff -r 584d5229cb91 -r ca64255bf7cd core/storagemanager.lua --- a/core/storagemanager.lua Fri Aug 08 12:38:35 2014 +0200 +++ b/core/storagemanager.lua Tue Feb 09 16:54:56 2016 +0100 @@ -118,6 +118,23 @@ current[key] = data; return self.keyval_store:set(username, current); end; + set_keys = function (self, username, keydatas) + local current, err = self.keyval_store:get(username); + if current == nil then + if err then + return nil, err; + else + current = keydatas; + end + else + for k,v in pairs(keydatas) do + if v == self.remove then v = nil; end + current[k] = v; + end + end + return self.keyval_store:set(username, current); + end; + remove = {}; }; }