A fence is a resetable deferred promise mechanism.
Calling fence() : promise
returns a deferred promise.
Calling resume(value)
fulfills the existing deferred promise and ratchets fence
to return a new deferred promise.
Calling abort(err)
rejects the existing deferred promise and ratchets fence
to return a new deferred promise.
-
ao_fence_v()
is the minimal version, return a list of:[fence(), reset(value), abort(err)]
. -
ao_fence_o(proto)
is the minimal object version, returning{__proto__: proto, fence, reset, abort}
. -
ao_fence_obj()
is the default object version of{fence, reset, abort}
supporting the Fence API. -
ao_fence_when()
creates a when-defined map usingao_fence_v
-
ao_fence_fn(tgt)
returns a list of[fence, reset, abort]
wheretgt
supports the Fence API. Whentgt
is absent,tgt = fence
is used. -
ao_fence_out()
returns an object of{fence, reset, abort}
supporting the Fence Output API. -
ao_fence_in()
returns an object of{fence, reset, abort}
supporting the Fence Input API. -
ao_fence_iter()
is a composition ofao_fence_obj
,ao_fence_out
, andaog_iter
to form anao_queue
with minimal dependencies. -
ao_fence_sink()
is a composition ofao_fence_obj
,ao_fence_out
, andaog_sink
to form anao_fold
with minimal dependencies. -
ao_feeder({g_in})
returns a closurev => g_in.next(v)
to drive anao_fence_out
instance -
ao_feeder_v({g_in})
returns a closure(...args) => g_in.next(args)
to drive anao_fence_out
instance
ao_fork()
-- an async iterable that emits successivefence()
responses.[Symbol.asyncIterator]()
-- alias forthis.ao_fork()
ao_check_done(v)
-- returns true when v is a validao_done
signal, otherwisethrow v
(see ao_fence_core_api from core/fence.jsy
)
TODO: Expound why core/fence_out.jsy
is useful outside of core/fence_in.jsy
.
Then add useful documentation.
[Symbol.asyncIterator]()
-- alias forthis.ao_bound()
async * ao_bound()
is dynamically bound async generator. Seebind_gated(f_gate)
allow_many()
-- allows implicit multipleao_fork
subscribed async iterators.ao_run()
-- on first call, invokesao_run(this.ao_bound())
to run async process and assignswhen_run
; returnswhen_run
promise.async * ao_gated(f_gate)
-- provides fence pulses that driveao_fork()
async * _ao_gated(f_gate)
-- implementation of fence pulses that driveao_fork()
bind_gated(f_gate) : this
-- bindsao_bound
to_ao_gated(f_gate)
(see core/fence_out.jsy
)
-
ao_fold(ns_gen)
-- alias forthis.ao_xform_run({xinit: aog_iter, ...ns_gen})
-
ao_queue(ns_gen)
-- alias forthis.ao_xform_run({xinit: aog_sink, ...ns_gen})
-
ao_xform(ns_gen)
-- sophisticated async generator composer.{xinit}
-- used to drivefence_in.xform()
{xemit}
-- used to wrap output generator{xrecv}
-- used inxinit
to transform beforexemit
; seeaog_iter
, andaog_sink
for examples.
-
aog_iter(xf)
-- initializer for blocking generator -
aog_sink(f_gate, xf)
-- initializer for async generator gated byf_gate
-
next(v) => {value, done}
return(v) => {value, done}
throw(err) => {value, done}
(see core/fence_in.jsy
)