notifier

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MPL-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 CatalogServicesRegistration

type CatalogServicesRegistration struct {
	templates.Template
	// contains filtered or unexported fields
}

CatalogServicesRegistration is a custom notifier expected to be used for a template that contains catalogServicesRegistration template function (tmplfunc) and any other tmplfuncs e.g. services tmplfunc.

This notifier only notifies on changes to Catalog Services registration information and once-mode. It suppresses notifications for changes to other tmplfuncs and changes to Catalog Services tag data.

func NewCatalogServicesRegistration

func NewCatalogServicesRegistration(tmpl templates.Template, serviceCount int) *CatalogServicesRegistration

NewCatalogServicesRegistration creates a new CatalogServicesRegistration notifier. serviceCount parameter: the number of services the task is configured with

func (*CatalogServicesRegistration) Notify

func (n *CatalogServicesRegistration) Notify(d interface{}) (notify bool)

Notify notifies when Catalog Services registration changes.

Notifications are sent when: A. There is a change in the Catalog Service's dependency ([]*dep.CatalogSnippet)

that is specifically a service _registration_ change.

B. All the dependencies have been received for the first time. This is

regardless of the dependency type that "completes" having received all the
dependencies. Note: this is a special notification sent to handle a race
condition that causes hanging during once-mode (details below)

Notification are suppressed when:

  • There is a change in the Catalog Service's dependency ([]*dep.CatalogSnippet) that is specifically a service _tag_ change.
  • Other types of dependencies that are not Catalog Service. For example, Services ([]*dep.HealthService).

Race condition: Once-mode requires a notification when all dependencies are received in order to trigger CTS. It will hang otherwise. This notifier only notifies on Catalog Service registration changes. The dependencies are received by the notifier in any order. Therefore sometimes the last dependency to "complete all dependencies" is a Health Service change, which can lead to no notification even though once-mode requires a notification when all dependencies are received. Resolved by sending a special notification for once-mode. Bullet B above.

Jump to

Keyboard shortcuts

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