informer

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package informer provides the informer for mesh controller.

Index

Constants

View Source
const (

	// EventUpdate is the update inform event.
	EventUpdate = "Update"
	// EventDelete is the delete inform event.
	EventDelete = "Delete"
)

Variables

View Source
var (
	// ErrAlreadyWatched is the error when watch the same entry again.
	ErrAlreadyWatched = fmt.Errorf("already watched")

	// ErrClosed is the error when watching a closed informer.
	ErrClosed = fmt.Errorf("informer already been closed")

	// ErrNotFound is the error when watching an entry which is not found.
	ErrNotFound = fmt.Errorf("not found")
)

Functions

This section is empty.

Types

type CertFunc

type CertFunc func(event Event, value *spec.Certificate) bool

CertFunc is the callback function type for service/ingressController's cert.

type Event

type Event struct {
	EventType string
	RawKV     *mvccpb.KeyValue
}

Event is the type of inform event.

type HTTPRouteGroupSpecFunc

type HTTPRouteGroupSpecFunc func(event Event, value *spec.HTTPRouteGroup) bool

HTTPRouteGroupSpecFunc is the callback function type for HTTP route group spec.

type HTTPRouteGroupSpecsFunc

type HTTPRouteGroupSpecsFunc func(value map[string]*spec.HTTPRouteGroup) bool

HTTPRouteGroupSpecsFunc is the callback function type for HTTP route group specs.

type Informer

type Informer interface {
	OnPartOfServiceSpec(serviceName string, fn ServiceSpecFunc) error
	OnAllServiceSpecs(fn ServiceSpecsFunc) error

	OnPartOfServiceInstanceSpec(serviceName, instanceID string, fn ServicesInstanceSpecFunc) error
	OnServiceInstanceSpecs(serviceName string, fn ServiceInstanceSpecsFunc) error
	OnAllServiceInstanceSpecs(fn ServiceInstanceSpecsFunc) error

	OnPartOfServiceInstanceStatus(serviceName, instanceID string, fn ServiceInstanceStatusFunc) error
	OnServiceInstanceStatuses(serviceName string, fn ServiceInstanceStatusesFunc) error
	OnAllServiceInstanceStatuses(fn ServiceInstanceStatusesFunc) error

	OnPartOfTenantSpec(tenantName string, fn TenantSpecFunc) error
	OnAllTenantSpecs(fn TenantSpecsFunc) error

	OnPartOfIngressSpec(serviceName string, fn IngressSpecFunc) error
	OnAllIngressSpecs(fn IngressSpecsFunc) error

	OnPartOfHTTPRouteGroupSpec(groupName string, fn HTTPRouteGroupSpecFunc) error
	OnAllHTTPRouteGroupSpecs(fn HTTPRouteGroupSpecsFunc) error

	OnPartOfTrafficTargetSpec(ttName string, fn TrafficTargetSpecFunc) error
	OnAllTrafficTargetSpecs(fn TrafficTargetSpecsFunc) error

	OnPartOfServiceCanary(serviceCanaryName string, fn ServiceCanarySpecFunc) error
	OnAllServiceCanaries(fn ServiceCanariesFunc) error

	StopWatchServiceSpec(serviceName string)
	StopWatchServiceInstanceSpec(serviceName string)

	OnAllServerCert(fn ServiceCertsFunc) error
	OnServerCert(serviceName, instanceID string, fn CertFunc) error
	OnIngressControllerCert(instaceID string, fn CertFunc) error

	Close()
}

Informer is the interface for informing two type of storage changed for every Mesh spec structure.

  1. Based on comparison between old and new part of entry.
  2. Based on comparison on entries with the same prefix.

func NewInformer

func NewInformer(store storage.Storage, service string) Informer

NewInformer creates an informer If service is specified, will only inform resource changes within the same tenant of the service and the global tenant, note this only apply to service, service instance and service status. if service is empty, will inform all resource changes.

type IngressSpecFunc

type IngressSpecFunc func(event Event, ingressSpec *spec.Ingress) bool

IngressSpecFunc is the callback function type for ingress spec.

type IngressSpecsFunc

type IngressSpecsFunc func(value map[string]*spec.Ingress) bool

IngressSpecsFunc is the callback function type for ingress specs.

type ServiceCanariesFunc

type ServiceCanariesFunc func(value map[string]*spec.ServiceCanary) bool

ServiceCanariesFunc is the callback function type for service canary specs.

type ServiceCanarySpecFunc

type ServiceCanarySpecFunc func(event Event, value *spec.ServiceCanary) bool

ServiceCanarySpecFunc is the callback function type for service canary spec.

type ServiceCertsFunc

type ServiceCertsFunc func(value map[string]*spec.Certificate) bool

ServiceCertsFunc is the callback function type for service certs.

type ServiceInstanceSpecsFunc

type ServiceInstanceSpecsFunc func(value map[string]*spec.ServiceInstanceSpec) bool

ServiceInstanceSpecsFunc is the callback function type for service instance specs.

type ServiceInstanceStatusFunc

type ServiceInstanceStatusFunc func(event Event, value *spec.ServiceInstanceStatus) bool

ServiceInstanceStatusFunc is the callback function type for service instance status.

type ServiceInstanceStatusesFunc

type ServiceInstanceStatusesFunc func(value map[string]*spec.ServiceInstanceStatus) bool

ServiceInstanceStatusesFunc is the callback function type for service instance statuses.

type ServiceSpecFunc

type ServiceSpecFunc func(event Event, serviceSpec *spec.Service) bool

ServiceSpecFunc is the callback function type for service spec.

type ServiceSpecsFunc

type ServiceSpecsFunc func(value map[string]*spec.Service) bool

ServiceSpecsFunc is the callback function type for service specs.

type ServicesInstanceSpecFunc

type ServicesInstanceSpecFunc func(event Event, instanceSpec *spec.ServiceInstanceSpec) bool

ServicesInstanceSpecFunc is the callback function type for service instance spec.

type TenantSpecFunc

type TenantSpecFunc func(event Event, value *spec.Tenant) bool

TenantSpecFunc is the callback function type for tenant spec.

type TenantSpecsFunc

type TenantSpecsFunc func(value map[string]*spec.Tenant) bool

TenantSpecsFunc is the callback function type for tenant specs.

type TrafficTargetSpecFunc

type TrafficTargetSpecFunc func(event Event, value *spec.TrafficTarget) bool

TrafficTargetSpecFunc is the callback function type for traffic target spec.

type TrafficTargetSpecsFunc

type TrafficTargetSpecsFunc func(value map[string]*spec.TrafficTarget) bool

TrafficTargetSpecsFunc is the callback function type for traffic target specs.

Jump to

Keyboard shortcuts

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