offline-web/DESIGN.md

69 lines
1.7 KiB
Markdown

# Design Notes
## Synchronization
We support several operations for Bootstrapping
* Fetch Bootstrap
* Fetch Reference
* Fetch Object
## Resource Datamodel
We assume all resources are content-addressable and form a merkle tree. We
maintain an index of path to content-addressable items.
Resource reference paths are rooted at a `/ref/` prefix for their path
namespace. They contain a payload with the `objectID`, `content_address` if
there is one, and a list of any dependent resources.
```json
{
"objectId": <merkle-hash>,
"content_address": <content-hash>,
"name": "/path/name0",
"dependents": [
{
"path": "path/name1",
"content_address": <content-hash>,
"objectId": <merkle-hash>, content: <payload>
},
{
"path": "path/name2",
"content_address": <content-hash>,
"objectId": <merkle-hash>, content: <payload>
}
],
}
```
### Reserved References
* `/ref/all/<username>` The root of the resouce tree. List all sub
resources that the user has access too.
* `/ref/user/<username>` The user information.
### Content-Addressable Query API
The content addressable store is considered immutable. You do not delete from
it. We may garbage collect at some point as a storage optimization.
Content addressable paths are rooted at `/object/<content-hash>`.
Their payloads are whatever the contents serialize to in json
## Syncrhonization
### Bootstrapping
* Load `/ref/all/<username>`
* Follow the sub resources recusively to load the entire dataset locally making
sure to keep the content-addresses around for comparison.
# Benchmarking
## Bootstrapping benchmark tests
* Rest API
* WebSockets