josephg / diamond-types

The world's fastest CRDT. WIP.
1.61k stars 31 forks source link

Difference between `insert_seq_start` and `seq`? #1

Closed vedantroy closed 3 years ago

vedantroy commented 3 years ago

Hi! I had a question while browsing the automerge folder in this repository.

In CRDTLocationExternal, there's a field called seq. From seeing how this is used, I don't think this is an Automerge sequence number, right?

https://github.com/josephg/text-crdt-rust/blob/ba20b6386c0472958f33024ce0b806e75470e1ca/src/automerge/mod.rs#L22

But I'm assuming insert_seq_start represents an Automerge sequence number?

https://github.com/josephg/text-crdt-rust/blob/ba20b6386c0472958f33024ce0b806e75470e1ca/src/automerge/mod.rs#L51

Just wanted to clarify this. 🙂

I also see that there's a JS version of (at least some of) the Rust code?

https://github.com/josephg/text-crdt-rust/blob/ba20b6386c0472958f33024ce0b806e75470e1ca/src/automerge/txn.rs#L359

I checked https://github.com/josephg/reference-crdts, but I don't see any JS code that corresponds to the the branchContainsVersion checks.

josephg commented 3 years ago

Hi!

The automerge sequence number wasn't handled properly in that version of the code. I never got around to fixing it - it turned out I somewhat misunderstood how RGA worked; which I discovered while making my reference-crdts repository.

As for the JS reference, I've done so many javascript implementations of parts of this stuff now I'm losing track of it all. That code reference comes from here.