aboutsummaryrefslogtreecommitdiff
path: root/dna
diff options
context:
space:
mode:
Diffstat (limited to 'dna')
-rw-r--r--dna/drive.go36
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)