FRC2706 / giorno

Scouting App made for the 2019-2020 FRC Competition
GNU General Public License v3.0
0 stars 0 forks source link

General Sync #2

Open crabctrl opened 4 years ago

crabctrl commented 4 years ago

We should have a single central class that handles the high-level sync stuff, so if we implement multiple sync interfaces (eg WiFi, QR codes, whatever) we don't have to rewrite the code every time. (moved to #12)

Stuff we need to sync:

crabctrl commented 4 years ago

So after doing some work on #12, I'm just going to type up an overview of how the sync currently works.

It is split into three stages:

  1. Device writes a handshake, containing the checksums of all the objects it has.
  2. Device reads the peer's handshake. Comparing the peer's list of checksums to its own, it determines which objects it has that the peer does not. It then sends a response containing all of these objects.
  3. Device reads the peer's response, and passes them on to the various SyncProviders for parsing. Object checksums are looked through again to ensure duplicates are never added.

So in other words, this requires two read operations and two write operations. This might be annoying depending on the specific implementation (cough cough #4), but all in all it's pretty efficient and avoids us having to resend the entire database each time we sync.