EndpointSelector

fun interface EndpointSelector

Strategy that picks the next endpoint index from a cluster list on each call.

The selector receives size (the number of endpoints) and returns the index to use as the new current endpoint. The default implementation is RoundRobinEndpointSelector.

ServerClusterReconnect always calls next under its own atomicfu lock, so an implementation's per-call state need not be independently synchronized — but next must not suspend or block.

Inheritors

Functions

Link copied to clipboard
abstract fun next(size: Int): Int

Return the index of the next endpoint to use.