Papyrus was the material used to preserve the biblical books. The Bible is made up of several partial and complete pieces of papyrus.
The oldest partial papyri can be used to correct or confirm the information contained in the Cortex (the full text).
In the same way, a .papyrus file contains the known tree of the original file. A PDF book shouldn't have to be entirely rewritten just because a single page changed.
So we would only need the new hash, and the repositioning of the affected pages and their nearest nodes.
The base file uses the .papyrus extension, which contains at its core:
- Fingerprint of the original file
- How many pages all fragments have
- HashTable of the fragments
- Complete-file flag bit
The composite key of the binary key-value store uses the page order.
The fragments are made up of the following elements:
- Fragment's page
- Total pages
- Fingerprint of the original file
- Fingerprint of the fragment
- Fragment's bytes
Once all fragments have been added, the flag bit changes to complete.
Extraction follows the page order and joins everything into a sequence of bytes, so the original file is reassembled.
The assembly of an empty papyrus file contains at least:
- The fingerprint of the original file
- The list of pages + fingerprints of the fragments
When the first fragment is added, it enters the key-value store table.
The fingerprint of the original file needs to work incrementally, so that when a leaf is created, the fingerprint of the bytes and the page's representation are incremented into the original file's fingerprint.
Inserting fragments into the papyrus file is relatively simple. First, we need a hash tree, and some bytes that represent a piece and prove it belongs to the tree.
Fortunately, we already have this solved with a Merkle Tree.
That makes it easy to piece the local files together, by downloading the files via HTTP.
Coming soon...
This is a translation of draft.md, the original document.