Software /
code /
prosody
Annotate
plugins/mod_storage_none.lua @ 6969:31d8e1a8a014
mod_blocklist: Add comment about compliance issue #575
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 06 Dec 2015 02:08:24 +0100 |
parent | 6283:7cf6d3a2c855 |
child | 8058:1b35a562528d |
rev | line source |
---|---|
5425
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 local driver = {}; |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 local driver_mt = { __index = driver }; |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 |
6283
7cf6d3a2c855
mod_storage_{none,internal,sql}: Return error for unsupported (everything but keyval) store types
Kim Alvefur <zash@zash.se>
parents:
5425
diff
changeset
|
4 function driver:open(store, typ) |
7cf6d3a2c855
mod_storage_{none,internal,sql}: Return error for unsupported (everything but keyval) store types
Kim Alvefur <zash@zash.se>
parents:
5425
diff
changeset
|
5 if typ and typ ~= "keyval" then |
7cf6d3a2c855
mod_storage_{none,internal,sql}: Return error for unsupported (everything but keyval) store types
Kim Alvefur <zash@zash.se>
parents:
5425
diff
changeset
|
6 return nil, "unsupported-store"; |
7cf6d3a2c855
mod_storage_{none,internal,sql}: Return error for unsupported (everything but keyval) store types
Kim Alvefur <zash@zash.se>
parents:
5425
diff
changeset
|
7 end |
7cf6d3a2c855
mod_storage_{none,internal,sql}: Return error for unsupported (everything but keyval) store types
Kim Alvefur <zash@zash.se>
parents:
5425
diff
changeset
|
8 return setmetatable({ store = store, type = typ }, driver_mt); |
5425
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 end |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 function driver:get(user) |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 return {}; |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 end |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 function driver:set(user, data) |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 return nil, "Storage disabled"; |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
16 end |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 function driver:stores(username) |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 return { "roster" }; |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 end |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 function driver:purge(user) |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 return true; |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 end |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 |
b00812c6daf8
mod_storage_none: A null-like storage provider that returns all stores as empty, and fails to save anything to them
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 module:provides("storage", driver); |