Skip to main content

cell_model/
io.rs

1// SPDX-License-Identifier: MIT
2// Copyright (c) 2025 Leif Rydenfalk – https://github.com/Leif-Rydenfalk/cell
3
4use alloc::string::String;
5use rkyv::{Archive, Deserialize, Serialize};
6
7#[derive(Archive, Serialize, Deserialize, Debug)]
8#[archive(check_bytes)]
9pub enum IoRequest {
10    /// "I am cell 'worker-1'. Please bind my Membrane."
11    Bind { cell_name: String },
12
13    /// "I want to talk to 'ledger'. Give me a connection."
14    Connect { target_cell: String },
15}
16
17#[derive(Archive, Serialize, Deserialize, Debug)]
18#[archive(check_bytes)]
19pub enum IoResponse {
20    /// "Here is your FD. It is a Unix Listener."
21    ListenerBound,
22
23    /// "Here are your FDs (Read/Write) or SHM FDs."
24    ConnectionEstablished,
25
26    Error {
27        message: String,
28    },
29}