client

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2022 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*consul.Client
	// contains filtered or unexported fields
}

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

func (s *Client) GetNodeAddresses(onlyHealthy bool) ([]string, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL