| 1 | # Rust library API |
| 2 | |
| 3 | ## Select facade |
| 4 | |
| 5 | Use `celld::asyncrt::select!` when the source order must not decide a tie. The |
| 6 | macro selects a cyclic start for each poll, and it rejects the `biased;` token. |
| 7 | |
| 8 | Use `celld::asyncrt::select_biased!` only when the source order defines the |
| 9 | winner of a tie. The macro polls the branches in source order. The first token |
| 10 | must be a non-empty string literal that states which arm wins and why. |
| 11 | |
| 12 | ## Durability ownership |
| 13 | |
| 14 | The `celld` crate requires one `node_log::DurabilityOwner` for each local |
| 15 | durability stack. The owner keeps the coupled registration. It retains each |
| 16 | live or failed background-task handle until shutdown joins it. It also retains |
| 17 | each admitted release-close task and the final close handle until the |
| 18 | registered managed databases close. |
| 19 | |
| 20 | The crate removes these public functions: |
| 21 | |
| 22 | - `LtxRepl::set_shipper` |
| 23 | - `LtxRepl::set_bundle_sink` |
| 24 | - `node_log::spawn_maintenance` |
| 25 | - `node_log::spawn_fragment_gc` |
| 26 | |
| 27 | The old setter functions installed separate strong references. A |
| 28 | `NodeLogManager` also retains its `LtxRepl`, so these references can create an |
| 29 | ownership cycle. |
| 30 | |
| 31 | The old spawn functions detached their task handles. An embedding process |
| 32 | therefore cannot stop or join the tasks during local shutdown. |
| 33 | |
| 34 | Construct a `DurabilityOwner` after the node-log recovery completes. Call |
| 35 | `DurabilityOwner::start_background` before the process starts its application |
| 36 | services, and retain the owner for the process lifetime. |
| 37 | |
| 38 | Await `LtxRepl::release` when a runtime stops a cell and keeps its local files. |
| 39 | The method admits a managed database close to the owner task group before it |
| 40 | waits. Require an `Ok` result before another activation reuses the local path. |
| 41 | The owner retains the admitted close if the caller is cancelled. An `Err` |
| 42 | result retains the replica, so a later call can retry while the owner accepts |
| 43 | close work. The final owner shutdown also closes a retained replica. |
| 44 | |
| 45 | Call `DurabilityOwner::quiesce_and_seal_within` with the remaining process time |
| 46 | during shutdown. A `false` result means that the local fallback ran. Therefore, |
| 47 | the process must not prepare a clean reload. |
| 48 | |
| 49 | Stop and join all application and runtime operations before the final local |
| 50 | shutdown. This order prevents an activation from retaining an unregistered |
| 51 | database across the final shutdown snapshot. |
| 52 | |
| 53 | Call `DurabilityOwner::shutdown_local_within` after an optional clean-reload |
| 54 | preparation. Pass the remaining process time to this method. A `false` result |
| 55 | means that the local fallback ran before the local shutdown completed, so the |
| 56 | process must exit without unwinding. |
| 57 | |
| 58 | A process that has a follower store without a runtime durability stack must |
| 59 | use `DurabilityOwner::new_follower`. This owner starts, stops, and joins the |
| 60 | follower fragment collector. |