Rename snapshots.Manager => exporter.Exporter

This commit is contained in:
Tom Wiesing 2022-10-17 15:41:33 +02:00
parent 063f3f9b7d
commit 8d2855fdcb
No known key found for this signature in database
23 changed files with 105 additions and 100 deletions

View file

@ -0,0 +1,33 @@
package exporter
import (
"path/filepath"
)
type WithManifest struct {
Manifest []string
}
func (wm *WithManifest) handleManifest(dest string) (chan<- string, func()) {
manifest := make(chan string)
done := make(chan struct{})
go func() {
defer close(done)
for file := range manifest {
// get the relative path to the root of the manifest.
// nothing *should* go wrong, but in case it does, use the original path.
path, err := filepath.Rel(dest, file)
if err != nil {
path = file
}
// add the manifest
wm.Manifest = append(wm.Manifest, path)
}
}()
return manifest, func() {
close(manifest)
<-done
}
}