src/queue.bend checks
raw source on the hub · import bend-kube-runtime@0.12.0.0/src/queue.bend as Queue
1 import
import Base
Types
type Action source · line 27 · raw
Data
Requeue: run again after ms. AwaitChange: run on the next change. Hold: not done yet (waiting on something outside), run again after ms; not a failure, and a finalizer cleanup that holds keeps its finalizer. Retry: failed; run again after the key's backoff. RetryIn: failed; run again after ms (an error that knows its delay, such as a 429's Retry-After). Both failures count toward the key's backoff and Ctx.fails.
Requeue@ms:U32 -> Action
AwaitChangeAction
Retry@msg:String -> Action
RetryIn@msg:String -> @ms:U32 -> Action
Hold@ms:U32 -> Action
type Queue source · line 34 · raw
Data
Queue@front:List<&2, String> -> @back:List<&2, String> -> @inq:Map<&2, U32> -> @running:Map<&2, U32> -> @dirty:Map<&2, U32> -> @gens:Map<&2, U32> -> @fails:Map<&2, U32> -> @nrun:U32 -> @max:U32 -> Queue
type Timer source · line 40 · raw
Data
A timer for the driver to start: wake key after ms with this generation.
Timer@key:String -> @gen:U32 -> @ms:U32 -> Timer
Definitions
def Queue.new source · line 43 · raw
@+max:U32 -> Queue
def Mp.has.fin source · line 50 · raw
@r:Pair(Map<&2, U32>, Bool) -> Bool
def Mp.has source · line 55 · raw
@+m:Map<&2, U32> -> @key:String -> Bool
def Mp.get.fin source · line 58 · raw
@r:Pair(Map<&2, U32>, U32) -> U32
def Mp.get source · line 63 · raw
@+m:Map<&2, U32> -> @key:String -> U32
def Mp.on source · line 66 · raw
@m:Map<&2, U32> -> @key:String -> Map<&2, U32>
def Mp.off source · line 69 · raw
@m:Map<&2, U32> -> @key:String -> Map<&2, U32>
def Mp.bump source · line 72 · raw
@+m:Map<&2, U32> -> @+key:String -> Map<&2, U32>
def Queue.add.go source · line 75 · raw
@f:List<&2, String> -> @b:List<&2, String> -> @inq:Map<&2, U32> -> @run:Map<&2, U32> -> @d:Map<&2, U32> -> @g:Map<&2, U32> -> @fl:Map<&2, U32> -> @n:U32 -> @mx:U32 -> @+key:String -> @running:Bool -> @waiting:Bool -> Queue
def Queue.add source · line 91 · raw
@q:Queue -> @+key:String -> Queue
Queues key unless it waits already; a running key is marked dirty instead. Either way its pending timer, if any, goes stale.
def Queue.add_all source · line 97 · raw
@ks:List<&2, String> -> @q:Queue -> Queue
def Queue.pop.flip source · line 104 · raw
@f:List<&2, String> -> @i:Map<&2, U32> -> @r:Map<&2, U32> -> @d:Map<&2, U32> -> @g:Map<&2, U32> -> @fl:Map<&2, U32> -> @+n:U32 -> @mx:U32 -> Pair(Queue, Maybe<&2, String>)
def Queue.pop.go source · line 112 · raw
@f:List<&2, String> -> @b:List<&2, String> -> @i:Map<&2, U32> -> @r:Map<&2, U32> -> @d:Map<&2, U32> -> @g:Map<&2, U32> -> @fl:Map<&2, U32> -> @+n:U32 -> @mx:U32 -> @free:Bool -> Pair(Queue, Maybe<&2, String>)
def Queue.pop source · line 128 · raw
@q:Queue -> Pair(Queue, Maybe<&2, String>)
The next waiting key, if a worker slot is free: it leaves the queue and starts running.
def Queue.pop_all.q source · line 133 · raw
@r:Pair(Queue, Maybe<&2, String>) -> Queue
def Queue.pop_all.acc source · line 138 · raw
@r:Pair(Queue, Maybe<&2, String>) -> @acc:List<&2, String> -> List<&2, String>
def Queue.pop_all source · line 146 · raw
@fuel:Nat -> @+q:Queue -> @acc:List<&2, String> -> Pair(Queue, List<&2, String>)
Every key that may start now, in queue order (fuel bounds the count).
def Queue.backoff.go source · line 153 · raw
@+fails:U32 -> @capped:Bool -> U32
def Queue.backoff source · line 164 · raw
@+fails:U32 -> U32
The delay after fails failures: 5ms doubling, at most 1000s.
def Queue.done.fails source · line 167 · raw
@+fl:Map<&2, U32> -> @+key:String -> @a:Action -> Map<&2, U32>
def Queue.done.dirty source · line 176 · raw
@q:Queue -> @+key:String -> @dirty:Bool -> Queue
def Queue.arm source · line 184 · raw
@q:Queue -> @+key:String -> @ms:U32 -> Pair(Queue, List<&2, Timer>)
Starts a timer for key, staling any earlier one.
def Queue.done.timer source · line 190 · raw
@q:Queue -> @+key:String -> @a:Action -> @+fails:U32 -> Pair(Queue, List<&2, Timer>)
def Queue.done.run source · line 203 · raw
@q:Queue -> @+key:String -> @+a:Action -> Pair(Queue, List<&2, Timer>)
def Queue.done.go source · line 211 · raw
@q:Queue -> @+key:String -> @+a:Action -> @running:Bool -> Pair(Queue, List<&2, Timer>)
def Queue.running source · line 221 · raw
@q:Queue -> @key:String -> Bool
def Queue.done source · line 229 · raw
@+q:Queue -> @+key:String -> @+a:Action -> Pair(Queue, List<&2, Timer>)
A run of key ended with an action. The key stops running; a dirty key is queued again at once; the action may ask for a timer. A key that is not running changes nothing.
def Queue.wake.go source · line 232 · raw
@q:Queue -> @+key:String -> @current:Bool -> Queue
def Queue.wake source · line 240 · raw
@q:Queue -> @+key:String -> @+gen:U32 -> Queue
A timer woke: the key is queued if the timer is still current.
def Queue.waiting source · line 245 · raw
@q:Queue -> @key:String -> Bool
def Queue.nrun source · line 250 · raw
@q:Queue -> U32
def Queue.forget.go source · line 258 · raw
@q:Queue -> @+key:String -> @busy:Bool -> Queue
def Queue.forget source · line 268 · raw
@+q:Queue -> @+key:String -> Queue
Drops what the queue remembers of a key whose object is gone (its timer generation and failures, as client-go's Forget does), so memory follows the live objects. A key still waiting or running keeps its state.
def Queue.forget_all source · line 271 · raw
@ks:List<&2, String> -> @q:Queue -> Queue
def Queue.depth source · line 279 · raw
@q:Queue -> U32
How many keys wait to run.
def Queue.fails source · line 285 · raw
@q:Queue -> @key:String -> U32
How many times in a row key has failed.