Consistent Appends #2036
Replies: 4 comments 1 reply
-
It would be very easy to implement this requirement. One thing that worries me though: Could it be over-used and lead to extreme performance issues if very long strings are kept being appended to? Also, I'm not sure about any use case that wouldn't be better if by adding new rows instead of extending an existing string. Logging is one such example. |
Beta Was this translation helpful? Give feedback.
-
Thanks @dfahlander, I'm curious what counts as very long? I'm trying to think through the best way to store the content of a text document from CodeMirror. Their data model
It sounds like I am better off storing the string the data in Dexie as an array of lines, or a tree as opposed to a flat string. The tree seems most complex, but would be most performant if I could get it it to work. The array would help with appends (this is a direct feature of the app I'm building, a "quick capture" that appends to your note). But for regular updates, I would either need to blow away the whole array and re-insert all of it, or compute which lines to update. The latter sounds as difficult as just storing it in a tree. Asking about what size this would start to matter because I think almost all notes would be less than 1mb, most less than 50kb. For what its worth, this was a difficult issue I was trying to solve without Dexie.js, so I am at least excited to see Dexie.js has some supprot for storing trees! |
Beta Was this translation helpful? Give feedback.
-
Interesting, I was shying away from CRDTs because of their storage overhead and potential performance issues with that. I am building mostly around single player note taking, though collaborative use cases of course start coming up because people have multiple devices. In any case, I think I am able to store and update the text from codemirror as a tree somewhat easily:
What you're describing sounds nice with the existence of y-codemirror, so might still give that a shot one 1926 is done. I'd say for now I definitely don't need string appeneds, so happy to close this. Would definitely appreciate any feedback on the update code above, I generated it with claude, but it seems to be working. |
Beta Was this translation helpful? Give feedback.
-
I am noticing some issues with my editor currently when QA/stress testing it, so I likely will switch to yjs shortly |
Beta Was this translation helpful? Give feedback.
-
Feature Proposal: Consistent String Append Operation
Dexie Cloud currently provides consistency guarantees for various update operations
Proposal:
Implement a consistent string append operation that would work similarly to the existing add() operation for sets or the mathematical add() for numbers.
Potential Implementation
Rationale
Potential Issues
Is this a reasonable request? let me know any questions or next steps if I can help at all
Beta Was this translation helpful? Give feedback.
All reactions