Skip to content

Commit

Permalink
Merge pull request #49 from golemcloud/vigoo/undo
Browse files Browse the repository at this point in the history
Added the revert-worker golem host function
  • Loading branch information
vigoo authored Feb 10, 2025
2 parents c3926aa + ab92c31 commit c961aa1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
13 changes: 12 additions & 1 deletion wit/deps/golem-1.x/golem-host.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package golem:api@1.1.2;
package golem:api@1.1.3;

/// 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.
Expand Down Expand Up @@ -164,6 +164,14 @@ interface host {
get-next: func() -> option<list<worker-metadata>>;
}

/// Target parameter for the `revert-worker` operation
variant revert-worker-target {
/// Revert to a specific oplog index. The given index will be the last one to be kept.
revert-to-oplog-index(oplog-index),
/// Revert the last N invocations.
revert-last-invocations(u64)
}

/// Create a new promise
create-promise: func() -> promise-id;

Expand Down Expand Up @@ -239,6 +247,9 @@ interface host {

/// Fork a worker to another worker at a given oplog index
fork-worker: func(source-worker-id: worker-id, target-worker-id: worker-id, oplog-idx-cut-off: oplog-index) -> ();

/// Revert a worker to a previous state
revert-worker: func(worker-id: worker-id, revert-target: revert-worker-target);
}

/// Interface providing user-defined snapshotting capability. This can be used to perform manual update of workers
Expand Down
2 changes: 1 addition & 1 deletion wit/deps/golem-1.x/golem-oplog-processor.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package golem:api@1.1.2;
package golem:api@1.1.3;

interface oplog-processor {
use wasi:clocks/wall-clock@0.2.0.{datetime};
Expand Down
2 changes: 1 addition & 1 deletion wit/deps/golem-1.x/golem-oplog.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package golem:api@1.1.2;
package golem:api@1.1.3;

/// Host interface for enumerating and searching for worker oplogs
interface oplog {
Expand Down
4 changes: 2 additions & 2 deletions wit/deps/golem-durability/golem-durability-1.2.wit
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
package golem:durability@1.2.0;

interface durability {
use golem:api/host@1.1.2.{persistence-level};
use golem:api/oplog@1.1.2.{oplog-index, wrapped-function-type};
use golem:api/host@1.1.3.{persistence-level};
use golem:api/oplog@1.1.3.{oplog-index, wrapped-function-type};
use wasi:clocks/wall-clock@0.2.0.{datetime};
use golem:rpc/types@0.1.2.{value-and-type};

Expand Down

0 comments on commit c961aa1

Please sign in to comment.