-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate replication manager with networking stack (#387)
* Use SyncMessage in replication network behaviour * Use target set in sync request * Convert integer to Mode * Add replication to main behaviour struct * Add SyncManager to replication behaviour * Add schema provider to behaviour * Move mananger again out of network behaviour, add replication service * Introduce event loop to handle swarm and channel events * Add new service message types to enum * Better method name and structure for event loop * Send and receive service messages on new or closed connections and replication messages * Have peer id on network config struct * Introduce connection manager in replication service * Prepare methods for finished or failing sessions * Add and remove peers in connection manager * Count failed and successful sessions * Initiate replication with peers * Add some basic logging * Do not override with default when building config in cli * Fix checking only for certain messages in async loop * Clippy happy, developer happy * Make Domain error in IngestError transparent * Add logging for replication entry exchange * Sort system schema to the front of TargetSet * Refactor log height diff logic * Don't diff over schema sub-range of target set * Introduce DuplicateSessionRequestError * More logging and use new error type * Logging for dropping and re-initiating duplicate session requests * Log when re-initiating session with peer * Fix issue when calculating local log heights * More logging in manager * Improve logging message * Fix diff test * Correct expect error message * Ignore duplicate inbound sync requests * Add messaging diagram to lifetime test * Logging in behaviour * Remove re-initiating dropped duplicate sessions if they had a different target set * Diagram for sync lifetime test * Test for concurrent sync request handling * Remove duplicate diagram * Make random target set include more * Small logging and improved comments * Elegantly handle concurrent session requests with duplicate target set * Correct validation of TargetSet * Better naming in TargetSet fixture * Update tests * Order log heights in Have message * Implement Human on Message and SyncMessage * Some work on logging * Fix remote log height logging * fmt * Remove all sessions for a peer on replication error * Add error logging to handler * Add ConnectionId to peer identifier in replication service * Doc string for PeerConnectionIdentifier * Add comment to PeerConnectionId defaults * Add (very) basic replication scheduler * Refactor replication behaviour event triggering * Temp fix for UNIQUE * Send SyncMessages to one handler by ConnectionId * Maintain list of peers and all their connections on ConnectionManager * Remove connection from ConnectionManager when swarm issues ConnectionClosed event * Refactor ConnectionEstablished messaging in replication behaviour * Improve error handling and logging * Update api in behaviour network tests * Error logging in replication connection handler * Cargo clippy * fmt * More tests for TargetSet validation * Only identify peers by their PeerId (not ConnectionId) in replication logic * Rename ConnectionEstablished to PeerConnected etc.. * Poll ticking stream for scheduling replication * Dynamically retrieve target set when starting replication * Add some more doc strings * Fix formatting * Fix missing peer id in e2e test * Remove unnecessary type casting in entry SQL * Give error logging more context * Fix SQL query by making seq_num IN values a string * Try different string literal * Use IntervalStream from tokio for scheduler * Add doc strings * Fix filtering active sessions logic * Update comments * Remove repeating debug log * Re-initiate dropped session if its concerning a different target set * Allow max 3 sessions per peer and max one for the same target set * Update test and fix bug in re-initiating session logic * Correct diagram * Inform connection handler about replication errors, introduce timeout * Close all connection handlers on critical errors * Fix import style * Fix import style * Remove no longer relevant log message * Stop dialing peer after one address dialed successfully * Only accept one inbound and one outbound connection per peer * fmt x clippy * Use libp2p from git main * Add network info logging on incoming connection errors * Revert * Make clippy happy * Do never actively close connections * Remove dead code * Check more often when using ping and mDNS discovery * Close replication session on all errors * Better error logging * Fix issue where outbound streams could not be re-established after error * Add behaviour logic which always uses latest healthy connection * Rename to peers behaviour * Make clippy happy * Add entry to CHANGELOG.md * Use connection ids to identify peers * Clean up logging a little bit * A little bit less verbose logging * Fix tests * Add a test for connection manager * Write some more doc-strings * Add more docs * Disconnect from all peers before shutdown * Dial peers by multiaddr on mdns discovery * Rename Naive -> LogHeight strategy * Naming improvement * Doc strings * fmt --------- Co-authored-by: Sam Andreae <contact@samandreae.com>
- Loading branch information
1 parent
b304217
commit c45b96a
Showing
40 changed files
with
2,721 additions
and
775 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.