Changeset

5036:be33164aa97e

storagemanager: Split out driver choosing from the open() method
author Kim Alvefur <zash@zash.se>
date Sat, 28 Jul 2012 21:30:24 +0200
parents 5035:874cab7b4b3e
children 5037:c34fdcae6d29
files core/storagemanager.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/storagemanager.lua	Sat Jul 28 21:27:45 2012 +0200
+++ b/core/storagemanager.lua	Sat Jul 28 21:30:24 2012 +0200
@@ -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