rocicorp / repc

The canonical Replicache client, implemented in Rust.
Other
31 stars 7 forks source link

implement checksum #89

Closed phritz closed 4 years ago

phritz commented 4 years ago

background: https://github.com/rocicorp/replicache-client/issues/31

basically the diffserver has a map and the client has a map, and during sync the diffserver delivers a patch to the client to apply to their map. to ensure we detect it if the maps get out of sync we compute a checksum over the map. this is merely a function of keys and values and not of any impl details of how they are stored. this checksum is stored in the commit https://github.com/rocicorp/repc/blob/3678fa5b5fbcce0ed061955ebddafa790565017c/src/db/commit.fbs#L29 and comes down in the response https://github.com/rocicorp/diff-server/blob/37135a25431fcd768c82279c9af35e9637b0fac5/serve/types/types.go#L20 https://github.com/rocicorp/repc/blob/3678fa5b5fbcce0ed061955ebddafa790565017c/src/embed/sync.rs#L52. the computation is here: https://github.com/rocicorp/diff-server/blob/master/kv/checksum.go.

punt on json canonicalization for now.

we need to

phritz commented 4 years ago

closed by https://github.com/rocicorp/repc/pull/123