clientfunk

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package clientfunk contains client-side types and utilities

Index

Constants

View Source
const ClusterfunkSchemaName = "cluster"

ClusterfunkSchemaName is the schema used for the connections. Each server connection uses clusterfunk://[endpointname] when resolving. This should be combined with the service config settings included in this package.

View Source
const GRPCServiceConfig = `{
	"loadBalancingPolicy": "round_robin"
}`

GRPCServiceConfig is the default service config for Clusterfunk clients. It will enable retries when the service is down but not when the call times out.

Variables

This section is empty.

Functions

func ConnectToManagement added in v0.0.7

ConnectToManagement is a convenience method to get a cluster management client directly. If the zeroConf parameter is set to true ZeroConf will be used to locate a cluster node. The clusterName parameter is optional if the client parameters are set.

Types

type Client added in v0.0.7

type Client interface {
	// Register an endpoint . Clients do not provide endpoints but if they
	// provide some other interface out to the rest of the world it's nice to
	// include it in the node metadata.
	RegisterEndpoint(name string, listenAddress string) error
	// WaitForEndpoint waits for an endpoint to become available.
	WaitForEndpoint(name string)
	// ServiceEndpoints lists all available service endpoints
	ServiceEndpoints(name string) []funk.Endpoint
	// ClusterEndpoitns lists all available cluster endpoints
	ClusterEndpoints(name string) []funk.Endpoint
	// Endpoints returns all of the available endpoints
	Endpoints() []funk.Endpoint
}

Client is a cluster client interface.

func NewClusterClient added in v0.0.7

func NewClusterClient(clusterName string, zeroConf bool, seedNodes []string, name string) (Client, error)

NewClusterClient creates a new cluster client. clusterName is the name of the cluster. If zeroConf is set to true mDNS/ZeroConf will be used to find a serf node to attach to. If the zeroConf parameter is set to false the seedNode parameter is used to attach to a Serf node.

type ManagementServerParameters added in v0.0.7

type ManagementServerParameters struct {
	Name             string `kong:"help='Cluster name',default='clusterfunk',short='n'"`
	Zeroconf         bool   `kong:"help='Use zeroconf discovery for Serf',default='true',short='z'"`
	Endpoint         string `kong:"help='gRPC management endpoint',short='e'"`
	TLS              bool   `kong:"help='TLS enabled for gRPC',short='T'"`
	CertFile         string `kong:"help='Client certificate for management service',type='existingfile',short='C'"`
	HostnameOverride string `kong:"help='Host name override for certificate',short='H'"`
}

ManagementServerParameters holds the gRPC and utility configuration

Jump to

Keyboard shortcuts

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