This commit is contained in:
parent
0ea302d688
commit
37d884e665
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
@ -123,18 +124,6 @@ func (s *SnapshotProcessor) metadataForSnapshotKey(snapshotKey string) (Snapshot
|
||||
// Returns key under which is the snapshot stored and/or error if there is any.
|
||||
// Metadata about the snapshot are stored in extra object under metadata/ prefix.
|
||||
func (s *SnapshotProcessor) CreateSnapshot(appName string, labels []string) (string, error) {
|
||||
// Create an archive
|
||||
archive := archiver.TarZstd{
|
||||
Tar: &archiver.Tar{
|
||||
MkdirAll: true,
|
||||
ContinueOnError: true,
|
||||
OverwriteExisting: false,
|
||||
ImplicitTopLevelFolder: false,
|
||||
},
|
||||
// CompressionLevel: 6,
|
||||
// SelectiveCompression: true,
|
||||
}
|
||||
|
||||
snapshot := Snapshot{
|
||||
UUID: uuid.NewV4().String(),
|
||||
AppName: appName,
|
||||
@ -149,7 +138,7 @@ func (s *SnapshotProcessor) CreateSnapshot(appName string, labels []string) (str
|
||||
return snapshot.KeyName(s.IndexLabel), fmt.Errorf("change working directory error: %v", err)
|
||||
}
|
||||
|
||||
err = archive.Archive([]string{"./"}, tmpSnapshotArchivePath)
|
||||
err = exec.Command("/usr/bin/tar", "-acvf", tmpSnapshotArchivePath, "./").Run()
|
||||
if err != nil {
|
||||
return snapshot.KeyName(s.IndexLabel), fmt.Errorf("compression error: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user