ServiceLifecycle

public struct ServiceLifecycle

Undocumented

  • Creates a ComponentLifecycle instance.

    Declaration

    Swift

    public init(configuration: Configuration = .init())

    Parameters

    configuration

    Defines lifecycle Configuration

  • Starts the provided LifecycleItem array. Startup is performed in the order of items provided.

    Declaration

    Swift

    public func start(_ callback: @escaping (Error?) -> Void)

    Parameters

    callback

    The handler which is called after the start operation completes. The parameter will be nil on success and contain the Error otherwise.

  • Starts the provided LifecycleItem array and waits (blocking) until a shutdown Signal is captured or shutdown is called on another thread. Startup is performed in the order of items provided.

    Declaration

    Swift

    public func startAndWait() throws

    Parameters

    configuration

    Defines lifecycle Configuration

  • Shuts down the LifecycleItem array provided in start or startAndWait. Shutdown is performed in reverse order of items provided.

    Declaration

    Swift

    public func shutdown(_ callback: @escaping (Error?) -> Void = { _ in })

    Parameters

    callback

    The handler which is called after the start operation completes. The parameter will be nil on success and contain the Error otherwise.

  • Waits (blocking) until shutdown Signal is captured or shutdown is invoked on another thread.

    Declaration

    Swift

    public func wait()

ServiceLifecycle