Diff

core/storagemanager.lua @ 5043:2856e1cfbe95

Merge with Zash
author Matthew Wild <mwild1@gmail.com>
date Sat, 28 Jul 2012 20:59:03 +0100
parent 5041:be204204cc5f
child 5110:72a7427368f8
line wrap: on
line diff
--- a/core/storagemanager.lua	Sat Jul 28 18:50:04 2012 +0100
+++ b/core/storagemanager.lua	Sat Jul 28 20:59:03 2012 +0100
@@ -58,7 +58,7 @@
 	return stores_available:get(host, driver_name);
 end
 
-function open(host, store, typ)
+function get_driver(host, store)
 	local storage = config.get(host, "core", "storage");
 	local driver_name;
 	local option_type = type(storage);
@@ -77,7 +77,11 @@
 		driver_name = "null";
 		driver = null_storage_driver;
 	end
+	return driver, driver_name;
+	end
 	
+function open(host, store, typ)
+	local driver, driver_name = get_driver(host, store);
 	local ret, err = driver:open(store, typ);
 	if not ret then
 		if err == "unsupported-store" then
@@ -96,5 +100,11 @@
 function datamanager.store(username, host, datastore, data)
 	return open(host, datastore):set(username, data);
 end
+function datamanager.list_stores(username, host)
+	return get_driver(host):list_stores(username, host);
+end
+function datamanager.purge(username, host)
+	return get_driver(host):purge(username, host);
+end
 
 return _M;