Class JoinBinding
java.lang.Object
ai.badmonkey.agentspaces.agent.join.JoinBinding
- All Implemented Interfaces:
AutoCloseable
The binder's runtime for one
@SpaceJoin method (SPEC ยง10.3, issue
#16). It owns what a hand-written join owns: a subscription per part, the
per-key state of which parts have arrived, the seed of that state from the
space on start (and again for any key it meets for the first time, so a key
forgotten after within is picked up from what the space still
holds), the re-read of the parts by key when a key completes, and the "once"
rule of the mode: an in-memory set in SpaceJoin.Mode.LOCAL, a
JoinTicket taken under a lease in SpaceJoin.Mode.LEASED, and
a ticket taken through the ordered-log coordinator in
SpaceJoin.Mode.ORDERED, where the first committed ticket claim per
key, as every member sees it in the same order, is the one that fires.
Constructed and started by AgentBinder; the action and the
dispatch it is given are the binder's method invocation and return handling,
so this class never reflects on the agent itself.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhat the binder configured.static final recordOne part as the binder resolved it: its type, its filtered template, the space it lives in (the join's by default; a part may name another), and where its key is. -
Constructor Summary
ConstructorsConstructorDescriptionJoinBinding(JoinBinding.Config config, Function<Joined, Object> action, Consumer<Object> dispatch, InstantSource clock) -
Method Summary
-
Constructor Details
-
JoinBinding
public JoinBinding(JoinBinding.Config config, Function<Joined, Object> action, Consumer<Object> dispatch, InstantSource clock) - Parameters:
config- what the binder resolved from the annotationaction- invokes the agent's method on the bag and returns its resultdispatch- the binder's return handling (entry, Tagged, Contribution, null)clock- the binder's clock
-
-
Method Details
-
name
The join's name, as tickets and the card carry it. -
start
public void start()Seeds the per-key state from the space, subscribes to every part, and starts the mode's loop. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-