Conversation
- Introduced `demo.mjs` for initializing and managing a discovery LAN instance. - Implemented `demo.test.mjs` for testing the demo script with various scenarios. - Added a Rust library (`lib.rs`) for handling CRDT state observation and increment operations. - Updated dependencies in multiple example projects to use `nx-sdk` version 0.1.5.
- Added `InvalidConfig` variant to `NetError` for better error reporting on invalid node configurations. - Implemented `validate` method in `NodeConfig` to enforce limits on `max_peers`, `event_channel_capacity`, and `socket_timeout` before resource allocation. - Introduced `try_new` method in `Node` to create nodes with immediate validation, returning errors for invalid configurations. - Updated various methods in `Node` to validate configurations before operations, ensuring robustness against misconfigurations. - Enhanced documentation to clarify the validation process and error handling in the context of node creation and management. - Improved tests to cover new validation logic and ensure that invalid configurations are handled gracefully without panics.
…c:Introduced with`MAX_DISCOVERY_EVENT_CAPACITY` constant to limit event capacity to 4096, with validation in dynamic provider constructors, enhanced `CandidateRegistry` to better handle candidate contributions and ensuring proper expiration and renewal logic.
…y `--listen` vs `--advertised-endpoint` usage
…n string compatibility
…ment virtualized multicast limitations
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.
This pull request implements v0.1.5, introducing dynamic peer candidate discovery to Numax while maintaining backward compatibility with static
--peerdeployments.Prior to$O(N^2)$ operational complexity). This release introduces the
v0.1.5, clustering required knowing and configuring all remote peer addresses statically (PeerDiscoveryabstraction, candidate coordination innx-core, discovery modes (mDNS, Bootstrap Gossip, DNS-SRV, and File Watch), and dynamic endpoint resolution without breaking authentication or transport boundaries.Architectural Changes & Key Additions:
1.
nx-core: Discovery Abstraction & Coordination (crates/nx-core/src/discovery/)PeerDiscoveryContract: Definesdiscover(),watch(), andannounce()primitives with atomic snapshot-watch consistency.CandidateCoordinator&CandidateRegistry:DEFAULT_DISCOVERY_EVENT_CAPACITYandMAX_DISCOVERY_EVENT_CAPACITYlimits across broadcast channels.StaticDiscovery: Preserves backward compatibility with CLI/TOML--peerconfigurations.MdnsDiscovery: Zero-configuration peer discovery for local networks over UDP multicast 5353.BootstrapGossipDiscovery: Seed-based candidate exchange for bootstrap discovery.DnsSrvDiscovery: Periodic DNS SRV record resolution with TTL-aware polling.FileWatchDiscovery: File-system-based dynamic candidate updates for container orchestrators.2.
nx-net: Bootstrap Protocol & Configuration Validation (crates/nx-net/)BootstrapClient,BootstrapServer, andWireMessage::bootstrap_hellofor exchanging peer candidates during bootstrap.InvalidConfigvariant toNetErrorfor descriptive configuration errors.NodeConfig::validate()andNode::try_new()to validate peer limits, timeouts, and channel capacities before resource allocation.3.
nx-cli: Configuration & CLI Integration (crates/nx-cli/)DiscoveryMode(static,bootstrap,mdns,dns-srv,file) in TOML and CLI flags:--discovery-mode <MODE>--advertised-endpoint <IP:PORT>--cluster-id <ID>--bootstrap-seed <IP:PORT>NX_*) > TOML config > Defaults.4. Examples & Verification (
examples/discovery_lan/)examples/discovery_lan/).--peer.5. Documentation (
docs/nx-site/)--listenvs--advertised-endpoint, wildcard binds, and dynamic port allocation).Invariants & Safety Guarantees Preserved:
nx-net.sync_managerremain intact.max_candidatesandMAX_DISCOVERY_EVENT_CAPACITY(4096) to prevent unbounded memory growth.AbortOnDropTaskand explicit shutdown triggers for deterministic teardown.