Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshots #3

Open
ThomasHalwax opened this issue Oct 19, 2023 · 2 comments
Open

Snapshots #3

ThomasHalwax opened this issue Oct 19, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@ThomasHalwax
Copy link
Member

With a growing number of events it gets more expensive to calculate the most recent state since we need to consider all events in the timeline.
Snapshots of the most recent state would be helpful since a "late comer" needs to read the latest snapshot and all subsequent events only.

Creating snapshots is triggered by the number of events that have been posted since the latest snapshot. The responsibility for creating the snapshot for a room/layer is transferred to the client whose latest events releases the trigger.
If there are two users A and B both clients need to count the events. If the trigger count is set to 10 and A posted 9 events the client that posts the next event is responsible for the snapshot.

Snapshots may become big and exceed the max size of matrix messages. Thus snapshots need to be sliced into chunks.

@ThomasHalwax ThomasHalwax self-assigned this Oct 19, 2023
@ThomasHalwax ThomasHalwax added the enhancement New feature or request label Oct 19, 2023
@ThomasHalwax
Copy link
Member Author

ThomasHalwax commented Oct 19, 2023

Since we can't guarantee that there will be no other event between the "trigger event" and the snapshot event the snapshot needs to refer to the trigger event. That way one can check for additional events and apply them accordingly.

io.syncpoint.odin.chunk = {
  content: {{BASE_64_ENCODED_CONTENT}}
}

io.syncpoint.odin.snapshot = {
  trigger: {{event_id_of_the_trigger_event}},
  chunks: [
    {{chunks_event_id_0}},  // typeof io.syncpoint.odin.chunk
    {{chunks_event_id_1}},
    {{chunks_event_id_2}},
    {{chunks_event_id_n}},
  ]
}

@ThomasHalwax
Copy link
Member Author

The snapshot is the most recent state and does not contain any del operations. Applying the snapshot means removing all items that are NOT part of the snapshot or the subsequents events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant