repository: Implement index/snapshot/lock compression

The config file is not compressed as it should remain readable by older
restic versions such that these can return a proper error.

As the old format for unpacked data does not include a version header,
make use of a trick: The old data is always encoded as JSON. Thus it can
only start with '{' or '['. For any other value the first byte indicates
a versioned format. The version is set to 2 for now. Then the zstd
compressed data follows.
This commit is contained in:
Michael Eischer
2022-04-30 10:07:42 +02:00
committed by Alexander Neumann
parent 0957b74887
commit 4b957e7373
2 changed files with 59 additions and 1 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ require (
github.com/hashicorp/golang-lru v0.5.4
github.com/json-iterator/go v1.1.12 // indirect
github.com/juju/ratelimit v1.0.1
github.com/klauspost/compress v1.15.1 // indirect
github.com/klauspost/compress v1.15.1
github.com/klauspost/cpuid/v2 v2.0.12 // indirect
github.com/kurin/blazer v0.5.4-0.20211030221322-ba894c124ac6
github.com/minio/md5-simd v1.1.2 // indirect