Package discord4j.core.shard
Interface ShardCoordinator
-
- All Known Implementing Classes:
LocalShardCoordinator
public interface ShardCoordinator
AShardCoordinator
defines key operations to leverage shard coordination across boundaries.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Mono<Integer>
getConnectedCount()
Return the number of currently connected shards.PayloadTransformer
getIdentifyLimiter(ShardInfo shardInfo, int maxConcurrency)
Returns a transformation function for a sequence of payloads that can be held or delayed in order to successfully identify multiple shards in a coordinated manner.Mono<Void>
publishConnected(ShardInfo shardInfo)
Notifies this coordinator that a given shard has connected successfully.Mono<Void>
publishDisconnected(ShardInfo shardInfo, SessionInfo sessionInfo)
Notifies this coordinator that a given shard has disconnected.
-
-
-
Method Detail
-
getIdentifyLimiter
PayloadTransformer getIdentifyLimiter(ShardInfo shardInfo, int maxConcurrency)
Returns a transformation function for a sequence of payloads that can be held or delayed in order to successfully identify multiple shards in a coordinated manner.- Parameters:
shardInfo
- the shard from where to retrieve the limitermaxConcurrency
- the number of shards that can be concurrently identified- Returns:
- a
PayloadTransformer
allowing IDENTIFY payload coordination across shards
-
publishConnected
Mono<Void> publishConnected(ShardInfo shardInfo)
Notifies this coordinator that a given shard has connected successfully. Can be used to signal other shards for authentication.- Parameters:
shardInfo
- the connected shard details- Returns:
- a
Mono
indicating when this operation has completed
-
publishDisconnected
Mono<Void> publishDisconnected(ShardInfo shardInfo, @Nullable SessionInfo sessionInfo)
Notifies this coordinator that a given shard has disconnected.- Parameters:
shardInfo
- the disconnected shard detailssessionInfo
- the disconnected shard session details to resume, ornull
if resume is not available- Returns:
- a
Mono
indicating when this operation has completed
-
-