endpoints

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Announce

type Announce struct {
	Add    Map         // contains newly discovered endpoints
	Update Map         // contains endpoints with changes (reserved for later use with load factor)
	Del    []InfoShort // contains endpoints that are no longer present in YDB cluster
}

Announce consolidates changes observed in YDB endpoints since previous observation.

type DB

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

DB is thread safe in-memory storage for endpoints.

func NewDB

func NewDB() DB

NewDB creates endpoints DB.

func (*DB) Compare

func (db *DB) Compare(endpoints []*Ydb_Discovery.EndpointInfo) bool

Compare takes current state of endpoints and compares it with internal endpoints Map. It returns true if incoming state is identical to internal or false otherwise.

func (*DB) GetAll

func (db *DB) GetAll() Map

GetAll returns copy of internal endpoints Map.

func (*DB) Update

func (db *DB) Update(endpoints []*Ydb_Discovery.EndpointInfo) (Announce, int, int)

Update takes current state of endpoints and - updates internal DB accordingly - constructs endpoints announcement that reflects performed changes.

type Filter added in v0.0.1

type Filter struct {
	Require *Require
	Prefer  *Prefer
}

func NewFilter added in v0.0.1

func NewFilter() *Filter

func (*Filter) Filter added in v0.0.1

func (f *Filter) Filter(endpoints []*Ydb_Discovery.EndpointInfo) (
	preferred []*Ydb_Discovery.EndpointInfo,
	notPreferred []*Ydb_Discovery.EndpointInfo,
)

func (*Filter) WithQueryService added in v0.0.1

func (f *Filter) WithQueryService() *Filter

type InfoShort

type InfoShort struct {
	Address     string
	Location    string
	AddressHash uint64
	NodeID      uint32
	Port        uint32
}

InfoShort uniquely identifies YDB endpoint.

func NewInfoShort

func NewInfoShort(ep *Ydb_Discovery.EndpointInfo) InfoShort

func NewInfoShortFromParams added in v0.0.2

func NewInfoShortFromParams(location, address string, nodeID, port uint32) InfoShort

func (*InfoShort) GetAddress

func (eis *InfoShort) GetAddress() string

func (*InfoShort) GetPort

func (eis *InfoShort) GetPort() uint32

type Map

Map stores endpoints as kay-value structure.

type Prefer added in v0.0.1

type Prefer struct {
	Locations []string
}

type Require added in v0.0.1

type Require struct {
	Services  []string
	Locations []string
}

Jump to

Keyboard shortcuts

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