cluster_table_conf

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllClusterBackendCheck

func AllClusterBackendCheck(conf *AllClusterBackend) error

AllClusterBackendCheck check AllClusterBackend config

func BackendConfCheck

func BackendConfCheck(conf *BackendConf) error

BackendConfCheck check BackendConf config

func ClusterTableConfCheck

func ClusterTableConfCheck(conf ClusterTableConf) error

ClusterTableConfCheck check ClusterTableConf config

func ClusterTableDump

func ClusterTableDump(conf ClusterTableConf, filename string) error

ClusterTableDump dumps conf to file

Types

type AllClusterBackend

type AllClusterBackend map[string]ClusterBackend

func (*AllClusterBackend) Check

func (conf *AllClusterBackend) Check() error

func (AllClusterBackend) HasDiff

func (allClusterBackend AllClusterBackend) HasDiff(compared AllClusterBackend) bool

func (AllClusterBackend) IsSub

func (allClusterBackend AllClusterBackend) IsSub(compared AllClusterBackend) bool

IsSub Compare two AllClusterBackend, return true if compared contains all cluster in allClusterBackend, and there cluster has same ClusterBackend value.

func (AllClusterBackend) Shuffle

func (allClusterBackend AllClusterBackend) Shuffle()

Shuffle shuffles all the backends in allClusterBackend

func (AllClusterBackend) Sort

func (allClusterBackend AllClusterBackend) Sort()

Sort sortes all the backends in allClusterBackend

type BackendConf

type BackendConf struct {
	Name   *string // e.g., "a-05.a"
	Addr   *string // e.g., "10.26.35.33"
	Port   *int    // e.g., 8000
	Weight *int    // weight in load balance, e.g., 10
}

BackendConf is conf of backend

func (*BackendConf) AddrInfo

func (b *BackendConf) AddrInfo() string

type ClusterBackend

type ClusterBackend map[string]SubClusterBackend

func (ClusterBackend) HasDiff

func (clusterBackend ClusterBackend) HasDiff(compared ClusterBackend) bool

func (ClusterBackend) IsSame

func (clusterBackend ClusterBackend) IsSame(compared ClusterBackend) bool

type ClusterTableConf

type ClusterTableConf struct {
	Version *string // version of config
	Config  *AllClusterBackend
}

ClusterTableConf is conf of cluster

func ClusterTableLoad

func ClusterTableLoad(filename string) (ClusterTableConf, error)

ClusterTableLoad loads config of cluster table from file

type SubClusterBackend

type SubClusterBackend []*BackendConf

func (*SubClusterBackend) Check

func (s *SubClusterBackend) Check() error

func (SubClusterBackend) Len

func (s SubClusterBackend) Len() int

func (SubClusterBackend) Less

func (s SubClusterBackend) Less(i, j int) bool

func (SubClusterBackend) Shuffle

func (s SubClusterBackend) Shuffle()

Shuffle random shuffle backends

func (SubClusterBackend) Sort

func (s SubClusterBackend) Sort()

Sort sorted backends by addr and port

func (SubClusterBackend) Swap

func (s SubClusterBackend) Swap(i, j int)

Jump to

Keyboard shortcuts

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