mirror of
https://github.com/swift-server/swift-service-lifecycle
synced 2026-11-24 04:38:12 +00:00
733 lines
37 KiB
HTML
733 lines
37 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<title>ServiceLifecycle Structure Reference</title>
|
||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||
<meta charset="utf-8">
|
||
<script src="../js/jquery.min.js" defer></script>
|
||
<script src="../js/jazzy.js" defer></script>
|
||
|
||
<script src="../js/lunr.min.js" defer></script>
|
||
<script src="../js/typeahead.jquery.js" defer></script>
|
||
<script src="../js/jazzy.search.js" defer></script>
|
||
</head>
|
||
<body>
|
||
|
||
<a name="//apple_ref/swift/Struct/ServiceLifecycle" class="dashAnchor"></a>
|
||
|
||
<a title="ServiceLifecycle Structure Reference"></a>
|
||
|
||
<header class="header">
|
||
<p class="header-col header-col--primary">
|
||
<a class="header-link" href="../index.html">
|
||
Lifecycle 1.0.0-alpha.4 Docs
|
||
</a>
|
||
(76% documented)
|
||
</p>
|
||
|
||
<p class="header-col--secondary">
|
||
<form role="search" action="../search.json">
|
||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||
</form>
|
||
</p>
|
||
|
||
<p class="header-col header-col--secondary">
|
||
<a class="header-link" href="https://github.com/swift-server/swift-service-lifecycle">
|
||
<img class="header-icon" src="../img/gh.png"/>
|
||
View on GitHub
|
||
</a>
|
||
</p>
|
||
|
||
<p class="header-col header-col--secondary">
|
||
<a class="header-link" href="dash-feed://https%3A%2F%2Fswift-server.github.io%2Fswift-service-lifecycle%2Fdocs%2F1.0.0-alpha.4%2FLifecycle%2Fdocsets%2FLifecycle.xml">
|
||
<img class="header-icon" src="../img/dash.png"/>
|
||
Install in Dash
|
||
</a>
|
||
</p>
|
||
</header>
|
||
|
||
<p class="breadcrumbs">
|
||
<a class="breadcrumb" href="../index.html">Lifecycle Reference</a>
|
||
<img class="carat" src="../img/carat.png" />
|
||
ServiceLifecycle Structure Reference
|
||
</p>
|
||
|
||
<div class="content-wrapper">
|
||
<nav class="navigation">
|
||
<ul class="nav-groups">
|
||
<li class="nav-group-name">
|
||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/ComponentLifecycle.html">ComponentLifecycle</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/LifecycleTask.html">LifecycleTask</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/LifecycleHandler.html">LifecycleHandler</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/ServiceLifecycle.html">ServiceLifecycle</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/ServiceLifecycle/Signal.html">– Signal</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/ServiceLifecycle/Configuration.html">– Configuration</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</nav>
|
||
<article class="main-content">
|
||
|
||
<section class="section">
|
||
<div class="section-content top-matter">
|
||
<h1>ServiceLifecycle</h1>
|
||
<div class="declaration">
|
||
<div class="language">
|
||
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">ServiceLifecycle</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<p>Undocumented</p>
|
||
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L84-L143">Show on GitHub</a>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="section">
|
||
<div class="section-content">
|
||
<div class="task-group">
|
||
<ul class="item-container">
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V13configurationA2C13ConfigurationV_tcfc"></a>
|
||
<a name="//apple_ref/swift/Method/init(configuration:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V13configurationA2C13ConfigurationV_tcfc">init(configuration:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Creates a <code><a href="../Classes/ComponentLifecycle.html">ComponentLifecycle</a></code> instance.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">configuration</span><span class="p">:</span> <span class="kt"><a href="../Structs/ServiceLifecycle/Configuration.html">Configuration</a></span> <span class="o">=</span> <span class="o">.</span><span class="nf">init</span><span class="p">())</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>configuration</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>Defines lifecycle <code><a href="../Structs/ServiceLifecycle/Configuration.html">Configuration</a></code></p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L92-L100">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V5startyyys5Error_pSgcF"></a>
|
||
<a name="//apple_ref/swift/Method/start(_:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V5startyyys5Error_pSgcF">start(_:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Starts the provided <code>LifecycleItem</code> array.
|
||
Startup is performed in the order of items provided.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">start</span><span class="p">(</span><span class="n">_</span> <span class="nv">callback</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-></span> <span class="kt">Void</span><span class="p">)</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>callback</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>The handler which is called after the start operation completes. The parameter will be <code>nil</code> on success and contain the <code>Error</code> otherwise.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L107-L119">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V12startAndWaityyKF"></a>
|
||
<a name="//apple_ref/swift/Method/startAndWait()" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V12startAndWaityyKF">startAndWait()</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Starts the provided <code>LifecycleItem</code> array and waits (blocking) until a shutdown <code><a href="../Structs/ServiceLifecycle/Signal.html">Signal</a></code> is captured or <code>shutdown</code> is called on another thread.
|
||
Startup is performed in the order of items provided.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">startAndWait</span><span class="p">()</span> <span class="k">throws</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>configuration</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>Defines lifecycle <code><a href="../Structs/ServiceLifecycle/Configuration.html">Configuration</a></code></p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L126-L128">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V8shutdownyyys5Error_pSgcF"></a>
|
||
<a name="//apple_ref/swift/Method/shutdown(_:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V8shutdownyyys5Error_pSgcF">shutdown(_:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Shuts down the <code>LifecycleItem</code> array provided in <code>start</code> or <code>startAndWait</code>.
|
||
Shutdown is performed in reverse order of items provided.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">shutdown</span><span class="p">(</span><span class="n">_</span> <span class="nv">callback</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-></span> <span class="kt">Void</span> <span class="o">=</span> <span class="p">{</span> <span class="n">_</span> <span class="k">in</span> <span class="p">})</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>callback</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>The handler which is called after the start operation completes. The parameter will be <code>nil</code> on success and contain the <code>Error</code> otherwise.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L135-L137">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V4waityyF"></a>
|
||
<a name="//apple_ref/swift/Method/wait()" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V4waityyF">wait()</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Waits (blocking) until shutdown <code><a href="../Structs/ServiceLifecycle/Signal.html">Signal</a></code> is captured or <code>shutdown</code> is invoked on another thread.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">wait</span><span class="p">()</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L140-L142">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div class="task-group">
|
||
<div class="task-name-container">
|
||
<a name="/ServiceLifecycle"></a>
|
||
<a name="//apple_ref/swift/Section/ServiceLifecycle" class="dashAnchor"></a>
|
||
<div class="section-name-container">
|
||
<a class="section-name-link" href="#/ServiceLifecycle"></a>
|
||
<h3 class="section-name"><p>ServiceLifecycle</p>
|
||
</h3>
|
||
</div>
|
||
</div>
|
||
<ul class="item-container">
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V4trap6signal7handler2on8Dispatch0G12SourceSignal_pAC0I0V_yAKcAH0G5QueueCtFZ"></a>
|
||
<a name="//apple_ref/swift/Method/trap(signal:handler:on:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V4trap6signal7handler2on8Dispatch0G12SourceSignal_pAC0I0V_yAKcAH0G5QueueCtFZ">trap(signal:<wbr>handler:<wbr>on:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Setup a signal trap.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="nf">trap</span><span class="p">(</span><span class="n">signal</span> <span class="nv">sig</span><span class="p">:</span> <span class="kt"><a href="../Structs/ServiceLifecycle/Signal.html">Signal</a></span><span class="p">,</span> <span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt"><a href="../Structs/ServiceLifecycle/Signal.html">Signal</a></span><span class="p">)</span> <span class="o">-></span> <span class="kt">Void</span><span class="p">,</span> <span class="n">on</span> <span class="nv">queue</span><span class="p">:</span> <span class="kt">DispatchQueue</span> <span class="o">=</span> <span class="o">.</span><span class="nf">global</span><span class="p">())</span> <span class="o">-></span> <span class="kt">DispatchSourceSignal</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>signal</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>The signal to trap.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>handler</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>closure to invoke when the signal is captured.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div>
|
||
<h4>Return Value</h4>
|
||
<p>a <code>DispatchSourceSignal</code> for the given trap. The source must be cancled by the caller.</p>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L152-L161">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V6SignalV"></a>
|
||
<a name="//apple_ref/swift/Struct/Signal" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V6SignalV">Signal</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>A system signal</p>
|
||
|
||
<a href="../Structs/ServiceLifecycle/Signal.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Signal</span> <span class="p">:</span> <span class="kt">Equatable</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L164-L183">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V8registeryyAA0A4Task_pd_tF"></a>
|
||
<a name="//apple_ref/swift/Method/register(_:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V8registeryyAA0A4Task_pd_tF">register(_:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Adds a <code>Task</code> to a <code>Tasks</code> collection.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">register</span><span class="p">(</span><span class="n">_</span> <span class="nv">tasks</span><span class="p">:</span> <span class="kt"><a href="../Protocols/LifecycleTask.html">LifecycleTask</a></span><span class="o">...</span><span class="p">)</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>tasks</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>one or more <code>Tasks</code>.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L191-L193">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V8registeryySayAA0A4Task_pGF"></a>
|
||
<a name="//apple_ref/swift/Method/register(_:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V8registeryySayAA0A4Task_pGF">register(_:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Adds a <code>Task</code> to a <code>Tasks</code> collection.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">register</span><span class="p">(</span><span class="n">_</span> <span class="nv">tasks</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Protocols/LifecycleTask.html">LifecycleTask</a></span><span class="p">])</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>tasks</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>array of <code>Tasks</code>.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L199-L201">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V8register5label5start8shutdownySS_AA0A7HandlerVAItF"></a>
|
||
<a name="//apple_ref/swift/Method/register(label:start:shutdown:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V8register5label5start8shutdownySS_AA0A7HandlerVAItF">register(label:<wbr>start:<wbr>shutdown:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Adds a <code>Task</code> to a <code>Tasks</code> collection.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">register</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">start</span><span class="p">:</span> <span class="kt"><a href="../Structs/LifecycleHandler.html">LifecycleHandler</a></span><span class="p">,</span> <span class="nv">shutdown</span><span class="p">:</span> <span class="kt"><a href="../Structs/LifecycleHandler.html">LifecycleHandler</a></span><span class="p">)</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>label</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>label of the item, useful for debugging.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>start</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p><code>Handler</code> to perform the startup.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>shutdown</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p><code>Handler</code> to perform the shutdown.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L209-L211">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V16registerShutdown5label_ySS_AA0A7HandlerVtF"></a>
|
||
<a name="//apple_ref/swift/Method/registerShutdown(label:_:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V16registerShutdown5label_ySS_AA0A7HandlerVtF">registerShutdown(label:<wbr>_:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Adds a <code>Task</code> to a <code>Tasks</code> collection.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">registerShutdown</span><span class="p">(</span><span class="nv">label</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="n">_</span> <span class="nv">handler</span><span class="p">:</span> <span class="kt"><a href="../Structs/LifecycleHandler.html">LifecycleHandler</a></span><span class="p">)</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>label</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>label of the item, useful for debugging.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>handler</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p><code>Handler</code> to perform the shutdown.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L218-L220">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:9Lifecycle07ServiceA0V13ConfigurationV"></a>
|
||
<a name="//apple_ref/swift/Struct/Configuration" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:9Lifecycle07ServiceA0V13ConfigurationV">Configuration</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p><code>Lifecycle</code> configuration options.</p>
|
||
|
||
<a href="../Structs/ServiceLifecycle/Configuration.html" class="slightly-smaller">See more</a>
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Configuration</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/swift-server/swift-service-lifecycle/tree/1.0.0-alpha.4/Sources/Lifecycle/Lifecycle.swift#L225-L244">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
</article>
|
||
</div>
|
||
<section class="footer">
|
||
<p>© 2020 <a class="link" href="https://github.com/swift-server/swift-service-lifecycle" target="_blank" rel="external">SwiftServiceLifecycle team</a>. All rights reserved. (Last updated: 2020-07-15)</p>
|
||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.5</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||
</section>
|
||
</body>
|
||
</div>
|
||
</html>
|