commit 95909a84bdd7259234d2c91035ff99093ec527aa
parent 624e49092ebce05863a5cb495169de534dc6b4e6
Author: Joris Vink <joris@coders.se>
Date: Fri, 30 Nov 2018 09:53:58 +0100
Add hook API documentation
Diffstat:
SUMMARY.md | 1 +
api/hooks.md | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 140 insertions(+), 0 deletions(-)
diff --git a/SUMMARY.md b/SUMMARY.md
@@ -11,6 +11,7 @@
* [Routes](applications/routes.md)
* [Filemaps](applications/filemap.md)
* [API](api/README.md)
+ * [Hooks](api/hooks.md)
* [Buffers](api/buffers.md)
* [HTTP](api/http.md)
* [Pools](api/pools.md)
diff --git a/api/hooks.md b/api/hooks.md
@@ -0,0 +1,139 @@
+# Hooks
+
+Kore supports several hooking functions allowing your application
+to do things at certain times in the Kore startup / shutdown procedure.
+
+* [kore\_parent\_configure](#parentconfigure)
+* [kore\_parent\_daemonized](#parentdaemonized)
+* [kore\_parent\_teardown](#parentteardown)
+* [kore\_worker\_configure](#workerconfigure)
+* [kore\_worker\_teardown](#workerteardown)
+* [kore\_python\_preinit](#pythonpreinit)
+
+---
+
+# kore\_parent\_configure {#parentconfigure}
+
+### Synopsis
+
+```
+void kore_parent_configure(int argc, char *argv[])
+```
+
+### Description
+
+Called immediately after Kore is done parsing the command line arguments
+and before any configuration is read.
+
+This is called only once.
+
+| Parameter | Description |
+| --- | --- |
+| argc | The number of remaining command line arguments. |
+| argv | The remaining command line arguments. |
+
+### Returns
+
+Nothing
+
+---
+
+# kore\_parent\_daemonized {#parentdaemonized}
+
+### Synopsis
+
+```
+void kore_parent_daemonized(void)
+```
+
+### Description
+
+Called after the parent process has daemonized itself.
+
+This is called only once.
+
+### Returns
+
+Nothing
+
+---
+
+# kore\_parent\_teardown {#parentteardown}
+
+### Synopsis
+
+```
+void kore_parent_teardown(void)
+```
+
+### Description
+
+Called right before the parent process will exit.
+
+This is called only once.
+
+### Returns
+
+Nothing
+
+---
+
+# kore\_worker\_configure {#workerconfigure}
+
+### Synopsis
+
+```
+void kore_worker_configure(void)
+```
+
+### Description
+
+Called by a worker process immediately after it is done initializing itself.
+
+(This is called **per** worker).
+
+### Returns
+
+Nothing
+
+---
+
+# kore\_worker\_teardown {#workerteardown}
+
+### Synopsis
+
+```
+void kore_worker_teardown(void)
+```
+
+### Description
+
+Called by a worker process right before it exits.
+
+(This is called **per** worker).
+
+### Returns
+
+Nothing
+
+---
+
+# kore\_python\_preinit {#pythonpreinit}
+
+### Synopsis
+
+```
+void kore_python_preinit(void)
+```
+
+### Description
+
+If Python support is enabled Kore will call this hook right before
+it calls Py\_Initialize().
+
+This allows your application to register its own built-in modules
+that can be used by your Python code.
+
+### Returns
+
+Nothing