cache

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Package cache is a generated GoMock package.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Index

Constants

View Source
const (
	TypeEndpoint objectType = iota
	TypeSvc
	TypeNode
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

NewCache returns a new instance of Cache.

func (*Cache) AddAnnotatedNamespace

func (c *Cache) AddAnnotatedNamespace(ns string)

func (*Cache) DeleteAnnotatedNamespace

func (c *Cache) DeleteAnnotatedNamespace(ns string)

func (*Cache) DeleteRetinaEndpoint

func (c *Cache) DeleteRetinaEndpoint(epKey string) error

DeleteRetinaEndpoint deletes the given retina endpoint from the cache.

func (*Cache) DeleteRetinaNode

func (c *Cache) DeleteRetinaNode(nodeName string) error

DeleteRetinaNode deletes the given retina node from the cache.

func (*Cache) DeleteRetinaSvc

func (c *Cache) DeleteRetinaSvc(svcKey string) error

DeleteRetinaSvc deletes the given retina service from the cache.

func (*Cache) GetAnnotatedNamespaces

func (c *Cache) GetAnnotatedNamespaces() []string

func (*Cache) GetIPsByNamespace

func (c *Cache) GetIPsByNamespace(ns string) []net.IP

func (*Cache) GetNodeByIP

func (c *Cache) GetNodeByIP(ip string) *common.RetinaNode

GetNodeByIP returns the retina node for the given IP.

func (*Cache) GetObjByIP

func (c *Cache) GetObjByIP(ip string) interface{}

GetObjByIP returns the retina object for the given IP.

func (*Cache) GetPodByIP

func (c *Cache) GetPodByIP(ip string) *common.RetinaEndpoint

GetPodByIP returns the retina endpoint for the given IP.

func (*Cache) GetSvcByIP

func (c *Cache) GetSvcByIP(ip string) *common.RetinaSvc

GetSvcByIP returns the retina service for the given IP.

func (*Cache) SubscribeAPIServerFn

func (c *Cache) SubscribeAPIServerFn(obj interface{})

func (*Cache) UpdateRetinaEndpoint

func (c *Cache) UpdateRetinaEndpoint(ep *common.RetinaEndpoint) error

UpdateRetinaEndpoint updates the cache with the given retina endpoint.

func (*Cache) UpdateRetinaNode

func (c *Cache) UpdateRetinaNode(node *common.RetinaNode) error

UpdateRetinaNode updates the cache with the given retina node.

func (*Cache) UpdateRetinaSvc

func (c *Cache) UpdateRetinaSvc(svc *common.RetinaSvc) error

UpdateRetinaSvc updates the cache with the given retina service.

type CacheEvent

type CacheEvent struct {
	// Type is the type of the event.
	Type EventType
	// Obj is the object that the event is about.
	Obj interface{}
}

func NewCacheEvent

func NewCacheEvent(t EventType, obj common.PublishObj) *CacheEvent

type CacheInterface

type CacheInterface interface {
	// GetPodByIP returns the retina endpoint for the given IP.
	GetPodByIP(ip string) *common.RetinaEndpoint
	// GetSvcByIP returns the retina service for the given IP.
	GetSvcByIP(ip string) *common.RetinaSvc
	// GetNodeByIP returns the retina node for the given IP.
	GetNodeByIP(ip string) *common.RetinaNode
	// GetObjByIP returns the object for the given IP.
	GetObjByIP(ip string) interface{}
	// GetIPsByNamespace returns the net.IPs for a given namespace.
	GetIPsByNamespace(ns string) []net.IP
	// GetAnnotatedNamespaces returns list of namespaces that are annotated with retina to observe.
	GetAnnotatedNamespaces() []string

	// UpdateRetinaEndpoint updates the retina endpoint in the cache.
	UpdateRetinaEndpoint(ep *common.RetinaEndpoint) error
	// UpdateRetinaSvc updates the retina service in the cache.
	UpdateRetinaSvc(svc *common.RetinaSvc) error
	// UpdateRetinaNode updates the retina node in the cache.
	UpdateRetinaNode(node *common.RetinaNode) error
	AddAnnotatedNamespace(ns string)

	// DeleteRetinaEndpoint deletes the retina endpoint from the cache.
	DeleteRetinaEndpoint(epKey string) error
	// DeleteRetinaSvc deletes the retina service from the cache.
	DeleteRetinaSvc(svcKey string) error
	// DeleteRetinaNode deletes the retina node from the cache.
	DeleteRetinaNode(nodeName string) error
	DeleteAnnotatedNamespace(ns string)
}

type EventType

type EventType int
const (
	// EventTypePodAdded is the event type for a pod add event.
	EventTypePodAdded EventType = iota
	// EventTypePodDeleted is the event type for a pod delete event.
	EventTypePodDeleted
	// EventTypeSvcAdded is the event type for a service add event.
	EventTypeSvcAdded
	// EventTypeSvcDeleted is the event type for a service delete event.
	EventTypeSvcDeleted
	// EventTypeNodeAdded is the event type for a node add event.
	EventTypeNodeAdded
	// EventTypeNodeDeleted is the event type for a node delete event.
	EventTypeNodeDeleted
	// EventTypeAddAPIServerIPs  is the event type for adding API server IPs.
	EventTypeAddAPIServerIPs
	// EventTypeDeleteAPIServerIPs  is the event type for deleting API server IPs.
	EventTypeDeleteAPIServerIPs
)

func (EventType) String

func (e EventType) String() string

type MockCacheInterface

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

MockCacheInterface is a mock of CacheInterface interface.

func NewMockCacheInterface

func NewMockCacheInterface(ctrl *gomock.Controller) *MockCacheInterface

NewMockCacheInterface creates a new mock instance.

func (*MockCacheInterface) AddAnnotatedNamespace

func (m *MockCacheInterface) AddAnnotatedNamespace(arg0 string)

AddAnnotatedNamespace mocks base method.

func (*MockCacheInterface) DeleteAnnotatedNamespace

func (m *MockCacheInterface) DeleteAnnotatedNamespace(arg0 string)

DeleteAnnotatedNamespace mocks base method.

func (*MockCacheInterface) DeleteRetinaEndpoint

func (m *MockCacheInterface) DeleteRetinaEndpoint(arg0 string) error

DeleteRetinaEndpoint mocks base method.

func (*MockCacheInterface) DeleteRetinaNode

func (m *MockCacheInterface) DeleteRetinaNode(arg0 string) error

DeleteRetinaNode mocks base method.

func (*MockCacheInterface) DeleteRetinaSvc

func (m *MockCacheInterface) DeleteRetinaSvc(arg0 string) error

DeleteRetinaSvc mocks base method.

func (*MockCacheInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCacheInterface) GetAnnotatedNamespaces

func (m *MockCacheInterface) GetAnnotatedNamespaces() []string

GetAnnotatedNamespaces mocks base method.

func (*MockCacheInterface) GetIPsByNamespace

func (m *MockCacheInterface) GetIPsByNamespace(arg0 string) []net.IP

GetIPsByNamespace mocks base method.

func (*MockCacheInterface) GetNodeByIP

func (m *MockCacheInterface) GetNodeByIP(arg0 string) *common.RetinaNode

GetNodeByIP mocks base method.

func (*MockCacheInterface) GetObjByIP

func (m *MockCacheInterface) GetObjByIP(arg0 string) any

GetObjByIP mocks base method.

func (*MockCacheInterface) GetPodByIP

func (m *MockCacheInterface) GetPodByIP(arg0 string) *common.RetinaEndpoint

GetPodByIP mocks base method.

func (*MockCacheInterface) GetSvcByIP

func (m *MockCacheInterface) GetSvcByIP(arg0 string) *common.RetinaSvc

GetSvcByIP mocks base method.

func (*MockCacheInterface) UpdateRetinaEndpoint

func (m *MockCacheInterface) UpdateRetinaEndpoint(arg0 *common.RetinaEndpoint) error

UpdateRetinaEndpoint mocks base method.

func (*MockCacheInterface) UpdateRetinaNode

func (m *MockCacheInterface) UpdateRetinaNode(arg0 *common.RetinaNode) error

UpdateRetinaNode mocks base method.

func (*MockCacheInterface) UpdateRetinaSvc

func (m *MockCacheInterface) UpdateRetinaSvc(arg0 *common.RetinaSvc) error

UpdateRetinaSvc mocks base method.

type MockCacheInterfaceMockRecorder

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

MockCacheInterfaceMockRecorder is the mock recorder for MockCacheInterface.

func (*MockCacheInterfaceMockRecorder) AddAnnotatedNamespace

func (mr *MockCacheInterfaceMockRecorder) AddAnnotatedNamespace(arg0 any) *gomock.Call

AddAnnotatedNamespace indicates an expected call of AddAnnotatedNamespace.

func (*MockCacheInterfaceMockRecorder) DeleteAnnotatedNamespace

func (mr *MockCacheInterfaceMockRecorder) DeleteAnnotatedNamespace(arg0 any) *gomock.Call

DeleteAnnotatedNamespace indicates an expected call of DeleteAnnotatedNamespace.

func (*MockCacheInterfaceMockRecorder) DeleteRetinaEndpoint

func (mr *MockCacheInterfaceMockRecorder) DeleteRetinaEndpoint(arg0 any) *gomock.Call

DeleteRetinaEndpoint indicates an expected call of DeleteRetinaEndpoint.

func (*MockCacheInterfaceMockRecorder) DeleteRetinaNode

func (mr *MockCacheInterfaceMockRecorder) DeleteRetinaNode(arg0 any) *gomock.Call

DeleteRetinaNode indicates an expected call of DeleteRetinaNode.

func (*MockCacheInterfaceMockRecorder) DeleteRetinaSvc

func (mr *MockCacheInterfaceMockRecorder) DeleteRetinaSvc(arg0 any) *gomock.Call

DeleteRetinaSvc indicates an expected call of DeleteRetinaSvc.

func (*MockCacheInterfaceMockRecorder) GetAnnotatedNamespaces

func (mr *MockCacheInterfaceMockRecorder) GetAnnotatedNamespaces() *gomock.Call

GetAnnotatedNamespaces indicates an expected call of GetAnnotatedNamespaces.

func (*MockCacheInterfaceMockRecorder) GetIPsByNamespace

func (mr *MockCacheInterfaceMockRecorder) GetIPsByNamespace(arg0 any) *gomock.Call

GetIPsByNamespace indicates an expected call of GetIPsByNamespace.

func (*MockCacheInterfaceMockRecorder) GetNodeByIP

func (mr *MockCacheInterfaceMockRecorder) GetNodeByIP(arg0 any) *gomock.Call

GetNodeByIP indicates an expected call of GetNodeByIP.

func (*MockCacheInterfaceMockRecorder) GetObjByIP

func (mr *MockCacheInterfaceMockRecorder) GetObjByIP(arg0 any) *gomock.Call

GetObjByIP indicates an expected call of GetObjByIP.

func (*MockCacheInterfaceMockRecorder) GetPodByIP

func (mr *MockCacheInterfaceMockRecorder) GetPodByIP(arg0 any) *gomock.Call

GetPodByIP indicates an expected call of GetPodByIP.

func (*MockCacheInterfaceMockRecorder) GetSvcByIP

func (mr *MockCacheInterfaceMockRecorder) GetSvcByIP(arg0 any) *gomock.Call

GetSvcByIP indicates an expected call of GetSvcByIP.

func (*MockCacheInterfaceMockRecorder) UpdateRetinaEndpoint

func (mr *MockCacheInterfaceMockRecorder) UpdateRetinaEndpoint(arg0 any) *gomock.Call

UpdateRetinaEndpoint indicates an expected call of UpdateRetinaEndpoint.

func (*MockCacheInterfaceMockRecorder) UpdateRetinaNode

func (mr *MockCacheInterfaceMockRecorder) UpdateRetinaNode(arg0 any) *gomock.Call

UpdateRetinaNode indicates an expected call of UpdateRetinaNode.

func (*MockCacheInterfaceMockRecorder) UpdateRetinaSvc

func (mr *MockCacheInterfaceMockRecorder) UpdateRetinaSvc(arg0 any) *gomock.Call

UpdateRetinaSvc indicates an expected call of UpdateRetinaSvc.

Jump to

Keyboard shortcuts

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