Skip to content

Commit

Permalink
Merge pull request #33 from golemcloud/oplog-processor
Browse files Browse the repository at this point in the history
Initial version of the oplog-processor interface
  • Loading branch information
vigoo authored Nov 29, 2024
2 parents 8f3839e + 4ac1adc commit 1ca3c2a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions wit/deps/golem-1.1/golem-oplog-processor-1.1.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package golem:api@1.1.0-rc1;

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

use host.{account-id, component-id, oplog-index, worker-id, worker-metadata};
use oplog.{oplog-entry};

record account-info {
account-id: account-id
}

/// A processor resource is instantiated for each account having activated this oplog processor plugin.
/// There are no guarantees for the number of processors running at the same time, and different entries from the same worker
/// may be sent to different processor instances.
resource processor {
/// Initializes an oplog processor for a given component where the plugin was installed to.
/// The `account-info` parameters contains details of the account the installation belongs to.
/// The `component-id` parameter contains the identifier of the component the plugin was installed to.
/// The `config` parameter contains the configuration parameters for the plugin, as specified in the plugin installation
/// for the component.
constructor(account-info: account-info, component-id: component-id, config: list<tuple<string, string>>);

/// Called when one of the workers the plugin is activated on has written new entries to its oplog.
/// The `worker-id` parameter identifies the worker.
/// The `metadata` parameter contains the latest metadata of the worker.
/// The `first-entry-index` parameter contains the index of the first entry in the list of `entries`.
/// The `entries` parameteter always contains at least one element.
process: func(worker-id: worker-id, metadata: worker-metadata, first-entry-index: oplog-index, entries: list<oplog-entry>) -> result<_, string>;
}
}

0 comments on commit 1ca3c2a

Please sign in to comment.