zktestserver

package
v0.0.0-...-116a328 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: Apache-2.0, BSD-3-Clause Imports: 9 Imported by: 0

README

zktestserver

Contains testing code copied out of github.com/samuel/go-zookeeper/zk due to the functionality being removed from upstream in later versions.

Documentation

Index

Constants

View Source
const (
	DefaultServerTickTime                 = 2000
	DefaultServerInitLimit                = 10
	DefaultServerSyncLimit                = 5
	DefaultServerAutoPurgeSnapRetainCount = 3
	DefaultPeerPort                       = 2888
	DefaultLeaderElectionPort             = 3888
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrMissingServerConfigField

type ErrMissingServerConfigField string

func (ErrMissingServerConfigField) Error

type Server

type Server struct {
	JarPath        string
	ConfigPath     string
	Stdout, Stderr io.Writer
	// contains filtered or unexported fields
}

func (*Server) Start

func (srv *Server) Start() error

func (*Server) Stop

func (srv *Server) Stop() error

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 // Direcrory 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)
	Servers                  []ServerConfigServer
}

func (ServerConfig) Marshall

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

type ServerConfigServer

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

type TestCluster

type TestCluster struct {
	Path    string
	Servers []TestServer
}

func StartTestCluster

func StartTestCluster(size int, stdout, stderr io.Writer) (*TestCluster, error)

func (*TestCluster) Stop

func (tc *TestCluster) Stop() error

type TestServer

type TestServer struct {
	Port int
	Path string
	Srv  *Server
}

Jump to

Keyboard shortcuts

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