mozilla-services / mozilla-services/syncstorage-rs

Simplify batch API methods

Open
#835 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3 cleanup p1
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 to validate_batch so at this point it seems unnecessary. commit_batch should take a batch_id instead of a params::Batch. Additionally validate_batch is called from append (and elsewhere in MySql). So a batch post call is probably calling get/validate 3 times for no good reason.

  • Remove the bsos argument (and the do_append work) from create_batch. It's not needed: the batch handler always specifies a bsos value of vec![]

  • results::CommitBatch is results::PostBsos (as it used to return the result of it). It should be a SyncTimestamp instead as the other fields of PostBsos aren't used here #934

And some associated tests will need to reflect these changes too

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.