connector

package
v0.0.0-...-7f9db45 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WormholeConnector

type WormholeConnector struct {
	WRaft *WormholeRaft
	WSerf *WormholeSerf
	// contains filtered or unexported fields
}

WormholeConnector is a core structure for handling communication of a wormhole connector, such as HTTP2 connections, Serf and Raft.

func NewWormholeConnector

func NewWormholeConnector(config WormholeConnectorConfig) (*WormholeConnector, error)

NewWormholeConnector returns a new wormhole connector, which holds e.g., local IP address, http server, location of data directory, and pointers to WormholeSerf & WormholeRaft structures. This function implicitly initializes both WormholeSerf and WormholeRaft, and registers necessary HTTP handlers as well.

func (*WormholeConnector) ListenAndServeTLS

func (wc *WormholeConnector) ListenAndServeTLS(cert, key string)

ListenAndServeTLS spawns a goroutine that runs http.ListenAndServeTLS.

func (*WormholeConnector) ProbeSerfRaft

func (wc *WormholeConnector) ProbeSerfRaft(sigchan chan os.Signal) error

ProbeSerfRaft goes into a loop where Raft status becomes verified, and serf events are handled correspondently.

func (*WormholeConnector) SetupSerfRaft

func (wc *WormholeConnector) SetupSerfRaft() error

SetupSerfRaft initializes a Serf cluster being joined by the given peers, and it bootstraps a Raft cluster with the peers.

func (*WormholeConnector) Shutdown

func (wc *WormholeConnector) Shutdown(ctx context.Context)

Shutdown shuts down the http server of WormholeConnector, and it also destroys its Serf object.

type WormholeConnectorConfig

type WormholeConnectorConfig struct {
	KymaServer            string
	KymaReverseTunnelPort int
	RaftPort              int
	LocalAddr             string
	SerfMemberAddrs       string
	SerfPort              int
	Timeout               time.Duration
	DataDir               string
	TrustCAFile           string
	Insecure              bool
}

WormholeConnectorConfig holds all kinds of configurations given by users or local config files. It is used when initializing a new wormhole connector.

type WormholeRaft

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

WormholeRaft holds runtime information for Raft, such as IP address, TCP port, and a pointer to the underlying Raft structure.

func NewWormholeRaft

func NewWormholeRaft(pWc *WormholeConnector, lAddr string, rPort int, dataDir string) (*WormholeRaft, error)

NewWormholeRaft returns a new wormhole raft object, which holds e.g., TCP transport information and the underlying Raft structure.

func (*WormholeRaft) AddVoter

func (wr *WormholeRaft) AddVoter(changedPeer string) error

AddVoter is a simple wrapper around Raft.AddVoter(), which adds the given server to the cluster as a staging server, making a voter.

func (*WormholeRaft) BootstrapRaft

func (wr *WormholeRaft) BootstrapRaft(peerAddrs []string) error

BootstrapRaft initializes a Raft cluster and bootstraps it with the list of given peers.

func (*WormholeRaft) DiscardTopEvent

func (wr *WormholeRaft) DiscardTopEvent() error

func (*WormholeRaft) EnqueueEvent

func (wr *WormholeRaft) EnqueueEvent(ev string) error

func (*WormholeRaft) IsLeader

func (wr *WormholeRaft) IsLeader() bool

IsLeader returns true if the current Raft node is a valid leader. Otherwise it returns false.

func (*WormholeRaft) RemoveServer

func (wr *WormholeRaft) RemoveServer(changedPeer string) error

RemoveServer is a simple wrapper around Raft.RemoveServer(), which removes the given server from the cluster.

func (*WormholeRaft) Shutdown

func (wr *WormholeRaft) Shutdown()

Shutdown destroys everything for Raft before shutting down the wormhole connector.

func (*WormholeRaft) VerifyRaft

func (wr *WormholeRaft) VerifyRaft() error

VerifyRaft checks for the status of the current raft node, and prints it out.

type WormholeSerf

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

WormholeSerf holds runtime information for Serf, such as database, events, peers, and TCP transport information.

func NewWormholeSerf

func NewWormholeSerf(pWc *WormholeConnector, sPeers []lib.SerfPeer, sAddr string, sPort int) (*WormholeSerf, error)

NewWormholeSerf returns a new wormhole serf object, which holds e.g., database, events, peers, and TCP transport information.

func (*WormholeSerf) GetPeerAddrs

func (ws *WormholeSerf) GetPeerAddrs() []string

GetPeerAddrs returns a list of IP addresses of Serf peers.

func (*WormholeSerf) InitSerfDB

func (ws *WormholeSerf) InitSerfDB(dbPath string) error

InitSerfDB opens the database, initializes the database with the default bucket name.

func (*WormholeSerf) SetupSerf

func (ws *WormholeSerf) SetupSerf() error

SetupSerf makes every given Serf peer join the Serf cluster.

func (*WormholeSerf) Shutdown

func (ws *WormholeSerf) Shutdown()

Shutdown destroys everything for Serf before shutting down the wormhole connector.

Jump to

Keyboard shortcuts

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