krabka_client_streams/processor/
mod.rs1pub mod api;
4pub mod erased;
5pub(crate) mod factory;
6pub mod fixed_key;
7pub(crate) mod graph;
8pub(crate) mod node;
9pub mod punctuation;
10pub mod record;
11pub mod serde;
12
13#[cfg(not(target_family = "wasm"))]
14pub mod schema_serde;
15
16pub use api::{Processor, ProcessorContext, ProcessorSupplier};
17pub use erased::ProcessorError;
18pub use fixed_key::{
19 FixedKeyProcessor, FixedKeyProcessorContext, FixedKeyProcessorSupplier, FixedKeyRecord,
20};
21pub use punctuation::{Cancellable, PunctuationType, Punctuator};
22pub use record::{Record, RecordContext};
23pub use serde::{
24 BytesSerde, Changed, Consumed, DefaultSerde, I64Serde, Produced, Serde, SerdeError, SerdeRole,
25 StringSerde,
26};
27
28#[macro_export]
46macro_rules! impl_processor {
47 (
48 impl $processor:ty: ($kin:ty, $vin:ty) -> ($kout:ty, $vout:ty) {
49 $(
50 async fn init(&mut self, $init_ctx:ident) $init_body:block
51 )?
52 async fn process(&mut self, $ctx:ident, $record:ident) $process_body:block
53 $(
54 async fn close(&mut self) $close_body:block
55 )?
56 }
57 ) => {
58 #[$crate::__async_trait]
59 impl $crate::processor::api::Processor<$kin, $vin, $kout, $vout> for $processor {
60 $(
61 async fn init(
62 &mut self,
63 $init_ctx: &mut $crate::processor::api::ProcessorContext<'_, '_, $kout, $vout>,
64 ) $init_body
65 )?
66
67 async fn process(
68 &mut self,
69 $ctx: &mut $crate::processor::api::ProcessorContext<'_, '_, $kout, $vout>,
70 $record: $crate::processor::record::Record<$kin, $vin>,
71 ) $process_body
72
73 $(
74 async fn close(&mut self) $close_body
75 )?
76 }
77 };
78}
79
80#[macro_export]
99macro_rules! impl_fixed_key_processor {
100 (
101 impl $processor:ty: ($kin:ty, $vin:ty) -> $vout:ty {
102 async fn process(&mut self, $ctx:ident, $record:ident) $process_body:block
103 }
104 ) => {
105 #[$crate::__async_trait]
106 impl $crate::processor::fixed_key::FixedKeyProcessor<$kin, $vin, $vout> for $processor {
107 async fn process(
108 &mut self,
109 $ctx: &mut $crate::processor::fixed_key::FixedKeyProcessorContext<
110 '_,
111 '_,
112 '_,
113 $kin,
114 $vout,
115 >,
116 $record: $crate::processor::fixed_key::FixedKeyRecord<$kin, $vin>,
117 ) $process_body
118 }
119 };
120}