Skip to main content

Crate golem_rust

Crate golem_rust 

Source

Re-exports§

pub use bindings::golem::api::host::ForkResult;
pub use bindings::golem::api::host::PersistenceLevel;
pub use bindings::golem::api::host::PromiseId;
pub use bindings::golem::api::host::complete_promise;
pub use bindings::golem::api::host::create_promise;
pub use bindings::golem::api::host::fork;
pub use bindings::golem::api::host::get_promise;
pub use bindings::golem::api::host::oplog_commit;
pub use bindings::golem::websocket::client::CloseInfo as WebSocketCloseInfo;
pub use bindings::golem::websocket::client::Error as WebSocketError;
pub use bindings::golem::websocket::client::Message as WebSocketMessage;
pub use bindings::golem::websocket::client::WebsocketConnection;
pub use wasip2;
pub use wstd;
pub use golem_wasm;
pub use quota::*;

Modules§

bindings
durability
quota
Ergonomic wrappers for the golem:quota/host WIT interface.
retry
value_and_type

Structs§

AtomicOperationGuard
Checkpoint
A checkpoint that captures the current oplog index and can revert execution back to it.
FallibleTransaction
FallibleTransaction is a sequence of operations that are executed in a way that if any of the operations fails all the already performed operation’s compensation actions got executed in reverse order.
IdempotenceModeGuard
InfallibleTransaction
InfallibleTransaction is a sequence of operations that are executed in a way that if any of the operations or the underlying Golem executor fails, the whole transaction is going to be retried.
PersistenceLevelGuard
Uuid
A Universally Unique Identifier (UUID).

Enums§

TransactionFailure
The result of a transaction execution that failed.

Traits§

CheckpointOptionExt
Extension trait for Option that provides checkpoint-based revert on None.
CheckpointResultExt
Extension trait for Result that provides checkpoint-based revert on error.
CompensationFunction
Operation
Represents an atomic operation of the transaction which has a rollback action.
Transaction
A unified interface for the different types of transactions. Using it can make the code easier to switch between different transactional guarantees but is more constrained in terms of error types.
TupleOrUnit

Functions§

atomically
Executes the given function as an atomic operation.
atomically_async
Executes the given async function as an atomic operation.
await_promise
Awaits a promise.
await_promise_json
Awaits a promise.
blocking_await_promise
Awaits a promise blocking the execution of the agent. The agent is going to be suspended until the promise is completed.
blocking_await_promise_json
Awaits a promise blocking the execution of the agent. The agent is going to be suspended until the promise is completed.
boxed
Wraps an async block into a LocalBoxFuture. Use this when passing closures to fallible_transaction or infallible_transaction:
call_compensation_function
complete_promise_json
Completes a promise with a JSON payload
fallible_transaction
Fallible transaction execution. If any operation fails, all the already executed successful operation’s compensation actions are executed in reverse order and the transaction returns with a failure.
generate_idempotency_key
Generates an idempotency key. This operation will never be replayed — i.e. not only is this key generated, but it is persisted and committed, such that the key can be used in third-party systems (e.g. payment processing) to introduce idempotence.
infallible_transaction
Retry the transaction in case of failure. If any operation returns with a failure, all the already executed successful operation’s compensation actions are executed in reverse order and the transaction gets retried, using Golem’s active retry policy.
infallible_transaction_with_strong_rollback_guarantees
Same as infallible_transaction, but with strong rollback guarantees. The compensation actions are guaranteed to be always executed before the transaction gets retried, even if it fails due to a panic or an external executor failure.
mark_atomic_operation
Marks a block as an atomic operation
operation
Constructs an Operation from two async closures: one for executing the operation, and one for rolling it back. The rollback operation always sees the input and the output of the operation.
sync_operation
Constructs an Operation from two synchronous closures: one for executing the operation, and one for rolling it back. This is a convenience wrapper around operation for cases where the execute and compensate logic is synchronous.
transaction
A generic interface for defining transactions, where the transaction mode is determined by the function’s parameter (it can be FallibleTransaction or InfallibleTransaction).
use_idempotence_mode
Temporarily sets the idempotence mode to the given value.
use_persistence_level
Temporarily sets the oplog persistence level to the given value.
with_checkpoint
Creates a checkpoint, runs the given function, and reverts on error.
with_checkpoint_async
Creates a checkpoint, runs the given async function, and reverts on error.
with_idempotence_mode
Executes the given function with the idempotence mode set to the given value.
with_idempotence_mode_async
Executes the given async function with the idempotence mode set to the given value.
with_persistence_level
Executes the given function with the oplog persistence level set to the given value.
with_persistence_level_async
Executes the given async function with the oplog persistence level set to the given value.

Type Aliases§

LocalBoxFuture
A boxed local future. Used as the return type for transaction closures to allow the returned future to borrow from the transaction reference.
TransactionResult
The result of a transaction execution.

Attribute Macros§

agent_definition
agent_implementation
description
endpoint
golem_operation
Defines a function as an Operation that can be used in transactions
prompt

Derive Macros§

AllowedLanguages
AllowedMimeTypes
ConfigSchema
FromValueAndType
IntoValue
MultimodalSchema
Schema