generated from WebAssembly/wasi-proposal-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
addressing first round of feedback: added type aliases, added remove-…
…metadata method, added new-line at the end of files, improved argument names, removed .gitignore, improved documentation, changed get-subscriptions function name Signed-off-by: danbugs <[email protected]>
- Loading branch information
Showing
11 changed files
with
144 additions
and
62 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
<h1><a id="imports_request_reply"></a>World imports-request-reply</h1> | ||
<p>The <a href="#imports_request_reply"><code>imports-request-reply</code></a> world extends <code>imports</code> by including the <code>request-reply</code> interface. | ||
This allows the component to perform request/reply messaging patterns.</p> | ||
<ul> | ||
<li>Imports: | ||
<ul> | ||
|
@@ -11,6 +13,12 @@ | |
<h2><a id="wasi_messaging_types_0_2_0_draft"></a>Import interface wasi:messaging/[email protected]</h2> | ||
<hr /> | ||
<h3>Types</h3> | ||
<h4><a id="metadata"></a><code>type metadata</code></h4> | ||
<p><a href="#metadata"><a href="#metadata"><code>metadata</code></a></a></p> | ||
<p>A type alias for list<tuple<string, string>> to represent metadata attached to a message | ||
<h4><a id="topic"></a><code>type topic</code></h4> | ||
<p><code>string</code></p> | ||
<p>A type alias for string to represent a message topic | ||
<h4><a id="client"></a><code>resource client</code></h4> | ||
<p>A connection to a message-exchange service (e.g., buffer, broker, etc.).</p> | ||
<h4><a id="error"></a><code>variant error</code></h4> | ||
|
@@ -58,7 +66,7 @@ | |
<h4><a id="constructor_message"></a><code>[constructor]message: func</code></h4> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a id="constructor_message.topic"></a><code>topic</code>: <code>string</code></li> | ||
<li><a id="constructor_message.topic"></a><a href="#topic"><code>topic</code></a>: <code>string</code></li> | ||
<li><a id="constructor_message.data"></a><code>data</code>: list<<code>u8</code>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
|
@@ -73,14 +81,14 @@ | |
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a id="method_message_topic.0"></a> <code>string</code></li> | ||
<li><a id="method_message_topic.0"></a> <a href="#topic"><a href="#topic"><code>topic</code></a></a></li> | ||
</ul> | ||
<h4><a id="method_message_set_topic"></a><code>[method]message.set-topic: func</code></h4> | ||
<p>Set the topic/subject/channel this message should be sent on</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a id="method_message_set_topic.self"></a><code>self</code>: borrow<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="method_message_set_topic.topic"></a><code>topic</code>: <code>string</code></li> | ||
<li><a id="method_message_set_topic.topic"></a><a href="#topic"><code>topic</code></a>: <a href="#topic"><a href="#topic"><code>topic</code></a></a></li> | ||
</ul> | ||
<h4><a id="method_message_content_type"></a><code>[method]message.content-type: func</code></h4> | ||
<p>An optional content-type describing the format of the data in the message. This is | ||
|
@@ -127,7 +135,7 @@ message</p> | |
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a id="method_message_metadata.0"></a> option<list<(<code>string</code>, <code>string</code>)>></li> | ||
<li><a id="method_message_metadata.0"></a> option<<a href="#metadata"><a href="#metadata"><code>metadata</code></a></a>></li> | ||
</ul> | ||
<h4><a id="method_message_add_metadata"></a><code>[method]message.add-metadata: func</code></h4> | ||
<p>Add a new key-value pair to the metadata, overwriting any existing value for the same key</p> | ||
|
@@ -137,6 +145,13 @@ message</p> | |
<li><a id="method_message_add_metadata.key"></a><code>key</code>: <code>string</code></li> | ||
<li><a id="method_message_add_metadata.value"></a><code>value</code>: <code>string</code></li> | ||
</ul> | ||
<h4><a id="method_message_remove_metadata"></a><code>[method]message.remove-metadata: func</code></h4> | ||
<p>Remove a key-value pair from the metadata</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a id="method_message_remove_metadata.self"></a><code>self</code>: borrow<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="method_message_remove_metadata.key"></a><code>key</code>: <code>string</code></li> | ||
</ul> | ||
<h2><a id="wasi_messaging_request_reply_0_2_0_draft"></a>Import interface wasi:messaging/[email protected]</h2> | ||
<p>The request-reply interface allows a guest to send a message and await a response. This | ||
interface is considered optional as not all message services support the concept of | ||
|
@@ -193,8 +208,8 @@ return the list of messages received up to that point.</p> | |
<h5>Params</h5> | ||
<ul> | ||
<li><a id="request.c"></a><code>c</code>: borrow<<a href="#client"><a href="#client"><code>client</code></a></a>></li> | ||
<li><a id="request.msg"></a><code>msg</code>: borrow<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="request.opts"></a><code>opts</code>: option<own<<a href="#request_options"><a href="#request_options"><code>request-options</code></a></a>>></li> | ||
<li><a id="request.message"></a><a href="#message"><code>message</code></a>: borrow<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="request.options"></a><code>options</code>: option<own<<a href="#request_options"><a href="#request_options"><code>request-options</code></a></a>>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
|
@@ -213,7 +228,7 @@ where the reply is sent and the connection is closed.</p> | |
<h5>Params</h5> | ||
<ul> | ||
<li><a id="reply.reply_to"></a><code>reply-to</code>: borrow<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="reply.reply"></a><a href="#reply"><code>reply</code></a>: own<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="reply.message"></a><a href="#message"><code>message</code></a>: own<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
|
@@ -239,7 +254,7 @@ where the reply is sent and the connection is closed.</p> | |
<h5>Params</h5> | ||
<ul> | ||
<li><a id="send.c"></a><code>c</code>: borrow<<a href="#client"><a href="#client"><code>client</code></a></a>></li> | ||
<li><a id="send.m"></a><code>m</code>: own<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="send.message"></a><a href="#message"><code>message</code></a>: own<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
<h1><a id="imports"></a>World imports</h1> | ||
<p>The <a href="#imports"><code>imports</code></a> world defines the interfaces that the component will import from the host. | ||
It includes the <code>producer</code> interface for sending messages.</p> | ||
<ul> | ||
<li>Imports: | ||
<ul> | ||
|
@@ -10,6 +12,12 @@ | |
<h2><a id="wasi_messaging_types_0_2_0_draft"></a>Import interface wasi:messaging/[email protected]</h2> | ||
<hr /> | ||
<h3>Types</h3> | ||
<h4><a id="metadata"></a><code>type metadata</code></h4> | ||
<p><a href="#metadata"><a href="#metadata"><code>metadata</code></a></a></p> | ||
<p>A type alias for list<tuple<string, string>> to represent metadata attached to a message | ||
<h4><a id="topic"></a><code>type topic</code></h4> | ||
<p><code>string</code></p> | ||
<p>A type alias for string to represent a message topic | ||
<h4><a id="client"></a><code>resource client</code></h4> | ||
<p>A connection to a message-exchange service (e.g., buffer, broker, etc.).</p> | ||
<h4><a id="error"></a><code>variant error</code></h4> | ||
|
@@ -57,7 +65,7 @@ | |
<h4><a id="constructor_message"></a><code>[constructor]message: func</code></h4> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a id="constructor_message.topic"></a><code>topic</code>: <code>string</code></li> | ||
<li><a id="constructor_message.topic"></a><a href="#topic"><code>topic</code></a>: <code>string</code></li> | ||
<li><a id="constructor_message.data"></a><code>data</code>: list<<code>u8</code>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
|
@@ -72,14 +80,14 @@ | |
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a id="method_message_topic.0"></a> <code>string</code></li> | ||
<li><a id="method_message_topic.0"></a> <a href="#topic"><a href="#topic"><code>topic</code></a></a></li> | ||
</ul> | ||
<h4><a id="method_message_set_topic"></a><code>[method]message.set-topic: func</code></h4> | ||
<p>Set the topic/subject/channel this message should be sent on</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a id="method_message_set_topic.self"></a><code>self</code>: borrow<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="method_message_set_topic.topic"></a><code>topic</code>: <code>string</code></li> | ||
<li><a id="method_message_set_topic.topic"></a><a href="#topic"><code>topic</code></a>: <a href="#topic"><a href="#topic"><code>topic</code></a></a></li> | ||
</ul> | ||
<h4><a id="method_message_content_type"></a><code>[method]message.content-type: func</code></h4> | ||
<p>An optional content-type describing the format of the data in the message. This is | ||
|
@@ -126,7 +134,7 @@ message</p> | |
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a id="method_message_metadata.0"></a> option<list<(<code>string</code>, <code>string</code>)>></li> | ||
<li><a id="method_message_metadata.0"></a> option<<a href="#metadata"><a href="#metadata"><code>metadata</code></a></a>></li> | ||
</ul> | ||
<h4><a id="method_message_add_metadata"></a><code>[method]message.add-metadata: func</code></h4> | ||
<p>Add a new key-value pair to the metadata, overwriting any existing value for the same key</p> | ||
|
@@ -136,6 +144,13 @@ message</p> | |
<li><a id="method_message_add_metadata.key"></a><code>key</code>: <code>string</code></li> | ||
<li><a id="method_message_add_metadata.value"></a><code>value</code>: <code>string</code></li> | ||
</ul> | ||
<h4><a id="method_message_remove_metadata"></a><code>[method]message.remove-metadata: func</code></h4> | ||
<p>Remove a key-value pair from the metadata</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a id="method_message_remove_metadata.self"></a><code>self</code>: borrow<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="method_message_remove_metadata.key"></a><code>key</code>: <code>string</code></li> | ||
</ul> | ||
<h2><a id="wasi_messaging_producer_0_2_0_draft"></a>Import interface wasi:messaging/[email protected]</h2> | ||
<p>The producer interface is used to send messages to a channel/topic.</p> | ||
<hr /> | ||
|
@@ -156,7 +171,7 @@ message</p> | |
<h5>Params</h5> | ||
<ul> | ||
<li><a id="send.c"></a><code>c</code>: borrow<<a href="#client"><a href="#client"><code>client</code></a></a>></li> | ||
<li><a id="send.m"></a><code>m</code>: own<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="send.message"></a><a href="#message"><code>message</code></a>: own<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
<h1><a id="messaging_core"></a>World messaging-core</h1> | ||
<p>The <a href="#messaging_core"><code>messaging-core</code></a> world includes the basic <code>imports</code> and exports the <code>incoming-handler</code>, | ||
enabling the component to handle incoming messages without request/reply capabilities.</p> | ||
<ul> | ||
<li>Imports: | ||
<ul> | ||
|
@@ -15,6 +17,12 @@ | |
<h2><a id="wasi_messaging_types_0_2_0_draft"></a>Import interface wasi:messaging/[email protected]</h2> | ||
<hr /> | ||
<h3>Types</h3> | ||
<h4><a id="metadata"></a><code>type metadata</code></h4> | ||
<p><a href="#metadata"><a href="#metadata"><code>metadata</code></a></a></p> | ||
<p>A type alias for list<tuple<string, string>> to represent metadata attached to a message | ||
<h4><a id="topic"></a><code>type topic</code></h4> | ||
<p><code>string</code></p> | ||
<p>A type alias for string to represent a message topic | ||
<h4><a id="client"></a><code>resource client</code></h4> | ||
<p>A connection to a message-exchange service (e.g., buffer, broker, etc.).</p> | ||
<h4><a id="error"></a><code>variant error</code></h4> | ||
|
@@ -62,7 +70,7 @@ | |
<h4><a id="constructor_message"></a><code>[constructor]message: func</code></h4> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a id="constructor_message.topic"></a><code>topic</code>: <code>string</code></li> | ||
<li><a id="constructor_message.topic"></a><a href="#topic"><code>topic</code></a>: <code>string</code></li> | ||
<li><a id="constructor_message.data"></a><code>data</code>: list<<code>u8</code>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
|
@@ -77,14 +85,14 @@ | |
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a id="method_message_topic.0"></a> <code>string</code></li> | ||
<li><a id="method_message_topic.0"></a> <a href="#topic"><a href="#topic"><code>topic</code></a></a></li> | ||
</ul> | ||
<h4><a id="method_message_set_topic"></a><code>[method]message.set-topic: func</code></h4> | ||
<p>Set the topic/subject/channel this message should be sent on</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a id="method_message_set_topic.self"></a><code>self</code>: borrow<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="method_message_set_topic.topic"></a><code>topic</code>: <code>string</code></li> | ||
<li><a id="method_message_set_topic.topic"></a><a href="#topic"><code>topic</code></a>: <a href="#topic"><a href="#topic"><code>topic</code></a></a></li> | ||
</ul> | ||
<h4><a id="method_message_content_type"></a><code>[method]message.content-type: func</code></h4> | ||
<p>An optional content-type describing the format of the data in the message. This is | ||
|
@@ -131,7 +139,7 @@ message</p> | |
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a id="method_message_metadata.0"></a> option<list<(<code>string</code>, <code>string</code>)>></li> | ||
<li><a id="method_message_metadata.0"></a> option<<a href="#metadata"><a href="#metadata"><code>metadata</code></a></a>></li> | ||
</ul> | ||
<h4><a id="method_message_add_metadata"></a><code>[method]message.add-metadata: func</code></h4> | ||
<p>Add a new key-value pair to the metadata, overwriting any existing value for the same key</p> | ||
|
@@ -141,6 +149,13 @@ message</p> | |
<li><a id="method_message_add_metadata.key"></a><code>key</code>: <code>string</code></li> | ||
<li><a id="method_message_add_metadata.value"></a><code>value</code>: <code>string</code></li> | ||
</ul> | ||
<h4><a id="method_message_remove_metadata"></a><code>[method]message.remove-metadata: func</code></h4> | ||
<p>Remove a key-value pair from the metadata</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a id="method_message_remove_metadata.self"></a><code>self</code>: borrow<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="method_message_remove_metadata.key"></a><code>key</code>: <code>string</code></li> | ||
</ul> | ||
<h2><a id="wasi_messaging_producer_0_2_0_draft"></a>Import interface wasi:messaging/[email protected]</h2> | ||
<p>The producer interface is used to send messages to a channel/topic.</p> | ||
<hr /> | ||
|
@@ -161,7 +176,7 @@ message</p> | |
<h5>Params</h5> | ||
<ul> | ||
<li><a id="send.c"></a><code>c</code>: borrow<<a href="#client"><a href="#client"><code>client</code></a></a>></li> | ||
<li><a id="send.m"></a><code>m</code>: own<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="send.message"></a><a href="#message"><code>message</code></a>: own<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
|
@@ -176,6 +191,9 @@ message</p> | |
#### <a id="error"></a>`type error` | ||
[`error`](#error) | ||
<p> | ||
#### <a id="topic"></a>`type topic` | ||
[`topic`](#topic) | ||
<p> | ||
---- | ||
<h3>Functions</h3> | ||
<h4><a id="handle"></a><code>handle: func</code></h4> | ||
|
@@ -185,18 +203,18 @@ message accordingly. Implementors (such as hosts) calling this interface should | |
own decisions on how to handle errors returned from this function.</p> | ||
<h5>Params</h5> | ||
<ul> | ||
<li><a id="handle.ms"></a><code>ms</code>: own<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
<li><a id="handle.message"></a><a href="#message"><code>message</code></a>: own<<a href="#message"><a href="#message"><code>message</code></a></a>></li> | ||
</ul> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a id="handle.0"></a> result<_, <a href="#error"><a href="#error"><code>error</code></a></a>></li> | ||
</ul> | ||
<h4><a id="get_subscriptions"></a><code>get-subscriptions: func</code></h4> | ||
<p>Subscribe to a list of topics (represented as <code>string</code>s) at runtime. | ||
Implementors should consider also allowing subscriptions to be made at compile time via | ||
some sort of configuration file. This function is intended to be called at the start of the | ||
<h4><a id="get_topics"></a><code>get-topics: func</code></h4> | ||
<p>Returns a list of topics (represented as <code>string</code>s) at runtime the guest should be subscribed | ||
to at runtime. Implementors should consider also allowing subscriptions to be made at compile time | ||
via some sort of configuration file. This function is intended to be called at the start of the | ||
guest's lifecycle before any messages are sent.</p> | ||
<h5>Return values</h5> | ||
<ul> | ||
<li><a id="get_subscriptions.0"></a> result<list<<code>string</code>>, <a href="#error"><a href="#error"><code>error</code></a></a>></li> | ||
<li><a id="get_topics.0"></a> result<list<<a href="#topic"><a href="#topic"><code>topic</code></a></a>>, <a href="#error"><a href="#error"><code>error</code></a></a>></li> | ||
</ul> |
Oops, something went wrong.