cluster

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataCenterNone = ""
	DataCenterOne  = "datacenter-1"
	DataCenterTwo  = "datacenter-2"
)

Variables

This section is empty.

Functions

func DaemonAt

func DaemonAt(idx int) *gubernator.Daemon

DaemonAt returns a specific daemon

func FindOwningDaemon

func FindOwningDaemon(name, key string) (*gubernator.Daemon, error)

FindOwningDaemon finds the daemon which owns the rate limit with the provided name and unique key

func FindOwningPeer

func FindOwningPeer(name, key string) (gubernator.PeerInfo, error)

FindOwningPeer finds the peer which owns the rate limit with the provided name and unique key

func GetDaemons

func GetDaemons() []*gubernator.Daemon

GetDaemons returns a list of all daemons in the cluster

func GetPeers

func GetPeers() []gubernator.PeerInfo

GetPeers returns a list of all peers in the cluster

func GetRandomPeer

func GetRandomPeer(dc string) gubernator.PeerInfo

GetRandomPeer returns a random peer from the cluster

func ListNonOwningDaemons

func ListNonOwningDaemons(name, key string) ([]*gubernator.Daemon, error)

ListNonOwningDaemons returns a list of daemons in the cluster that do not own the rate limit for the name and key provided.

func NumOfDaemons

func NumOfDaemons() int

NumOfDaemons returns the number of instances

func PeerAt

func PeerAt(idx int) gubernator.PeerInfo

PeerAt returns a specific peer

func Restart

func Restart(ctx context.Context) error

Restart the cluster

func Start

func Start(numInstances int) error

Start a local cluster of gubernator servers

func StartWith

func StartWith(localPeers []gubernator.PeerInfo, opts ...option) error

StartWith a local cluster with specific addresses

func Stop

func Stop()

Stop all daemons in the cluster

func WithEventChannel added in v2.8.1

func WithEventChannel(eventChannel chan<- gubernator.HitEvent) option

WithEventChannel sets EventChannel to Gubernator config.

Types

This section is empty.

Jump to

Keyboard shortcuts

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