Files
kopia/tests/testenv/storage_inmemory.go
Jarek Kowalski 51dcaa985d chore(ci): upgraded linter to 1.48.0 (#2294)
Mechanically fixed all issues, added `lint-fix` make target.
2022-08-09 06:07:54 +00:00

30 lines
821 B
Go

package testenv
import (
"context"
"github.com/alecthomas/kingpin"
"github.com/kopia/kopia/cli"
"github.com/kopia/kopia/internal/repotesting"
"github.com/kopia/kopia/repo/blob"
)
// storageInMemoryFlags is in-memory storage initialization flags for cli
// setup.
type storageInMemoryFlags struct {
options repotesting.ReconnectableStorageOptions
}
func (c *storageInMemoryFlags) Setup(_ cli.StorageProviderServices, cmd *kingpin.CmdClause) {
cmd.Flag("uuid", "UUID of the reconnectable in-memory storage").Required().StringVar(&c.options.UUID)
}
func (c *storageInMemoryFlags) Connect(ctx context.Context, isCreate bool, _ int) (blob.Storage, error) {
//nolint:wrapcheck
return blob.NewStorage(ctx, blob.ConnectionInfo{
Type: repotesting.ReconnectableStorageType,
Config: &c.options,
}, isCreate)
}