octl_core/ids.rs
1//! Identifier generators and types per design.md ยง1.1.
2
3use ulid::Ulid;
4
5/// Generate a new lowercase-ULID `run_id`.
6pub fn new_run_id() -> String {
7 Ulid::new().to_string().to_lowercase()
8}
9
10/// Format a monotonic per-run `node_id` (e.g. `n-0001`).
11pub fn format_node_id(n: u32) -> String {
12 format!("n-{n:04}")
13}
14
15/// Generate a new `d-<ULID>` discussion ID.
16pub fn new_discussion_id() -> String {
17 format!("d-{}", Ulid::new().to_string().to_lowercase())
18}
19
20/// Generate a new `s-<ULID>` spinoff proposal ID.
21pub fn new_proposal_id() -> String {
22 format!("s-{}", Ulid::new().to_string().to_lowercase())
23}