d2

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultInitialUriWatchTimeout = 10 * time.Second

Variables

Functions

func ClustersPath added in v0.1.1

func ClustersPath(cluster string) string

func EnableD2Logging added in v0.1.1

func EnableD2Logging()

func ServicesPath

func ServicesPath(service string) string

func UrisPath

func UrisPath(clusterName string) string

Types

type Client

type Client struct {
	Conn *zk.Conn
	// During the initial listing of the /d2/uris node for a new cluster, this duration specifies how long to for the
	// first host to show up. If the /d2/services node exists for a service, it is impossible to know whether or not a
	// host will ever show up in the /d2/uris node for that service, which is why this timeout is provided.
	// A positive value will be used as-is, a 0 value will default to DefaultInitialUriWatchTimeout and a negative value
	// disables the timeout altogether
	InitialZkWatchTimeout time.Duration
	// contains filtered or unexported fields
}

func (*Client) ResolveHostnameAndContextForQuery added in v1.0.3

func (c *Client) ResolveHostnameAndContextForQuery(rootResource string, _ *url.URL) (*url.URL, error)

func (*Client) SingleServiceClient added in v1.0.3

func (c *Client) SingleServiceClient(serviceName string) *SingleServiceClient

SingleServiceClient will always return URIs from the given serviceName instead of getting them from the service specified in resourceBaseName in ResolveHostnameAndContextForQuery. Some services announce to special D2 cluster instead of the resource name (i.e. by default, the service name is equal to the resource name).

type Cluster added in v0.1.1

type Cluster struct {
	ClusterName         string `json:"clusterName"`
	PartitionProperties struct {
		HashAlgorithm     string `json:"hashAlgorithm"`
		PartitionCount    int    `json:"partitionCount"`
		PartitionKeyRegex string `json:"partitionKeyRegex"`
		PartitionType     string `json:"partitionType"`
	} `json:"partitionProperties"`
}

type Service

type Service struct {
	Path                        string
	ClusterName                 string   `json:"clusterName"`
	PrioritizedSchemes          []string `json:"prioritizedSchemes"`
	SslSessionValidationStrings []string `json:"sslSessionValidationStrings"`
}

type SingleServiceClient added in v0.4.0

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

func (*SingleServiceClient) ResolveHostnameAndContextForQuery added in v0.7.3

func (c *SingleServiceClient) ResolveHostnameAndContextForQuery(_ string, query *url.URL) (*url.URL, error)

type Uri

type Uri struct {
	Weights       map[url.URL]float64
	Properties    map[url.URL]UriProperty
	PartitionDesc map[url.URL]map[int]float64
}

func (*Uri) UnmarshalJSON

func (u *Uri) UnmarshalJSON(data []byte) error

type UriProperty

type UriProperty struct {
	AppName    string `json:"com.linkedin.app.name"`
	AppVersion string `json:"com.linkedin.app.version"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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