-
Notifications
You must be signed in to change notification settings - Fork 1
[Local Skip Graph] Implements Local Skip Graph Join #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
thep2p
wants to merge
52
commits into
main
Choose a base branch
from
thep2p/local-skip-graph
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Adds a network module defining the interfaces and structures for network communication. This includes message types, a message struct, a message processor trait, and a network trait with methods for sending messages, registering processors, and starting/stopping the network service.
Introduces a mock network implementation for testing purposes. This implementation includes: - A `NetworkHub` for managing multiple mock networks. - A `MockNetwork` that simulates network behavior. The `Identifier` struct is also updated to implement the `Hash` trait.
Updates `new_mock_network` to pass a reference to the `NetworkHub` to the newly created `MockNetwork`. This allows the `MockNetwork` to interact with the hub, facilitating message routing and network management.
Introduces a test module for the mock network implementation. Simplifies the network hub by removing the boxed trait object, improving type safety and reducing complexity. This change also prepares the mock network for more comprehensive testing.
Uses `Rc` instead of `Arc` for mock network management in the hub. This change improves performance by reducing the overhead associated with heavy locking mechanisms, especially in single-threaded testing scenarios or when mutable access is infrequent.
Updates the mock network implementation to use `Rc` instead of `Arc` for managing shared mutable state. This change improves performance by avoiding unnecessary thread synchronization in the single-threaded mock environment. Also adds a test suite to test the mock network implementation.
Enables the mock network to simulate receiving and processing messages. This is achieved by adding an `incoming_message` function that allows injecting messages into the registered message processor. A test case is added to ensure that the message is properly processed.
Renames the `send_message` function to `incoming_message` for better clarity and to reflect the direction of the message flow. Also improves error handling by using a wildcard pattern for the lock error.
Removes an unnecessary message variable in the test function to improve code readability and maintainability.
Removes the `get_network` function from the `NetworkHub`, as it is no longer being used. Also removes the `start` and `stop` functions from both the `Network` trait and the `MockNetwork` implementation, as these functions are no-ops for the mock network and not needed in the trait.
Removes the generic `payload` field from the `Message` struct. The payload will be handled in a different, more type-safe manner to avoid the complexities and potential runtime errors associated with `Any`.
Renames the `MessageType` enum to `Payload` to better reflect its purpose, which is to define the structure of the message payload rather than the message type itself. This change provides a more accurate and descriptive name for the enum.
Refactors mock network tests for clarity and correctness. - Simplifies message processor logic for better handling of incoming messages. - Ensures messages are correctly routed and processed within the mock network, including verification of message processing. - Updates test assertions to accurately reflect message handling behavior.
Refactors the project structure to enable testing of the network module. The network module and its submodules are now only compiled during testing. This ensures that the network functionality, mainly used for testing, does not get included in production.
Adds documentation to the mock network hub and network components to improve understanding and maintainability. The documentation describes the purpose and usage of the `NetworkHub` and `MockNetwork` structures and their methods.
Adds a test case to verify concurrent message sending between mock networks. This test spawns multiple threads that concurrently send messages to a single recipient to ensure that messages are delivered correctly in a multithreaded environment. It validates that no messages are lost during concurrent sending.
Updates the mock network implementation to use `Arc>` instead of `Rc>` for thread safety. This change allows concurrent access and modification of the mock network state, preventing data races and ensuring safe concurrent testing.
Updates the `MessageProcessor` trait bound in `MockNetwork` to allow for more flexible implementations. Adds a print statement to confirm message processing in a test.
Adds the skip-graphs paper as a PDF document. This provides a reference document for the skip-graphs algorithm.
Adds the `Debug` derive macro to the `IdentifierSearchRequest` struct. This will allow for easier debugging and logging of search requests.
Implements integration tests for the skip graph functionality. This commit introduces a new test suite to verify the correct behavior of the skip graph, including: - Basic skip graph creation and connectivity - Node search functionality (sequential and concurrent) - Lookup table validity - Scalability tests with a larger number of nodes - Edge case handling - Performance benchmark test These tests ensure the skip graph functions as expected and maintains its integrity under various conditions.
Updates assertion messages in integration tests for better readability and debugging. Replaces string formatting with more concise and readable expressions. Adds linting instructions to AGENTS.md to promote code quality and consistency.
bee7705 to
900ec06
Compare
Removes the `IdentifierSearcher` trait as it is no longer needed. This simplifies the codebase and removes potential confusion.
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.
No description provided.