Kinto / Kinto/kinto.js

Remove coupling between synchronization and storage

Open
#464 0 comments 0 reactions 0 assignees View on GitHub
enhancement stale
Dominant language
TypeScript
Stars
330
Forks
75
Avg merge
3d 5h
Merged PRs (30d)
4

Description

Currently the `collection.js` file handles both storage and synchronization.

We had a discussion around January (I remember diagrams were drawn :)) to split the implementation into two pieces.

The idea would be to have a series of agnostic functions that would receive a list of records to sync and return a sync result.
This would allow, for example, to use the synchronization algorithm with completely different storage implementation (e.g. key-value store instead of our storage adapters etc.)

A first step would be at least to split the source file into two: `collection.js` and `sync.js`.
The sync function would receive as input the result of `gatherLocalChanges()` but would not be in charge of inspecting the local data.

My only interrogation concerns the split of conflicts detection. But we could think of something using callbacks for example. Importing records locally could be done using the information obtained from the sync result object.

Note that it would help solving #340.

Contributor guide

Open the contributing guide

Research direction

The issue centers on collection.js and proposes separating synchronization into sync.js. Start by reading gatherLocalChanges() and the surrounding storage and synchronization responsibilities; done means the sync logic accepts records independently of storage and returns a sync result that can support importing records locally.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
distributed-systems
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.