File

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
line wrap: on
line source

local record lib
	ready : function () : boolean
	waiter : function (num : integer, allow_many : boolean) : function (), function ()
	guarder : function () : function (id : function ()) : function () | nil
	record runner_t<T>
		func : function (T)
		thread : thread
		enum state_e
			-- from Lua manual
			"running"
			"suspended"
			"normal"
			"dead"

			-- from util.async
			"ready"
			"error"
		end
		state : state_e
		notified_state : state_e
		queue : { T }
		type watcher_t = function (runner_t<T>, ... : any)
		type watchers_t = { state_e : watcher_t }
		data : any
		id : string

		run : function (runner_t<T>, T) : boolean, state_e, integer
		enqueue : function (runner_t<T>, T) : runner_t<T>
		log : function (runner_t<T>, string, string, ... : any)
		onready : function (runner_t<T>, function) : runner_t<T>
		onready : function (runner_t<T>, function) : runner_t<T>
		onwaiting : function (runner_t<T>, function) : runner_t<T>
		onerror : function (runner_t<T>, function) : runner_t<T>
	end
	runner : function <T>(function (T), runner_t.watchers_t, any) : runner_t<T>
	wait_for : function (any) : any, any
	sleep : function (t:number)

	-- set_nexttick = function(new_next_tick) next_tick = new_next_tick; end;
	-- set_schedule_function = function (new_schedule_function) schedule_task = new_schedule_function; end;
end
return lib