Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a convenience wrapper for an inner `*consul.Client`.
func New ¶
func New(conf config.ConsulOpts, serviceName string) (*Client, error)
New creates a new Consul client and returns a `*Client` to the caller.
func (*Client) GetNodeAddresses ¶
GetNodeAddresses queries the Consul Service Catalog for members of the `s.ServiceName`, constructs a slice of addresses in the format <ip>:<port> which it returns to the caller. When `onlyHealthy` is true Consul will only return nodes that are currently passing all health checks.
func (*Client) GetScalingOpts ¶
func (c *Client) GetScalingOpts() (*ScalingOpts, error)
GetScalingOpts fetches the count of Redis primary and replica nodes from KV path: "service/destServiceName/scaling", and return them as a `*ScalingOpts` to the caller.
type ScalingOpts ¶
type ScalingOpts struct { // PrimaryCount is the count of primary Redis nodes you expect to be present // in the final Redis Cluster. PrimaryCount int `yaml:"primary-count"` // ReplicaCount is the count of replica Redis nodes you expect to be present // in the final Redis Cluster. ReplicaCount int `yaml:"replica-count"` }
ScalingOpts defines the expected number of primary and replica nodes in the Redis Cluster being orchestrated by Attaché.
func (*ScalingOpts) NodesMissing ¶
func (s *ScalingOpts) NodesMissing(nodesInAwait int) int
NodesMissing returns the total count of expected replica and primary nodes minus nodesInAwait.
func (*ScalingOpts) ReplicasPerPrimary ¶
func (s *ScalingOpts) ReplicasPerPrimary() int
ReplicasPerPrimary returns the number of replica nodes per primary shard.