Skip to content

Commit 579716e

Browse files
authored
Combine register and resolve into proxy_open_shared_queue. (#97)
While there, add `proxy_delete_shared_queue`. Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
1 parent 53b2814 commit 579716e

1 file changed

Lines changed: 26 additions & 34 deletions

File tree

abi-versions/vNEXT/README.md

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,51 +1534,30 @@ Returned `status` value is:
15341534

15351535
### Functions exposed by the host
15361536

1537-
#### `proxy_register_shared_queue`
1537+
#### `proxy_open_shared_queue`
15381538

15391539
* params:
1540-
- `i32 (const char *) name_data`
1541-
- `i32 (size_t) name_size`
1540+
- `i32 (const char *) queue_name_data`
1541+
- `i32 (size_t) queue_name_size`
1542+
- `i32 (bool) create_if_not_exist`
15421543
- `i32 (uint32_t *) return_queue_id`
15431544
* returns:
15441545
- `i32 (`[`proxy_status_t`]`) status`
15451546

1546-
Registers shared queue under a name (`name_data`, `name_size`).
1547-
1548-
If the named queue already exists, then it's going to be opened
1549-
instead of creating a new empty queue.
1550-
1551-
Items can be enqueued/dequeued on the created/opened queue using
1552-
[`proxy_enqueue_shared_queue`] and/or [`proxy_dequeue_shared_queue`]
1553-
with `return_queue_id`.
1554-
1555-
Returned `status` value is:
1556-
- `OK` on success.
1557-
- `INVALID_MEMORY_ACCESS` when `name_data`, `name_size`
1558-
and/or `return_queue_id` point to invalid memory address.
1559-
1560-
1561-
#### `proxy_resolve_shared_queue`
1562-
1563-
* params:
1564-
- `i32 (const char *) vm_id_data`
1565-
- `i32 (size_t) vm_id_size`
1566-
- `i32 (const char *) name_data`
1567-
- `i32 (size_t) name_size`
1568-
- `i32 (uint32_t *) return_queue_id`
1569-
* returns:
1570-
- `i32 (`[`proxy_status_t`]`) status`
1547+
Opens named queue (`queue_name_data`, `queue_name_size`).
15711548

1572-
Resolves existing shared queue using the provided VM ID (`vm_id_data`,
1573-
`vm_id_size`) and name (`name_data`, `name_size`).
1549+
If `create_if_not_exist` is `true` and there is no shared queue with
1550+
the given name, then it will be created.
15741551

15751552
Items can be enqueued/dequeued on the opened queue using
15761553
[`proxy_enqueue_shared_queue`] and/or [`proxy_dequeue_shared_queue`]
15771554
with `return_queue_id`.
15781555

15791556
Returned `status` value is:
1580-
- `OK` on success.
1581-
- `NOT_FOUND` when the requested queue was not found.
1557+
- `OK` on success when opening existing queue.
1558+
- `CREATED` on success when a queue with the given name was created.
1559+
- `NOT_FOUND` when `create_if_not_exist` is `false` and no shared queue
1560+
with the given name exists.
15821561
- `INVALID_MEMORY_ACCESS` when `vm_id_data`, `vm_id_size`, `name_data`,
15831562
`name_size` and/or `return_queue_id` point to invalid memory address.
15841563

@@ -1622,6 +1601,18 @@ Returned `status` value is:
16221601
and/or `return_value_size` point to invalid memory address.
16231602

16241603

1604+
#### `proxy_delete_shared_queue`
1605+
1606+
* params:
1607+
- `i32 (uint32_t) queue_id`
1608+
* returns:
1609+
- `i32 (`[`proxy_status_t`]`) status`
1610+
1611+
Deletes previously created shared queue (`queue_id`).
1612+
- `OK` on success.
1613+
- `UNKNOWN_RESOURCE_ID` for unknown `queue_id`.
1614+
1615+
16251616
### Callbacks exposed by the Wasm module
16261617

16271618
#### `proxy_on_queue_ready`
@@ -2048,6 +2039,7 @@ changes to unrelated connections/requests.
20482039
- `INTERNAL_FAILURE` = `10`
20492040
- `UNIMPLEMENTED` = `12`
20502041
- `UNKNOWN_RESOURCE_ID` = `13`
2042+
- `CREATED` = `14`
20512043

20522044

20532045
#### `proxy_action_t`
@@ -2185,10 +2177,10 @@ changes to unrelated connections/requests.
21852177
[`proxy_on_grpc_close`]: #proxy_on_grpc_close
21862178
[`proxy_set_shared_data`]: #proxy_set_shared_data
21872179
[`proxy_get_shared_data`]: #proxy_get_shared_data
2188-
[`proxy_register_shared_queue`]: #proxy_register_shared_queue
2189-
[`proxy_resolve_shared_queue`]: #proxy_resolve_shared_queue
2180+
[`proxy_open_shared_queue`]: #proxy_open_shared_queue
21902181
[`proxy_enqueue_shared_queue`]: #proxy_enqueue_shared_queue
21912182
[`proxy_dequeue_shared_queue`]: #proxy_dequeue_shared_queue
2183+
[`proxy_delete_shared_queue`]: #proxy_delete_shared_queue
21922184
[`proxy_on_queue_ready`]: #proxy_on_queue_ready
21932185
[`proxy_define_metric`]: #proxy_define_metric
21942186
[`proxy_record_metric`]: #proxy_record_metric

0 commit comments

Comments
 (0)