integration

package
v0.0.0-...-cc177ea Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServerConfig

type ServerConfig struct {
	TickTime                 int    // Number of milliseconds of each tick
	InitLimit                int    // Number of ticks that the initial synchronization phase can take
	SyncLimit                int    // Number of ticks that can pass between sending a request and getting an acknowledgement
	DataDir                  string // Directory where the snapshot is stored
	ClientPort               int    // Port at which clients will connect
	AutoPurgeSnapRetainCount int    // Number of snapshots to retain in dataDir
	AutoPurgePurgeInterval   int    // Purge task internal in hours (0 to disable auto purge)
	FLWCommandsWhitelist     string
	Servers                  []*ServerConfigServer
	ReconfigEnabled          bool
}

ServerConfig allows programmatic configurability of a Zookeeper server.

func DefaultConfig

func DefaultConfig() *ServerConfig

DefaultConfig returns a ServerConfig with default values.

func (ServerConfig) Marshall

func (sc ServerConfig) Marshall(w io.Writer) error

Marshall writes the context of a ServerConfig struct to a file format understandable by Apache Zookeeper.

type ServerConfigServer

type ServerConfigServer struct {
	ID                 int
	Host               string
	PeerPort           int
	LeaderElectionPort int
}

ServerConfigServer represents a single server in ServerConfig when replicated mode is used.

type ZKServer

type ZKServer struct {
	Version string
	Config  *ServerConfig
	// contains filtered or unexported fields
}

ZKServer represents a configurable Zookeeper server, mainly used for integration testing.

func NewZKServer

func NewZKServer(version string, config *ServerConfig) (*ZKServer, error)

NewZKServer creates a new ZKServer instance using the given version and config map. Contents of the config struct are written to a file which will later be used by the ZK binary.

func (*ZKServer) Run

func (server *ZKServer) Run() error

Run downloads the specified Zookeeper version from Apache's website, extracts it and runs it using the config specified by configPath. The server runs in the background until Shutdown is called.

func (*ZKServer) Shutdown

func (server *ZKServer) Shutdown() error

Shutdown kills the underlying process of a ZKServer instance.

Jump to

Keyboard shortcuts

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