Crate golem_rust

Source

Re-exports§

pub use bindings::golem::api::host::fork;
pub use bindings::golem::api::host::oplog_commit;
pub use bindings::golem::api::host::ForkResult;
pub use bindings::golem::api::host::PersistenceLevel;
pub use golem_wasm_rpc as wasm_rpc;

Modules§

bindings
durability
value_and_type

Structs§

AtomicOperationGuard
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
RetryPolicy
RetryPolicyGuard

Enums§

TransactionFailure
The result of a transaction execution that failed.

Traits§

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.
await_promise_json
call_compensation_function
complete_promise_json
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 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.
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.
use_retry_policy
Temporarily sets the retry policy to the given value.
with_idempotence_mode
Executes the given 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_retry_policy
Executes the given function with the retry policy set to the given value.

Type Aliases§

TransactionResult
The result of a transaction execution.

Attribute Macros§

create_wit_file
Annotates a module with #[golem_rust_macro::create_wit_file] and generates WIT file in the root of your project. Supports enums, structs, traits and alias types.
golem_operation
Defines a function as an Operation that can be used in transactions

Derive Macros§

FromValueAndType
IntoValue
WIT_From_Into
Derives From<> And Into<> typeclasses for wit-bindgen generated data types (e.g. WitPerson) and custom domain data types (e.g. Person). So it’s possible to write code like this: