trait LocationService extends AnyRef
A LocationService interface to manage registrations. All operations are non-blocking.
- Alphabetic
- By Inheritance
- LocationService
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def find[L <: Location](connection: TypedConnection[L]): Future[Option[L]]
Resolves the location for a connection from the local cache
Resolves the location for a connection from the local cache
- connection
a connection to resolve to with its registered location
- returns
a future which completes with the resolved location if found or None otherwise. It can fail with csw.location.api.exceptions.RegistrationListingFailed.
- abstract def list(connectionType: ConnectionType): Future[List[Location]]
Filters all locations registered based on a connection type
Filters all locations registered based on a connection type
- connectionType
list components of this
connectionType
- returns
a future which completes with filtered locations or can fail with csw.location.api.exceptions.RegistrationListingFailed
- abstract def list(hostname: String): Future[List[Location]]
Filters all locations registered based on a hostname
Filters all locations registered based on a hostname
- hostname
list components running on this
hostname
- returns
a future which completes with filtered locations or can fail with csw.location.api.exceptions.RegistrationListingFailed
- abstract def list(componentType: ComponentType): Future[List[Location]]
Filters all locations registered based on a component type
Filters all locations registered based on a component type
- componentType
list components of this
componentType
- returns
a future which completes with filtered locations or can fail with csw.location.api.exceptions.RegistrationListingFailed
- abstract def list: Future[List[Location]]
Lists all locations registered
Lists all locations registered
- returns
a future which completes with a List of all registered locations or can fail with csw.location.api.exceptions.RegistrationListingFailed
- abstract def listByPrefix(prefix: String): Future[List[Location]]
Filters all locations registered based on a prefix.
Filters all locations registered based on a prefix.
- prefix
list components by this
prefix
- returns
a future which completes with filtered locations or can fail with csw.location.api.exceptions.RegistrationListingFailed
- Note
all locations having subsystem prefix that starts with the given prefix value will be listed.
- abstract def register(registration: Registration): Future[RegistrationResult]
Registers a connection -> location in cluster
Registers a connection -> location in cluster
- registration
the Registration holding connection and it's corresponding location to register with
LocationService
- returns
a future which completes with Registration result or can fail with csw.location.api.exceptions.RegistrationFailed or csw.location.api.exceptions.OtherLocationIsRegistered
- abstract def resolve[L <: Location](connection: TypedConnection[L], within: FiniteDuration): Future[Option[L]]
Resolves the location for a connection from the local cache, if not found waits for the event to arrive within specified time limit.
Resolves the location for a connection from the local cache, if not found waits for the event to arrive within specified time limit. Returns None if both fail.
- L
the concrete Location type returned once the connection is resolved
- connection
a connection to resolve to with its registered location
- within
max wait time for event to arrive
- returns
a future which completes with the resolved location if found or None otherwise. It can fail with csw.location.api.exceptions.RegistrationListingFailed.
- abstract def subscribe(connection: Connection, callback: (TrackingEvent) => Unit): Subscription
Subscribe to tracking events for a connection by providing a callback For each event the callback is invoked.
Subscribe to tracking events for a connection by providing a callback For each event the callback is invoked. Use this method if you do not want to handle materialization and happy with a side-effecting callback instead.
- connection
the
connection
that is to be tracked- callback
the callback function of type
TrackingEvent
=> Unit which gets executed on receiving anyTrackingEvent
- returns
a killswitch which can be shutdown to unsubscribe the consumer
- Note
Callbacks are not thread-safe on the JVM. If you are doing side effects/mutations inside the callback, you should ensure that it is done in a thread-safe way inside an actor.
- abstract def track(connection: Connection): Source[TrackingEvent, Subscription]
Tracks the connection and send events for modification or removal of its location
Tracks the connection and send events for modification or removal of its location
- connection
the
connection
that is to be tracked- returns
A stream that emits events related to the connection. It can be cancelled using KillSwitch. This will stop giving events for earlier tracked connection
- abstract def unregister(connection: Connection): Future[Done]
Unregisters the connection
Unregisters the connection
- connection
an already registered connection
- returns
a future which completes after un-registration happens successfully and fails otherwise with csw.location.api.exceptions.UnregistrationFailed
- Note
this method is idempotent, which means multiple call to unregister the same connection will be no-op once successfully unregistered from location service
- abstract def unregisterAll(): Future[Done]
Unregisters all connections
Unregisters all connections
- returns
a future which completes after all connections are unregistered successfully or fails otherwise with csw.location.api.exceptions.RegistrationListingFailed
- Note
it is highly recommended to use this method for testing purpose only
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])