Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeartbeatChecker ¶
type HeartbeatChecker interface { StartCheckingHeartbeats(staleThresholdMs int, handler HeartbeatsStoppedHandler) error StopCheckingHeartbeats() }
A HeartbeatChecker checks _other_ nodes in the cluster for stale heartbeats and reacts by calling back the HeartbeatsStoppedHandler
type HeartbeatSender ¶
type HeartbeatSender interface { StartSendingHeartbeats(intervalMs int) error StopSendingHeartbeats() }
A HeartbeatSender sends heartbeats
type Heartbeater ¶
type Heartbeater interface { HeartbeatChecker HeartbeatSender }
A Heartbeater is something that can both send and check for heartbeats that are stored as documents in a Couchbase bucket
func NewCouchbaseHeartbeater ¶
func NewCouchbaseHeartbeater(couchbaseUrl, bucketName, keyPrefix, nodeUuid string) (Heartbeater, error)
Create a new CouchbaseHeartbeater, passing in the arguments needed to connect to Couchbase Server (url, bucket), the keyPrefix which will be prepended to the heartbeat doc keys, and the nodeUuid, which is an opaque identifier for the "thing" that is using this library. You can think of nodeUuid as a generic token, so put whatever you want there as long as it is unique to the node where this is running. (eg, an ip address could work)
type HeartbeatsStoppedHandler ¶
type HeartbeatsStoppedHandler interface {
StaleHeartBeatDetected(nodeUuid string)
}
This is the callback interface that clients of this library need to pass in to be notified when other nodes have appeared to have stopped sending heartbeats.