air/drain.bend fails
raw source on the hub · import 0x1efee7e6292e6267db2ca5c7e267456a/air/drain.bend as Drain
1 import
import Base
Types
type Tally source · line 31 · raw
Data
Open@n:U32 -> Tally
Draining@n:U32 -> Tally
Definitions
def Switch source · line 14 · raw
Data
def Switch.new source · line 17 · raw
IO(Chan(Unit))
def Switch.flip source · line 21 · raw
@switch:Chan(Unit) -> IO(Unit)
Flips the switch. Flipping it again does nothing.
def Switch.wait source · line 25 · raw
@switch:Chan(Unit) -> IO(Unit)
Returns once the switch is flipped.
def Tally.count source · line 35 · raw
@t:Tally -> U32
def Tally.admit source · line 43 · raw
@t:Tally -> Bool
Whether a new request may start.
def Tally.enter source · line 51 · raw
@t:Tally -> Tally
A request starts; none does while draining.
def Tally.leave source · line 58 · raw
@t:Tally -> Tally
def Tally.drain source · line 65 · raw
@t:Tally -> Tally
def Tally.clear source · line 73 · raw
@t:Tally -> Bool
Drained: no request in flight, and none admitted since.
def Gate source · line 83 · raw
Data
def Gate.new.go source · line 86 · raw
@gate:Chan(Tally) -> IO(Chan(Tally))
def Gate.new source · line 90 · raw
IO(Chan(Tally))
def swap.put source · line 93 · raw
@f:(@_:Tally -> Tally) -> @+gate:Chan(Tally) -> @t:Tally -> IO(Maybe<&1, Tally>)
def swap.go source · line 97 · raw
@f:(@_:Tally -> Tally) -> @+gate:Chan(Tally) -> @got:Maybe<&1, Tally> -> IO(Maybe<&1, Tally>)
def swap source · line 105 · raw
@f:(@_:Tally -> Tally) -> @+gate:Chan(Tally) -> IO(Maybe<&1, Tally>)
Replaces the tally with f of it and answers the old one.
def admitted source · line 108 · raw
@got:Maybe<&1, Tally> -> Bool
def cleared source · line 115 · raw
@got:Maybe<&1, Tally> -> Bool
def enter source · line 123 · raw
@+gate:Chan(Tally) -> IO(Bool)
A request starts: True when admitted, and then leave must follow.
def leave source · line 126 · raw
@+gate:Chan(Tally) -> IO(Unit)
def is_open source · line 129 · raw
@+gate:Chan(Tally) -> IO(Bool)
def close source · line 133 · raw
@+gate:Chan(Tally) -> IO(Unit)
Stops admitting requests.
def settled source · line 136 · raw
@+gate:Chan(Tally) -> IO(Bool)
def in_flight source · line 139 · raw
@got:Maybe<&1, Tally> -> U32
def count source · line 146 · raw
@+gate:Chan(Tally) -> IO(U32)
def poll source · line 150 · raw
U32
Polling period while draining, in ms.
def await source · line 153 · raw
@fuel:Nat -> @+gate:Chan(Tally) -> @done:Bool -> IO(Bool)
def wait_for source · line 167 · raw
@+gate:Chan(Tally) -> @+grace:U32 -> IO(Bool)
Waits up to grace ms for the requests in flight to finish. True when
they did.