kevaundray / neo-go

Modular Implementation of the node in Golang
0 stars 0 forks source link

[V2] - Sync Manager #1

Open kevaundray opened 6 years ago

kevaundray commented 6 years ago

The first thing we will work on is the sync manager.

The sync manager will be broken down further into separate modules:

V3: Ideally we would like a timeout that adjusts itself for each node, as we do not want to disconnect nodes because they are naturally just slow. We would then pass more requests to the faster nodes. This is more advanced and a static timeout would be fine for now.

How do the three of these packages communicate?

The ConnectionManager First establishes a connection with the peers and does the handshake. It then has an interface like so GetPeer() Peer . This method will send back a peer to the downloadManager, to use, if the peer is not working or is slow, timeout is defined in the DM, then the downloadManager will ask for another peer. The connectionManager is in charge of checking if peers are invalid or slow. When a Peer is sent back to the pool, it will be checked to see if it is still good.

kevaundray commented 6 years ago

In order for us to even have a syncing manager, we need a Wire Protocol, which should not rely on the other code

kevaundray commented 6 years ago

Now that the wire is slowly being implemented; we can discuss the next steps with better terminology.

The connectionManager will use the Wire to maintain a pool of peers. It will hold the state of the peers and the state of what peers have been given out to the downloadManager. Also what peers have connected to us.

We will aim to not have multiple peers connecting to us, and we will also have a maximum amount of incoming connections. 6-10 seems fair, outbound we can have unlimited.

kevaundray commented 6 years ago

Update for what has been done and changed.

We will not have a uploadManager, the Peer abstract takes care of this. We will still have a SyncManager, which will only be used to download Blocks, to keep the node in sync.

We will also still have connectionManager.