Using Standard Capabilities

Using existing capabilities from within an actor is quick and easy. If an actor interface exists for the type of capability contract you’re looking to use, then it’s just a matter of declaring a reference to it from inside your code.

Find an Actor Interface

If you’re looking to see which types of supported, first-party capability provider contracts are available, you’ll want to take a look at the actor interfaces repository. Here you will find links to documentation as well as a list of which language-specific providers are available and links to multiple implementations of the same contract (file system and S3 are both available implementations of wasmcloud:blobstore, for example).

Add the Actor Interface as a Dependency

It should also be very easy to simply declare a dependency on the actor interface from within your actor project. Remember that you’re taking a dependency on the abstract contract, and not the concrete implementation. You might be declaring a dependency on the wasmcloud:keyvalue contract, and not on Redis or Cassandra.

As an example, here’s what it looks like to add a dependency on the wasmcloud:graphdb actor interface in your Cargo.toml:

wasmcloud-actor-graphdb = "0.1.2"

And then you can import the graph database actor interface code in your src/ file as shown:

use wasmcloud_actor_graphdb as graph;
use graph::*;

We’ve covered starting and linking actors in a few places throughout the documentation. Refer to the Run the Actor section of the application development guide for more information.