Comparison

core/storagemanager.lua @ 6792:8b284787fe26

storagemanager: Add forward declaration to fix use of open() before it's defined
author Kim Alvefur <zash@zash.se>
date Thu, 20 Aug 2015 23:57:22 +0200
parent 6791:e813e8cf6046
child 6811:82350a06df6e
comparison
equal deleted inserted replaced
6791:e813e8cf6046 6792:8b284787fe26
98 current[key] = data; 98 current[key] = data;
99 return self.keyval_store:set(username, current); 99 return self.keyval_store:set(username, current);
100 end; 100 end;
101 }; 101 };
102 } 102 }
103
104 local open; -- forward declaration
105
103 local function create_map_shim(host, store) 106 local function create_map_shim(host, store)
104 local keyval_store, err = open(host, store, "keyval"); 107 local keyval_store, err = open(host, store, "keyval");
105 if keyval_store == nil then return nil, err end 108 if keyval_store == nil then return nil, err end
106 return setmetatable({ 109 return setmetatable({
107 keyval_store = keyval_store; 110 keyval_store = keyval_store;
108 }, map_shim_mt); 111 }, map_shim_mt);
109 end 112 end
110 113
111 local function open(host, store, typ) 114 function open(host, store, typ)
112 local driver, driver_name = get_driver(host, store); 115 local driver, driver_name = get_driver(host, store);
113 local ret, err = driver:open(store, typ); 116 local ret, err = driver:open(store, typ);
114 if not ret then 117 if not ret then
115 if err == "unsupported-store" then 118 if err == "unsupported-store" then
116 if typ == "map" then -- Use shim on top of keyval store 119 if typ == "map" then -- Use shim on top of keyval store