Skip to main content
Tweeted twitter.com/StackSoftEng/status/893571045990555649
deleted 1 character in body
Source Link
User
  • 371
  • 1
  • 4
  • 11

I thought about 2 approaches and already implemented 1 of them, but it's quite complicated and I fear a bit about it'sits performance and error-proneness.

I thought about 2 approaches and already implemented 1 of them, but it's quite complicated and I fear a bit about it's performance and error-proneness.

I thought about 2 approaches and already implemented 1 of them, but it's quite complicated and I fear a bit about its performance and error-proneness.

added 114 characters in body
Source Link
User
  • 371
  • 1
  • 4
  • 11

P.S. would also appreciate reading recommendations about this (maybe as a comment), any good resource about sync strategies. I'm using Scala, Play 2.4 and Akka in some parts so a recommendation in this direction would also be very useful.

P.S. would also appreciate reading recommendations about this (maybe as a comment), any good resource about sync strategies.

P.S. would also appreciate reading recommendations about this (maybe as a comment), any good resource about sync strategies. I'm using Scala, Play 2.4 and Akka in some parts so a recommendation in this direction would also be very useful.

added 1 character in body
Source Link
User
  • 371
  • 1
  • 4
  • 11
  1. Client sends all its items to server (this could be refined by filtering items that need create/update/delete, but for now it sends everything). Items have a server last update timestamp and flag if it's marked to be deleted.

  2. Server queries all the items for the user

  3. ProgramaticProgrammatic algorithm that goes through all the items checking timestamps in order to determine if the item can be updated/deleted or not. If the last server update timestamp in the client's item is different than the one stored in the server (meaning, someone else updated the item in between) the update/delete is rejected. I build many lists here, one of items that have to be inserted (items are not in the server's query result), items that are to be updated, items that are to be deleted, items that can't be updated because the timestamp is different, items that can't be deleted because the timestamp is different.

  4. Transaction for inserts/updates/deletes, for which I use lists constructed in 3.

  5. Query to get again all the items for the user.

  6. Send result of this query to client, together with the lists of items that couldn't be updated or deleted built in 3., so client knows what failed.

  1. Client sends all its items to server (this could be refined by filtering items that need create/update/delete, but for now it sends everything). Items have a server last update timestamp and flag if it's marked to be deleted.

  2. Server queries all the items for the user

  3. Programatic algorithm that goes through all the items checking timestamps in order to determine if the item can be updated/deleted or not. If the last server update timestamp in the client's item is different than the one stored in the server (meaning, someone else updated the item in between) the update/delete is rejected. I build many lists here, one of items that have to be inserted (items are not in the server's query result), items that are to be updated, items that are to be deleted, items that can't be updated because the timestamp is different, items that can't be deleted because the timestamp is different.

  4. Transaction for inserts/updates/deletes, for which I use lists constructed in 3.

  5. Query to get again all the items for the user.

  6. Send result of this query to client, together with the lists of items that couldn't be updated or deleted built in 3., so client knows what failed.

  1. Client sends all its items to server (this could be refined by filtering items that need create/update/delete, but for now it sends everything). Items have a server last update timestamp and flag if it's marked to be deleted.

  2. Server queries all the items for the user

  3. Programmatic algorithm that goes through all the items checking timestamps in order to determine if the item can be updated/deleted or not. If the last server update timestamp in the client's item is different than the one stored in the server (meaning, someone else updated the item in between) the update/delete is rejected. I build many lists here, one of items that have to be inserted (items are not in the server's query result), items that are to be updated, items that are to be deleted, items that can't be updated because the timestamp is different, items that can't be deleted because the timestamp is different.

  4. Transaction for inserts/updates/deletes, for which I use lists constructed in 3.

  5. Query to get again all the items for the user.

  6. Send result of this query to client, together with the lists of items that couldn't be updated or deleted built in 3., so client knows what failed.

added 128 characters in body
Source Link
User
  • 371
  • 1
  • 4
  • 11
Loading
deleted 8 characters in body
Source Link
User
  • 371
  • 1
  • 4
  • 11
Loading
added 1307 characters in body
Source Link
User
  • 371
  • 1
  • 4
  • 11
Loading
added 1307 characters in body
Source Link
User
  • 371
  • 1
  • 4
  • 11
Loading
deleted 11 characters in body
Source Link
User
  • 371
  • 1
  • 4
  • 11
Loading
Source Link
User
  • 371
  • 1
  • 4
  • 11
Loading