Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LayeredServiceDiscovery<S, P>

Abstract discovery for implementing layers, such as filtering and mapping.

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected Readonly availableEvent

availableEvent: Event<LayeredServiceDiscovery<S, P>, [service: S]>

Event used to emit when a service is available.

Protected Readonly debug

debug: Debugger

Debugger that can be used to output debug messages for the discovery.

Protected Readonly parent

parent: ServiceDiscovery<P>

Parent discovery that is being modified.

Protected Readonly unavailableEvent

unavailableEvent: Event<LayeredServiceDiscovery<S, P>, [service: S]>

Event used to emit when a service is no longer available.

Protected Readonly updateEvent

updateEvent: Event<LayeredServiceDiscovery<S, P>, [service: S, previousService: S]>

Event used to emit when a service has been updated.

Accessors

destroyed

  • get destroyed(): boolean

onAvailable

  • get onAvailable(): Subscribable<this, [service: S]>

onDestroy

  • get onDestroy(): Subscribable<this, []>

onError

  • get onError(): Subscribable<this, [err: Error]>

onUnavailable

  • get onUnavailable(): Subscribable<this, [service: S]>

onUpdate

  • get onUpdate(): Subscribable<this, [service: S, previousService: S]>

services

  • get services(): S[]

Methods

and

destroy

  • destroy(): Promise<void>

filter

find

findAll

get

  • get(id: string): null | S

Protected Abstract handleParentServiceAvailable

  • handleParentServiceAvailable(service: P): void

Protected Abstract handleParentServiceUnavailable

  • handleParentServiceUnavailable(service: P): void

Protected Abstract handleParentServiceUpdate

  • handleParentServiceUpdate(service: P, previousService: P): void

Protected logAndEmitError

  • logAndEmitError(error: unknown, message?: string): void

map

release

  • release(): Promise<void>

Protected removeService

  • removeService(service: string | S): null | S

Protected setServices

  • setServices(available: Iterable<S>): void

Protected updateService

  • updateService(service: S): null | S
  • Add or update a service that has been found. This will register the service and emit suitable events. Services are identified internally using their identifier. Services will be treated as new if their id does is not currently tracked, and as updates if their id is currently tracked.

    Parameters

    • service: S
      • service to update

    Returns null | S

    previous service or null if not registered

Generated using TypeDoc