ntcore icon indicating copy to clipboard operation
ntcore copied to clipboard

Describe potential synchronization scenarios and desired results

Open virtuald opened this issue 6 years ago • 1 comments

Synchronization in NT has never been particularly clear cut, and is not documented as clearly as I would like.

I'd like us to write out the various synchronization cases to clarify what we expect the behavior of NT to be in each situation. Then, once that's correct, there should be tests for each (mostly done for pynetworktables), and this table should be added to the NT documentation somewhere. There are terms that need to be defined here:

  • Connected: both sides connected and synchronized
  • Disconnect: both sides retain internal state (such as a network disconnect)
  • Restart: one side does not retain internal state (such as a program restart).

For the purposes of this discussion, client and server are not connected until stated.

Writes before connection

Client writes value

Action Global NT state Notes
client foo=1
connected foo=1

Server writes value

Action Global NT state Notes
server foo=1
connected foo=1

Both write value

Action Global NT state Notes
server foo=1
client foo=2
connected foo=2 client wins

Server restart

Client wrote value locally

Action Global NT state Notes
client foo=1
connected foo=1
server restart
connected foo=1

Server wrote value

Action Global NT state Notes
server foo=1
connected foo=1
server restart
connected foo deleted Not an intuitive result

Both write value

Action Global NT state Notes
connected
client foo=1 foo=1
server foo=2 foo=2
server restart
connected foo=2

Client restart

Action Global NT state Notes
client foo=1
connected foo=1
client restart
connected foo=1
Action Global NT state Notes
server foo=1
connected foo=1
client restart
connected foo=1
Action Global NT state Notes
server foo=1
connected foo=1
client restart
server foo=2
connected foo=2

Disconnect

Server update during disconnect - server initiated value

Action Global NT state Notes
connected
server foo=1 foo=1
disconnect
server foo=2
connected foo=2

Server update during disconnect - client initiated value

Action Global NT state Notes
connected
client foo=1 foo=1
disconnect
server foo=2
connected foo=1 client wins

Client update during disconnect

Action Global NT state Notes
connected
client foo=1 foo=1
disconnect
client foo=2
connected foo=2
client foo=3 foo=3

Both update during disconnect

Action Global NT state Notes
connected
client foo=1 foo=1
disconnect
client foo=2
server foo=3
connected foo=2
client foo=4 foo=4

Client updates during disconnect (both previously written)

Action Global NT state Notes
connected
client foo=1 foo=1
server foo=2 foo=2
disconnect
client foo=3
connected foo=3 issue #270?
client foo=4 foo=4

Client and server updates during disconnect (both previously written)

Action Global NT state Notes
connected
client foo=1 foo=1
server foo=2 foo=2
disconnect
server foo=3
client foo=4
connected foo=4 issue #270?
client foo=5 foo=5

virtuald avatar Feb 28 '18 19:02 virtuald