client

package
v0.0.0-...-f429149 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: Apache-2.0 Imports: 11 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 {
	node.Client
	// contains filtered or unexported fields
}

Client is a service Client implementation for the Raft consensus protocol

func NewClient

func NewClient(config cluster.Cluster, consistency raft.ReadConsistency) *Client

NewClient returns a new Raft client

func (*Client) Close

func (c *Client) Close() error

Close closes the client

func (*Client) IsLeader

func (c *Client) IsLeader() bool

IsLeader returns whether this node is the leader

func (*Client) Leader

func (c *Client) Leader() string

Leader returns the current leader

func (*Client) MustLeader

func (c *Client) MustLeader() bool

MustLeader returns whether requests must be handled by a leader

func (*Client) Read

func (c *Client) Read(ctx context.Context, in []byte, stream streams.WriteStream) error

Read sends a read operation to the cluster

func (*Client) Write

func (c *Client) Write(ctx context.Context, in []byte, stream streams.WriteStream) error

Write sends a write operation to the cluster

Jump to

Keyboard shortcuts

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