Add Transport trait abstraction for P2P sync with hyperswarm-rs integration points#87
Merged
kayodebristol merged 5 commits intomainfrom Feb 18, 2026
Merged
Conversation
Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
…ayer Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
Co-authored-by: kayodebristol <3579196+kayodebristol@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Integrate hyperswarm-rs as default P2P transport for PluresDB sync
Add Transport trait abstraction for P2P sync with hyperswarm-rs integration points
Feb 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a foundational Transport trait abstraction for PluresDB's P2P synchronization layer, laying the groundwork for hyperswarm-rs integration. It provides a pluggable architecture supporting three transport modes: Hyperswarm (DHT-based P2P), Relay (WebSocket for corporate networks), and Disabled (local-only). The Hyperswarm and Relay transports are implemented as stubs with clear error messages and integration points documented, while DisabledTransport is fully functional for local-only mode.
Changes:
- Adds Transport and Connection trait definitions with async methods for P2P operations (connect, announce, lookup, disconnect)
- Implements BLAKE2b-256 topic derivation for deterministic DHT topic generation from database IDs
- Provides three transport implementations: HyperswarmTransport (stub), RelayTransport (stub), and DisabledTransport (complete)
- Includes comprehensive documentation, integration tests, and factory pattern for transport instantiation
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/HYPERSWARM_INTEGRATION.md | Comprehensive tracking document for hyperswarm-rs integration progress, architecture, and implementation roadmap |
| crates/pluresdb-sync/README.md | Complete crate documentation with usage examples, architecture diagrams, and API reference |
| crates/pluresdb-sync/src/transport.rs | Core trait definitions, BLAKE2b-256 topic derivation, TransportConfig, and factory function |
| crates/pluresdb-sync/src/hyperswarm.rs | Stub implementation with HyperswarmConfig, bootstrap nodes, and integration point comments |
| crates/pluresdb-sync/src/relay.rs | Stub implementation for WebSocket relay transport with corporate firewall traversal design |
| crates/pluresdb-sync/src/disabled.rs | Complete implementation for local-only mode with graceful no-op behavior |
| crates/pluresdb-sync/src/lib.rs | Module exports for transport implementations and existing sync event broadcaster |
| crates/pluresdb-sync/tests/integration_test.rs | Integration tests for transport factory, topic derivation, and disabled transport; placeholder tests for future implementations |
| crates/pluresdb-sync/Cargo.toml | Adds blake2 (0.10) and async-trait dependencies, hex as dev dependency |
| Cargo.lock | Lockfile updates for new dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PluresDB needs pluggable P2P transport for CRDT sync across different network environments (home DHT vs corporate firewalls). This adds the foundation layer for hyperswarm-rs integration.
Transport Abstraction
Defines
Transporttrait for pluggable sync backends:Topic derivation converts database IDs to DHT topics via BLAKE2b-256:
Implementations
HyperswarmTransport: Stub with integration points for hyperswarm-rs crate (Implement Rust DHT client with holepunching, Noise encryption, and IPv6 support hyperswarm#4). Methods return actionable errors until dependency added.
RelayTransport: Stub for WebSocket relay on port 443 (corporate firewall traversal). Ready for tokio-tungstenite integration.
DisabledTransport: Complete implementation for local-only mode. Production-ready graceful fallback.
Configuration
Dependencies
blake2 = "0.10"for topic derivationhex = "0.4"(dev-only) for test assertionsStructure
Next step: Add hyperswarm-rs dependency and implement HyperswarmTransport methods for DHT operations.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.