Software /
code /
prosody
Annotate
teal-src/core/storagemanager.d.tl @ 12945:d2c1c327a4d1
util.sasl.{scram,plain}: Pass authzid to SASL profile callback
For potential future use.
Used for logging into a different account than the one used for
authentication.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 16 Mar 2023 13:57:30 +0100 |
parent | 12802:4a8740e01813 |
rev | line source |
---|---|
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
1 -- Storage local record API Description |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 -- |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 -- This is written as a TypedLua description |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 -- Key-Value stores (the default) |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
7 local stanza = require"util.stanza".stanza_t |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
8 |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
9 local record keyval_store |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
10 get : function ( keyval_store, string ) : any , string |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
11 set : function ( keyval_store, string, any ) : boolean, string |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 end |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 -- Map stores (key-key-value stores) |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
16 local record map_store |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
17 get : function ( map_store, string, any ) : any, string |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
18 set : function ( map_store, string, any, any ) : boolean, string |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
19 set_keys : function ( map_store, string, { any : any }) : boolean, string |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
20 remove : table |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 end |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 -- Archive stores |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
25 local record archive_query |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
26 start : number -- timestamp |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
27 ["end"]: number -- timestamp |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
28 with : string |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
29 after : string -- archive id |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
30 before : string -- archive id |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
31 total : boolean |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
32 end |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
34 local record archive_store |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 -- Optional set of capabilities |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 caps : { |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 -- Optional total count of matching items returned as second return value from :find() |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
38 string : any |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
39 } |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 -- Add to the archive |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
42 append : function ( archive_store, string, string, any, number, string ) : string, string |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
43 |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
44 -- Iterate over archive |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
45 type iterator = function () : string, any, number, string |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
46 find : function ( archive_store, string, archive_query ) : iterator, integer |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
47 |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
48 -- Removal of items. API like find. Optional |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
49 delete : function ( archive_store, string, archive_query ) : boolean | number, string |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
50 |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
51 -- Array of dates which do have messages (Optional) |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
52 dates : function ( archive_store, string ) : { string }, string |
9903
2c5546cc5c70
mod_storage_internal: Implement a summary API returning message counts per contact
Kim Alvefur <zash@zash.se>
parents:
7744
diff
changeset
|
53 |
2c5546cc5c70
mod_storage_internal: Implement a summary API returning message counts per contact
Kim Alvefur <zash@zash.se>
parents:
7744
diff
changeset
|
54 -- Map of counts per "with" field |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
55 summary : function ( archive_store, string, archive_query ) : { string : integer }, string |
10838
f26f2ec33f1e
doc/storage: Add archive store map-like API
Kim Alvefur <zash@zash.se>
parents:
9903
diff
changeset
|
56 |
f26f2ec33f1e
doc/storage: Add archive store map-like API
Kim Alvefur <zash@zash.se>
parents:
9903
diff
changeset
|
57 -- Map-store API |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
58 get : function ( archive_store, string, string ) : stanza, number, string |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
59 get : function ( archive_store, string, string ) : nil, string |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
60 set : function ( archive_store, string, string, stanza, number, string ) : boolean, string |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
61 end |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
62 |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
63 -- This represents moduleapi |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
64 local record coremodule |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
65 -- If the first string is omitted then the name of the module is used |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
66 -- The second string is one of "keyval" (default), "map" or "archive" |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
67 open_store : function (archive_store, string, string) : keyval_store, string |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
68 open_store : function (archive_store, string, string) : map_store, string |
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
69 open_store : function (archive_store, string, string) : archive_store, string |
7744
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
70 |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
71 -- Other module methods omitted |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
72 end |
4d9186d990a5
doc: Add a description of the Storage API in TypedLua format
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
73 |
12607
8943ae10f7e8
core.storagemanager: Convert old Typed Lua description file into Teal
Kim Alvefur <zash@zash.se>
parents:
10838
diff
changeset
|
74 return coremodule |