Mercurial > prosody-hg
comparison plugins/mod_storage_internal.lua @ 4085:7699cef04740
storagemanager, mod_storage_internal: Split out default driver to mod_storage_internal, and greatly simplify storagemanager's error handling and fallback code
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 07 Jan 2011 04:22:28 +0000 |
| parents | |
| children | c64b5081bfa8 |
comparison
equal
deleted
inserted
replaced
| 4084:680df3c635c6 | 4085:7699cef04740 |
|---|---|
| 1 local datamanager = require "core.storagemanager".olddm; | |
| 2 | |
| 3 local host = module.host; | |
| 4 | |
| 5 local driver = { name = "internal" }; | |
| 6 local driver_mt = { __index = driver }; | |
| 7 | |
| 8 function driver:open(store) | |
| 9 return setmetatable({ store = store }, driver_mt); | |
| 10 end | |
| 11 function driver:get(user) | |
| 12 return datamanager.load(user, host, self.store); | |
| 13 end | |
| 14 | |
| 15 function driver:set(user, data) | |
| 16 return datamanager.store(user, host, self.store, data); | |
| 17 end | |
| 18 | |
| 19 module:add_item("data-driver", driver); |
