offline-web/DESIGN.md

69 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2025-03-28 17:46:09 -04:00
# Design Notes
## Synchronization
We support several operations for Bootstrapping
2025-03-28 17:46:09 -04:00
* Fetch Bootstrap
* Fetch Reference
* Fetch Object
2025-03-28 17:46:09 -04:00
## Resource Datamodel
2025-03-28 17:46:09 -04:00
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.
2025-03-28 17:46:09 -04:00
```json
{
2025-03-30 15:11:26 -04:00
"objectId": <merkle-hash>,
"content_address": <content-hash>,
2025-05-21 19:23:13 -04:00
"name": "/path/name0",
2025-03-28 17:46:09 -04:00
"dependents": [
2025-03-30 15:11:26 -04:00
{
"path": "path/name1",
"content_address": <content-hash>,
"objectId": <merkle-hash>, content: <payload>
},
{
"path": "path/name2",
"content_address": <content-hash>,
"objectId": <merkle-hash>, content: <payload>
}
2025-03-28 17:46:09 -04:00
],
}
```
### Reserved References
* `/ref/all/<username>` The root of the resouce tree. List all sub
2025-03-28 17:46:09 -04:00
resources that the user has access too.
* `/ref/user/<username>` The user information.
2025-03-28 17:46:09 -04:00
### 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>`.
2025-03-28 17:46:09 -04:00
Their payloads are whatever the contents serialize to in json
2025-03-28 17:46:09 -04:00
## 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.
2025-03-28 17:46:09 -04:00
# Benchmarking
## Bootstrapping benchmark tests
* Rest API
* WebSockets