zk

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultServer      = "localhost:2181"
	DefaultServiceName = "test"
	DefaultPath        = "/xmidt/test"
	DefaultAddress     = "localhost"
	DefaultPort        = 8080
	DefaultScheme      = "http"

	DefaultConnectTimeout time.Duration = 5 * time.Second
	DefaultSessionTimeout time.Duration = 10 * time.Second
)

Variables

This section is empty.

Functions

func NewEnvironment

func NewEnvironment(l log.Logger, zo Options, eo ...service.Option) (service.Environment, error)

NewEnvironment constructs a Zookeeper-based service.Environment using both a zookeeper Options (typically unmarshaled from configuration) and an optional extra set of environment options.

Types

type Client

type Client struct {
	// Connection is the comma-delimited Zookeeper connection string.  Both this and
	// Servers may be set, and they will be merged together when connecting to Zookeeper.
	Connection string `json:"connection,omitempty"`

	// Servers is the array of Zookeeper servers.  Both this and Connection may be set,
	// and they will be merged together when connecting to Zookeeper.
	Servers []string `json:"servers,omitempty"`

	// ConnectTimeout is the Zookeeper connection timeout.
	ConnectTimeout time.Duration `json:"connectTimeout"`

	// SessionTimeout is the Zookeeper session timeout.
	SessionTimeout time.Duration `json:"sessionTimeout"`
}

Client is the client portion of the options struct

type Options

type Options struct {
	// Client holds the zookeeper client options
	Client Client `json:"client"`

	// Registrations are the ways in which the host process should be registered with zookeeper.
	// There is no default for this field.
	Registrations []Registration `json:"registrations,omitempty"`

	// Watches are the zookeeper paths to watch for updates.  There is no default for this field.
	Watches []string `json:"watches,omitempty"`
}

Options represents the set of configurable attributes for Zookeeper

type Registration

type Registration struct {
	// Name is the service name under which to register.  If not supplied, DefaultServiceName is used.
	Name string `json:"name,omitempty"`

	// Path is the znode path under which to register.  If not supplied, DefaultPath is used.
	Path string `json:"path,omitempty"`

	// Address is the FQDN or hostname of the server which hosts the service.  If not supplied, DefaultAddress is used.
	Address string `json:"address,omitempty"`

	// Port is the TCP port on which the service listens.  If not supplied, DefaultPort is used.
	Port int `json:"port,omitempty"`

	// Scheme specific the protocl used for the service.  If not supplied, DefaultScheme is used.
	Scheme string `json:"scheme,omitempty"`
}

Jump to

Keyboard shortcuts

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