Software /
code /
prosody
Annotate
teal-src/util/async.d.tl @ 12953:ebe3b2f96cad
mod_tokenauth: Switch to new token format (invalidates existing tokens!)
The new format has the following properties:
- 5 bytes longer than the previous format
- The token now has separate 'id' and 'secret' parts - the token itself is no
longer stored in the DB, and the secret part is hashed
- The only variable length field (JID) has been moved to the end
- The 'secret-token:' prefix (RFC 8959) is now included
Compatibility with the old token format was not maintained, and all previously
issued tokens are invalid after this commit (they will be removed from the DB
if used).
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 21 Mar 2023 14:33:29 +0000 |
parent | 12498:c3e47a5dd30d |
rev | line source |
---|---|
12498
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local record lib |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 ready : function () : boolean |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 waiter : function (num : integer, allow_many : boolean) : function (), function () |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 guarder : function () : function (id : function ()) : function () | nil |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 record runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 func : function (T) |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 thread : thread |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 enum state_e |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 -- from Lua manual |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 "running" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 "suspended" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 "normal" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 "dead" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 -- from util.async |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 "ready" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 "error" |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 end |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 state : state_e |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 notified_state : state_e |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 queue : { T } |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 type watcher_t = function (runner_t<T>, ... : any) |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 type watchers_t = { state_e : watcher_t } |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 data : any |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 id : string |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 run : function (runner_t<T>, T) : boolean, state_e, integer |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 enqueue : function (runner_t<T>, T) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 log : function (runner_t<T>, string, string, ... : any) |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
30 onready : function (runner_t<T>, function) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
31 onready : function (runner_t<T>, function) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 onwaiting : function (runner_t<T>, function) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 onerror : function (runner_t<T>, function) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
34 end |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 runner : function <T>(function (T), runner_t.watchers_t, any) : runner_t<T> |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 wait_for : function (any) : any, any |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 sleep : function (t:number) |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 -- set_nexttick = function(new_next_tick) next_tick = new_next_tick; end; |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 -- set_schedule_function = function (new_schedule_function) schedule_task = new_schedule_function; end; |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 end |
c3e47a5dd30d
util.async: Add Teal description file
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 return lib |