fluvio_smartmodule/
output.rs1use fluvio_protocol::{
2 Encoder, Decoder,
3 record::Record,
4 link::smartmodule::{
5 SmartModuleTransformRuntimeError, SmartModuleInitRuntimeError,
6 SmartModuleLookbackRuntimeError,
7 },
8};
9
10#[derive(Debug, Default, Encoder, Decoder)]
12pub struct SmartModuleOutput {
13 pub successes: Vec<Record>,
15 pub error: Option<SmartModuleTransformRuntimeError>,
17}
18
19impl SmartModuleOutput {
20 pub fn new(successes: Vec<Record>) -> Self {
21 Self {
22 successes,
23 error: None,
24 }
25 }
26
27 pub fn with_error(
28 successes: Vec<Record>,
29 error: Option<SmartModuleTransformRuntimeError>,
30 ) -> Self {
31 Self { successes, error }
32 }
33}
34
35#[derive(Debug, Default, Encoder, Decoder)]
37pub struct SmartModuleAggregateOutput {
38 pub base: SmartModuleOutput,
40 #[fluvio(min_version = 16)]
41 pub accumulator: Vec<u8>,
42}
43
44impl SmartModuleAggregateOutput {
45 pub fn new(base: SmartModuleOutput, accumulator: Vec<u8>) -> Self {
46 Self { base, accumulator }
47 }
48}
49
50#[derive(Debug, Default, Encoder, Decoder)]
52pub struct SmartModuleInitOutput {
53 pub error: SmartModuleInitRuntimeError,
55}
56
57#[derive(Debug, Default, Encoder, Decoder)]
59pub struct SmartModuleLookbackOutput {
60 pub error: SmartModuleLookbackRuntimeError,
62}