client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RoleCandidate represents a candidate
	RoleCandidate = Role(0)

	// RoleFollower represents a follower
	RoleFollower = Role(1)

	// RoleLeader represents a leader
	RoleLeader = Role(2)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EleCli

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

EleCli is the client of the elector

func NewClient

func NewClient(host, path string, timeout uint) *EleCli

NewClient returns a elector client

func (*EleCli) Abdicate

func (ec *EleCli) Abdicate() (bool, error)

Abdicate the leadership

func (*EleCli) Close

func (ec *EleCli) Close()

Close the connection with the server

func (*EleCli) Connect

func (ec *EleCli) Connect() error

Connect the elector user request server We prefer to use unix domain socket to decrease the TIME_WAIT hanging socket when using TCP

func (*EleCli) Promote

func (ec *EleCli) Promote() (bool, error)

Promote to leader

func (*EleCli) Role

func (ec *EleCli) Role() (Role, error)

Role return the current elector's role

type Role

type Role uint

Role represents the role of the elector

func (Role) String

func (r Role) String() string

Jump to

Keyboard shortcuts

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