mirror of
https://github.com/kopia/kopia.git
synced 2026-05-14 01:37:07 -04:00
repo: upgraded to latest version, removed format block settings from repository create, instead --encryption=NONE disables encryption of both blocks and format
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
func runCacheClearCommand(ctx context.Context, rep *repo.Repository) error {
|
||||
if d := rep.CacheDirectory; d != "" {
|
||||
printStderr("Clearing cache directory: %v.\n", d)
|
||||
err := os.RemoveAll(d)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -23,7 +24,7 @@ func runCacheClearCommand(ctx context.Context, rep *repo.Repository) error {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Noticef("cache cleared")
|
||||
printStderr("Cache cleared.\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,9 @@
|
||||
var (
|
||||
createCommand = repositoryCommands.Command("create", "Create new repository in a specified location.")
|
||||
|
||||
createMetadataEncryptionFormat = createCommand.Flag("metadata-encryption", "Metadata item encryption.").PlaceHolder("FORMAT").Default(repo.DefaultEncryptionAlgorithm).Enum(repo.SupportedEncryptionAlgorithms...)
|
||||
createBlockHashFormat = createCommand.Flag("block-hash", "Block hash algorithm.").PlaceHolder("ALGO").Default(block.DefaultHash).Enum(block.SupportedHashAlgorithms()...)
|
||||
createBlockEncryptionFormat = createCommand.Flag("block-encryption", "Block encryption algorithm.").PlaceHolder("ALGO").Default(block.DefaultEncryption).Enum(block.SupportedEncryptionAlgorithms()...)
|
||||
createObjectSplitter = createCommand.Flag("object-splitter", "The splitter to use for new objects in the repository").Default("DYNAMIC").Enum(object.SupportedSplitters...)
|
||||
createBlockHashFormat = createCommand.Flag("block-hash", "Block hash algorithm.").PlaceHolder("ALGO").Default(block.DefaultHash).Enum(block.SupportedHashAlgorithms()...)
|
||||
createBlockEncryptionFormat = createCommand.Flag("encryption", "Block encryption algorithm.").PlaceHolder("ALGO").Default(block.DefaultEncryption).Enum(block.SupportedEncryptionAlgorithms()...)
|
||||
createObjectSplitter = createCommand.Flag("object-splitter", "The splitter to use for new objects in the repository").Default("DYNAMIC").Enum(object.SupportedSplitters...)
|
||||
|
||||
createMinBlockSize = createCommand.Flag("min-block-size", "Minimum size of a data block.").PlaceHolder("KB").Default("1024").Int()
|
||||
createAvgBlockSize = createCommand.Flag("avg-block-size", "Average size of a data block.").PlaceHolder("KB").Default("10240").Int()
|
||||
@@ -49,7 +48,6 @@ func init() {
|
||||
|
||||
func newRepositoryOptionsFromFlags() *repo.NewRepositoryOptions {
|
||||
return &repo.NewRepositoryOptions{
|
||||
FormatEncryptionAlgorithm: *createMetadataEncryptionFormat,
|
||||
BlockFormat: block.FormattingOptions{
|
||||
Hash: *createBlockHashFormat,
|
||||
Encryption: *createBlockEncryptionFormat,
|
||||
@@ -89,9 +87,8 @@ func runCreateCommandWithStorage(ctx context.Context, st storage.Storage) error
|
||||
password := mustGetPasswordFromFlags(true, false)
|
||||
|
||||
printStderr("Initializing repository with:\n")
|
||||
printStderr(" metadata encryption: %v\n", options.FormatEncryptionAlgorithm)
|
||||
printStderr(" block hash: %v\n", options.BlockFormat.Hash)
|
||||
printStderr(" block encryption: %v\n", options.BlockFormat.Encryption)
|
||||
printStderr(" encryption: %v\n", options.BlockFormat.Encryption)
|
||||
switch options.ObjectFormat.Splitter {
|
||||
case "DYNAMIC":
|
||||
printStderr(" object splitter: DYNAMIC with block sizes (min:%v avg:%v max:%v)\n",
|
||||
|
||||
2
go.mod
2
go.mod
@@ -9,7 +9,7 @@ require (
|
||||
github.com/danieljoos/wincred v1.0.1 // indirect
|
||||
github.com/godbus/dbus v4.1.0+incompatible // indirect
|
||||
github.com/jpillora/go-ogle-analytics v0.0.0-20161213085824-14b04e0594ef
|
||||
github.com/kopia/repo v0.2.3
|
||||
github.com/kopia/repo v0.2.4
|
||||
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348
|
||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
||||
github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c
|
||||
|
||||
2
go.sum
2
go.sum
@@ -61,6 +61,8 @@ github.com/kopia/repo v0.2.2 h1:jGOYALGhhcVSLLg/tZ4JDVl2fajbJ/+AaszlIYy339g=
|
||||
github.com/kopia/repo v0.2.2/go.mod h1:f0B1sGjCEGiMlxoq92V46LlQMM4dy1nxDbOkHjIz0J0=
|
||||
github.com/kopia/repo v0.2.3 h1:iFP5oGkYOU9MowWJlsl/bFE2jiLbNB3h4yaGts3rA1k=
|
||||
github.com/kopia/repo v0.2.3/go.mod h1:zgmEpcVhJ5hCytonqyQ5EajaS8Zx6MSPOQfJxBFjQ4s=
|
||||
github.com/kopia/repo v0.2.4 h1:skjrO14YLxGtKRtlBEQ2pBxwHi2KY1ZP1RqLX80AlCc=
|
||||
github.com/kopia/repo v0.2.4/go.mod h1:zgmEpcVhJ5hCytonqyQ5EajaS8Zx6MSPOQfJxBFjQ4s=
|
||||
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4=
|
||||
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
|
||||
@@ -50,7 +50,6 @@ func (e *Environment) Setup(t *testing.T, opts ...func(*repo.NewRepositoryOption
|
||||
Splitter: "FIXED",
|
||||
MaxBlockSize: 400,
|
||||
},
|
||||
FormatEncryptionAlgorithm: "NONE",
|
||||
}
|
||||
|
||||
for _, mod := range opts {
|
||||
|
||||
@@ -244,7 +244,7 @@ func (e *testenv) run(t *testing.T, args ...string) ([]string, error) {
|
||||
cmdArgs := append(append([]string(nil), e.fixedArgs...), args...)
|
||||
c := exec.Command(e.exe, cmdArgs...)
|
||||
c.Env = append(os.Environ(), e.environment...)
|
||||
o, err := c.CombinedOutput()
|
||||
o, err := c.Output()
|
||||
t.Logf("finished 'kopia %v' with err=%v and output:\n%v", strings.Join(args, " "), err, trimOutput(string(o)))
|
||||
return splitLines(string(o)), err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user