diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-10-18 16:00:08 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-10-18 16:00:08 +0200 |
commit | 04563efa9c0dc1f6a36094dfd884ae432cf46b29 (patch) | |
tree | be5a78647bec2a6d5812fb8b61b4ac4fcd3744b7 /dna | |
parent | 5539220a8839519becd45b63be65ed86fa9286a4 (diff) | |
download | dna-backup-04563efa9c0dc1f6a36094dfd884ae432cf46b29.tar.gz dna-backup-04563efa9c0dc1f6a36094dfd884ae432cf46b29.zip |
add intermediate export package no to make repo dependant on dna
Diffstat (limited to 'dna')
-rw-r--r-- | dna/drive.go | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/dna/drive.go b/dna/drive.go index 013c4b4..0f62d5e 100644 --- a/dna/drive.go +++ b/dna/drive.go @@ -25,6 +25,7 @@ import ( "os" "path/filepath" + "github.com/n-peugnet/dna-backup/export" "github.com/n-peugnet/dna-backup/logger" "github.com/n-peugnet/dna-backup/utils" ) @@ -56,23 +57,6 @@ type Header struct { Files uint64 } -type dnaVersion struct { - Input dnaInput - Output dnaOutput -} - -type dnaInput struct { - Chunks io.WriteCloser - Recipe io.WriteCloser - Files io.WriteCloser -} - -type dnaOutput struct { - Chunks io.ReadCloser - Recipe io.ReadCloser - Files io.ReadCloser -} - func New( destination string, poolCount int, @@ -105,20 +89,28 @@ func New( } } -func (d *DnaDrive) VersionInput() (dnaInput, <-chan bool) { +func (d *DnaDrive) ExportVersion() (export.Input, <-chan bool) { rChunks, wChunks := io.Pipe() rRecipe, wRecipe := io.Pipe() rFiles, wFiles := io.Pipe() - version := dnaVersion{ - Input: dnaInput{wChunks, wRecipe, wFiles}, - Output: dnaOutput{rChunks, rRecipe, rFiles}, + version := export.Version{ + Input: export.Input{ + Chunks: wChunks, + Recipe: wRecipe, + Files: wFiles, + }, + Output: export.Output{ + Chunks: rChunks, + Recipe: rRecipe, + Files: rFiles, + }, } end := make(chan bool) go d.writeVersion(version.Output, end) return version.Input, end } -func (d *DnaDrive) writeVersion(output dnaOutput, end chan<- bool) { +func (d *DnaDrive) writeVersion(output export.Output, end chan<- bool) { var err error var recipe, files, version bytes.Buffer n := d.write(output.Chunks, d.pools[1:], Forward) |