servicecache

package
v0.8.20 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceCache

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

ServiceCache is a cache of existing services.

func New

func New() *ServiceCache

New creates a new empty ServiceCache.

func (*ServiceCache) DeleteByAddr

func (svcc *ServiceCache) DeleteByAddr(ip net.IP, port uint16) bool

DeleteByAddr removes the cache entry identified by the given service frontend ip and port. It returns true if an entry was deleted.

func (*ServiceCache) DeleteByID

func (svcc *ServiceCache) DeleteByID(id int64) bool

DeleteByID removes the cache entry identified by the given id. It returns true if an entry was deleted.

func (*ServiceCache) GetServiceByAddr

func (svcc *ServiceCache) GetServiceByAddr(ip net.IP, port uint16) (service pb.Service, ok bool)

GetServiceByAddr retrieves a service from the cache given its frontend IP and port. If the service was found in the cache, ok is true.

func (*ServiceCache) InitializeFrom

func (svcc *ServiceCache) InitializeFrom(entries []*models.Service) error

InitializeFrom initializes the cache with the given list of services.

func (*ServiceCache) Upsert

func (svcc *ServiceCache) Upsert(id int64, name, typ, ns string, frontendIP net.IP, frontendPort uint16) bool

Upsert updates or inserts a cache entry and returns true if the update was performed.

Jump to

Keyboard shortcuts

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