zerodds_corba_cos_transactions/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3
4//! Crate `zerodds-corba-cos-transactions`. Safety classification: **STANDARD**.
5//!
6//! OMG **Object Transaction Service** (OTS / `CosTransactions`) 1.4
7//! (`formal/2003-09-02`) — pure-Rust `no_std + alloc`, `forbid(unsafe_code)`.
8//! The OTS brings distributed transactions (ACID) into the CORBA model and is the
9//! core lever for the "drop-in for legacy finance systems" migration: 2-phase
10//! commit across multiple servers, with transaction-context propagation via the
11//! GIOP service context `TransactionService` (id = 0).
12//!
13//! Implements:
14//! - **`otid_t`** (§ OTS Appendix A) — the cross-ORB transaction
15//! identifier; byte-exact CDR codec ([`otid`]).
16//! - **`PropagationContext`** + `TransactionService` service context (id = 0) —
17//! transaction-context propagation over GIOP ([`propagation`]).
18//! - **2-phase commit protocol** (`prepare`/`commit`/`rollback`/
19//! `commit_one_phase`/`forget`) with a vote-driven state machine, incl.
20//! read-only optimization + one-phase commit ([`two_phase`]).
21//! - **`Current` / `Coordinator` / `Terminator` / `Control`** — the OTS
22//! orchestration interfaces as Rust types ([`transaction`]).
23//! - **`TransactionLog` / `RecoveryCoordinator`** (§10.3.7) — durability: the
24//! commit decision is force-written before phase 2; a restart resolves
25//! in-doubt transactions as presumed-abort ([`recovery`]).
26//!
27//! Spec: OMG Transaction Service 1.4. Real-Time CORBA + CosTrading are separate
28//! (Trading subordinate, RT-CORBA covered via DDS-QoS).
29
30#![no_std]
31#![forbid(unsafe_code)]
32#![cfg_attr(docsrs, feature(doc_cfg))]
33#![warn(missing_docs)]
34
35extern crate alloc;
36
37pub mod otid;
38pub mod propagation;
39pub mod recovery;
40pub mod transaction;
41pub mod two_phase;
42
43pub use otid::Otid;
44pub use propagation::{PropagationContext, TRANSACTION_SERVICE_CONTEXT_ID, TransIdentity};
45pub use recovery::{
46 InMemoryLog, LogState, RecoveryCoordinator, ResourceResolver, TransactionLog, TxOutcome,
47 coordinate_commit_durable,
48};
49pub use transaction::{Control, Coordinator, Current, Status, Terminator, TransactionError};
50pub use two_phase::{Completion, HeuristicOutcome, Resource, Vote, coordinate_commit};