sillsdev / sillsdev/harmony

[Idea] Record when commits are received (and sent?)

Open
#19 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
14
Forks
4
Avg merge
3d 21h
Merged PRs (30d)
3

Description

-- As discussed with @hahn-kev this is to document an unfinished discussion about a possible feature --

It's currently impossible to determine what an object looked like on a client at a given time, because we don't track when changes arrive from other clients.

To solve this we'd need to stamp commits with the time that they are received and those timestamps would need to be on the same hybrid logical clock that is used when authoring commits so that they can be accurately compared.

Why might we want to calculate the local state of an object in the past?

  • Generally speaking, so it's possible to explain exactly what happened to an object on a user's machine over time
  • To show the user a history ordered by when changes were received (by comparing diffs of local state at different points in time e.g. before and after a sync)
  • It would make the following API possible SaveObject(object, versionIEdited), because the versionIEdited could be recalculated and compared to object in order to calculate an accurate diff
Other thoughts:

Perhaps stamp both sent and received commits with the same date when a sync happens
(We can always determine which changes we authored based on the client ID)

I think this would be problematic, because we might send changes we received from client A to client B and wouldn't want to overwrite the received timestamp with a sent timestamp.
We could also send our own changes to multiple other clients. A sindle timestamp wouldn't let us record both syncs. So, this wouldn't be equivalent to a Sync log.

Where to save the sync timestamp?

  • In CommitMetadata: which is serialized in a single column as JSON. We'd need 2 fields for the hybrid logical clock.
  • In a seperate table?

Contributor guide

No contributing guide indexed for this repository

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 reviewing the sync flow and CommitMetadata serialization described in the issue, then trace how authored and received commits are represented. Determine whether the proposed timestamps belong in CommitMetadata or a separate table, and define how sent and received events would be compared on the hybrid logical clock. Done means the storage model and historical-state behavior are specified well enough to implement and test.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.