Comparison

teal-src/core/storagemanager.d.tl @ 12607:8943ae10f7e8

core.storagemanager: Convert old Typed Lua description file into Teal Still only a type definition. Typed Lua is no longer maintained. Teal is currently an active project.
author Kim Alvefur <zash@zash.se>
date Wed, 24 Mar 2021 20:23:38 +0100
parent 10838:doc/storage.tld@f26f2ec33f1e
child 12802:4a8740e01813
comparison
equal deleted inserted replaced
12606:6683beb96e01 12607:8943ae10f7e8
1 -- Storage local record API Description
2 --
3 -- This is written as a TypedLua description
4
5 -- Key-Value stores (the default)
6
7 local stanza = require"util.stanza".stanza_t
8
9 local record keyval_store
10 get : function ( keyval_store, string ) : any , string
11 set : function ( keyval_store, string, any ) : boolean, string
12 end
13
14 -- Map stores (key-key-value stores)
15
16 local record map_store
17 get : function ( map_store, string, any ) : any, string
18 set : function ( map_store, string, any, any ) : boolean, string
19 set_keys : function ( map_store, string, { any : any }) : boolean, string
20 remove : table
21 end
22
23 -- Archive stores
24
25 local record archive_query
26 start : number -- timestamp
27 ["end"]: number -- timestamp
28 with : string
29 after : string -- archive id
30 before : string -- archive id
31 total : boolean
32 end
33
34 local record archive_store
35 -- Optional set of capabilities
36 caps : {
37 -- Optional total count of matching items returned as second return value from :find()
38 string : any
39 }
40
41 -- Add to the archive
42 append : function ( archive_store, string, string, any, number, string ) : string, string
43
44 -- Iterate over archive
45 type iterator = function () : string, any, number, string
46 find : function ( archive_store, string, archive_query ) : iterator, integer
47
48 -- Removal of items. API like find. Optional
49 delete : function ( archive_store, string, archive_query ) : boolean | number, string
50
51 -- Array of dates which do have messages (Optional)
52 dates : function ( archive_store, string ) : { string }, string
53
54 -- Map of counts per "with" field
55 summary : function ( archive_store, string, archive_query ) : { string : integer }, string
56
57 -- Map-store API
58 get : function ( archive_store, string, string ) : stanza, number, string
59 get : function ( archive_store, string, string ) : nil, string
60 set : function ( archive_store, string, string, stanza, number, string ) : boolean, string
61 end
62
63 -- This represents moduleapi
64 local record coremodule
65 -- If the first string is omitted then the name of the module is used
66 -- The second string is one of "keyval" (default), "map" or "archive"
67 open_store : function (archive_store, string, string) : keyval_store, string
68 open_store : function (archive_store, string, string) : map_store, string
69 open_store : function (archive_store, string, string) : archive_store, string
70
71 -- Other module methods omitted
72 end
73
74 return coremodule