-
Notifications
You must be signed in to change notification settings - Fork 5
Store Jay's proposal
Joshua Thijssen edited this page Feb 1, 2021
·
3 revisions
A collection has a "calculated" (but maybe cached) timestamp of the latest timestamp of all the entries (or subcollections) underneat:
/collection ts=1600
/item1 ts=1500
/item2 ts=1400
/item3 ts=1600
Store itself is a collection of ALL items
/
/contacts
/contacts/group1 => [{uuid}, {uuid}, {uuid}, {uuid}, {uuid} ]
/contacts/group2 => [{uuid}, {uuid} ]
/contacts/group3 => [{uuid}, {uuid}, {uuid} ]
/contacts/entries
/contacts/entries/{uuid} => { address: jaytaph! name: joshua Thijssen otherstuff: .... }
/contacts/entries/{uuid} => ...
/contacts/entries/{uuid} => ...
/contacts/entries/{uuid} => ...
/contacts/entries/{uuid} => ...
/bm-client-gui
/bm-client-gui/config => json-blob
/bm-client-gui/theme => json-blob
/bm-client-gui/other-stuff => json-blob
/mobile-client
/mobile-client/config => json-blob
/boxes => [
/boxes/"box-1" => { name: "Inbox", parent: 0 }
/boxes/"box-2" => { name: "Sent mail", parent: 0 }
/boxes/"box-3" => { name: "Recylcing", parent: 0 }
/boxes/"box-100" => { name: "important", parent: "box-1" }
/boxes/"box-101" => { name: "work-stuff", parent: "box-100" }
Storage on disk:
key:
# The key that we use for querying
hash(/store)
value:
# What is the parent collection (hash-key) of this collection
parent: nil
# This key is a collection
collection: true
# The value of the key. Should be nil when it's a collection, but could be nil when the item is "removed"
value: nil
# The timestamp of the item, or the highest timestamp of any entries or subcollections underneath.
timestamp: 14
# The entries underneath this collection
entries: []
# The subcollection underneath this collection
subcollections: [hash(/store/boxes)]
key:
hash(/store/boxes/"box-1")
value:
parent: hash(/store/boxes)
collection: false
value: blob
timestamp: 123456
key:
hash(/store/boxes)
value:
parent: hash(/store)
collection: true
value: nil
timestamp: 147437
entries: [hash(/store/boxes/"box-1")]
subcollections: []
GET /store ?since=<ts>&offset=0&limit=100
Fetches whole store
POST /store/<hash(/store/contacts/entries/{uuid})>
stores an item at the given entry
GET /store/<hash>
Get single entry
DELETE /store/<hash>
Remove single entry
Question:
How do we sync "removed" items (update timestamp of collection, but how does the client "sync" removed items? Return nil on the item?