Skip to content

Commit

Permalink
Merge pull request #45 from golemcloud/scheduled-invocation
Browse files Browse the repository at this point in the history
Add worker scheduling apis
  • Loading branch information
mschuwalow authored Feb 7, 2025
2 parents 54149d9 + b47ee10 commit c3926aa
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

pub const WASM_RPC_WIT: &str = include_str!("../wit/deps/wasm-rpc/wasm-rpc.wit");
pub const WASI_POLL_WIT: &str = include_str!("../wit/deps/io/poll.wit");
pub const WASI_WALL_CLOCKS_WIT: &str = include_str!("../wit/deps/clocks/wall-clock.wit");
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package golem:api@1.1.1;
package golem:api@1.1.2;

/// 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.
interface host {
use golem:rpc/types@0.1.1.{uri};
use golem:rpc/types@0.1.2.{uri, wit-value};
use wasi:clocks/monotonic-clock@0.2.0.{duration};

/// An index into the persistent log storing all performed operations of a worker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package golem:api@1.1.1;
package golem:api@1.1.2;

interface oplog-processor {
use wasi:clocks/wall-clock@0.2.0.{datetime};
use golem:rpc/types@0.1.1.{wit-value};
use golem:rpc/types@0.1.2.{wit-value};

use host.{account-id, component-id, oplog-index, worker-id, worker-metadata};
use oplog.{oplog-entry};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package golem:api@1.1.1;
package golem:api@1.1.2;

/// Host interface for enumerating and searching for worker oplogs
interface oplog {
use wasi:clocks/wall-clock@0.2.0.{datetime};
use golem:rpc/types@0.1.1.{wit-value};
use golem:rpc/types@0.1.2.{wit-value};

use host.{account-id, component-version, oplog-index, retry-policy, uuid, worker-id};

Expand Down
6 changes: 3 additions & 3 deletions wit/deps/golem-durability/golem-durability-1.2.wit
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
package golem:durability@1.2.0;

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

type durable-function-type = wrapped-function-type;

Expand Down
4 changes: 2 additions & 2 deletions wit/deps/golem/golem-host.wit
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package golem:api@0.2.0;
package golem:api@0.2.1;

/// 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.
interface host {
use golem:rpc/types@0.1.1.{uri};
use golem:rpc/types@0.1.2.{uri};
use wasi:clocks/monotonic-clock@0.2.0.{duration};

/// An index into the persistent log storing all performed operations of a worker
Expand Down
6 changes: 5 additions & 1 deletion wit/deps/wasm-rpc/wasm-rpc.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package golem:rpc@0.1.1;
package golem:rpc@0.1.2;

interface types {
use wasi:clocks/wall-clock@0.2.0.{datetime};
use wasi:io/poll@0.2.0.{pollable};

type node-index = s32;
Expand Down Expand Up @@ -93,6 +94,9 @@ interface types {
invoke: func(function-name: string, function-params: list<wit-value>) -> result<_, rpc-error>;

async-invoke-and-await: func(function-name: string, function-params: list<wit-value>) -> future-invoke-result;

/// Schedule invocation for later
schedule-invocation: func(scheduled-time: datetime, function-name: string, function-params: list<wit-value>) -> ();
}

resource future-invoke-result {
Expand Down

0 comments on commit c3926aa

Please sign in to comment.