Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
Fix typo: ququeID->queueID, Therfore->Therefore (#387)
Browse files Browse the repository at this point in the history
Signed-off-by: yike21 <[email protected]>
  • Loading branch information
yike21 committed Jul 14, 2023
1 parent ea0c458 commit 2fa0f22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions doc/OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Please refer to [hostcall.go](../proxywasm/hostcall.go) for all the available ho

## Entrypoint

When Envoy creates VMs, it calls `main` function of your program at startup phase before it tries to create `VMContext` inside VMs. Therfore you must pass your own implementation of `VMContext` in `main` function.
When Envoy creates VMs, it calls `main` function of your program at startup phase before it tries to create `VMContext` inside VMs. Therefore you must pass your own implementation of `VMContext` in `main` function.

[proxywasm](../proxywasm) package's `SetVMContext` function is the entrypoint used for that purpose. That being said, your `main` function should look like the following:

Expand Down Expand Up @@ -397,21 +397,21 @@ func DequeueSharedQueue(queueID uint32) ([]byte, error)
// RegisterSharedQueue registers the shared queue on this plugin context.
// "Register" means that OnQueueReady is called for this plugin context whenever a new item is enqueued on that queueID.
// Only available for types.PluginContext. The returned ququeID can be used for Enqueue/DequeueSharedQueue.
// Only available for types.PluginContext. The returned queueID can be used for Enqueue/DequeueSharedQueue.
// Note that "name" must be unique across all Wasm VMs which share a same "vm_id".
// That means you can use "vm_id" can be used for separating shared queue namespace.
//
// Only after RegisterSharedQueue is called, ResolveSharedQueue("this vm_id", "name") succeeds
// to retrive queueID by other VMs.
func RegisterSharedQueue(name string) (ququeID uint32, err error)
func RegisterSharedQueue(name string) (queueID uint32, err error)
// EnqueueSharedQueue enqueues an data to the shared queue of the given queueID.
// In order to get queue id for a target queue, use "ResolveSharedQueue" first.
func EnqueueSharedQueue(queueID uint32, data []byte) error
// ResolveSharedQueue acquires the queueID for the given vm_id and queue name.
// The returned ququeID can be used for Enqueue/DequeueSharedQueue.
func ResolveSharedQueue(vmID, queueName string) (ququeID uint32, err error)
// The returned queueID can be used for Enqueue/DequeueSharedQueue.
func ResolveSharedQueue(vmID, queueName string) (queueID uint32, err error)
```

Basically `RegisterSharedQueue` and `DequeueSharedQueue` are used by "consumer" of the queue
Expand Down
9 changes: 4 additions & 5 deletions proxywasm/hostcall.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,18 @@ func SetEffectiveContext(contextID uint32) error {

// RegisterSharedQueue registers the shared queue on this plugin context.
// "Register" means that OnQueueReady is called for this plugin context whenever a new item is enqueued on that queueID.
// Only available for types.PluginContext. The returned ququeID can be used for Enqueue/DequeueSharedQueue.
// Only available for types.PluginContext. The returned queueID can be used for Enqueue/DequeueSharedQueue.
// Note that "name" must be unique across all Wasm VMs which share the same "vm_id".
// That means you can use "vm_id" to separate shared queue namespace.
func RegisterSharedQueue(name string) (ququeID uint32, err error) {
var queueID uint32
func RegisterSharedQueue(name string) (queueID uint32, err error) {
ptr := internal.StringBytePtr(name)
st := internal.ProxyRegisterSharedQueue(ptr, len(name), &queueID)
return queueID, internal.StatusToError(st)
}

// ResolveSharedQueue acquires the queueID for the given vmID and queueName.
// The returned ququeID can be used for Enqueue/DequeueSharedQueue.
func ResolveSharedQueue(vmID, queueName string) (ququeID uint32, err error) {
// The returned queueID can be used for Enqueue/DequeueSharedQueue.
func ResolveSharedQueue(vmID, queueName string) (queueID uint32, err error) {
var ret uint32
st := internal.ProxyResolveSharedQueue(internal.StringBytePtr(vmID),
len(vmID), internal.StringBytePtr(queueName), len(queueName), &ret)
Expand Down

0 comments on commit 2fa0f22

Please sign in to comment.