aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-11-26 20:11:03 +0100
committerKim Alvefur <zash@zash.se>2016-11-26 20:11:03 +0100
commit728d74d8bf721e7f9377bcdeea7e456f15d0e856 (patch)
tree5fafe37e76936f880749432bffa3174a7ca120cd /doc
parentc8bbcabaf7597f13bace9e5aefc98ecb9e172796 (diff)
parent1b95aabe8959649223e49482b31eea221844d7a3 (diff)
downloadprosody-728d74d8bf721e7f9377bcdeea7e456f15d0e856.tar.gz
prosody-728d74d8bf721e7f9377bcdeea7e456f15d0e856.zip
Merge 0.10->trunk
Diffstat (limited to 'doc')
-rw-r--r--doc/storage.tld61
1 files changed, 61 insertions, 0 deletions
diff --git a/doc/storage.tld b/doc/storage.tld
new file mode 100644
index 00000000..f1d33e58
--- /dev/null
+++ b/doc/storage.tld
@@ -0,0 +1,61 @@
+-- Storage Interface API Description
+--
+-- This is written as a TypedLua description
+
+-- Key-Value stores (the default)
+
+interface keyval_store
+ get : ( self, string? ) -> (any) | (nil, string)
+ set : ( self, string?, any ) -> (boolean) | (nil, string)
+end
+
+-- Map stores (key-key-value stores)
+
+interface map_store
+ get : ( self, string?, any ) -> (any) | (nil, string)
+ set : ( self, string?, any, any ) -> (boolean) | (nil, string)
+ set_keys : ( self, string?, { any : any }) -> (boolean) | (nil, string)
+ remove : {}
+end
+
+-- Archive stores
+
+typealias archive_query = {
+ "start" : number?, -- timestamp
+ "end" : number?, -- timestamp
+ "with" : string?,
+ "after" : string?, -- archive id
+ "before" : string?, -- archive id
+ "total" : boolean?,
+}
+
+interface archive_store
+ -- Optional set of capabilities
+ caps : {
+ -- Optional total count of matching items returned as second return value from :find()
+ "total" : boolean?,
+ }?
+
+ -- Add to the archive
+ append : ( self, string?, string?, any, number?, string? ) -> (string) | (nil, string)
+
+ -- Iterate over archive
+ find : ( self, string?, archive_query? ) -> ( () -> ( string, any, number?, string? ), integer? )
+
+ -- Removal of items. API like find. Optional?
+ delete : ( self, string?, archive_query? ) -> (boolean) | (number) | (nil, string)
+
+ -- Array of dates which do have messages (Optional?)
+ dates : ( self, string? ) -> ({ string }) | (nil, string)
+end
+
+-- This represents moduleapi
+interface module
+ -- If the first string is omitted then the name of the module is used
+ -- The second string is one of "keyval" (default), "map" or "archive"
+ open_store : (self, string?, string?) -> (keyval_store) | (map_store) | (archive_store) | (nil, string)
+
+ -- Other module methods omitted
+end
+
+module : module