mozilla-services / mozilla-services/syncstorage-rs
Simplify batch API methods
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 86
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 21
Description
Now that we've moved away from the older batch impl. based on the go version (saving the batch bsos into a json blob), we can simplify a couple parts of the batch API:
-
Remove
Db::batch_get: This method was somewhat useful for the old version (mostly for tests). It's similar tovalidate_batchso at this point it seems unnecessary.commit_batchshould take abatch_idinstead of aparams::Batch. Additionallyvalidate_batchis called fromappend(and elsewhere in MySql). So a batch post call is probably callingget/validate3 times for no good reason. -
Remove the
bsosargument (and thedo_appendwork) fromcreate_batch. It's not needed: the batch handler always specifies a bsos value ofvec![] -
#934results::CommitBatchisresults::PostBsos(as it used to return the result of it). It should be aSyncTimestampinstead as the other fields ofPostBsosaren't used here
And some associated tests will need to reflect these changes too
Contributor guide
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 tracing Db::batch_get, commit_batch, validate_batch, append, and create_batch, then inspect the associated tests mentioned in the issue. Identify all callers and update the batch API consistently: remove Db::batch_get, pass batch_id to commit_batch, remove the bsos argument and do_append work from create_batch, and make the tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend, backend-api-design
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100