rfc/content/docs/rfcs/3/README.md

220 lines
5.6 KiB
Markdown
Raw Normal View History

2020-02-20 15:44:00 +00:00
---
Merge repo with rfc.vac.dev (#310) * Hugo init * Init Hugo book * Add basic README and title * Import RFC: 1/COSS * Move example content to dedicated folder * Basic menu * Tweak single layout * Fix base url and permalink * Basic index tweaks * Add netifly config * gitignore * 1/COSS: Add COSS lifecycle * Remove public artifact * Add basic numbers in menu * Empty READMEs init * Import mvds spec raw * 2/MVDS: Simplify * 3/REMOTE-LOG: Import * 3/REMOTE-LOG: Simplify * 4/MVDS-META: Import * 4/MVDS-META Simplify * Tweaks * 5/WAKU0: Import * 5: Simplify * 6/WAKU1: Import * 6/WAKU1: Simplify * 7/WAKU-DATA: Import * 7/WAKU-DATA: Simplify * 8/WAKU-MAIL: Import * 8/WAKU-MAIL: Simplify * Tweak * 9/WAKU-RPC: Import * 9/WAKU-RPC: Simplify * 10/WAKU2: Import * 10/WAKU2: Simplify * 11/WAKU-RELAY: Import * Tweaks * 11/WAKU-RELAY: Simplify * 12/WAKU-FILTER: Import * 12/WAKU2-FILTER: Simplify * 13/WAKU-STORE: Import * 13/WAKU-STORE: Simplify * 14/WAKU-MESSAGE: Import * 14/WAKU-MESSAGE: Simplify * 15/WAKU-BRIDGE: Import * 15: Simplify * 16: Import * 16: Simplify * 17: Import * 17: Simplify * 18: Import * 18: Simplify * 12: Bump update * 14: Bump update * 11: Bump update * 17: Bump update * 18: Bump update * 16: Bump update * Fix slug for 18 * Editor changes for 11, 12, 15 * Revert "Editor changes for 11, 12, 15" This reverts commit 5c32fe791bec57ca1d5326e0d2724339f12a784a. * Revert "Revert "Editor changes for 11, 12, 15"" This reverts commit ccd75131d72a1f1c43b701f445fe66ebd6857fc4. * Editor changes for 13, 2, 4 * Move current specs to archive * Update README * bump
2021-04-01 04:03:14 +00:00
slug: 3
title: 3/REMOTE-LOG
name: Remote log specification
status: draft
editor: Oskar Thorén <oskar@status.im>
contributors:
- Dean Eigenmann <dean@status.im>
2020-02-20 15:44:00 +00:00
---
2019-09-30 05:08:04 +00:00
Merge repo with rfc.vac.dev (#310) * Hugo init * Init Hugo book * Add basic README and title * Import RFC: 1/COSS * Move example content to dedicated folder * Basic menu * Tweak single layout * Fix base url and permalink * Basic index tweaks * Add netifly config * gitignore * 1/COSS: Add COSS lifecycle * Remove public artifact * Add basic numbers in menu * Empty READMEs init * Import mvds spec raw * 2/MVDS: Simplify * 3/REMOTE-LOG: Import * 3/REMOTE-LOG: Simplify * 4/MVDS-META: Import * 4/MVDS-META Simplify * Tweaks * 5/WAKU0: Import * 5: Simplify * 6/WAKU1: Import * 6/WAKU1: Simplify * 7/WAKU-DATA: Import * 7/WAKU-DATA: Simplify * 8/WAKU-MAIL: Import * 8/WAKU-MAIL: Simplify * Tweak * 9/WAKU-RPC: Import * 9/WAKU-RPC: Simplify * 10/WAKU2: Import * 10/WAKU2: Simplify * 11/WAKU-RELAY: Import * Tweaks * 11/WAKU-RELAY: Simplify * 12/WAKU-FILTER: Import * 12/WAKU2-FILTER: Simplify * 13/WAKU-STORE: Import * 13/WAKU-STORE: Simplify * 14/WAKU-MESSAGE: Import * 14/WAKU-MESSAGE: Simplify * 15/WAKU-BRIDGE: Import * 15: Simplify * 16: Import * 16: Simplify * 17: Import * 17: Simplify * 18: Import * 18: Simplify * 12: Bump update * 14: Bump update * 11: Bump update * 17: Bump update * 18: Bump update * 16: Bump update * Fix slug for 18 * Editor changes for 11, 12, 15 * Revert "Editor changes for 11, 12, 15" This reverts commit 5c32fe791bec57ca1d5326e0d2724339f12a784a. * Revert "Revert "Editor changes for 11, 12, 15"" This reverts commit ccd75131d72a1f1c43b701f445fe66ebd6857fc4. * Editor changes for 13, 2, 4 * Move current specs to archive * Update README * bump
2021-04-01 04:03:14 +00:00
A remote log is a replication of a local log. This means a node can read data that originally came from a node that is offline.
2019-09-30 05:08:04 +00:00
This specification is complemented by a proof of concept implementation[^1].
2019-09-30 05:08:04 +00:00
## Definitions
| Term | Definition |
| ----------- | -------------------------------------------------------------------------------------- |
| CAS | Content-addressed storage. Stores data that can be addressed by its hash. |
| NS | Name system. Associates mutable data to a name. |
| Remote log | Replication of a local log at a different location. |
## Wire Protocol
### Secure Transport, storage, and name system
2019-10-02 06:07:31 +00:00
This specification does not define anything related to: secure transport,
2019-09-30 05:08:04 +00:00
content addressed storage, or the name system. It is assumed these capabilities
are abstracted away in such a way that any such protocol can easily be
implemented.
<!-- TODO: Elaborate on properties required here. -->
### Payloads
Payloads are implemented using [protocol buffers v3](https://developers.google.com/protocol-buffers/).
**CAS service**:
```protobuf
2019-10-01 03:34:24 +00:00
syntax = "proto3";
2019-09-30 05:08:04 +00:00
package vac.cas;
service CAS {
rpc Add(Content) returns (Address) {}
rpc Get(Address) returns (Content) {}
}
message Address {
bytes id = 1;
}
message Content {
bytes data = 1;
}
```
<!-- XXX/TODO: Can we get rid of the id/data complication and just use bytes? -->
**NS service**:
```protobuf
2019-10-01 03:34:24 +00:00
syntax = "proto3";
package vac.cas;
2019-09-30 05:08:04 +00:00
service NS {
rpc Update(NameUpdate) returns (Response) {}
rpc Fetch(Query) returns (Content) {}
}
message NameUpdate {
string name = 1;
bytes content = 2;
}
message Query {
string name = 1;
}
message Content {
bytes data = 1;
}
message Response {
bytes data = 1;
}
```
<!-- XXX: Response and data type a bit weird, Ok/Err enum? -->
<!-- TODO: Do we want NameInit here? -->
**Remote log:**
```protobuf
2019-10-01 03:34:24 +00:00
syntax = "proto3";
package vac.cas;
2019-09-30 05:08:04 +00:00
message RemoteLog {
repeated Pair pair = 1;
bytes tail = 2;
message Pair {
bytes remoteHash = 1;
bytes localHash = 2;
bytes data = 3;
}
}
```
<!-- TODO: Better name for Pair, Mapping? -->
2019-10-03 03:12:50 +00:00
<!-- TODO: Consider making more useful in conjunction with metadata field. It makes sense to explicitly list what sequence a message is <local hash, remote hash, data, seqid> this way I can easily sync a messages prior or after a specific number. To enable this to be dynamic it might make sense to add page info so that I am aware which page I can find seqid on -->
2019-09-30 05:08:04 +00:00
## Synchronization
### Roles
There are four fundamental roles:
1. Alice
2. Bob
2. Name system (NS)
3. Content-addressed storage (CAS)
2019-10-02 06:07:31 +00:00
The *remote log* protobuf is what is stored in the name system.
2019-09-30 05:08:04 +00:00
2019-10-01 03:34:24 +00:00
"Bob" can represent anything from 0 to N participants. Unlike Alice, Bob only needs read-only access to NS and CAS.
2019-09-30 05:08:04 +00:00
2019-10-03 03:12:50 +00:00
<!-- TODO: Document random node as remote log -->
<!-- TODO: Document how to find initial remote log (e.g. per sync contexts -->
2019-09-30 05:08:04 +00:00
### Flow
<!-- diagram -->
<p align="center">
2020-02-20 15:22:13 +00:00
<img src="../assets/remotelog/remote-log.png" />
2019-09-30 05:08:04 +00:00
<br />
Figure 1: Remote log data synchronization.
</p>
2019-10-03 03:13:50 +00:00
<!-- Document the flow wrt operations -->
2019-09-30 05:08:04 +00:00
### Remote log
The remote log lets receiving nodes know what data they are missing. Depending
on the specific requirements and capabilities of the nodes and name system, the
information can be referred to differently. We distinguish between three rough
modes:
1. Fully replicated log
2. Normal sized page with CAS mapping
3. "Linked list" mode - minimally sized page with CAS mapping
**Data format:**
```
| H1_3 | H2_3 |
| H1_2 | H2_2 |
| H1_1 | H2_1 |
| ------------|
| next_page |
```
Here the upper section indicates a list of ordered pairs, and the lower section
contains the address for the next page chunk. `H1` is the native hash function,
and `H2` is the one used by the CAS. The numbers corresponds to the messages.
To indicate which CAS is used, a remote log SHOULD use a multiaddr.
**Embedded data:**
A remote log MAY also choose to embed the wire payloads that corresponds to the
native hash. This bypasses the need for a dedicated CAS and additional
round-trips, with a trade-off in bandwidth usage.
```
| H1_3 | | C_3 |
| H1_2 | | C_2 |
| H1_1 | | C_1 |
| -------------|
| next_page |
```
Here `C` stands for the content that would be stored at the CAS.
Both patterns can be used in parallel, e,g. by storing the last `k` messages
directly and use CAS pointers for the rest. Together with the `next_page` page
semantics, this gives users flexibility in terms of bandwidth and
latency/indirection, all the way from a simple linked list to a fully replicated
log. The latter is useful for things like backups on durable storage.
### Next page semantics
The pointer to the 'next page' is another remote log entry, at a previous point
in time.
<!-- TODO: Determine requirement re overlapping, adjacent, and/or missing entries -->
2019-10-03 03:12:50 +00:00
<!-- TODO: Document message ordering append only requirements -->
2019-09-30 05:08:04 +00:00
### Interaction with MVDS
Merge repo with rfc.vac.dev (#310) * Hugo init * Init Hugo book * Add basic README and title * Import RFC: 1/COSS * Move example content to dedicated folder * Basic menu * Tweak single layout * Fix base url and permalink * Basic index tweaks * Add netifly config * gitignore * 1/COSS: Add COSS lifecycle * Remove public artifact * Add basic numbers in menu * Empty READMEs init * Import mvds spec raw * 2/MVDS: Simplify * 3/REMOTE-LOG: Import * 3/REMOTE-LOG: Simplify * 4/MVDS-META: Import * 4/MVDS-META Simplify * Tweaks * 5/WAKU0: Import * 5: Simplify * 6/WAKU1: Import * 6/WAKU1: Simplify * 7/WAKU-DATA: Import * 7/WAKU-DATA: Simplify * 8/WAKU-MAIL: Import * 8/WAKU-MAIL: Simplify * Tweak * 9/WAKU-RPC: Import * 9/WAKU-RPC: Simplify * 10/WAKU2: Import * 10/WAKU2: Simplify * 11/WAKU-RELAY: Import * Tweaks * 11/WAKU-RELAY: Simplify * 12/WAKU-FILTER: Import * 12/WAKU2-FILTER: Simplify * 13/WAKU-STORE: Import * 13/WAKU-STORE: Simplify * 14/WAKU-MESSAGE: Import * 14/WAKU-MESSAGE: Simplify * 15/WAKU-BRIDGE: Import * 15: Simplify * 16: Import * 16: Simplify * 17: Import * 17: Simplify * 18: Import * 18: Simplify * 12: Bump update * 14: Bump update * 11: Bump update * 17: Bump update * 18: Bump update * 16: Bump update * Fix slug for 18 * Editor changes for 11, 12, 15 * Revert "Editor changes for 11, 12, 15" This reverts commit 5c32fe791bec57ca1d5326e0d2724339f12a784a. * Revert "Revert "Editor changes for 11, 12, 15"" This reverts commit ccd75131d72a1f1c43b701f445fe66ebd6857fc4. * Editor changes for 13, 2, 4 * Move current specs to archive * Update README * bump
2021-04-01 04:03:14 +00:00
[vac.mvds.Message](/spec/2#payloads) payloads are the only payloads that MUST be uploaded. Other messages types MAY be uploaded, depending on the implementation.
2019-11-14 04:20:37 +00:00
## Acknowledgments
2019-09-30 05:08:04 +00:00
TBD.
## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
## Footnotes
[^1]: <https://github.com/vacp2p/research/tree/master/remote_log>