pg: Phase 1 — identity & storage substrate (RFC 012)

Add a process-groups module (name -> multiset<Member>) sibling to the
registry, plus the cluster-shaped identity it is keyed on.

- NodeId/Incarnation u32 newtypes; Member { node, incarnation, pid } at
  final (BEAM NEW_PID_EXT-shaped) layout.
- Config::node_id/incarnation builder setters beside wake_slot, defaulting
  to a fixed single-node value; threaded through RuntimeInner::new.
- process_groups: RawMutex<ProcessGroups> on RuntimeInner, Leaf class,
  mirroring the registry field.
- remove_where: the one dumb predicate-eviction primitive (no liveness wired
  yet; first caller is the Phase 2 death hook).
- Public surface (join/leave/members/pick) in pre-liveness/pre-monitor form,
  Pid-shaped; node/incarnation filled from runtime identity.
- Structural unit tests on synthetic members: idempotent join, multiset
  semantics across groups, generation-distinct members, leave + empty-group
  pruning, predicate sweep, incarnation-sweep shape.
This commit is contained in:
smarm-agent
2026-06-15 16:41:30 +00:00
parent 4d4a2a6c9b
commit b78311bc88
3 changed files with 360 additions and 0 deletions
+2
View File
@@ -24,6 +24,7 @@ pub mod io;
pub mod mutex;
pub mod monitor;
pub mod registry;
pub mod pg;
pub mod link;
pub mod gen_server;
pub mod runtime;
@@ -54,6 +55,7 @@ pub use link::{link, trap_exit, unlink, ExitSignal};
pub use monitor::{demonitor, monitor, Down, DownReason, Monitor, MonitorId};
pub use mutex::{LockTimeout, Mutex, MutexGuard};
pub use pid::Pid;
pub use pg::{join, leave, members, pick, Incarnation, Member, NodeId};
pub use registry::{name_of, register, unregister, whereis, RegisterError};
pub use runtime::{init, Config, Runtime};
pub use scheduler::{