client

package
v0.0.0-...-aef646c Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// The Autofact Path
	AutoPath string
	// Conn holds the configuration for connecting to the server.
	conf.Conn
	// Conf holds the client configuration (how the client behaves).
	Conf *conf.Client

	// The websocket connection that this client uses.
	WS *websocket.Conn

	ServerURL url.URL
	// contains filtered or unexported fields
}

Client is anything that talks to the server.

func New

func New(c conf.Conn, log zap.Logger) *Client

func (*Client) CPUUtilization

func (c *Client) CPUUtilization(doneCh chan struct{})

func (*Client) Connect

func (c *Client) Connect() bool

Connect handles connecting to the server and returns the connection status. The client will attempt to connect until it has either succeeded or the connection retry period has been exceeded. A retry is done every 5 seconds.

If the client is already connected, nothing will be done.

func (*Client) DialServer

func (c *Client) DialServer() error

func (*Client) IsConnected

func (c *Client) IsConnected() bool

IsConnected returns if the client is connected.

func (*Client) Listen

func (c *Client) Listen(doneCh chan struct{})

func (*Client) LoadAvg

func (c *Client) LoadAvg() error

LoadAvg gets the current loadavg and pushes the bytes into the message queue

func (*Client) MemInfo

func (c *Client) MemInfo(doneCh chan struct{})

func (*Client) MessageWriter

func (c *Client) MessageWriter(doneCh chan struct{})

func (*Client) NetUsage

func (c *Client) NetUsage(doneCh chan struct{})

func (*Client) NewMessage

func (c *Client) NewMessage(k message.Kind, p []byte) []byte

NewMessage creates a new message of type Kind using the received bytes. The MessageID is a snowflake using the client's ID and the current time.

func (*Client) Reconnect

func (c *Client) Reconnect() bool

Jump to

Keyboard shortcuts

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