Runtime Suppport

Obelisk provides built-in runtime support functions that can be accessed by workflows. These functions offer essential capabilities like logging, random number generation, creating join sets, and, crucially, the ability to pause workflow execution (sleep). Activities and webhook endpoints have access to logging support functions, but not to the other workflow-specific functions.

Available Support Functions

The runtime support functions are defined using WIT (WebAssembly Interface Type) files. Here's a breakdown of the available functions, grouped by their WIT interface:

obelisk:log/log@1.0.0

Available to:

This interface provides standard logging functions. All messages are strings.

Example (Rust):

use obelisk::log::log;

log::info("This is an informational message.");
log::error("This is an error message!");

obelisk:workflow/workflow-support@2.0.0

Available to:

Some of these functions act like host-based activities - they avoid the need to spawn a WASM activity to obtain e.g. a random number. Other functions are related to persistent sleep and join set construction.

Example (Rust):

use obelisk::workflow::workflow_support::*;
use obelisk::types::time::Duration;

// Persistently sleep for 5 seconds
sleep(Duration::Seconds(5));

// Generate a random number between 1 and 10 (inclusive)
let random_num = random_u64_inclusive(1, 10);

// Create a named join set
let join_set_id = new_join_set_named("my_join_set", ClosingStrategy::Complete).unwrap();

obelisk:activity/process@1.0.0

Available to:

The process WIT interface allows activities to spawn, wait for, kill etc. a local process.

See Process API for details.