-
Notifications
You must be signed in to change notification settings - Fork 159
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
ChainSync framework #243
ChainSync framework #243
Conversation
|
||
#[derive(Default)] | ||
pub struct SyncManager { | ||
sync_queue: SyncBucketSet, | ||
} | ||
|
||
impl SyncManager { | ||
pub fn schedule_tipset(&mut self, tipset: Rc<Tipset>) { | ||
pub fn schedule_tipset(&mut self, tipset: Arc<Tipset>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for the 2 other funcs below
use libp2p::core::PeerId; | ||
use log::trace; | ||
|
||
/// Context used in chain sync to handle sequential |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sequential what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had it fixed on my local wip changes lol
/// Returns FullTipset from store if TipSetKeys exist in key-value store otherwise requests FullTipset | ||
/// from block sync | ||
pub fn fetch_tipset(&self, _peer_id: PeerId, tsk: &TipSetKeys) -> Result<FullTipset, Error> { | ||
let fts = match self.load_fts(tsk) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cant you just use ?
instead of match? Just a nit dun matter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not changed in this PR but the idea is leaving like this until the TODO is done (I commented the same thing on Dustin's PR)
Summary of changes
Changes introduced in this pull request:
ChainSyncer
a channel from the networking thread to this threadBlockSyncResponse
including the tipset bundle and status code into a result with ok type being a full tipsetNetworkContext
struct to be able to handle RPC requests to the network and manage the request IDsIn this PR I've setup the ChainSyncer so that the underlying database and channels can be replaced from using a live db and p2p network to an in memory db and local channels for testing or replaced by anything else generic in the future. I will wait to write the actual integrated tests until the full structure is done, but I setup a test to make it easier to set that up if someone else does this.
There is some stuff still TODO, but as discussed I would open this PR as interim to hopefully allow others to build ontop of
Reference issue to close (if applicable)
Closes #223
Closes #227
Other information and links