Add batch support
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6.5k
- Forks
- 456
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 5
Description
ShareDB database really needs batch support. Which controls operations if they are success and undo previous success operations if other failed. Something like state management.
Example:
I'm going to submit 3 ops which are connected together.
- first op was successfully executed.
- second op failed
- third op is not inserted because second failed.
It means I have in database first op, my code is looking for this value and if the value is there then it can execute code in way where it takes in account second and third op.
I expect the batch command to do something like this:
- inserts first op (success?) cool, batch it.
- trying to insert second op (failed?), cancel batch to not break workflow / or batch it as failed.
So the batch should insert the values to the database only if all batched results are OK.
I can imagine an usability of the code
const document = getDocument();
const batch = document.createBatch();
batch.submitOp(xxx);
batch.submitOp(xxx);
batch.submitOp(xxx);
if(batch.execute()) log("everything is synchronized and fine")
else log("Whole process was cancelled to not break workflow.")
If it fails during execution of the batch then it should undo all executed operations in the batch.
It would be cool to have support for batching to multiple documents where each have different OT type.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing ShareDB's existing document operation submission behavior and the proposed document.createBatch(), batch.submitOp(), and batch.execute() entry points. Clarify transaction and rollback semantics, including whether multiple documents are in scope. Done means failed batches leave no operations applied and successful batches apply all operations consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100