Documentation ¶
Index ¶
Constants ¶
const ( RehashKeepDevice = "rehash_keep_device" RehashDisconnectDevice = "rehash_disconnect_device" RehashDisconnectAllCounter = "rehash_disconnect_all_count" RehashTimestamp = "rehash_timestamp" RehashDurationMilliseconds = "rehash_duration_ms" ReasonLabel = "reason" DisconnectAllServiceDiscoveryError = "sd_error" DisconnectAllServiceDiscoveryStopped = "sd_stopped" DisconnectAllServiceDiscoveryNoInstances = "sd_no_instances" )
const ( RehashError = "rehash-error" RehashOtherInstance = "rehash-other-instance" ServiceDiscoveryError = "service-discovery-error" ServiceDiscoveryStopped = "service-discovery-stopped" ServiceDiscoveryNoInstances = "service-discovery-no-instances" )
Variables ¶
This section is empty.
Functions ¶
func New ¶
New creates a monitor Listener which will rehash and disconnect devices in response to service discovery events from a given set of services. This function panics if the connector is nil, if no IsRegistered strategy is configured or if no services were provided to filter events.
If the returned listener encounters any service discovery error, all devices are disconnected. Otherwise, the IsRegistered strategy is used to determine which devices should still be connected to the Connector. Devices that hash to instances not registered in this environment are disconnected.
Types ¶
type Option ¶
type Option func(*rehasher)
Option is a configuration option for a rehasher
func WithAccessorFactory ¶
func WithAccessorFactory(af service.AccessorFactory) Option
WithAccessorFactory configures a rehasher with a specific factory for service.Accessor objects. If af is nil, the default accessor factory is used.
func WithIsRegistered ¶
WithIsRegistered configures a rehasher with a strategy for determining if a discovered service instance is registered as this process. There is no default.
func WithLogger ¶
WithLogger configures a rehasher with a logger, using the default logger if l is nil.
func WithMetricsProvider ¶
WithMetricsProvider configures a metrics subsystem the resulting rehasher will use to track things. A nil provider passed to this option means to discard all metrics.