-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
98 changed files
with
5,232 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ aiven.sh | |
deploy | ||
release | ||
slingshot-server/tmp | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.wasm | ||
slingshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: '3' | ||
|
||
description: > | ||
task slingshot-build | ||
task wasm-build | ||
task wasm-run | ||
tasks: | ||
# task slingshot-build | ||
slingshot-build: | ||
cmds: | ||
- | | ||
target=$(pwd) | ||
cd ../slingshot-server | ||
env CGO_ENABLED=0 go build -ldflags="-s -w" -o ${target}/slingshot | ||
# task wasm-build | ||
wasm-build: | ||
cmds: | ||
- | | ||
tinygo build -scheduler=none --no-debug \ | ||
-o hello.wasm \ | ||
-target wasi main.go | ||
ls -lh *.wasm | ||
# task wasm-run | ||
wasm-run: | ||
cmds: | ||
- | | ||
./slingshot cli --wasm=./hello.wasm --handler=hello --input="Bob 🤓" | ||
# task all | ||
all: | ||
cmds: | ||
- task slingshot-build | ||
- task wasm-build | ||
- task wasm-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module hello | ||
|
||
go 1.20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/extism/go-pdk" | ||
) | ||
|
||
//export hello | ||
func hello() { | ||
// read function argument from the shared memory | ||
input := pdk.Input() | ||
output := "👋 Hello " + string(input) | ||
|
||
// copy output to shared memory | ||
mem := pdk.AllocateString(output) | ||
pdk.OutputMemory(mem) | ||
} | ||
|
||
func main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.wasm | ||
slingshot* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "hello" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate_type = ["cdylib"] | ||
|
||
[dependencies] | ||
extism-pdk = "0.3.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: '3' | ||
|
||
description: > | ||
task slingshot-build | ||
task wasm-build | ||
task wasm-run | ||
tasks: | ||
# task slingshot-build | ||
slingshot-build: | ||
cmds: | ||
- | | ||
target=$(pwd) | ||
cd ../slingshot-server | ||
env CGO_ENABLED=0 go build -ldflags="-s -w" -o ${target}/slingshot | ||
# task wasm-build | ||
wasm-build: | ||
cmds: | ||
- | | ||
cargo clean | ||
cargo build --release --target wasm32-wasi #--offline | ||
# ls -lh *.wasm | ||
ls -lh ./target/wasm32-wasi/release/*.wasm | ||
cp ./target/wasm32-wasi/release/*.wasm . | ||
# task wasm-run | ||
wasm-run: | ||
cmds: | ||
- | | ||
./slingshot cli --wasm=./hello.wasm --handler=hello --input="Bob 🤓" | ||
# task all | ||
all: | ||
cmds: | ||
- task slingshot-build | ||
- task wasm-build | ||
- task wasm-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use extism_pdk::*; | ||
|
||
#[plugin_fn] | ||
pub fn hello(input: String) -> FnResult<String> { | ||
|
||
let output : String = "👋 Hello ".to_string() + &input; | ||
|
||
Ok(output) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"rustc_fingerprint":15056852261292534572,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/k33g/.rustup/toolchains/stable-aarch64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"neon\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"17351682911112135739":{"success":true,"status":"","code":0,"stdout":"___.wasm\nlib___.rlib\n___.wasm\nlib___.a\n/home/k33g/.rustup/toolchains/stable-aarch64-unknown-linux-gnu\noff\n___\ndebug_assertions\npanic=\"abort\"\nproc_macro\ntarget_arch=\"wasm32\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"wasm\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"wasi\"\ntarget_pointer_width=\"32\"\ntarget_vendor=\"unknown\"\n","stderr":"warning: dropping unsupported crate type `dylib` for target `wasm32-wasi`\n\nwarning: dropping unsupported crate type `proc-macro` for target `wasm32-wasi`\n\nwarning: 2 warnings emitted\n\n"},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.71.1 (eb26296b5 2023-08-03)\nbinary: rustc\ncommit-hash: eb26296b556cef10fb713a38f3d16b9886080f26\ncommit-date: 2023-08-03\nhost: aarch64-unknown-linux-gnu\nrelease: 1.71.1\nLLVM version: 16.0.5\n","stderr":""}},"successes":{}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Signature: 8a477f597d28d172789f06886806bc55 | ||
# This file is a cache directory tag created by cargo. | ||
# For information about cache directory tags see https://bford.info/cachedir/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Signature: 8a477f597d28d172789f06886806bc55 | ||
# This file is a cache directory tag created by cargo. | ||
# For information about cache directory tags see https://bford.info/cachedir/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.wasm | ||
slingshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: '3' | ||
|
||
description: > | ||
task slingshot-build | ||
task wasm-build | ||
task wasm-run | ||
tasks: | ||
# task slingshot-build | ||
slingshot-build: | ||
cmds: | ||
- | | ||
target=$(pwd) | ||
cd ../slingshot-server | ||
env CGO_ENABLED=0 go build -ldflags="-s -w" -o ${target}/slingshot | ||
# task wasm-build | ||
wasm-build: | ||
cmds: | ||
- | | ||
tinygo build -scheduler=none --no-debug \ | ||
-o print.wasm \ | ||
-target wasi main.go | ||
ls -lh *.wasm | ||
# task wasm-run | ||
wasm-run: | ||
cmds: | ||
- | | ||
./slingshot cli --wasm=./print.wasm --handler=hello --input="🤓 I'm a geek" | ||
# task all | ||
all: | ||
cmds: | ||
- task slingshot-build | ||
- task wasm-build | ||
- task wasm-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module print | ||
|
||
go 1.20 |
Oops, something went wrong.