endpoints

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 2 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 is helpful message for consumers of this service about changes in YDB endpoints. For example dispatcher uses it to adjust balancing tree.

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 InfoShort

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

InfoShort uniquely identifies YDB endpoint.

func NewInfoShort

func NewInfoShort(ep *Ydb_Discovery.EndpointInfo) 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.

Jump to

Keyboard shortcuts

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