-
Notifications
You must be signed in to change notification settings - Fork 2
/
lib.rs
37 lines (31 loc) · 1.01 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-FileCopyrightText: © 2023 Claudio Cicconetti <c.cicconetti@iit.cnr.it>
// SPDX-License-Identifier: MIT
pub use edgeless_function::*;
struct NoopFunction;
impl EdgeFunction for NoopFunction {
fn handle_cast(src: InstanceId, encoded_message: &[u8]) {
log::info!(
"Noop casted, node {:?}, function {:?}, MSG: {:?}",
src.node_id,
src.component_id,
encoded_message
);
}
fn handle_call(src: InstanceId, encoded_message: &[u8]) -> CallRet {
log::info!(
"Noop called, node {:?}, function {:?}, MSG: {:?}",
src.node_id,
src.component_id,
encoded_message
);
CallRet::NoReply
}
fn handle_init(payload: Option<&[u8]>, _serialized_state: Option<&[u8]>) {
edgeless_function::init_logger();
log::info!("Noop initialized, payload: {:?}", payload);
}
fn handle_stop() {
log::info!("Noop stopped");
}
}
edgeless_function::export!(NoopFunction);