Comments (2)
tl;dr this works as expected. If you want to keep result consistent eg. for the sake of deterministic testing, you should create document with and explicit ID using Y.YDoc(client_id=X)
.
Longer explanation
The series of updates we're receiving in this scenario - concerning the ysource
shared text type is basically:
- Create a document with randomised identifier
X
and put character "a" at the beginning. - Concurrently to pt.1 at document with ID
845456925
insert character "a" at the beginning. - After pt.2 (but still concurrently to pt.1) at the document with ID
3709507946
insert character "b" after character "a" inserted by845456925
. - Serialise updates from pt.2 and pt.3. and apply them to document with ID
X
from pt.1.
The consistent part is that points 2. and 3. generate a string "ab" that's supposed to be inserted at the beginning of a ysource... however the actual position of a second "a" character is not set in stone, as we have concurrent operation of inserting character "a" at the same position by a different document.
In this case the conflict resolution algorithm will use document IDs to determine which piece of text ("ab" or "a") to insert first and which should be inserted second. Eg. if our document from pt.1 was generated with ID < 3709507946
(pt.3) the result will be "aba", but if its generated ID was higher, then the result will be "aab".
This means that depending on the run, the randomly generated ID can affect the order of operations. If that ID was static (not generated) the order would stay the same.
from ypy.
Makes sense, thanks a lot for the explanations!
from ypy.
Related Issues (20)
- Building ypy with setuptools_rust instead of maturin HOT 2
- Parent points to a block which is not a shared type HOT 1
- Upgrade to yrs 0.13+ HOT 8
- YBytes? HOT 4
- JSON serialization of Text fails on special chars
- Retrieve YDoc from Y object HOT 2
- No universal2 wheels for Python 3.9 HOT 1
- Can not access YDoc object created in another thread HOT 2
- Provide wheels for linux/arm64 (aarch64) HOT 2
- M1 wheel? HOT 2
- Missing license information on PYPI HOT 2
- emscripten-forge package
- MultipleIntegrationError HOT 3
- Release v0.6.1 failed HOT 1
- No pre-built wheel for macOS arm64 HOT 2
- 0.6.1: sphinx warnings `reference target not found`
- Getting error "decoded variable integer size was outside of expected bounds of 70 bits" HOT 3
- Uploading emscripten wheels to pypi fails HOT 10
- WASM wheel does not upload to PyPI HOT 2
- Empty updates
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ypy.