Module host

Module host 

Source
Expand description

The Golem host API provides low level access to Golem specific features such as promises and control over the durability and transactional guarantees the executor provides.

Structs§

AccountId
Represents a Golem Cloud account
GetWorkers
ProjectId
Represents a Golem project
PromiseId
A promise ID is a value that can be passed to an external Golem API to complete that promise from an arbitrary external source, while Golem workers can await for this completion.
RetryPolicy
Configures how the executor retries failures
WorkerAllFilter
WorkerAnyFilter
WorkerCreatedAtFilter
WorkerEnvFilter
WorkerMetadata
WorkerNameFilter
WorkerStatusFilter
WorkerVersionFilter
WorkerWasiConfigVarsFilter

Enums§

FilterComparator
ForkResult
Indicates which worker the code is running on after fork
PersistenceLevel
Configurable persistence level for workers
RevertWorkerTarget
Target parameter for the revert-worker operation
StringFilterComparator
UpdateMode
Describes how to update a worker to a different component version
WorkerPropertyFilter
WorkerStatus

Functions§

await_promise
Suspends execution until the given promise gets completed, and returns the payload passed to the promise completion.
complete_promise
Completes the given promise with the given payload. Returns true if the promise was completed, false if the promise was already completed. The payload is passed to the worker that is awaiting the promise.
create_promise
Create a new promise
delete_promise
Deletes the given promise
fork
Forks the current worker at the current execution point. The new worker gets the new-name worker name, and this worker continues running as well. The return value is going to be different in this worker and the forked worker.
fork_worker
Fork a worker to another worker at a given oplog index
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.
get_idempotence_mode
Gets the current idempotence mode. See set-idempotence-mode for details.
get_oplog_index
Returns the current position in the persistent op log
get_oplog_persistence_level
Gets the worker’s current persistence level.
get_retry_policy
Gets the current retry policy associated with the worker
get_self_metadata
Get current worker metadata
get_worker_metadata
Get worker metadata
mark_begin_operation
Marks the beginning of an atomic operation. In case of a failure within the region selected by mark-begin-operation and mark-end-operation the whole region will be reexecuted on retry. The end of the region is when mark-end-operation is called with the returned oplog-index.
mark_end_operation
Commits this atomic operation. After mark-end-operation is called for a given index, further calls with the same parameter will do nothing.
oplog_commit
Blocks the execution until the oplog has been written to at least the specified number of replicas, or the maximum number of replicas if the requested number is higher.
poll_promise
Checks whether the given promise is completed. If not, it returns None. If the promise is completed, it returns the payload passed to the promise completion.
resolve_component_id
Get the component-id for a given component reference. Returns none when no component with the specified reference exists. The syntax of the component reference is implementation dependent.
resolve_worker_id
Get the worker-id for a given component and worker name. Returns none when no component for the specified reference exists.
resolve_worker_id_strict
Get the worker-id for a given component and worker name. Returns none when no component for the specified component-reference or no worker with the specified worker-name exists.
revert_worker
Revert a worker to a previous state
set_idempotence_mode
Sets the current idempotence mode. The default is true. True means side-effects are treated idempotent and Golem guarantees at-least-once semantics. In case of false the executor provides at-most-once semantics, failing the worker in case it is not known if the side effect was already executed.
set_oplog_index
Makes the current worker travel back in time and continue execution from the given position in the persistent op log.
set_oplog_persistence_level
Sets the worker’s current persistence level. This can increase the performance of execution in cases where durable execution is not required.
set_retry_policy
Overrides the current retry policy associated with the worker. Following this call, get-retry-policy will return the new retry policy.
update_worker
Initiates an update attempt for the given worker. The function returns immediately once the request has been processed, not waiting for the worker to get updated.

Type Aliases§

ComponentId
ComponentVersion
Represents a Golem component’s version
Duration
OplogIndex
An index into the persistent log storing all performed operations of a worker
Uuid
ValueAndType
WorkerId