-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Describe the zstdelta algorithm. It might be interesting to other source control folks. Reviewed By: muirdm Differential Revision: D41275018 fbshipit-source-id: 8e44c3e23716c9130eaaedf751575d37f81e7696
- Loading branch information
1 parent
dd98b87
commit d98a0a9
Showing
2 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# ZstDelta | ||
|
||
ZstDelta uses [zstd](https://www.zstd.net) dictionary compression to calculate | ||
a compressed delta between two inputs. | ||
|
||
## ZstDelta | ||
|
||
The `zstdelta` Rust library provides `diff` and `apply` to calculate such | ||
compressed deltas and restore content from deltas. You can get `delta` from | ||
`diff(a, b)`, then restore the content of `b` using `apply(a, delta)`. | ||
|
||
In Python, `bindings.zstd` provides access to the `diff` and `apply` functions: | ||
|
||
```with-output | ||
>>> import bindings, hashlib | ||
>>> a = b"".join(hashlib.sha256(str(i).encode()).digest() for i in range(1000)) | ||
>>> len(a) | ||
>>> b = a[:10000] + b'x' * 10000 + a[11000:] | ||
>>> diff = bindings.zstd.diff(a, b) | ||
>>> len(diff) | ||
>>> bindings.zstd.apply(a, diff) == b | ||
``` | ||
|
||
## ZStore | ||
|
||
The `zstore` Rust library provides an on-disk content store with internal | ||
delta-chain management. It uses the above `zstdelta` library for delta | ||
calculation and IndexedLog for on-disk storage. It is used by MetaLog. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters