-
Notifications
You must be signed in to change notification settings - Fork 8
docs: New Readme #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: New Readme #10
Conversation
// @Test | ||
// public void shouldInvokeFunctionFromUrlWasmSourceHostFuncs() { | ||
// var url = "https://github.com/extism/plugins/releases/latest/download/count_vowels_kvstore.wasm"; | ||
// var manifest = new Manifest(List.of(UrlWasmSource.fromUrl(url))); | ||
// | ||
// // Our application KV store | ||
// // Pretend this is redis or a database :) | ||
// var kvStore = new HashMap<String, byte[]>(); | ||
// | ||
// ExtismFunction kvWrite = (plugin, params, returns, data) -> { | ||
// System.out.println("Hello from Java Host Function!"); | ||
// var key = plugin.inputString(params[0]); | ||
// var value = plugin.inputBytes(params[1]); | ||
// System.out.println("Writing to key " + key); | ||
// kvStore.put(key, value); | ||
// }; | ||
// | ||
// ExtismFunction kvRead = (plugin, params, returns, data) -> { | ||
// System.out.println("Hello from Java Host Function!"); | ||
// var key = plugin.inputString(params[0]); | ||
// System.out.println("Reading from key " + key); | ||
// var value = kvStore.get(key); | ||
// if (value == null) { | ||
// // default to zeroed bytes | ||
// var zero = new byte[]{0,0,0,0}; | ||
// plugin.returnBytes(returns[0], zero); | ||
// } else { | ||
// plugin.returnBytes(returns[0], value); | ||
// } | ||
// }; | ||
// | ||
// HostFunction kvWriteHostFn = new HostFunction<>( | ||
// "kv_write", | ||
// new LibExtism.ExtismValType[]{LibExtism.ExtismValType.I64, LibExtism.ExtismValType.I64}, | ||
// new LibExtism.ExtismValType[0], | ||
// kvWrite, | ||
// Optional.empty() | ||
// ); | ||
// | ||
// HostFunction kvReadHostFn = new HostFunction<>( | ||
// "kv_read", | ||
// new LibExtism.ExtismValType[]{LibExtism.ExtismValType.I64}, | ||
// new LibExtism.ExtismValType[]{LibExtism.ExtismValType.I64}, | ||
// kvRead, | ||
// Optional.empty() | ||
// ); | ||
// | ||
// HostFunction[] functions = {kvWriteHostFn, kvReadHostFn}; | ||
// var plugin = new Plugin(manifest, false, functions); | ||
// var output = plugin.call("count_vowels", "Hello, World!"); | ||
// } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beside this commented out test case, the readme lgtm. Do we remove the test or keep it in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's broken, so i'm going to file a separate ticket and follow up
Closes #5