catalog

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectZoneName = "connect.consul"
	ServiceZoneName = "service.consul"
)
View Source
const FlightPathTag = "in-flightpath"

Variables

This section is empty.

Functions

func Hash

func Hash(l []ClusterInfo) string

Types

type Catalog

type Catalog struct {
	// contains filtered or unexported fields
}

Catalog interacts with consul and keeps a list of currently valid entities

func NewCatalog

func NewCatalog(ctx context.Context, client *api.Client) *Catalog

NewCatalog creates a new instance of Catalog

func (*Catalog) DiscoverClusters

func (c *Catalog) DiscoverClusters(clusters chan<- ClusterInfo, cleanup chan<- string)

DiscoverClusters delivers the state-of-the-world list of clusters as available in the consul catalog.

func (*Catalog) WatchTLS

func (c *Catalog) WatchTLS(service string, cert chan<- TLSInfo)

type CertFinder

type CertFinder interface {
	ConnectCALeaf(string, *api.QueryOptions) (*api.LeafCert, *api.QueryMeta, error)
}

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

func (*Cluster) Endpoints

func (c *Cluster) Endpoints() []Endpoint

func (*Cluster) Hash

func (c *Cluster) Hash() string

func (*Cluster) IsConnectEnabled

func (c *Cluster) IsConnectEnabled() bool

func (*Cluster) Name

func (c *Cluster) Name() string

func (*Cluster) Settings added in v0.0.5

func (c *Cluster) Settings() (*ClusterSettings, error)

TODO: right now we don't care about new or old cluster

settings. If these settings change across deployments
we'll just pick the latest one and work with that.
An upcoming version will support creating multiple
clusters per service e.g. canary, strand, etc
which will stick with their own cluster settings.

type ClusterInfo

type ClusterInfo interface {
	Name() string
	Endpoints() []Endpoint
	IsConnectEnabled() bool
	Hash() string
	Settings() (*ClusterSettings, error)
}

ClusterInfo represents a collection of service instances registered in consul catalog. A cluster represents only one type of service.

type ClusterSettings added in v0.0.5

type ClusterSettings struct {
	ConnTimeout          int64  `mapstructure:"flightpath-cluster-conn_timeout"`
	PerConnBufLimitBytes uint32 `mapstructure:"flightpath-cluster-per_conn_buf_limit_bytes"`
	MaxReqPerConn        uint32 `mapstructure:"flightpath-cluster-max_req_per_conn"`

	TcpKeepaliveProbes   uint32 `mapstructure:"flightpath-cluster-tcp_keepalive_probes"`
	TcpKeepaliveTime     uint32 `mapstructure:"flightpath-cluster-tcp_keepalive_time"`
	TcpKeepaliveInterval uint32 `mapstructure:"flightpath-cluster-tcp_keepalive_interval"`

	RetryOn             string `mapstructure:"flightpath-retry-on"`
	RetryAttempts       uint32 `mapstructure:"flightpath-retry-attempts"`
	RetryAttemptTimeout int64  `mapstructure:"flightpath-retry-per_try_timeout"`
	RetryBackoffBase    int64  `mapstructure:"flightpath-retry-backoff_base_interval"`
	RetryBackoffMax     int64  `mapstructure:"flightpath-retry-backoff_max_interval"`
}

func (*ClusterSettings) Canonicalize added in v0.0.5

func (cs *ClusterSettings) Canonicalize()

type Endpoint

type Endpoint struct {
	// contains filtered or unexported fields
}

Endpoint is the network address and port of the service instance.

func (*Endpoint) Addr

func (e *Endpoint) Addr() string

func (*Endpoint) DNSName

func (e *Endpoint) DNSName() string

func (*Endpoint) Name

func (e *Endpoint) Name() string

func (*Endpoint) Port

func (e *Endpoint) Port() int

func (*Endpoint) RoutingInfo

func (e *Endpoint) RoutingInfo() map[string][]string

type Route

type Route struct {
	// contains filtered or unexported fields
}

type RouteFinder

type RouteFinder interface {
	List(string, *api.QueryOptions) (api.KVPairs, *api.QueryMeta, error)
}

type RouteStorage

type RouteStorage struct {
	// contains filtered or unexported fields
}

func NewRouteStorage

func NewRouteStorage(ctx context.Context, prefix string, client *api.Client) *RouteStorage

func (*RouteStorage) WatchRoutes

func (i *RouteStorage) WatchRoutes(routes chan<- []Route, errs chan<- error)

type ServiceFinder

type ServiceFinder interface {
	Services(*api.QueryOptions) (map[string][]string, *api.QueryMeta, error)
	Service(string, string, *api.QueryOptions) ([]*api.CatalogService, *api.QueryMeta, error)
}

type TLSInfo

type TLSInfo interface {
	Serial() string
	Cert() string
	PKey() string
	ServiceName() string
}

Jump to

Keyboard shortcuts

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