Class AggregateClient
java.lang.Object
ai.badmonkey.agentspaces.agent.capability.AggregateClient
The typed client for
aspace:cap/aggregate (spec §8, §10.5): a thin
wrapper over this group's PushSumAggregate, so application code joins
an aggregation epoch and reads the converging fleet average through
spaces.group("g").capability(AggregateClient.class).
Resolution, by the AggregateClient.Factory: a PushSumAggregate registered
locally through GroupContext.provide(...) backs the client; otherwise
one is created over the group's CapabilityPipes and peer sampler and
registered as this peer's provider, since every push-sum participant both
pushes and receives shares. Push-sum is symmetric, so there is no
consumer-only mode to resolve.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classResolvesAggregateClients; registered throughServiceLoader. -
Method Summary
Modifier and TypeMethodDescriptionawaitEstimate(String epochId, Duration timeout) Waits for the fleet's estimate of an epoch to become available: the first exchange of the peer tick's push-sum rounds.awaitSettled(String epochId, PushSumAggregate.Settle settle, Duration timeout) Blocks until the epoch's estimate has settled under the rule, or the timeout elapses; the procedural form ofonEstimate(Predicate, PushSumAggregate.Settle, Consumer)(ISSUE-OnEstimate).Returns the underlying aggregator.Returns the current estimate of the fleet average for an epoch.onEstimate(Predicate<String> epochs, PushSumAggregate.Settle settle, Consumer<PushSumAggregate.Estimate> listener) PushSumAggregate.onEstimate(Predicate, PushSumAggregate.Settle, Consumer): a listener fired once per matching epoch when it settles.Returns the current, unexpired advertisements of the aggregate capability in this group.Joins an aggregation epoch with this peer's local value.
-
Method Details
-
start
Joins an aggregation epoch with this peer's local value.- Parameters:
epochId- the epoch identifier agreed among participantslocalValue- this peer's contribution- Returns:
- this client
-
awaitEstimate
Waits for the fleet's estimate of an epoch to become available: the first exchange of the peer tick's push-sum rounds. Empty if none arrives within the timeout (no other participant, or the epoch never started).- Parameters:
epochId- the epochtimeout- how long to wait- Returns:
- the estimate once the exchange has run
-
estimate
Returns the current estimate of the fleet average for an epoch.- Parameters:
epochId- the epoch- Returns:
- the estimate, or empty when this peer never joined the epoch
-
onEstimate
public AutoCloseable onEstimate(Predicate<String> epochs, PushSumAggregate.Settle settle, Consumer<PushSumAggregate.Estimate> listener) PushSumAggregate.onEstimate(Predicate, PushSumAggregate.Settle, Consumer): a listener fired once per matching epoch when it settles. -
awaitSettled
public OptionalDouble awaitSettled(String epochId, PushSumAggregate.Settle settle, Duration timeout) Blocks until the epoch's estimate has settled under the rule, or the timeout elapses; the procedural form ofonEstimate(Predicate, PushSumAggregate.Settle, Consumer)(ISSUE-OnEstimate). -
providers
Returns the current, unexpired advertisements of the aggregate capability in this group.- Returns:
- the advertisements
-
capability
Returns the underlying aggregator.
-