cluster

package
v0.0.0-...-da6718e Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DataPath string
	LogsPath string

	// DevMode is used to enable a development server mode.
	DevMode bool

	// Bootstrap mode is used to bring up the first Consul server.
	// It is required so that it can elect a leader without any
	// other nodes being present
	Bootstrap bool
}

func (*Config) Init

func (c *Config) Init()

type Listener

type Listener interface {
	net.Listener
	Dial(address string, timeout time.Duration) (net.Conn, error)
}

Listener is the interface Raft-compatible network layers should implement.

type RaftFSM

type RaftFSM struct {
}

func (*RaftFSM) Apply

func (fsm *RaftFSM) Apply(log *raft.Log) interface{}

func (*RaftFSM) Restore

func (fsm *RaftFSM) Restore(io.ReadCloser) error

func (*RaftFSM) Snapshot

func (fsm *RaftFSM) Snapshot() (raft.FSMSnapshot, error)

type RootHandler

type RootHandler struct {
	S *Server
	// contains filtered or unexported fields
}

func (*RootHandler) ServeHTTP

func (h *RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Server

type Server struct {
	Ln Listener
	// contains filtered or unexported fields
}

func NewServer

func NewServer(lnr Listener, config *Config) (*Server, error)

type TransportDelegate

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

Transport is the network service provided to Raft, and wraps a Listener.

func NewTransportDelegate

func NewTransportDelegate(ln Listener) *TransportDelegate

NewTransport returns an initialized Transport.

func (*TransportDelegate) Accept

func (t *TransportDelegate) Accept() (net.Conn, error)

Accept waits for the next connection.

func (*TransportDelegate) Addr

func (t *TransportDelegate) Addr() net.Addr

Addr returns the binding address of the transport.

func (*TransportDelegate) Close

func (t *TransportDelegate) Close() error

Close closes the transport

func (*TransportDelegate) Dial

func (t *TransportDelegate) Dial(addr raft.ServerAddress, timeout time.Duration) (net.Conn, error)

Dial creates a new network connection.

Jump to

Keyboard shortcuts

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