diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-10-18 16:16:54 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-10-18 16:16:54 +0200 |
commit | bd1681cfe3554075b1b0827563b76c6b95bf8b94 (patch) | |
tree | a05e737e3aee525d644da0be5ad5e7d0c0e9ebba /repo | |
parent | 56d1f553f32c242f7cc5043b9ce2b719e2285838 (diff) | |
download | dna-backup-bd1681cfe3554075b1b0827563b76c6b95bf8b94.tar.gz dna-backup-bd1681cfe3554075b1b0827563b76c6b95bf8b94.zip |
make the repo responsible of the export compression
Diffstat (limited to 'repo')
-rw-r--r-- | repo/export.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/repo/export.go b/repo/export.go index bcadd06..7597ce4 100644 --- a/repo/export.go +++ b/repo/export.go @@ -22,6 +22,7 @@ import ( "github.com/n-peugnet/dna-backup/export" "github.com/n-peugnet/dna-backup/logger" + "github.com/n-peugnet/dna-backup/utils" ) func (r *Repo) Export(exporter export.Exporter) { @@ -32,22 +33,24 @@ func (r *Repo) Export(exporter export.Exporter) { end := make(chan bool) input := exporter.ExportVersion(end) if len(chunks[i]) > 0 { + compressed := r.chunkWriteWrapper(input.Chunks) for _, c := range chunks[i] { - _, err := io.Copy(input.Chunks, c.Reader()) + _, err := io.Copy(compressed, c.Reader()) if err != nil { logger.Error(err) } } - input.Chunks.Close() + compressed.Close() } - readDelta(r.versions[i], recipeName, r.chunkReadWrapper, func(rc io.ReadCloser) { + input.Chunks.Close() + readDelta(r.versions[i], recipeName, utils.NopReadWrapper, func(rc io.ReadCloser) { _, err = io.Copy(input.Recipe, rc) if err != nil { logger.Error("load recipe ", err) } input.Recipe.Close() }) - readDelta(r.versions[i], filesName, r.chunkReadWrapper, func(rc io.ReadCloser) { + readDelta(r.versions[i], filesName, utils.NopReadWrapper, func(rc io.ReadCloser) { _, err = io.Copy(input.Files, rc) if err != nil { logger.Error("load files ", err) |