host_info_util

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

View Source
const (
	HOST_NO_PORT        = -1
	HOST_DEFAULT_WEIGHT = 100
)

Variables

This section is empty.

Functions

func AreHostListsEqual

func AreHostListsEqual(s1 []*HostInfo, s2 []*HostInfo) bool

func GetHostAndPort added in v1.1.0

func GetHostAndPort(host string, port int) string

func HaveNoHostsInCommon added in v1.1.0

func HaveNoHostsInCommon(hosts1 []*HostInfo, hosts2 []*HostInfo) bool

func IsHostInList added in v1.1.0

func IsHostInList(host *HostInfo, hosts []*HostInfo) bool

Types

type HostAvailability

type HostAvailability string
const (
	AVAILABLE   HostAvailability = "available"
	UNAVAILABLE HostAvailability = "unavailable"
)

type HostInfo

type HostInfo struct {
	Host           string
	HostId         string
	Port           int
	Availability   HostAvailability
	Role           HostRole
	Aliases        map[string]bool
	AllAliases     map[string]bool
	Weight         int
	LastUpdateTime time.Time
}

func GetReaders added in v1.1.0

func GetReaders(hosts []*HostInfo) []*HostInfo

func GetWriter

func GetWriter(hosts []*HostInfo) *HostInfo

func (*HostInfo) AddAlias

func (hostInfo *HostInfo) AddAlias(alias string)

func (*HostInfo) Equals

func (hostInfo *HostInfo) Equals(host *HostInfo) bool

func (*HostInfo) GetAliases added in v1.2.0

func (hostInfo *HostInfo) GetAliases() map[string]bool

func (*HostInfo) GetAllAliases added in v1.2.0

func (hostInfo *HostInfo) GetAllAliases() map[string]bool

func (*HostInfo) GetHost added in v1.1.0

func (hostInfo *HostInfo) GetHost() string

func (*HostInfo) GetHostAndPort

func (hostInfo *HostInfo) GetHostAndPort() string

func (*HostInfo) GetUrl

func (hostInfo *HostInfo) GetUrl() string

func (*HostInfo) IsNil

func (hostInfo *HostInfo) IsNil() bool

func (*HostInfo) IsPortSpecified

func (hostInfo *HostInfo) IsPortSpecified() bool

func (*HostInfo) MakeCopyWithRole

func (hostInfo *HostInfo) MakeCopyWithRole(role HostRole) *HostInfo

func (*HostInfo) ResetAliases

func (hostInfo *HostInfo) ResetAliases()

func (*HostInfo) String

func (hostInfo *HostInfo) String() string

type HostInfoBuilder

type HostInfoBuilder struct {
	// contains filtered or unexported fields
}

func NewHostInfoBuilder

func NewHostInfoBuilder() *HostInfoBuilder

func (*HostInfoBuilder) Build

func (hostInfoBuilder *HostInfoBuilder) Build() (hostInfo *HostInfo, err error)

func (*HostInfoBuilder) CopyFrom added in v1.1.0

func (hostInfoBuilder *HostInfoBuilder) CopyFrom(hostInfo *HostInfo) *HostInfoBuilder

func (*HostInfoBuilder) SetAvailability

func (hostInfoBuilder *HostInfoBuilder) SetAvailability(availability HostAvailability) *HostInfoBuilder

func (*HostInfoBuilder) SetHost

func (hostInfoBuilder *HostInfoBuilder) SetHost(host string) *HostInfoBuilder

func (*HostInfoBuilder) SetHostId

func (hostInfoBuilder *HostInfoBuilder) SetHostId(hostId string) *HostInfoBuilder

func (*HostInfoBuilder) SetLastUpdateTime

func (hostInfoBuilder *HostInfoBuilder) SetLastUpdateTime(lastUpdateTime time.Time) *HostInfoBuilder

func (*HostInfoBuilder) SetPort

func (hostInfoBuilder *HostInfoBuilder) SetPort(port int) *HostInfoBuilder

func (*HostInfoBuilder) SetRole

func (hostInfoBuilder *HostInfoBuilder) SetRole(role HostRole) *HostInfoBuilder

func (*HostInfoBuilder) SetWeight

func (hostInfoBuilder *HostInfoBuilder) SetWeight(weight int) *HostInfoBuilder

type HostRole

type HostRole string
const (
	READER  HostRole = "reader"
	WRITER  HostRole = "writer"
	UNKNOWN HostRole = "unknown"
)

Jump to

Keyboard shortcuts

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