Skip to content

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

Merged
merged 7 commits into from
Oct 16, 2023
Merged

docs: New Readme #10

merged 7 commits into from
Oct 16, 2023

Conversation

bhelx
Copy link
Contributor

@bhelx bhelx commented Oct 6, 2023

Closes #5

@bhelx bhelx marked this pull request as draft October 6, 2023 17:15
@bhelx bhelx marked this pull request as ready for review October 6, 2023 19:19
Comment on lines +56 to +107
// @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!");
// }

Copy link
Contributor

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?

Copy link
Contributor Author

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

@bhelx bhelx merged commit 1e1fd2c into main Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write a new README and getting started guide
2 participants