wasmVision Platform API

wasmVision Platform API documentation.

This is the WebAssembly guest module interface for host functions provided by the wasmVision runtime.

  • Imports:
    • interface wasmvision:platform/time
    • interface wasmvision:platform/logging
    • interface wasmvision:platform/config
    • interface wasmvision:platform/http
    • interface wasmvision:platform/datastore

Import interface wasmvision:platform/time


Functions

now: func

Get the current time in milliseconds since the Unix epoch. Use 0 for the tz parameter for now.

Params
  • tz: u32
Return values
  • u64

Import interface wasmvision:platform/logging


Functions

log: func

DEPRECATED: Log a message on the host. Instead use error, warn, info, or debug.

Params
  • msg: string

error: func

Log an error on the host.

Params
  • msg: string

warn: func

Log a warning on the host.

Params
  • msg: string

info: func

Log some non-critical information on the host.

Params
  • msg: string

debug: func

Log some debugging info on the host.

Params
  • msg: string

println: func

Print a message on the host. Intended to bypassing the normal logging system.

Params
  • msg: string

Import interface wasmvision:platform/config


Types

enum config-error

Enum Cases
  • success

    success, all is well.

  • no-such-key

    The requested key does not exist in the configuration.


Functions

get-config: func

Params
  • key: string
Return values

Import interface wasmvision:platform/http


Types

enum http-error

HTTP errors returned by the runtime.

Enum Cases
  • success
  • destination-not-allowed
  • invalid-url
  • request-error
  • runtime-error
  • too-many-requests

Functions

get: func

Get the content at the specified URL. Returns either the content or an error.

Params
  • url: string
Return values

post: func

Post the content to the specified URL. Returns either the response content or an error.

Params
  • url: string
  • content-type: string
  • body: list<u8>
Return values

post-image: func

Post the image to the specified URL. Template is the template to use to send the image. If the content-type is image/jpeg or image/png, the template is ignored, and the image is simply converted and sent in that format. Otherwise, the template is used to convert the image to the desired format using simple substitution of the symbol %IMAGE% after base64 encoding the image. The response-item is the item in the response to return. Usually this will be a JSON element that will be parsed. Mat is the reference to to the Mat to use.

Params
  • url: string
  • content-type: string
  • request-template: list<u8>
  • response-item: string
  • mat: u32
Return values

Import interface wasmvision:platform/datastore


Types

enum datastore-error

datastore errors returned by the runtime.

Enum Cases
  • success
  • no-such-frame
  • no-such-key
  • runtime-error

resource frame-store

frame-store is the interface for storing data associated with a specific frame.

resource processor-store

processor-store is the interface for storing data associated with a processor.

Functions

[constructor]frame-store: func

The id param is currently ignored

Params
  • id: u32
Return values

[method]frame-store.get: func

Get the value associated with the specified key for the specific frame.

Returns ok(none) if the key does not exist.

Params
Return values

[method]frame-store.set: func

Set the value associated with the specified key for the specific frame overwriting any existing value.

Params
  • self: borrow<frame-store>
  • frame: u32
  • key: string
  • value: string
Return values

[method]frame-store.delete: func

Delete the data with the specified key for the specified frame

No error is raised if a tuple did not previously exist for key.

Params
Return values

[method]frame-store.delete-all: func

Delete all data for the specified frame.

No error is raised if no data exists for the frame.

Params
Return values

[method]frame-store.exists: func

Return whether data exists for the specified frame

Params
Return values

[method]frame-store.get-keys: func

Return a list of all the keys. returns empty list if no keys are present.

Params
Return values
  • list<string>

[constructor]processor-store: func

The id param is currently ignored

Params
  • id: u32
Return values

[method]processor-store.get: func

Get the value associated with the specified key

Returns ok(none) if the key does not exist.

Params
Return values

[method]processor-store.set: func

Set the value associated with the specified key overwriting any existing value.

Params
  • self: borrow<processor-store>
  • processor: string
  • key: string
  • value: string
Return values

[method]processor-store.delete: func

Delete the tuple with the specified key

No error is raised if a tuple did not previously exist for key.

Params
Return values

[method]processor-store.delete-all: func

Delete all the data for the specified processor.

No error is raised if no data exists for the processor.

Params
Return values

[method]processor-store.exists: func

Return whether data exists for the specified processor.

Params
Return values

[method]processor-store.get-keys: func

Return a list of all the keys. returns empty list if no keys are present.

Params
Return values
  • list<string>