ServiceReloader

zio.macros.ServiceReloader
See theServiceReloader companion object

A ServiceReloader is a "registry" of services, allowing services to be reloaded dynamically. You can create a reloadable version of your service by using the reloadable operator on ZLayer. Then just call ServiceLoader.reload to reload the service.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def register[A : IsReloadable](serviceLayer: ZLayer[Any, Any, A]): IO[Error, A]

Registers the specified service with a layer that constructs the service. Returns an implementation of the service that is backed by a ScopedRef which will handle reloading the service. Fails with a ServiceInitializationError exception if an error occurs while acquiring the service.

Registers the specified service with a layer that constructs the service. Returns an implementation of the service that is backed by a ScopedRef which will handle reloading the service. Fails with a ServiceInitializationError exception if an error occurs while acquiring the service.

Attributes

def reload[A : Tag]: IO[Error, Unit]

Reloads the specified service, releasing any resources associated with the service and acquiring a new service. Fails with a ServiceInitializationError exception if an error occurs reloading the service or a ServiceNotRegistered exception if a layer constructing the service was never registered.

Reloads the specified service, releasing any resources associated with the service and acquiring a new service. Fails with a ServiceInitializationError exception if an error occurs reloading the service or a ServiceNotRegistered exception if a layer constructing the service was never registered.

Attributes