Skip to content

Commit

Permalink
align our interfaces w/ the wasi proposals (#269)
Browse files Browse the repository at this point in the history
* modified wit files to align w/ current and future wasi work

Signed-off-by: danbugs <[email protected]>

* deleted old interface files

Signed-off-by: danbugs <[email protected]>

* updated http crates

Signed-off-by: danbugs <[email protected]>

* fixing typos on keyvalue interface

Signed-off-by: danbugs <[email protected]>

* further typo fixing on the keyvalue interface

Signed-off-by: danbugs <[email protected]>

* updated http tests

Signed-off-by: danbugs <[email protected]>

* updated keyvalue tests

Signed-off-by: danbugs <[email protected]>

* updated configs tests

Signed-off-by: danbugs <[email protected]>

* updated configs crate

Signed-off-by: danbugs <[email protected]>

* updated keyvalue crate

Signed-off-by: danbugs <[email protected]>

* fix typos in distributed locking wit

Signed-off-by: danbugs <[email protected]>

* renamed kv crate to keyvalue

Signed-off-by: danbugs <[email protected]>

* renamed lockd crate to distributed-locking

Signed-off-by: danbugs <[email protected]>

* updated manifest files that referenced kv or lockd

Signed-off-by: danbugs <[email protected]>

* removed event type from message transmission for now — will do that in a separate PR

Signed-off-by: danbugs <[email protected]>

* updated pubsub

Signed-off-by: danbugs <[email protected]>

* renamed from pubsub to messaging

Signed-off-by: danbugs <[email protected]>

* updated manifest files that referenced pubsub

Signed-off-by: danbugs <[email protected]>

* ensuring backward compatibility

Signed-off-by: danbugs <[email protected]>

* temporarily removed references to mq — pending unification w/ messaging in another PR

Signed-off-by: danbugs <[email protected]>

* removed last references to old names — kv, lockd, and pubsub + commented out mq references

Signed-off-by: danbugs <[email protected]>

* addressing build errors

Signed-off-by: danbugs <[email protected]>

* addressing build errors again

Signed-off-by: danbugs <[email protected]>

* fix && fmt

Signed-off-by: danbugs <[email protected]>

* removed build-c calls for now in pipelines and added notes about them not functioning in README and multi_capability demo

Signed-off-by: danbugs <[email protected]>

Signed-off-by: danbugs <[email protected]>
  • Loading branch information
danbugs authored Dec 14, 2022
1 parent 8b25ec2 commit 4b542ef
Show file tree
Hide file tree
Showing 114 changed files with 1,127 additions and 1,738 deletions.
112 changes: 25 additions & 87 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ signal-child = "1"
[workspace]
members = [
"slight",
"crates/kv",
"crates/mq",
"crates/lockd",
"crates/keyvalue",
"crates/distributed-locking",
"crates/http",
"crates/http-api",
"crates/http-handler-macro",
"crates/pubsub",
"crates/messaging",
"crates/runtime",
"crates/runtime-configs",
"crates/common",
Expand Down
80 changes: 40 additions & 40 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ install-slight:
.PHONY: build-rust
build-rust:
cargo build --target wasm32-wasi --release --manifest-path ./examples/configs-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/multi_capability-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/kv-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/mq-sender-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/mq-receiver-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/lockd-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/pubsub-producer-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/pubsub-consumer-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/keyvalue-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/distributed-locking-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/messaging-producer-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/messaging-consumer-demo/Cargo.toml & \
cargo build --target wasm32-wasi --release --manifest-path ./examples/http-demo/Cargo.toml & \
wait; \
/bin/sh -c 'echo "DONE"'
# cargo build --target wasm32-wasi --release --manifest-path ./examples/multi_capability-demo/Cargo.toml & \
# cargo build --target wasm32-wasi --release --manifest-path ./examples/mq-sender-demo/Cargo.toml & \
# cargo build --target wasm32-wasi --release --manifest-path ./examples/mq-receiver-demo/Cargo.toml & \

# The dependencies to run this rule include:
# - etcd,
Expand All @@ -89,35 +89,35 @@ build-rust:
# - python.
.PHONY: run-rust
run-rust:
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/multi_capability-demo/slightfile.toml' run -m ./examples/multi_capability-demo/target/wasm32-wasi/release/multi_capability-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/kv-demo/kvfilesystem_slightfile.toml' run -m ./examples/kv-demo/target/wasm32-wasi/release/kv-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/kv-demo/kvawsdynamodb_slightfile.toml' run -m ./examples/kv-demo/target/wasm32-wasi/release/kv-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/kv-demo/kvazblob_slightfile.toml' run -m ./examples/kv-demo/target/wasm32-wasi/release/kv-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/kv-demo/kvredis_slightfile.toml' run -m ./examples/kv-demo/target/wasm32-wasi/release/kv-demo.wasm
# RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/multi_capability-demo/slightfile.toml' run -m ./examples/multi_capability-demo/target/wasm32-wasi/release/multi_capability-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/keyvalue-demo/keyvalue_filesystem_slightfile.toml' run -m ./examples/keyvalue-demo/target/wasm32-wasi/release/keyvalue-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/keyvalue-demo/keyvalue_awsdynamodb_slightfile.toml' run -m ./examples/keyvalue-demo/target/wasm32-wasi/release/keyvalue-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/keyvalue-demo/keyvalue_azblob_slightfile.toml' run -m ./examples/keyvalue-demo/target/wasm32-wasi/release/keyvalue-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/keyvalue-demo/keyvalue_redis_slightfile.toml' run -m ./examples/keyvalue-demo/target/wasm32-wasi/release/keyvalue-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/configs-demo/usersecrets_slightfile.toml' run -m ./examples/configs-demo/target/wasm32-wasi/release/configs-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/configs-demo/envvars_slightfile.toml' run -m ./examples/configs-demo/target/wasm32-wasi/release/configs-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/configs-demo/azapp_slightfile.toml' run -m ./examples/configs-demo/target/wasm32-wasi/release/configs-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/mq-sender-demo/mqfilesystem_slightfile.toml' run -m ./examples/mq-sender-demo/target/wasm32-wasi/release/mq-sender-demo.wasm &
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/mq-receiver-demo/mqfilesystem_slightfile.toml' run -m ./examples/mq-receiver-demo/target/wasm32-wasi/release/mq-receiver-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/mq-sender-demo/mqazsbus_slightfile.toml' run -m ./examples/mq-sender-demo/target/wasm32-wasi/release/mq-sender-demo.wasm &
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/mq-receiver-demo/mqazsbus_slightfile.toml' run -m ./examples/mq-receiver-demo/target/wasm32-wasi/release/mq-receiver-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/lockd-demo/slightfile.toml' run -m ./examples/lockd-demo/target/wasm32-wasi/release/lockd-demo.wasm &
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/lockd-demo/slightfile.toml' run -m ./examples/lockd-demo/target/wasm32-wasi/release/lockd-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/pubsub-consumer-demo/mosquitto_slightfile.toml' run -m ./examples/pubsub-consumer-demo/target/wasm32-wasi/release/pubsub-consumer-demo.wasm &
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/pubsub-producer-demo/mosquitto_slightfile.toml' run -m ./examples/pubsub-producer-demo/target/wasm32-wasi/release/pubsub-producer-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/pubsub-consumer-demo/caf_slightfile.toml' run -m ./examples/pubsub-consumer-demo/target/wasm32-wasi/release/pubsub-consumer-demo.wasm &
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/pubsub-producer-demo/caf_slightfile.toml' run -m ./examples/pubsub-producer-demo/target/wasm32-wasi/release/pubsub-producer-demo.wasm
# RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/mq-sender-demo/mqfilesystem_slightfile.toml' run -m ./examples/mq-sender-demo/target/wasm32-wasi/release/mq-sender-demo.wasm &
# RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/mq-receiver-demo/mqfilesystem_slightfile.toml' run -m ./examples/mq-receiver-demo/target/wasm32-wasi/release/mq-receiver-demo.wasm
# RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/mq-sender-demo/mqazsbus_slightfile.toml' run -m ./examples/mq-sender-demo/target/wasm32-wasi/release/mq-sender-demo.wasm &
# RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/mq-receiver-demo/mqazsbus_slightfile.toml' run -m ./examples/mq-receiver-demo/target/wasm32-wasi/release/mq-receiver-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/distributed-locking-demo/slightfile.toml' run -m ./examples/distributed-locking-demo/target/wasm32-wasi/release/distributed-locking-demo.wasm &
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/distributed-locking-demo/slightfile.toml' run -m ./examples/distributed-locking-demo/target/wasm32-wasi/release/distributed-locking-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/messaging-consumer-demo/mosquitto_slightfile.toml' run -m ./examples/messaging-consumer-demo/target/wasm32-wasi/release/messaging-consumer-demo.wasm &
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/messaging-producer-demo/mosquitto_slightfile.toml' run -m ./examples/messaging-producer-demo/target/wasm32-wasi/release/messaging-producer-demo.wasm
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/messaging-consumer-demo/caf_slightfile.toml' run -m ./examples/messaging-consumer-demo/target/wasm32-wasi/release/messaging-consumer-demo.wasm &
RUST_LOG=$(LOG_LEVEL) $(SLIGHT) -c './examples/messaging-producer-demo/caf_slightfile.toml' run -m ./examples/messaging-producer-demo/target/wasm32-wasi/release/messaging-producer-demo.wasm

.PHONY: clean-rust
clean-rust:
cargo clean --manifest-path ./examples/configs-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/multi_capability-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/kv-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/mq-sender-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/mq-receiver-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/lockd-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/pubsub-producer-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/pubsub-consumer-demo/Cargo.toml & \
# cargo clean --manifest-path ./examples/multi_capability-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/keyvalue-demo/Cargo.toml & \
# cargo clean --manifest-path ./examples/mq-sender-demo/Cargo.toml & \
# cargo clean --manifest-path ./examples/mq-receiver-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/distributed-locking-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/messaging-producer-demo/Cargo.toml & \
cargo clean --manifest-path ./examples/messaging-consumer-demo/Cargo.toml & \
wait; \
/bin/sh -c 'echo "DONE"'

Expand All @@ -126,17 +126,17 @@ clean-rust:
### C EXAMPLES

# To run this rule, you'll need wit-bindgen v0.2.0 installed (cargo install --git https://github.com/bytecodealliance/wit-bindgen wit-bindgen-cli --tag v0.2.0)
.PHONY: build-c
build-c:
$(MAKE) -C examples/multi_capability-demo-clang/ clean
$(MAKE) -C examples/multi_capability-demo-clang/ bindings
$(MAKE) -C examples/multi_capability-demo-clang/ build

.PHONY: build-c-win
build-c-win:
$(MAKE) -C examples/multi_capability-demo-clang/ clean
$(MAKE) -C examples/multi_capability-demo-clang/ bindings
$(MAKE) -C examples/multi_capability-demo-clang/ build-win
# .PHONY: build-c
# build-c:
# $(MAKE) -C examples/multi_capability-demo-clang/ clean
# $(MAKE) -C examples/multi_capability-demo-clang/ bindings
# $(MAKE) -C examples/multi_capability-demo-clang/ build

# .PHONY: build-c-win
# build-c-win:
# $(MAKE) -C examples/multi_capability-demo-clang/ clean
# $(MAKE) -C examples/multi_capability-demo-clang/ bindings
# $(MAKE) -C examples/multi_capability-demo-clang/ build-win


.PHONY: run-c
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ make build-c # builds our c example
make run-c # runs our c example
```

> Note: C Examples are currently non-functional.
# Building Rust Examples

There are also Rust examples that can be built (`build-rust`) and ran (`run-rust`). However, we do not recommend running them because some of these examples have dependencies on environment variables or local programs (e.g., `etcd`), so it probably won't work right off the gate like the C one did.
Expand Down
6 changes: 3 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use std::{
};

const WIT_DIRECTORY: &str = "wit/*";
const KV_TEST_PATH: &str = "tests/kv-test";
const KEYVALUE_TEST_PATH: &str = "tests/keyvalue-test";
const HTTP_TEST_PATH: &str = "tests/http-test";
const CONFIGS_TEST_PATH: &str = "tests/configs-test";

fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed={}", WIT_DIRECTORY);
println!("cargo:rerun-if-changed={}/src/main.rs", KV_TEST_PATH);
println!("cargo:rerun-if-changed={}/src/main.rs", KEYVALUE_TEST_PATH);
println!("cargo:rerun-if-changed={}/src/main.rs", HTTP_TEST_PATH);
println!("cargo:rerun-if-changed={}/src/main.rs", CONFIGS_TEST_PATH);

Expand All @@ -31,7 +31,7 @@ fn main() {
}

// Build test wasm modules
cargo_wasi_build(KV_TEST_PATH);
cargo_wasi_build(KEYVALUE_TEST_PATH);
cargo_wasi_build(HTTP_TEST_PATH);
cargo_wasi_build(CONFIGS_TEST_PATH);
}
Expand Down
12 changes: 6 additions & 6 deletions build/azure-pipeline/workflow-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ stages:
AZAPPCONFIG_KEYSECRET: $(AZAPPCONFIG_KEYSECRET)
condition: and(succeeded(), ne(variables['target_os'], 'windows'))

- script: make build-c
displayName: Build C Examples
condition: and(succeeded(), ne(variables['target_os'], 'windows'))
# - script: make build-c
# displayName: Build C Examples
# condition: and(succeeded(), ne(variables['target_os'], 'windows'))

- script: make build-c-win
displayName: Build C Examples Windows
condition: and(succeeded(), eq(variables['target_os'], 'windows'))
# - script: make build-c-win
# displayName: Build C Examples Windows
# condition: and(succeeded(), eq(variables['target_os'], 'windows'))

- script: make build-rust
displayName: Build Rust Examples
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "slight-lockd"
name = "slight-distributed-locking"
version = "0.1.0"
edition = { workspace = true }
authors = { workspace = true }
Expand All @@ -20,5 +20,5 @@ tracing = { version = "0.1", features = ["log"] }
url = "2.2"
async-trait = { workspace = true }
tokio = { version = "1", features = ["full"] }
# lockd.etcd deps
# distributed_locking.etcd deps
etcd-client = "0.9"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# lockd-etcd
# distributed-locking-etcd

Just like in `etcd`, the `d` in `lockd` stands for "distributed" — This is a service implementation for SpiderLightning that leverages `etcd` to provide distributed locking.
This is a service implementation for SpiderLightning that leverages `etcd` to provide distributed locking.

## How to Run the Examples

Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 4b542ef

Please sign in to comment.