Skip to content

Commit aba7371

Browse files
committed
Update WIT contracts
1 parent 7f9138e commit aba7371

File tree

12 files changed

+73
-22
lines changed

12 files changed

+73
-22
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// The interface of an accumulate operator.
22
interface accumulate {
3-
use types.{data-model,module-configuration};
3+
use types.{data-model,error,module-configuration};
44

55
// An accumulate operator takes two arguments:
66
// 1) A staged area which stores previous accumulated result.
77
// 2) A sequence of messages to be accumulated.
88
// A new combined message that will be passed to next accumulate operation,
99
// or the next node in the execution graph when all messages finish combining.
10-
process: func(staged: data-model, message: list<data-model>) -> data-model;
10+
process: func(staged: data-model, message: list<data-model>) -> result<data-model, error>;
1111

1212
// The init function called on module load
1313
init: func(configuration: module-configuration) -> bool;
@@ -18,4 +18,4 @@ world accumulate-impl {
1818
import metrics;
1919

2020
export accumulate;
21-
}
21+
}

samples/wasm/python/schema/branch.wit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// The interface of a branch operator.
22
interface branch {
3-
use types.{data-model,module-configuration};
3+
use types.{data-model,error,module-configuration};
44
use hybrid-logical-clock.{hybrid-logical-clock};
55

66
// A branch node has two output branches in the execution graph.
77
// The operator returns `false` if the input message should be passed to the first branch,
88
// and `true` if it should be passed to the second branch.
9-
process: func(timestamp: hybrid-logical-clock, message: data-model) -> bool;
9+
process: func(timestamp: hybrid-logical-clock, message: data-model) -> result<bool, error>;
1010

1111
// The init function called on module load
1212
init: func(configuration: module-configuration) -> bool;
@@ -18,4 +18,4 @@ world branch-impl {
1818
import metrics;
1919

2020
export branch;
21-
}
21+
}

samples/wasm/python/schema/delay.wit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// The interface of a delay operator.
22
interface delay {
3-
use types.{data-model,module-configuration};
3+
use types.{data-model,error,module-configuration};
44
use hybrid-logical-clock.{hybrid-logical-clock};
55

66
// A delay node takes data input and timely logic timestamp and returns a new timestamp
77
// in the execution graph.
88
// The operator can use own logic to process and return a new timestamp for delay.
9-
process: func(data: data-model, timestamp: hybrid-logical-clock) -> hybrid-logical-clock;
9+
process: func(data: data-model, timestamp: hybrid-logical-clock) -> result<hybrid-logical-clock, error>;
1010

1111
// The init function called on module load
1212
init: func(configuration: module-configuration) -> bool;
@@ -18,4 +18,4 @@ world delay-impl {
1818
import metrics;
1919

2020
export delay;
21-
}
21+
}

samples/wasm/python/schema/filter.wit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// The interface of a filter operator.
22
interface filter {
3-
use types.{data-model,module-configuration};
3+
use types.{data-model,error,module-configuration};
44

55
// A filter operator returns `true` if the input message should be passed
66
// to the next node in the execution graph, and false if it should be
77
// dropped.
8-
process: func(message: data-model) -> bool;
8+
process: func(message: data-model) -> result<bool, error>;
99

1010
// The init function called on module load
1111
init: func(configuration: module-configuration) -> bool;
@@ -17,4 +17,4 @@ world filter-impl {
1717
import metrics;
1818

1919
export filter;
20-
}
20+
}

samples/wasm/python/schema/hybrid_logical_clock.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ interface hybrid-logical-clock {
1010
counter: u64,
1111
node-id: string,
1212
}
13-
}
13+
}

samples/wasm/python/schema/logger.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ interface logger {
3434
}
3535
world logger-use {
3636
import logger;
37-
}
37+
}

samples/wasm/python/schema/map.wit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// The interface of a map operator.
22
interface map {
3-
use types.{data-model,module-configuration};
3+
use types.{data-model,error,module-configuration};
44

55
// A map operator takes a message and returns a new message
66
// that will be passed to the next node in the execution graph.
7-
process: func(message: data-model) -> data-model;
7+
process: func(message: data-model) -> result<data-model, error>;
88

99
// The init function called on module load
1010
init: func(configuration: module-configuration) -> bool;
@@ -15,4 +15,4 @@ world map-impl {
1515
import metrics;
1616

1717
export map;
18-
}
18+
}

samples/wasm/python/schema/metrics.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ interface metrics {
2828
}
2929
world metrics-use {
3030
import metrics;
31-
}
31+
}

samples/wasm/python/schema/processor.wit

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package tinykube-graph:processor@1.0.0;
1+
package wasm-graph:processor@1.1.0;
22

33
interface types {
44
use hybrid-logical-clock.{timespec};
@@ -100,6 +100,11 @@ interface types {
100100
properties: list<tuple<string, string>>,
101101
module-schemas: list<module-schema>
102102
}
103+
104+
record error
105+
{
106+
message: string,
107+
}
103108
}
104109

105110
world host {
@@ -110,8 +115,9 @@ world host {
110115
import logger;
111116
import metrics;
112117
import command-invoker;
118+
import schema-registry;
113119
}
114120

115121
world test {
116122
// import no interface so in test we can mock it
117-
}
123+
}

samples/wasm/python/schema/rpc.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ interface command-invoker {
6060
world mrpc-use{
6161
import command-invoker;
6262
import rpc-types;
63-
}
63+
}

0 commit comments

Comments
 (0)