Initial import of the CBDDC codebase with docs and tests. Add a .NET-focused gitignore to keep generated artifacts out of source control.
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
Joseph Doherty
2026-02-20 13:03:21 -05:00
commit 08bfc17218
218 changed files with 33910 additions and 0 deletions

76
samples/README.md Executable file
View File

@@ -0,0 +1,76 @@
# CBDDC Samples
This directory contains sample applications demonstrating **CBDDC v0.6** integration across different platforms using the **Lifter** hosting model.
## 🔗 Cross-Platform Cluster Compatibility
All samples are configured to run on the **same cluster** securely. You can run them simultaneously to test real-time P2P synchronization.
| Parameter | Value | Description |
| :--- | :--- | :--- |
| **AuthToken** | `demo-secret-key` | Shared secret for secure discovery |
| **Discovery Port** | `6000` (UDP) | Port for local peer discovery |
| **DB Mode** | SQLite (WAL) | Persistent storage |
### 🖥️ ZB.MOM.WW.CBDDC.Sample.Console
Interactive CLI node. Good for monitoring the mesh.
**Run:**
```bash
cd ZB.MOM.WW.CBDDC.Sample.Console
dotnet run
# OR simulate multiple nodes:
dotnet run node-2 5001
dotnet run node-3 5002
# Enable recursive merge conflict resolution:
dotnet run --merge
```
## 🧪 Quick Test Scenario
1. Start **Console** app (creates `node-1`).
**All Nodes Must Use Same Security Mode:**
- Secure ↔ Secure: ✅ Works
- Plaintext ↔ Plaintext: ✅ Works
- Secure ↔ Plaintext: ❌ Connection fails
2. In Console, type `l` to list peers.
3. In Console, type `p` to put some data (`Alice`, `Bob`).
## 📚 Documentation
For complete v0.6 documentation, see:
- [Getting Started](../docs/v0.6/getting-started.html)
- [Security](../docs/v0.6/security.html)
- [Conflict Resolution](../docs/v0.6/conflict-resolution.html)
- [Architecture](../docs/v0.6/architecture.html)
## 🆕 Conflict Resolution Demo
**New Commands** (Console sample):
- `demo` - Run automated conflict scenario
- `todos` - View all TodoLists
- `resolver [lww|merge]` - Show current strategy
**Try Recursive Merge:**
```bash
cd ZB.MOM.WW.CBDDC.Sample.Console
dotnet run --merge
# Type: demo
```
The demo simulates concurrent edits to a TodoList. With `--merge`, both changes are preserved by merging array items by `id`. Without it (LWW), last write wins.
## 🔒 Network Security
**Enable encrypted communication:**
```bash
dotnet run --secure
```
Features:
- ECDH key exchange for session establishment
- AES-256-CBC encryption with HMAC-SHA256 authentication
- Visual indicators: 🔒 (encrypted) vs 🔓 (plaintext)
- Status displayed in `l` (list peers) and `h` (health) commands
**Note**: All nodes in a cluster must use the same security mode (all `--secure` or all plaintext).