-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from golemcloud/oplog-processor
Initial version of the oplog-processor interface
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
} | ||
} |