parser

package module
v0.0.0-...-9998611 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2015 License: Apache-2.0 Imports: 8 Imported by: 2

README

Sentinel Config Parser

This is a Go library for parsing and acting on a Redis Sentinel configuration file. The goal is to make it simpler to perform various sentinel config and sentinel-based operations such as validating a config file or validating a running Sentinel.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PodConfig

type PodConfig struct {
	Name           string
	MasterIP       string
	MasterPort     string
	Authpass       string
	KnownSentinels []string
	KnownSlaves    []string
	Settings       map[string]string
	Quorum         string
	BadDirectives  [][]string
}

PodConfig represents te configuration of a pod based on Sentinel.

func (*PodConfig) Client

func (p *PodConfig) Client() *client.Redis

Client() returns a *client.Redis connection

func (*PodConfig) GetSentinels

func (p *PodConfig) GetSentinels() ([]string, error)

GetSentinels() returns the list of known sentinels

func (*PodConfig) GetSlaves

func (p *PodConfig) GetSlaves() ([]string, error)

GetSlaves() returns the list of known slaves

func (*PodConfig) ValidateMaster

func (p *PodConfig) ValidateMaster() (bool, error)

ValidateMaster() connexts to the master listed in the config and verifies it has the role of master

type SentinelConfig

type SentinelConfig struct {
	Name              string
	Host              string
	Port              int
	ManagedPodConfigs map[string]PodConfig
	Dir               string
	KnownSentinels    []string
	BadDirectives     []string
}

LocalSentinelConfig is a struct holding information about the sentinel RS is running on.

func ParseSentinelConfig

func ParseSentinelConfig(filename string) (SentinelConfig, error)

func (*SentinelConfig) GetPod

func (c *SentinelConfig) GetPod(podname string) (PodConfig, error)

Jump to

Keyboard shortcuts

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