cell_model/config.rs
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2025 Leif Rydenfalk – https://github.com/Leif-Rydenfalk/cell
3
4use rkyv::{Archive, Serialize, Deserialize};
5use serde::{Serialize as SerdeSerialize, Deserialize as SerdeDeserialize};
6use alloc::vec::Vec;
7use alloc::string::String;
8
9/// The strictly typed configuration injected into the cell at startup via the umbilical cord.
10/// This replaces environment variable parsing entirely.
11#[derive(Archive, Serialize, Deserialize, SerdeSerialize, SerdeDeserialize, Debug, Clone)]
12#[archive(check_bytes)]
13pub struct CellInitConfig {
14 /// The unique 64-bit identity of this node in the cluster.
15 pub node_id: u64,
16
17 /// The human-readable name of the cell (e.g., "consensus-1").
18 pub cell_name: String,
19
20 /// The static topology graph known at startup.
21 pub peers: Vec<PeerConfig>,
22
23 /// The specific Unix socket path this cell should bind its Membrane to.
24 pub socket_path: String,
25
26 /// The organism (namespace) this cell belongs to.
27 /// Used for service discovery scope resolution.
28 pub organism: String,
29}
30
31#[derive(Archive, Serialize, Deserialize, SerdeSerialize, SerdeDeserialize, Debug, Clone)]
32#[archive(check_bytes)]
33pub struct PeerConfig {
34 pub node_id: u64,
35 pub address: String,
36}