-
Notifications
You must be signed in to change notification settings - Fork 1
feat(api): record how far a device has read a library's feed #167
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9309f67
feat(api): record how far a device has read a library's feed
InstaZDLL 5fab7f5
docs(rfc): name the pull request that built decision 8
InstaZDLL d7de138
fix(api): document the 403, and bill each purge for its own cut
InstaZDLL 6af1f1d
fix(api): scope the acknowledgement's cursor read by membership too
InstaZDLL c7de11f
fix(api): let a device acknowledge the watermark itself
InstaZDLL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| -- How far a device has read one library's feed. RFC-007 decision 8. | ||
| -- | ||
| -- `sync_ack` minus its account column, and the difference is the whole reason | ||
| -- this is a second table rather than a wider first one: the user journal is | ||
| -- keyed per account, this feed is keyed per library. A device belongs to | ||
| -- exactly one account (`device.user_id`), so an account column here would be a | ||
| -- third value derivable from the other two — a second truth to keep in | ||
| -- agreement with the first, and the sort that goes stale in one place only. | ||
| -- | ||
| -- The account is therefore re-read from the device and checked against | ||
| -- `library_member` at write time, which is the rule every other read in this | ||
| -- server follows: tenancy lives in the query. | ||
| -- | ||
| -- Both foreign keys cascade. A revoked device and a deleted library each leave | ||
| -- nothing behind, and neither needs a sweeper to notice. | ||
| -- | ||
| -- What this table deliberately does not do is hold back the purge. A device | ||
| -- that never comes back would pin a feed forever, and a shared library would | ||
| -- lose retention entirely the moment one phone was thrown away. Retention is | ||
| -- decided by RFC-007 decision 7 and reported against these rows; it is not | ||
| -- bounded by them. | ||
| CREATE TABLE library_event_ack ( | ||
| library_id TEXT NOT NULL REFERENCES library(id) ON DELETE CASCADE, | ||
| device_id TEXT NOT NULL REFERENCES device(id) ON DELETE CASCADE, | ||
| cursor INTEGER NOT NULL CHECK (cursor >= 0), | ||
| acknowledged_at INTEGER NOT NULL, | ||
| PRIMARY KEY (library_id, device_id) | ||
| ) STRICT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.