Skip to content

Commit

Permalink
update wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
trmidboe committed Oct 8, 2021
1 parent c9657ea commit c0f34e3
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 67 deletions.
3 changes: 2 additions & 1 deletion src/adapters/serverless/serverless-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ let invokeController
*/
exports.makeServerlessAdapter = function (getParsers) {
return async function (service, provider) {
const parsers = getParsers()
// get remote parsers from aegis-services repo
const parsers = await getParsers()
/**
*
* @param {"request"|"response"} type
Expand Down
18 changes: 9 additions & 9 deletions wasm/assembly/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ export function test(keys: string[], values: string[]): string[][] {

export function getCommands(): string[][] {
const commands = new Array<string[]>(7);
commands[0] = ["websocketListen", "tell wasm module to begin listening"];
commands[1] = ["websocketNotify", "tell wasm module to send broadcast"];
commands[0] = ["serviceMeshListen", "tell wasm module to begin listening"];
commands[1] = ["serviceMeshNotify", "tell wasm module to send broadcast"];
commands[2] = ["runFibonacci", "remote calculate fibonacci for a number"];
commands[3] = ["websocketCallback", "subscribed event fired"];
commands[3] = ["serviceMeshCallback", "subscribed event fired"];
commands[4] = ["fibonacci", "calculate fibonacci for a number"];
commands[5] = ["deployModule", "request deployment of a module"];
commands[6] = ["commandEx", "command example"];
return commands;
}

export function websocketListen(keys: string[], values: string[]): void {
aegis.log("websocketListen" + keys[0] + ":" + values[0]);
aegis.addListener("wasmWebListen", "websocketCallback");
export function serviceMeshListen(keys: string[], values: string[]): void {
aegis.log("serviceMeshListen" + keys[0] + ":" + values[0]);
aegis.addListener("wasmWebListen", "serviceMeshCallback");
}

export function websocketNotify(keys: string[], vals: string[]): void {
export function serviceMeshNotify(keys: string[], vals: string[]): void {
//aegis.log("wasm invoked websocket notify " + eventName + " " + eventData);
const eventName = findVal("eventName", keys, vals);
const modelId = findVal("modelId", keys, vals);
Expand All @@ -77,12 +77,12 @@ export function websocketNotify(keys: string[], vals: string[]): void {
aegis.fireEvent("wasmWebListen", eventData);
}

export function websocketCallback(
export function serviceMeshCallback(
keys: string[],
values: string[]
): string[][] {
aegis.log("websocket callbacked fired" + keys[0] + " " + values[0]);
return [["key1", "websocketCallback"]];
return [["key1", "serviceMeshCallback"]];
}

export function inboundPort(keys: string[], vals: string[]): string[][] {
Expand Down
2 changes: 1 addition & 1 deletion wasm/build/optimized.wasm.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions wasm/build/optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@
(export "ModelSpec#constructor" (func $export:assembly/index/ModelSpec#constructor))
(export "modelFactory" (func $export:assembly/index/modelFactory))
(export "test" (func $export:assembly/index/test))
(export "websocketListen" (func $export:assembly/index/websocketListen))
(export "websocketNotify" (func $export:assembly/index/websocketNotify))
(export "websocketCallback" (func $export:assembly/index/websocketCallback))
(export "serviceMeshListen" (func $export:assembly/index/serviceMeshListen))
(export "serviceMeshNotify" (func $export:assembly/index/serviceMeshNotify))
(export "serviceMeshCallback" (func $export:assembly/index/serviceMeshCallback))
(export "inboundPort" (func $export:assembly/index/inboundPort))
(export "runFibonacci" (func $export:assembly/index/runFibonacci))
(export "getPorts" (func $export:assembly/index/getPorts))
Expand Down Expand Up @@ -8208,7 +8208,7 @@
call $~lib/builtins/abort
unreachable
)
(func $export:assembly/index/websocketListen (param $0 i32) (param $1 i32)
(func $export:assembly/index/serviceMeshListen (param $0 i32) (param $1 i32)
(local $2 i32)
global.get $~lib/memory/__stack_pointer
i32.const 8
Expand Down Expand Up @@ -8316,7 +8316,7 @@
call $~lib/builtins/abort
unreachable
)
(func $export:assembly/index/websocketNotify (param $0 i32) (param $1 i32)
(func $export:assembly/index/serviceMeshNotify (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
global.get $~lib/memory/__stack_pointer
Expand Down Expand Up @@ -8501,7 +8501,7 @@
call $~lib/builtins/abort
unreachable
)
(func $export:assembly/index/websocketCallback (param $0 i32) (param $1 i32) (result i32)
(func $export:assembly/index/serviceMeshCallback (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
global.get $~lib/memory/__stack_pointer
i32.const 8
Expand Down
2 changes: 1 addition & 1 deletion wasm/build/untouched.wasm.map

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions wasm/build/untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@
(export "ModelSpec#constructor" (func $export:assembly/index/ModelSpec#constructor))
(export "modelFactory" (func $export:assembly/index/modelFactory))
(export "test" (func $export:assembly/index/test))
(export "websocketListen" (func $export:assembly/index/websocketListen))
(export "websocketNotify" (func $export:assembly/index/websocketNotify))
(export "websocketCallback" (func $export:assembly/index/websocketCallback))
(export "serviceMeshListen" (func $export:assembly/index/serviceMeshListen))
(export "serviceMeshNotify" (func $export:assembly/index/serviceMeshNotify))
(export "serviceMeshCallback" (func $export:assembly/index/serviceMeshCallback))
(export "inboundPort" (func $export:assembly/index/inboundPort))
(export "runFibonacci" (func $export:assembly/index/runFibonacci))
(export "getPorts" (func $export:assembly/index/getPorts))
Expand Down Expand Up @@ -8802,7 +8802,7 @@
global.set $~lib/memory/__stack_pointer
local.get $3
)
(func $assembly/index/websocketListen (param $0 i32) (param $1 i32)
(func $assembly/index/serviceMeshListen (param $0 i32) (param $1 i32)
(local $2 i32)
global.get $~lib/memory/__stack_pointer
i32.const 28
Expand Down Expand Up @@ -8886,7 +8886,7 @@
i32.add
global.set $~lib/memory/__stack_pointer
)
(func $assembly/index/websocketNotify (param $0 i32) (param $1 i32)
(func $assembly/index/serviceMeshNotify (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
Expand Down Expand Up @@ -9062,7 +9062,7 @@
i32.add
global.set $~lib/memory/__stack_pointer
)
(func $assembly/index/websocketCallback (param $0 i32) (param $1 i32) (result i32)
(func $assembly/index/serviceMeshCallback (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
Expand Down Expand Up @@ -11196,7 +11196,7 @@
global.set $~lib/memory/__stack_pointer
local.get $2
)
(func $export:assembly/index/websocketListen (param $0 i32) (param $1 i32)
(func $export:assembly/index/serviceMeshListen (param $0 i32) (param $1 i32)
global.get $~lib/memory/__stack_pointer
i32.const 8
i32.sub
Expand All @@ -11210,13 +11210,13 @@
i32.store offset=4
local.get $0
local.get $1
call $assembly/index/websocketListen
call $assembly/index/serviceMeshListen
global.get $~lib/memory/__stack_pointer
i32.const 8
i32.add
global.set $~lib/memory/__stack_pointer
)
(func $export:assembly/index/websocketNotify (param $0 i32) (param $1 i32)
(func $export:assembly/index/serviceMeshNotify (param $0 i32) (param $1 i32)
global.get $~lib/memory/__stack_pointer
i32.const 8
i32.sub
Expand All @@ -11230,13 +11230,13 @@
i32.store offset=4
local.get $0
local.get $1
call $assembly/index/websocketNotify
call $assembly/index/serviceMeshNotify
global.get $~lib/memory/__stack_pointer
i32.const 8
i32.add
global.set $~lib/memory/__stack_pointer
)
(func $export:assembly/index/websocketCallback (param $0 i32) (param $1 i32) (result i32)
(func $export:assembly/index/serviceMeshCallback (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
global.get $~lib/memory/__stack_pointer
i32.const 8
Expand All @@ -11251,7 +11251,7 @@
i32.store offset=4
local.get $0
local.get $1
call $assembly/index/websocketCallback
call $assembly/index/serviceMeshCallback
local.set $2
global.get $~lib/memory/__stack_pointer
i32.const 8
Expand Down
4 changes: 2 additions & 2 deletions wasm/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const WasmInterop = require('../../src/adapters/webassembly/wasm-interop')
const wrapper = require('../../src/adapters/webassembly/wasm-decorators')

require('..').then(async wasmInstance => {
const { onUpdate, websocketNotify, runFibonacci } = wasmInstance.exports
const { onUpdate, serviceMeshNotify, runFibonacci } = wasmInstance.exports

//console.log(Object.entries(wasmInstance.exports))

Expand All @@ -18,6 +18,6 @@ require('..').then(async wasmInstance => {
})
console.log(model)
adapter.callWasmFunction(onUpdate, model)
adapter.callWasmFunction(websocketNotify, 'testing')
adapter.callWasmFunction(serviceMeshNotify, 'testing')
console.log(adapter.callWasmFunction(runFibonacci, model))
})
34 changes: 0 additions & 34 deletions workflow/ca-cert.js

This file was deleted.

1 change: 0 additions & 1 deletion workflow/index.js

This file was deleted.

0 comments on commit c0f34e3

Please sign in to comment.