from Hacker News

The Guide to building Sync-friendly APIs

by tg3 on 6/20/22, 6:07 PM with 4 comments

  • by ctheb on 6/20/22, 9:55 PM

    In a distributed system it may not be appropriate to rely on a timestamp like this without accounting for the possibility of clock skew (unless the system provides a guarantee that timestamps are monotonically increasing.)

    SQL databases have had auto increment columns for ages, and they can be used to help with this problem.

    For a “guide” I wish it would discuss some of the pitfalls of the presented approach along with alternatives.

  • by ivanvanderbyl on 6/20/22, 10:49 PM

    There are some good ideas in there, but it doesn't really address the hard parts of syncing, such as handling items that were deleted, or arrays of items that changed order.

    In other words, an API that is good for syncing needs to communicate what changed, not just the snapshot of the current state.

  • by zmj on 6/20/22, 10:42 PM

    This assumes the client's system clock is well-behaved, which is rarely true over long time spans.