Topics:

  • What's changed in Rust? via @jacobrosenthal
  • An Exploration of wasmcloud Microservices via @LJ

What's changed in Rust? via @jacobrosenthal

Rust Analyzer

rust-analyzer continues to get better and provides Rust with a proper IDE experience. If you are using VSCode, it is still not the default Rust extension. However, per the official Rust in Visual Studio Code, the RLS extension will soon be deprecated and rust-analyzer will become the recommended VS Code Rust extension by rust-lang.org. New assists are being added all the time. Some of the more useful ones are below:

  • Hover: shows you documentation when you hover over an expression.

  • Inlay Hints: shows type information for variables and chained expressions, making it easy to know what something is without digging into code. At the 2/24/2021 Meetup, we discussed a cool trick for toggling Inlay Hints on and off.

Crates VSCode Plugin

crates is another awesome VSCode plugin for Rust. It helps you manage dependencies by displaying the latest version of a crate next to it in your Cargo.toml. It also will show all versions (clickable) on the tooltip of the crate hovered.

An Exploration of wasmcloud Microservices via @LJ

What is Serverless?

In the old days, you had a server under your desk running your app all the time. Either that or you were paying someone for an entire server in the cloud (you paid the same price for the server regardless of whether you were using it or not). Later, we got virtualized servers that were multitenant (as you were sharing with other users, it introduced security concerns about people potentially sniffing into your memory).

With serverless architecture, you pay for every request. There is still a server despite the name. However, your usage is broken down to the smallest atomic piece possible. Serverless requests are flexible. They can be event-driven, so you could fire a serverless request when a file gets uploaded to an S3 bucket for instance. They are also built into cloud providers' identity model, so you can put an API Gateway in front of your serverless functions. There's overhead to doing that, but it's at least an alternative to running VMs.

WASM and Serverless Architecture

You don't need WASM to run serverless functions. Cloud providers make a runtime for most languages that we already use. However, wasm provides some benefits. For one thing, you have a sandbox to make sure people aren't accessing your memory. wasmCloud and Cloudflare Workers both use the V8 runtime.

What is wasmCloud?

wasmCloud is a distributed platform that follows the Actor-Context-Provider pattern. It is a self-repairing network, so you can hotswap providers if one is down.

  • Actors are snippets of wasm containing business logic.

  • Providers are functionality required by the actors that are not part of the core business logic (e.g. an HTTP server).

  • Lattice is the RPC bus between actors and providers which essentially tells actors what providers to use. Not every provider satisfies an actor's needs, which is part of the purpose of the lattice.

RFCs You Should Know

  • multidep: Allow Cargo packages to depend on the same crate multiple times with different dependency names, to support artifact dependencies for multiple targets. This will make it easier to build a native binary project that depends on one or more wasm crates.

Notes From The Presentation

The paradigm How 
	Actor: Client that's taking initiative in the system,	
	Provider: Services-provider, 


	Lattice: RPC -bus layer- over the OS Go server - messaging broker.  Contract defined between actor and provider to route message from the actor to the provider that can service the request

	No complex config!


Setup:

1. Need wash command
	brew tap wasmcloud/wasmcloud
	brew install wash
		
2. Need a NATS server
3. Need the wasmcloud runtime:
short circuit 2. + 3. this with a docker-compose.yml wasmcloud recommends


Gotchas:
	Make sure you have the Xcode stuff installed
	JQ, get it installed
	If on Monterey turn off Settings -> Sharing -> Airplay Receiver to keep port 5000 from constantly being in use

http://localhost:4000
	start actor

		OCI wasmcloud.azurecr.io/echo:0.3.4
	Start provider
		OCI wasmcloud.azurecr.io/httpserver:0.14.10
	Start link
		Contract ID wasmcloud:httpserver
		Values address=0.0.0.0:8080


	try to request it!
		curl localhost:8080/echo


I want to make an actor!:


Toolchain addition for your directory:
rustup target add wasm32-unknown-unknown

wash new actor test
Build the actor

Add the actor with start actor from file

Now link!
# Paste your actor ID after the `=` below (with no space after the `=`)
export HELLO_ACTOR_ID=MDFV5HY6HIQBL46DKOYGAHIAS5NNRTFFCURIQZFO245RC2D7PSWGAEKR

wash ctl link put ${HELLO_ACTOR_ID} VAG3QITQQ2ODAOWB5TTQSDJ53XK3SHBEIFNK4AYJ5RKAX2UNSCAPHA5M wasmcloud:httpserver address=0.0.0.0:8087


curl "localhost:8087?name=Carol"