flw

package
v0.0.0-...-cc177ea Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ruok

func Ruok(server string) error

Ruok executes the ruok FLW protocol function using the default client.

Types

type Client

type Client struct {
	Timeout time.Duration
}

Client is a customizable abstraction for calling FLW protocol functions.

func (*Client) Cons

func (c *Client) Cons(server string) ([]*ServerClient, error)

Cons is a FourLetterWord helper function. In particular, this function pulls the "cons" output from a server. As with Srvr, the error value indicates whether the request had an issue.

func (*Client) Ruok

func (c *Client) Ruok(server string) error

Ruok is a FourLetterWord helper function. In particular, this function pulls the "ruok" output of a server.

func (*Client) Srvr

func (c *Client) Srvr(server string) (*ServerStats, error)

Srvr is a FourLetterWord helper function. In particular, this function pulls the "srvr" output from the zookeeper instance and parses the output. A *ServerStats struct is returned as well as an error value to indicate whether this function processed successfully.

type Mode

type Mode uint8

Mode is used to build custom server modes (leader|follower|standalone).

const (
	ModeUnknown Mode = iota
	ModeLeader
	ModeFollower
	ModeStandalone
)

These constants represent the possible modes that a Zookeeper server can run in. A Zookeeper server can run in leader, follower or standalone mode. ModeUnknown is used when the mode cannot be recognized from the response.

func (Mode) String

func (m Mode) String() string

type ServerClient

type ServerClient struct {
	Queued        int64
	Received      int64
	Sent          int64
	SessionID     int64
	Lcxid         int64
	Lzxid         int64
	Timeout       int32
	LastLatency   int32
	MinLatency    int32
	AvgLatency    int32
	MaxLatency    int32
	Established   time.Time
	LastResponse  time.Time
	Addr          string
	LastOperation string // maybe?
}

ServerClient is the information for a single Zookeeper client and its session. This is used to parse/extract the output of the `cons` command.

func Cons

func Cons(server string) ([]*ServerClient, error)

Cons executes the cons FLW protocol function using the default client.

type ServerStats

type ServerStats struct {
	Sent        int64
	Received    int64
	NodeCount   int64
	MinLatency  int64
	AvgLatency  float64
	MaxLatency  int64
	Connections int64
	Outstanding int64
	Epoch       int32
	Counter     int32
	BuildTime   time.Time
	Mode        Mode
	Version     string
}

ServerStats is the information pulled from the Zookeeper `stat` command.

func Srvr

func Srvr(server string) (*ServerStats, error)

Srvr executes the srvr FLW protocol function using the default client.

Jump to

Keyboard shortcuts

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