Compare commits

...
Author SHA1 Message Date
Dmitry Afanasiev f19a10dce2 fix attr argument parsing - support quoted keys and values (#3294) 2020-07-16 19:23:35 -07:00
Harshavardhana ea8c0db96e update minio-go/v7 APIs again (#3305) 2020-07-16 18:03:17 -07:00
Harshavardhana 0b0acc611f Revert "cli: Load global flags in initBeforeRunningCmd (#3283)" (#3302)
This reverts commit 712ff33319.
2020-07-16 11:10:35 -07:00
ebozduman 7b5d5ea990 Fixes --attr regression (#3303) 2020-07-16 08:59:38 -07:00
Anis Elleuch 56c2c1a5c5 Fix object copying after upgrading to v7 (#3298) 2020-07-15 16:53:38 -07:00
Harshavardhana f3c9e9172a honor preserve flag during Copy operation (#3299)
continuation of #3285 which wasn't complete
2020-07-15 16:39:04 -07:00
Harshavardhana 9193388568 fix go mod tidy 2020-07-14 15:50:12 -07:00
Anis Elleuch a419bb4130 Use minio-go v7 and madmin master (#3295) 2020-07-14 11:15:19 -07:00
Harshavardhana 469665f886 update the correct cross platform qemu 2020-07-10 23:02:15 -07:00
Harshavardhana 5d98d19608 for release use the dl.min.io for containers 2020-07-10 22:40:06 -07:00
kannappanr 9d762f5aa6 Fix typos in the examples (#3289) 2020-07-07 21:08:33 -07:00
P R 51a3d287bb mc ilm list cell alignment for text (#3291) 2020-07-07 20:52:01 -07:00
Harshavardhana fbb7d75c1c support proper proxy for all transports (#3290)
fixes #3225
2020-07-07 17:07:49 -07:00
Harshavardhana 53dc65c92a move to latest released minio to fix policy (#3288)
fixes #3265
2020-07-07 12:19:48 -07:00
ebozduman d811d416a5 Fixes copy with partial metadata failure (#3282) 2020-07-06 17:22:06 -07:00
Harshavardhana ba37e08f1f support goreleaser for mc (#3286) 2020-07-05 18:37:43 -07:00
ebozduman 5c713e5ecb Adds support to preserve X-Amz-Meta-Mc-Attrs when os -> fs (#3285) 2020-07-03 15:31:27 -07:00
Anis Elleuch 712ff33319 cli: Load global flags in initBeforeRunningCmd (#3283)
app.Before receives a cli.Context but without flags parsed. There is no
point calling ctx.Bool() or ctx.IsSet() at that stage.

However, flags are parsed in commands, so minio initialization and
setting global variables (globalJSON, globalQuiet, etc..) can be moved
to the Before function of all commands.

Avoid setting command.Before for non leaf commands, otherwise Before
function will be called multiples times until it reaches the leaf
command.
2020-07-01 17:28:43 -07:00
Anis Elleuch 90d6e7df24 policy: Recalculate permission mode after setting a new one (#3280)
`mc policy set` can confuse users by showing that a bucket has 'none'
policy mode although issuing `mc policy get` will show it is `custom`
when the bucket already other policy statements for some sub-resources.

For better UX, mc will issue another request to get the real policy
mode.
2020-07-01 09:22:22 -07:00
poornas b8570a9a0b Fix mc cp regression for recursive copy (#3278)
Fixes #3267. Revert commit dc430afe07
which attempted to preserve similar behavior across mc cp and mc
mirror, but introduces a regression for cp when wildcards are
specified.
2020-06-29 20:33:31 -07:00
Anis Elleuch 360d094828 s3: Use list object v1 in case of GCS (#3274) 2020-06-24 05:22:29 -07:00
Harshavardhana 08685bae6a make sure active/active enables watch by default (#3271)
- effectively use context everywhere
- effectively look for source-mtime in all
  variations
- `mc diff` should do metadata diff as well
2020-06-23 16:56:08 -07:00
Harshavardhana 4989d51e2c fix: overwrite is implicit with active-active (#3268)
refactor lengthy options as mirrorOptions{} for
ease of readability and usage.
2020-06-22 23:41:24 -07:00
Harshavardhana a62a539399 fix: support STS for admin commands (#3264) 2020-06-19 12:37:57 -07:00
ebozduman d5b6931a1e Apply global context for all apis (#3240) 2020-06-16 16:55:31 -07:00
poornas 397f41c71c Fix mc cp when legal-hold or retention is set (#3257)
- Send Content-MD5 header if default retention is set on the bucket
- legal-hold needs to be case insensitive
2020-06-16 12:13:35 -07:00
Harshavardhana 707f46c32b rename multi-master to active-active (#3255) 2020-06-15 18:16:31 -07:00
81 changed files with 2042 additions and 1597 deletions
+167
View File
@@ -0,0 +1,167 @@
project_name: mc
release:
name_template: "Version {{.Version}}"
disable: true
github:
owner: minio
name: mc
env:
- CGO_ENABLED=0
- GO111MODULE=on
before:
hooks:
- make clean
- go generate ./...
- go mod tidy
- go mod download
builds:
-
goos:
- linux
- darwin
- windows
- freebsd
goarch:
- amd64
- arm64
- arm
- ppc64le
- s390x
goarm:
- 7
ignore:
- goos: darwin
goarch: arm64
- goos: darwin
goarch: arm
- goos: darwin
goarch: ppc64le
- goos: darwin
goarch: s390x
- goos: windows
goarch: arm64
- goos: windows
goarch: arm
- goos: windows
goarch: ppc64le
- goos: windows
goarch: s390x
- goos: freebsd
goarch: arm
- goos: freebsd
goarch: arm64
- goos: freebsd
goarch: ppc64le
- goos: freebsd
goarch: s390x
flags:
- -tags=kqueue
- -trimpath
ldflags:
- "-s -w -X github.com/minio/mc/cmd.Version={{.Version}} -X github.com/minio/mc/cmd.ReleaseTag={{.Tag}} -X github.com/minio/mc/cmd.CommitID={{.FullCommit}} -X github.com/minio/mc/cmd.ShortCommitID={{.ShortCommit}}"
archives:
-
format: binary
name_template: "{{ .Binary }}-release/{{ .Os }}-{{ .Arch }}/{{ .Binary }}.{{ .Version }}"
nfpms:
-
id: minio
package_name: mc
vendor: MinIO, Inc.
homepage: https://min.io/
maintainer: dev@min.io
description: MinIO Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff, find etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
license: Apache 2.0
bindir: /usr/bin
formats:
- deb
- rpm
overrides:
deb:
file_name_template: "{{ .Binary }}-release/debs/{{ .ProjectName }}-{{ .Version }}_{{ .Arch }}"
replacements:
arm: armv7
files:
"NOTICE": "/usr/share/mc/NOTICE"
"CREDITS": "/usr/share/mc/CREDITS"
"LICENSE": "/usr/share/mc/LICENSE"
"README.md": "/usr/share/mc/README.md"
rpm:
file_name_template: "{{ .Binary }}-release/rpms/{{ .ProjectName }}-{{ .Version }}.{{ .Arch }}"
replacements:
amd64: x86_64
arm64: aarch64
arm: armv7
files:
"NOTICE": "/usr/share/mc/NOTICE"
"CREDITS": "/usr/share/mc/CREDITS"
"LICENSE": "/usr/share/mc/LICENSE"
"README.md": "/usr/share/mc/README.md"
checksum:
algorithm: sha256
signs:
-
signature: "${artifact}.asc"
cmd: "sh"
args:
- '-c'
- 'gpg --quiet --detach-sign -a ${artifact}'
artifacts: all
changelog:
sort: asc
filters:
exclude:
- '^Update yaml files'
dockers:
-
goos: linux
goarch: amd64
dockerfile: Dockerfile.release
image_templates:
- minio/mc:{{ .Tag }}
- minio/mc:latest
-
goos: linux
goarch: ppc64le
dockerfile: Dockerfile.ppc64le.release
image_templates:
- minio/mc:{{ .Tag }}-ppc64le
-
goos: linux
goarch: s390x
dockerfile: Dockerfile.s390x.release
image_templates:
- minio/mc:{{ .Tag }}-s390x
-
goos: linux
goarch: arm64
goarm: ''
dockerfile: Dockerfile.arm64.release
image_templates:
- minio/mc:{{ .Tag }}-arm64
-
goos: linux
goarch: arm
goarm: '7'
dockerfile: Dockerfile.arm.release
image_templates:
- minio/mc:{{ .Tag }}-arm
+5 -5
View File
@@ -1,4 +1,4 @@
FROM golang:1.13-alpine
FROM golang:1.13-alpine as build
LABEL maintainer="MinIO Inc <dev@min.io>"
@@ -11,12 +11,12 @@ RUN \
git clone https://github.com/minio/mc && cd mc && \
go install -v -ldflags "$(go run buildscripts/gen-ldflags.go)"
FROM alpine:3.10
FROM alpine:3.12
COPY --from=0 /go/bin/mc /usr/bin/mc
COPY --from=build /go/bin/mc /usr/bin/mc
RUN \
apk add --no-cache ca-certificates && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
apk add --no-cache ca-certificates 'curl>7.61.0' && \
curl -s -q -O https://raw.githubusercontent.com/minio/minio/master/CREDITS
ENTRYPOINT ["mc"]
+13
View File
@@ -0,0 +1,13 @@
FROM multiarch/qemu-user-static:x86_64-arm as qemu
FROM arm32v7/alpine:3.12
LABEL maintainer="MinIO Inc <dev@min.io>"
COPY --from=qemu /usr/bin/qemu-arm-static /usr/bin
RUN apk add --no-cache ca-certificates 'curl>7.61.0' && \
curl -s -q https://dl.minio.io/client/mc/release/linux-arm/mc -o /usr/bin/mc && \
chmod +x /usr/bin/mc && \
curl -s -q -O https://raw.githubusercontent.com/minio/minio/release/CREDITS
ENTRYPOINT ["mc"]
+13
View File
@@ -0,0 +1,13 @@
FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu
FROM arm64v8/alpine:3.12
LABEL maintainer="MinIO Inc <dev@min.io>"
COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin
RUN apk add --no-cache ca-certificates 'curl>7.61.0' && \
curl -s -q https://dl.minio.io/client/mc/release/linux-arm64/mc -o /usr/bin/mc && \
chmod +x /usr/bin/mc && \
curl -s -q -O https://raw.githubusercontent.com/minio/minio/release/CREDITS
ENTRYPOINT ["mc"]
+3 -5
View File
@@ -1,10 +1,8 @@
FROM alpine:3.10
FROM alpine:3.12
COPY mc /usr/bin/
COPY CREDITS /
RUN \
apk add --no-cache ca-certificates && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf \
chmod +x /usr/bin/mc
RUN apk add --no-cache ca-certificates
ENTRYPOINT ["mc"]
+13
View File
@@ -0,0 +1,13 @@
FROM multiarch/qemu-user-static:x86_64-ppc64le as qemu
FROM ppc64le/alpine:3.12
LABEL maintainer="MinIO Inc <dev@min.io>"
COPY --from=qemu /usr/bin/qemu-ppc64le-static /usr/bin
RUN apk add --no-cache ca-certificates 'curl>7.61.0' && \
curl -s -q https://dl.minio.io/client/mc/release/linux-ppc64le/mc -o /usr/bin/mc && \
chmod +x /usr/bin/mc && \
curl -s -q -O https://raw.githubusercontent.com/minio/minio/release/CREDITS
ENTRYPOINT ["mc"]
+5 -6
View File
@@ -1,11 +1,10 @@
FROM alpine:3.10
FROM alpine:3.12
MAINTAINER MinIO Inc <dev@min.io>
RUN \
apk add --no-cache ca-certificates && \
apk add --no-cache --virtual .build-deps curl && \
curl https://dl.min.io/client/mc/release/linux-amd64/mc > /usr/bin/mc && \
chmod +x /usr/bin/mc && apk del .build-deps
RUN apk add --no-cache ca-certificates 'curl>7.61.0' && \
curl -s -q https://dl.minio.io/client/mc/release/linux-amd64/mc -o /usr/bin/mc && \
chmod +x /usr/bin/mc && \
curl -s -q -O https://raw.githubusercontent.com/minio/minio/release/CREDITS
ENTRYPOINT ["mc"]
+13
View File
@@ -0,0 +1,13 @@
FROM multiarch/qemu-user-static:x86_64-s390x as qemu
FROM s390x/alpine:3.12
LABEL maintainer="MinIO Inc <dev@min.io>"
COPY --from=qemu /usr/bin/qemu-s390x-static /usr/bin
RUN apk add --no-cache ca-certificates 'curl>7.61.0' && \
curl -s -q https://dl.minio.io/client/mc/release/linux-s390x/mc -o /usr/bin/mc && \
chmod +x /usr/bin/mc && \
curl -s -q -O https://raw.githubusercontent.com/minio/minio/release/CREDITS
ENTRYPOINT ["mc"]
+1 -1
View File
@@ -1,4 +1,4 @@
MinIO Client (C) 2014, 2015 MinIO, Inc.
MinIO Client (C) 2014-2020 MinIO, Inc.
This product includes software developed at MinIO, Inc.
(https://min.io/).
+1 -1
View File
@@ -8,7 +8,7 @@ function _init() {
export CGO_ENABLED=0
## List of architectures and OS to test coss compilation.
SUPPORTED_OSARCH="linux/ppc64le linux/arm64 linux/s390x darwin/amd64 freebsd/amd64 linux/arm linux/386"
SUPPORTED_OSARCH="linux/ppc64le linux/arm64 linux/s390x darwin/amd64 freebsd/amd64 linux/arm linux/386 windows/amd64"
}
function _build() {
+1 -1
View File
@@ -221,7 +221,7 @@ func mainAdminHeal(ctx *cli.Context) error {
fatalIf(err.Trace(clnt.GetURL().String()), "Unable to create client for URL ", aliasedURL)
return nil
}
for content := range clnt.List(false, false, false, DirNone) {
for content := range clnt.List(globalContext, false, false, false, DirNone) {
if content.Err != nil {
fatalIf(content.Err.Trace(clnt.GetURL().String()), "Unable to heal bucket `"+bucket+"`.")
return nil
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v6/pkg/set"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/pkg/console"
"github.com/minio/minio/pkg/madmin"
)
+2 -6
View File
@@ -75,15 +75,13 @@ func (u lockMessage) String() string {
timeFieldMaxLen := 20
resourceFieldMaxLen := -1
typeFieldMaxLen := 6
ownerFieldMaxLen := 20
lockState, timeDiff := getTimeDiff(u.Lock.Timestamp)
return console.Colorize(lockState, newPrettyTable(" ",
Field{"Time", timeFieldMaxLen},
Field{"Type", typeFieldMaxLen},
Field{"Owner", ownerFieldMaxLen},
Field{"Resource", resourceFieldMaxLen},
).buildRow(timeDiff, u.Lock.Type, u.Lock.Owner, u.Lock.Resource))
).buildRow(timeDiff, u.Lock.Type, u.Lock.Resource))
}
// JSON jsonified top oldest locks message.
@@ -130,13 +128,11 @@ func printHeaders() {
timeFieldMaxLen := 20
resourceFieldMaxLen := -1
typeFieldMaxLen := 6
ownerFieldMaxLen := 20
console.Println(console.Colorize("Headers", newPrettyTable(" ",
Field{"Time", timeFieldMaxLen},
Field{"Type", typeFieldMaxLen},
Field{"Owner", ownerFieldMaxLen},
Field{"Resource", resourceFieldMaxLen},
).buildRow("Time", "Type", "Owner", "Resource")))
).buildRow("Time", "Type", "Resource")))
}
// Prints oldest locks.
+1 -1
View File
@@ -96,7 +96,7 @@ func completeS3Path(s3Path string) (prediction []string) {
// List dirPath content and only pick elements that corresponds
// to the path that we want to complete
for content := range clnt.List(false, false, false, DirFirst) {
for content := range clnt.List(globalContext, false, false, false, DirFirst) {
cmplS3Path := alias + getKey(content)
if content.Type.IsDir() {
if !strings.HasSuffix(cmplS3Path, "/") {
+15 -11
View File
@@ -18,6 +18,7 @@ package cmd
import (
"bytes"
"context"
"errors"
"fmt"
"io"
@@ -139,7 +140,7 @@ func checkCatSyntax(ctx *cli.Context) {
}
// catURL displays contents of a URL to stdout.
func catURL(sourceURL string, encKeyDB map[string][]prefixSSEPair) *probe.Error {
func catURL(ctx context.Context, sourceURL string, encKeyDB map[string][]prefixSSEPair) *probe.Error {
var reader io.ReadCloser
size := int64(-1)
switch sourceURL {
@@ -152,11 +153,11 @@ func catURL(sourceURL string, encKeyDB map[string][]prefixSSEPair) *probe.Error
// downloaded object is equal to the original one. FS files
// are ignored since some of them have zero size though they
// have contents like files under /proc.
client, content, err := url2Stat(sourceURL, false, encKeyDB)
client, content, err := url2Stat(ctx, sourceURL, false, encKeyDB)
if err == nil && client.GetURL().Type == objectStorage {
size = content.Size
}
if reader, err = getSourceStreamFromURL(sourceURL, encKeyDB); err != nil {
if reader, err = getSourceStreamFromURL(ctx, sourceURL, encKeyDB); err != nil {
return err.Trace(sourceURL)
}
defer reader.Close()
@@ -210,17 +211,20 @@ func catOut(r io.Reader, size int64) *probe.Error {
}
// mainCat is the main entry point for cat command.
func mainCat(ctx *cli.Context) error {
func mainCat(cliCtx *cli.Context) error {
ctx, cancelCat := context.WithCancel(globalContext)
defer cancelCat()
// Parse encryption keys per command.
encKeyDB, err := getEncKeys(ctx)
encKeyDB, err := getEncKeys(cliCtx)
fatalIf(err, "Unable to parse encryption keys.")
// check 'cat' cli arguments.
checkCatSyntax(ctx)
checkCatSyntax(cliCtx)
// Set command flags from context.
stdinMode := false
if !ctx.Args().Present() {
if !cliCtx.Args().Present() {
stdinMode = true
}
@@ -231,11 +235,11 @@ func mainCat(ctx *cli.Context) error {
}
// if Args contain `-`, we need to preserve its order specially.
args := []string(ctx.Args())
if ctx.Args().First() == "-" {
args := []string(cliCtx.Args())
if cliCtx.Args().First() == "-" {
for i, arg := range os.Args {
if arg == "cat" {
// Overwrite ctx.Args with os.Args.
// Overwrite cliCtx.Args with os.Args.
args = os.Args[i+1:]
break
}
@@ -244,7 +248,7 @@ func mainCat(ctx *cli.Context) error {
// Convert arguments to URLs: expand alias, fix format.
for _, url := range args {
fatalIf(catURL(url, encKeyDB).Trace(url), "Unable to read from `"+url+"`.")
fatalIf(catURL(ctx, url, encKeyDB).Trace(url), "Unable to read from `"+url+"`.")
}
return nil
+11 -3
View File
@@ -1,5 +1,5 @@
/*
* MinIO Client (C) 2017 MinIO, Inc.
* MinIO Client (C) 2017-2020 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,8 +26,10 @@ import (
"sync"
"time"
"github.com/mattn/go-ieproxy"
"github.com/minio/mc/pkg/httptracer"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/minio/pkg/madmin"
)
@@ -63,9 +65,15 @@ func NewAdminFactory() func(config *Config) (*madmin.AdminClient, *probe.Error)
var api *madmin.AdminClient
var found bool
if api, found = clientCache[confSum]; !found {
// Admin API only supports signature v4.
creds := credentials.NewStaticV4(config.AccessKey, config.SecretKey, config.SessionToken)
// Not found. Instantiate a new MinIO
var e error
api, e = madmin.New(hostName, config.AccessKey, config.SecretKey, useTLS)
api, e = madmin.NewWithOptions(hostName, &madmin.Options{
Creds: creds,
Secure: useTLS,
})
if e != nil {
return nil, probe.NewError(e)
}
@@ -83,7 +91,7 @@ func NewAdminFactory() func(config *Config) (*madmin.AdminClient, *probe.Error)
}
var transport http.RoundTripper = &http.Transport{
Proxy: http.ProxyFromEnvironment,
Proxy: ieproxy.GetProxyFunc(),
DialContext: (&net.Dialer{
Timeout: 10 * time.Second,
KeepAlive: 15 * time.Second,
+99 -72
View File
@@ -33,14 +33,13 @@ import (
"github.com/pkg/xattr"
"github.com/rjeczalik/notify"
"github.com/minio/mc/cmd/ilm"
"github.com/minio/mc/pkg/disk"
"github.com/minio/mc/pkg/hookreader"
"github.com/minio/mc/pkg/ioutils"
"github.com/minio/mc/pkg/probe"
minio "github.com/minio/minio-go/v6"
"github.com/minio/minio-go/v6/pkg/encrypt"
"github.com/minio/minio-go/v6/pkg/tags"
minio "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/encrypt"
"github.com/minio/minio-go/v7/pkg/lifecycle"
)
// filesystem client
@@ -51,7 +50,7 @@ type fsClient struct {
const (
partSuffix = ".part.minio"
slashSeperator = "/"
metaDataKey = "X-Amz-Meta-Mc-Attrs"
metadataKey = "X-Amz-Meta-Mc-Attrs"
)
var ( // GOOS specific ignore list.
@@ -119,7 +118,7 @@ func (f *fsClient) GetURL() ClientURL {
}
// Select replies a stream of query results.
func (f *fsClient) Select(expression string, sse encrypt.ServerSide, opts SelectObjectOpts) (io.ReadCloser, *probe.Error) {
func (f *fsClient) Select(ctx context.Context, expression string, sse encrypt.ServerSide, opts SelectObjectOpts) (io.ReadCloser, *probe.Error) {
return nil, probe.NewError(APINotImplemented{
API: "Select",
APIType: "filesystem",
@@ -127,7 +126,7 @@ func (f *fsClient) Select(expression string, sse encrypt.ServerSide, opts Select
}
// Watches for all fs events on an input path.
func (f *fsClient) Watch(options WatchOptions) (*WatchObject, *probe.Error) {
func (f *fsClient) Watch(ctx context.Context, options WatchOptions) (*WatchObject, *probe.Error) {
eventChan := make(chan []EventInfo)
errorChan := make(chan *probe.Error)
doneChan := make(chan struct{})
@@ -223,29 +222,51 @@ func (f *fsClient) Watch(options WatchOptions) (*WatchObject, *probe.Error) {
}
func preserveAttributes(fd *os.File, attr map[string]string) *probe.Error {
mode, e := strconv.ParseUint(attr["mode"], 10, 32)
if e != nil {
return probe.NewError(e)
if val, ok := attr["mode"]; ok {
mode, e := strconv.ParseUint(val, 0, 32)
if e != nil {
return probe.NewError(e)
}
// Attempt to change the file mode.
if e := fd.Chmod(os.FileMode(mode)); e != nil {
return probe.NewError(e)
}
}
// Attempt to change the file mode.
if e := fd.Chmod(os.FileMode(mode)); e != nil {
return probe.NewError(e)
var uid, gid int
var gidExists, uidExists bool
var e error
if val, ok := attr["uid"]; ok {
uid, e = strconv.Atoi(val)
if e != nil {
return probe.NewError(e)
}
uidExists = true
}
uid, e := strconv.Atoi(attr["uid"])
if e != nil {
return probe.NewError(e)
}
gid, e := strconv.Atoi(attr["gid"])
if e != nil {
return probe.NewError(e)
if val, ok := attr["gid"]; ok {
gid, e = strconv.Atoi(val)
if e != nil {
return probe.NewError(e)
}
gidExists = true
}
// Attempt to change the owner.
if e := fd.Chown(uid, gid); e != nil {
return probe.NewError(e)
if gidExists && uidExists {
if e := fd.Chown(uid, gid); e != nil {
return probe.NewError(e)
}
} else if uidExists {
if e := fd.Chown(uid, -1); e != nil {
return probe.NewError(e)
}
} else {
if e := fd.Chown(-1, gid); e != nil {
return probe.NewError(e)
}
}
return nil
@@ -253,7 +274,7 @@ func preserveAttributes(fd *os.File, attr map[string]string) *probe.Error {
/// Object operations.
func (f *fsClient) put(reader io.Reader, size int64, metadata map[string][]string, progress io.Reader) (int64, *probe.Error) {
func (f *fsClient) put(ctx context.Context, reader io.Reader, size int64, meta map[string]string, progress io.Reader, preserve bool) (int64, *probe.Error) {
// ContentType is not handled on purpose.
// For filesystem this is a redundant information.
@@ -289,8 +310,8 @@ func (f *fsClient) put(reader io.Reader, size int64, metadata map[string][]strin
}
attr := make(map[string]string)
if len(metadata[metaDataKey]) != 0 {
attr, e = parseAttribute(metadata[metaDataKey][0])
if _, ok := meta[metadataKey]; ok && preserve {
attr, e = parseAttribute(meta[metadataKey])
if e != nil {
tmpFile.Close()
return 0, probe.NewError(e)
@@ -347,20 +368,31 @@ func (f *fsClient) put(reader io.Reader, size int64, metadata map[string][]strin
return totalWritten, err.Trace(objectPartPath, objectPath)
}
if len(attr) != 0 {
atime, e := strconv.ParseInt(attr["atime"], 10, 64)
if e != nil {
return totalWritten, probe.NewError(e)
if len(attr) != 0 && preserve {
var atime, mtime int64
var e error
var atimeChanged, mtimeChanged bool
if val, ok := attr["atime"]; ok {
atime, e = strconv.ParseInt(val, 10, 64)
if e != nil {
return totalWritten, probe.NewError(e)
}
atimeChanged = true
}
mtime, e := strconv.ParseInt(attr["mtime"], 10, 64)
if e != nil {
return totalWritten, probe.NewError(e)
if val, ok := attr["mtime"]; ok {
mtime, e = strconv.ParseInt(val, 10, 64)
if e != nil {
return totalWritten, probe.NewError(e)
}
mtimeChanged = true
}
// Attempt to change the access and modify time
if e := os.Chtimes(objectPath, time.Unix(atime, 0), time.Unix(mtime, 0)); e != nil {
return totalWritten, probe.NewError(e)
if atimeChanged && mtimeChanged {
if e := os.Chtimes(objectPath, time.Unix(atime, 0), time.Unix(mtime, 0)); e != nil {
return totalWritten, probe.NewError(e)
}
}
}
@@ -368,17 +400,12 @@ func (f *fsClient) put(reader io.Reader, size int64, metadata map[string][]strin
}
// Put - create a new file with metadata.
func (f *fsClient) Put(ctx context.Context, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide, md5, disableMultipart bool) (int64, *probe.Error) {
if metadata[metaDataKey] != "" {
meta := make(map[string][]string)
meta[metaDataKey] = append(meta[metaDataKey], metadata[metaDataKey])
return f.put(reader, size, meta, progress)
}
return f.put(reader, size, nil, progress)
func (f *fsClient) Put(ctx context.Context, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide, md5, disableMultipart, preserve bool) (int64, *probe.Error) {
return f.put(ctx, reader, size, metadata, progress, preserve)
}
// ShareDownload - share download not implemented for filesystem.
func (f *fsClient) ShareDownload(expires time.Duration) (string, *probe.Error) {
func (f *fsClient) ShareDownload(ctx context.Context, expires time.Duration) (string, *probe.Error) {
return "", probe.NewError(APINotImplemented{
API: "ShareDownload",
APIType: "filesystem",
@@ -386,7 +413,7 @@ func (f *fsClient) ShareDownload(expires time.Duration) (string, *probe.Error) {
}
// ShareUpload - share upload not implemented for filesystem.
func (f *fsClient) ShareUpload(startsWith bool, expires time.Duration, contentType string) (string, map[string]string, *probe.Error) {
func (f *fsClient) ShareUpload(ctx context.Context, startsWith bool, expires time.Duration, contentType string) (string, map[string]string, *probe.Error) {
return "", nil, probe.NewError(APINotImplemented{
API: "ShareUpload",
APIType: "filesystem",
@@ -394,7 +421,7 @@ func (f *fsClient) ShareUpload(startsWith bool, expires time.Duration, contentTy
}
// Copy - copy data from source to destination
func (f *fsClient) Copy(source string, size int64, progress io.Reader, srcSSE, tgtSSE encrypt.ServerSide, metadata map[string]string, disableMultipart bool) *probe.Error {
func (f *fsClient) Copy(ctx context.Context, source string, size int64, progress io.Reader, srcSSE, tgtSSE encrypt.ServerSide, metadata map[string]string, disableMultipart, preserve bool) *probe.Error {
rc, e := os.Open(source)
if e != nil {
err := f.toClientError(e, source)
@@ -403,14 +430,14 @@ func (f *fsClient) Copy(source string, size int64, progress io.Reader, srcSSE, t
defer rc.Close()
destination := f.PathURL.Path
if _, err := f.put(rc, size, map[string][]string{}, progress); err != nil {
if _, err := f.put(ctx, rc, size, metadata, progress, preserve); err != nil {
return err.Trace(destination, source)
}
return nil
}
// Get returns reader and any additional metadata.
func (f *fsClient) Get(sse encrypt.ServerSide) (io.ReadCloser, *probe.Error) {
func (f *fsClient) Get(ctx context.Context, sse encrypt.ServerSide) (io.ReadCloser, *probe.Error) {
fileData, e := os.Open(f.PathURL.Path)
if e != nil {
err := f.toClientError(e, f.PathURL.Path)
@@ -464,7 +491,7 @@ func deleteFile(deletePath string) error {
}
// Remove - remove entry read from clientContent channel.
func (f *fsClient) Remove(isIncomplete, isRemoveBucket, isBypass bool, contentCh <-chan *ClientContent) <-chan *probe.Error {
func (f *fsClient) Remove(ctx context.Context, isIncomplete, isRemoveBucket, isBypass bool, contentCh <-chan *ClientContent) <-chan *probe.Error {
errorCh := make(chan *probe.Error)
// Goroutine reads from contentCh and removes the entry in content.
@@ -503,7 +530,7 @@ func (f *fsClient) Remove(isIncomplete, isRemoveBucket, isBypass bool, contentCh
}
// List - list files and folders.
func (f *fsClient) List(isRecursive, isIncomplete, isMetadata bool, showDir DirOpt) <-chan *ClientContent {
func (f *fsClient) List(ctx context.Context, isRecursive, isIncomplete, isMetadata bool, showDir DirOpt) <-chan *ClientContent {
contentCh := make(chan *ClientContent)
filteredCh := make(chan *ClientContent)
@@ -877,7 +904,7 @@ func (f *fsClient) listRecursiveInRoutine(contentCh chan *ClientContent, isMetad
}
// MakeBucket - create a new bucket.
func (f *fsClient) MakeBucket(region string, ignoreExisting, withLock bool) *probe.Error {
func (f *fsClient) MakeBucket(ctx context.Context, region string, ignoreExisting, withLock bool) *probe.Error {
// TODO: ignoreExisting has no effect currently. In the future, we want
// to call os.Mkdir() when ignoredExisting is disabled and os.MkdirAll()
// otherwise.
@@ -890,7 +917,7 @@ func (f *fsClient) MakeBucket(region string, ignoreExisting, withLock bool) *pro
}
// Set object lock configuration of bucket.
func (f *fsClient) SetObjectLockConfig(mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit) *probe.Error {
func (f *fsClient) SetObjectLockConfig(ctx context.Context, mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit) *probe.Error {
return probe.NewError(APINotImplemented{
API: "SetObjectLockConfig",
APIType: "filesystem",
@@ -898,7 +925,7 @@ func (f *fsClient) SetObjectLockConfig(mode minio.RetentionMode, validity uint64
}
// Get object lock configuration of bucket.
func (f *fsClient) GetObjectLockConfig() (mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit, err *probe.Error) {
func (f *fsClient) GetObjectLockConfig(ctx context.Context) (mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit, err *probe.Error) {
return "", 0, "", probe.NewError(APINotImplemented{
API: "GetObjectLockConfig",
APIType: "filesystem",
@@ -906,7 +933,7 @@ func (f *fsClient) GetObjectLockConfig() (mode minio.RetentionMode, validity uin
}
// GetAccessRules - unsupported API
func (f *fsClient) GetAccessRules() (map[string]string, *probe.Error) {
func (f *fsClient) GetAccessRules(ctx context.Context) (map[string]string, *probe.Error) {
return map[string]string{}, probe.NewError(APINotImplemented{
API: "GetBucketPolicy",
APIType: "filesystem",
@@ -914,7 +941,7 @@ func (f *fsClient) GetAccessRules() (map[string]string, *probe.Error) {
}
// Set object retention for a given object.
func (f *fsClient) PutObjectRetention(mode minio.RetentionMode, retainUntilDate time.Time, bypassGovernance bool) *probe.Error {
func (f *fsClient) PutObjectRetention(ctx context.Context, mode minio.RetentionMode, retainUntilDate time.Time, bypassGovernance bool) *probe.Error {
return probe.NewError(APINotImplemented{
API: "PutObjectRetention",
APIType: "filesystem",
@@ -922,7 +949,7 @@ func (f *fsClient) PutObjectRetention(mode minio.RetentionMode, retainUntilDate
}
// Set object legal hold for a given object.
func (f *fsClient) PutObjectLegalHold(lhold minio.LegalHoldStatus) *probe.Error {
func (f *fsClient) PutObjectLegalHold(ctx context.Context, lhold minio.LegalHoldStatus) *probe.Error {
return probe.NewError(APINotImplemented{
API: "PutObjectLegalHold",
APIType: "filesystem",
@@ -930,7 +957,7 @@ func (f *fsClient) PutObjectLegalHold(lhold minio.LegalHoldStatus) *probe.Error
}
// GetAccess - get access policy permissions.
func (f *fsClient) GetAccess() (access string, policyJSON string, err *probe.Error) {
func (f *fsClient) GetAccess(ctx context.Context) (access string, policyJSON string, err *probe.Error) {
// For windows this feature is not implemented.
if runtime.GOOS == "windows" {
return "", "", probe.NewError(APINotImplemented{API: "GetAccess", APIType: "filesystem"})
@@ -955,7 +982,7 @@ func (f *fsClient) GetAccess() (access string, policyJSON string, err *probe.Err
}
// SetAccess - set access policy permissions.
func (f *fsClient) SetAccess(access string, isJSON bool) *probe.Error {
func (f *fsClient) SetAccess(ctx context.Context, access string, isJSON bool) *probe.Error {
// For windows this feature is not implemented.
// JSON policy for fs is not yet implemented.
if runtime.GOOS == "windows" || isJSON {
@@ -987,7 +1014,7 @@ func (f *fsClient) SetAccess(access string, isJSON bool) *probe.Error {
}
// Stat - get metadata from path.
func (f *fsClient) Stat(isIncomplete, isPreserve bool, sse encrypt.ServerSide) (content *ClientContent, err *probe.Error) {
func (f *fsClient) Stat(ctx context.Context, isIncomplete, isPreserve bool, sse encrypt.ServerSide) (content *ClientContent, err *probe.Error) {
st, err := f.fsStat(isIncomplete)
if err != nil {
return nil, err.Trace(f.PathURL.String())
@@ -1003,13 +1030,6 @@ func (f *fsClient) Stat(isIncomplete, isPreserve bool, sse encrypt.ServerSide) (
}
path := f.PathURL.String()
metaData, pErr := getAllXattrs(path)
if pErr != nil {
return content, nil
}
for k, v := range metaData {
content.Metadata[k] = v
}
// Populates meta data with file system attribute only in case of
// when preserve flag is passed.
if isPreserve {
@@ -1017,7 +1037,14 @@ func (f *fsClient) Stat(isIncomplete, isPreserve bool, sse encrypt.ServerSide) (
if err != nil {
return content, nil
}
content.Metadata[metaDataKey] = fileAttr
metaData, pErr := getAllXattrs(path)
if pErr != nil {
return content, nil
}
for k, v := range metaData {
content.Metadata[k] = v
}
content.Metadata[metadataKey] = fileAttr
}
return content, nil
@@ -1063,7 +1090,7 @@ func (f *fsClient) AddUserAgent(_, _ string) {
}
// Get Object Tags
func (f *fsClient) GetTags() (*tags.Tags, *probe.Error) {
func (f *fsClient) GetTags(ctx context.Context) (map[string]string, *probe.Error) {
return nil, probe.NewError(APINotImplemented{
API: "GetObjectTagging",
APIType: "filesystem",
@@ -1071,7 +1098,7 @@ func (f *fsClient) GetTags() (*tags.Tags, *probe.Error) {
}
// Set Object tags
func (f *fsClient) SetTags(tags string) *probe.Error {
func (f *fsClient) SetTags(ctx context.Context, tags string) *probe.Error {
return probe.NewError(APINotImplemented{
API: "SetObjectTagging",
APIType: "filesystem",
@@ -1079,7 +1106,7 @@ func (f *fsClient) SetTags(tags string) *probe.Error {
}
// Delete object tags
func (f *fsClient) DeleteTags() *probe.Error {
func (f *fsClient) DeleteTags(ctx context.Context) *probe.Error {
return probe.NewError(APINotImplemented{
API: "DeleteObjectTagging",
APIType: "filesystem",
@@ -1087,15 +1114,15 @@ func (f *fsClient) DeleteTags() *probe.Error {
}
// Get lifecycle configuration for a given bucket, not implemented.
func (f *fsClient) GetLifecycle() (ilm.LifecycleConfiguration, *probe.Error) {
return ilm.LifecycleConfiguration{}, probe.NewError(APINotImplemented{
func (f *fsClient) GetLifecycle(ctx context.Context) (*lifecycle.Configuration, *probe.Error) {
return nil, probe.NewError(APINotImplemented{
API: "GetLifecycle",
APIType: "filesystem",
})
}
// Set lifecycle configuration for a given bucket, not implemented.
func (f *fsClient) SetLifecycle(_ ilm.LifecycleConfiguration) *probe.Error {
func (f *fsClient) SetLifecycle(ctx context.Context, _ *lifecycle.Configuration) *probe.Error {
return probe.NewError(APINotImplemented{
API: "SetLifecycle",
APIType: "filesystem",
+23 -23
View File
@@ -45,7 +45,7 @@ func (s *TestSuite) TestList(c *C) {
var n int64
n, err = fsClient.Put(context.Background(), reader, int64(len(data)), map[string]string{
"Content-Type": "application/octet-stream",
}, nil, nil, false, false)
}, nil, nil, false, false, false)
c.Assert(err, IsNil)
c.Assert(n, Equals, int64(len(data)))
@@ -56,7 +56,7 @@ func (s *TestSuite) TestList(c *C) {
reader = bytes.NewReader([]byte(data))
n, err = fsClient.Put(context.Background(), reader, int64(len(data)), map[string]string{
"Content-Type": "application/octet-stream",
}, nil, nil, false, false)
}, nil, nil, false, false, false)
c.Assert(err, IsNil)
c.Assert(n, Equals, int64(len(data)))
@@ -65,7 +65,7 @@ func (s *TestSuite) TestList(c *C) {
// Verify previously create files and list them.
var contents []*ClientContent
for content := range fsClient.List(false, false, false, DirNone) {
for content := range fsClient.List(globalContext, false, false, false, DirNone) {
if content.Err != nil {
err = content.Err
break
@@ -84,7 +84,7 @@ func (s *TestSuite) TestList(c *C) {
reader = bytes.NewReader([]byte(data))
n, err = fsClient.Put(context.Background(), reader, int64(len(data)), map[string]string{
"Content-Type": "application/octet-stream",
}, nil, nil, false, false)
}, nil, nil, false, false, false)
c.Assert(err, IsNil)
c.Assert(n, Equals, int64(len(data)))
@@ -93,7 +93,7 @@ func (s *TestSuite) TestList(c *C) {
contents = nil
// List non recursive to list only top level files.
for content := range fsClient.List(false, false, false, DirNone) {
for content := range fsClient.List(globalContext, false, false, false, DirNone) {
if content.Err != nil {
err = content.Err
break
@@ -109,7 +109,7 @@ func (s *TestSuite) TestList(c *C) {
contents = nil
// List recursively all files and verify.
for content := range fsClient.List(true, false, false, DirNone) {
for content := range fsClient.List(globalContext, true, false, false, DirNone) {
if content.Err != nil {
err = content.Err
break
@@ -144,7 +144,7 @@ func (s *TestSuite) TestList(c *C) {
reader = bytes.NewReader([]byte(data))
n, err = fsClient.Put(context.Background(), reader, int64(len(data)), map[string]string{
"Content-Type": "application/octet-stream",
}, nil, nil, false, false)
}, nil, nil, false, false, false)
c.Assert(err, IsNil)
c.Assert(n, Equals, int64(len(data)))
@@ -153,7 +153,7 @@ func (s *TestSuite) TestList(c *C) {
contents = nil
// List recursively all files and verify.
for content := range fsClient.List(true, false, false, DirNone) {
for content := range fsClient.List(globalContext, true, false, false, DirNone) {
if content.Err != nil {
err = content.Err
break
@@ -194,7 +194,7 @@ func (s *TestSuite) TestPutBucket(c *C) {
bucketPath := filepath.Join(root, "bucket")
fsClient, err := fsNew(bucketPath)
c.Assert(err, IsNil)
err = fsClient.MakeBucket("us-east-1", true, false)
err = fsClient.MakeBucket(context.Background(), "us-east-1", true, false)
c.Assert(err, IsNil)
}
@@ -208,9 +208,9 @@ func (s *TestSuite) TestStatBucket(c *C) {
fsClient, err := fsNew(bucketPath)
c.Assert(err, IsNil)
err = fsClient.MakeBucket("us-east-1", true, false)
err = fsClient.MakeBucket(context.Background(), "us-east-1", true, false)
c.Assert(err, IsNil)
_, err = fsClient.Stat(false, false, nil)
_, err = fsClient.Stat(context.Background(), false, false, nil)
c.Assert(err, IsNil)
}
@@ -223,15 +223,15 @@ func (s *TestSuite) TestBucketACLFails(c *C) {
bucketPath := filepath.Join(root, "bucket")
fsClient, err := fsNew(bucketPath)
c.Assert(err, IsNil)
err = fsClient.MakeBucket("us-east-1", true, false)
err = fsClient.MakeBucket(context.Background(), "us-east-1", true, false)
c.Assert(err, IsNil)
// On windows setting permissions is not supported.
if runtime.GOOS != "windows" {
err = fsClient.SetAccess("readonly", false)
err = fsClient.SetAccess(context.Background(), "readonly", false)
c.Assert(err, IsNil)
_, _, err = fsClient.GetAccess()
_, _, err = fsClient.GetAccess(context.Background())
c.Assert(err, IsNil)
}
}
@@ -251,7 +251,7 @@ func (s *TestSuite) TestPut(c *C) {
var n int64
n, err = fsClient.Put(context.Background(), reader, int64(len(data)), map[string]string{
"Content-Type": "application/octet-stream",
}, nil, nil, false, false)
}, nil, nil, false, false, false)
c.Assert(err, IsNil)
c.Assert(n, Equals, int64(len(data)))
}
@@ -271,11 +271,11 @@ func (s *TestSuite) TestGet(c *C) {
reader = bytes.NewReader([]byte(data))
n, err := fsClient.Put(context.Background(), reader, int64(len(data)), map[string]string{
"Content-Type": "application/octet-stream",
}, nil, nil, false, false)
}, nil, nil, false, false, false)
c.Assert(err, IsNil)
c.Assert(n, Equals, int64(len(data)))
reader, err = fsClient.Get(nil)
reader, err = fsClient.Get(context.Background(), nil)
c.Assert(err, IsNil)
var results bytes.Buffer
_, e = io.Copy(&results, reader)
@@ -299,11 +299,11 @@ func (s *TestSuite) TestGetRange(c *C) {
reader = bytes.NewReader([]byte(data))
n, err := fsClient.Put(context.Background(), reader, int64(len(data)), map[string]string{
"Content-Type": "application/octet-stream",
}, nil, nil, false, false)
}, nil, nil, false, false, false)
c.Assert(err, IsNil)
c.Assert(n, Equals, int64(len(data)))
reader, err = fsClient.Get(nil)
reader, err = fsClient.Get(context.Background(), nil)
c.Assert(err, IsNil)
var results bytes.Buffer
buf := make([]byte, 5)
@@ -330,11 +330,11 @@ func (s *TestSuite) TestStatObject(c *C) {
reader := bytes.NewReader([]byte(data))
n, err := fsClient.Put(context.Background(), reader, int64(dataLen), map[string]string{
"Content-Type": "application/octet-stream",
}, nil, nil, false, false)
}, nil, nil, false, false, false)
c.Assert(err, IsNil)
c.Assert(n, Equals, int64(len(data)))
content, err := fsClient.Stat(false, false, nil)
content, err := fsClient.Stat(context.Background(), false, false, nil)
c.Assert(err, IsNil)
c.Assert(content.Size, Equals, int64(dataLen))
}
@@ -355,10 +355,10 @@ func (s *TestSuite) TestCopy(c *C) {
reader := bytes.NewReader([]byte(data))
n, err := fsClientSource.Put(context.Background(), reader, int64(len(data)), map[string]string{
"Content-Type": "application/octet-stream",
}, nil, nil, false, false)
}, nil, nil, false, false, false)
c.Assert(err, IsNil)
c.Assert(n, Equals, int64(len(data)))
err = fsClientTarget.Copy(sourcePath, int64(len(data)), nil, nil, nil, nil, false)
err = fsClientTarget.Copy(context.Background(), sourcePath, int64(len(data)), nil, nil, nil, nil, false, false)
c.Assert(err, IsNil)
}
+185 -203
View File
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -25,7 +25,7 @@ import (
"net/http/httptest"
"strconv"
minio "github.com/minio/minio-go/v6"
minio "github.com/minio/minio-go/v7"
. "gopkg.in/check.v1"
)
@@ -171,14 +171,14 @@ func (s *TestSuite) TestBucketOperations(c *C) {
s3c, err := S3New(conf)
c.Assert(err, IsNil)
err = s3c.MakeBucket("us-east-1", true, false)
err = s3c.MakeBucket(context.Background(), "us-east-1", true, false)
c.Assert(err, IsNil)
conf.HostURL = server.URL + string(s3c.GetURL().Separator)
s3c, err = S3New(conf)
c.Assert(err, IsNil)
for content := range s3c.List(false, false, false, DirNone) {
for content := range s3c.List(globalContext, false, false, false, DirNone) {
c.Assert(content.Err, IsNil)
c.Assert(content.Type.IsDir(), Equals, true)
}
@@ -187,7 +187,7 @@ func (s *TestSuite) TestBucketOperations(c *C) {
s3c, err = S3New(conf)
c.Assert(err, IsNil)
for content := range s3c.List(false, false, false, DirNone) {
for content := range s3c.List(globalContext, false, false, false, DirNone) {
c.Assert(content.Err, IsNil)
c.Assert(content.Type.IsDir(), Equals, true)
}
@@ -196,7 +196,7 @@ func (s *TestSuite) TestBucketOperations(c *C) {
s3c, err = S3New(conf)
c.Assert(err, IsNil)
for content := range s3c.List(false, false, false, DirNone) {
for content := range s3c.List(globalContext, false, false, false, DirNone) {
c.Assert(content.Err, IsNil)
c.Assert(content.Type.IsRegular(), Equals, true)
}
@@ -223,11 +223,11 @@ func (s *TestSuite) TestObjectOperations(c *C) {
reader = bytes.NewReader(object.data)
n, err := s3c.Put(context.Background(), reader, int64(len(object.data)), map[string]string{
"Content-Type": "application/octet-stream",
}, nil, nil, false, false)
}, nil, nil, false, false, false)
c.Assert(err, IsNil)
c.Assert(n, Equals, int64(len(object.data)))
reader, err = s3c.Get(nil)
reader, err = s3c.Get(context.Background(), nil)
c.Assert(err, IsNil)
var buffer bytes.Buffer
{
+4 -3
View File
@@ -18,6 +18,7 @@ package cmd
import (
"bytes"
"context"
"path/filepath"
"regexp"
"runtime"
@@ -183,7 +184,7 @@ func urlJoinPath(url1, url2 string) string {
}
// url2Stat returns stat info for URL.
func url2Stat(urlStr string, fileAttr bool, encKeyDB map[string][]prefixSSEPair) (client Client, content *ClientContent, err *probe.Error) {
func url2Stat(ctx context.Context, urlStr string, fileAttr bool, encKeyDB map[string][]prefixSSEPair) (client Client, content *ClientContent, err *probe.Error) {
client, err = newClient(urlStr)
if err != nil {
return nil, nil, err.Trace(urlStr)
@@ -191,7 +192,7 @@ func url2Stat(urlStr string, fileAttr bool, encKeyDB map[string][]prefixSSEPair)
alias, _ := url2Alias(urlStr)
sse := getSSE(urlStr, encKeyDB[alias])
content, err = client.Stat(false, fileAttr, sse)
content, err = client.Stat(ctx, false, fileAttr, sse)
if err != nil {
return nil, nil, err.Trace(urlStr)
}
@@ -231,7 +232,7 @@ func isURLPrefixExists(urlPrefix string, incomplete bool) bool {
isRecursive := false
isIncomplete := incomplete
isFetchMeta := false
for entry := range clnt.List(isRecursive, isIncomplete, isFetchMeta, DirNone) {
for entry := range clnt.List(globalContext, isRecursive, isIncomplete, isFetchMeta, DirNone) {
return entry.Err == nil
}
return false
+26 -27
View File
@@ -22,11 +22,10 @@ import (
"os"
"time"
"github.com/minio/mc/cmd/ilm"
"github.com/minio/mc/pkg/probe"
minio "github.com/minio/minio-go/v6"
"github.com/minio/minio-go/v6/pkg/encrypt"
"github.com/minio/minio-go/v6/pkg/tags"
minio "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/encrypt"
"github.com/minio/minio-go/v7/pkg/lifecycle"
)
// DirOpt - list directory option.
@@ -47,56 +46,56 @@ const defaultMultipartThreadsNum = 4
// Client - client interface
type Client interface {
// Common operations
Stat(isIncomplete, isPreserve bool, sse encrypt.ServerSide) (content *ClientContent, err *probe.Error)
List(isRecursive, isIncomplete, isFetchMeta bool, showDir DirOpt) <-chan *ClientContent
Stat(ctx context.Context, isIncomplete, isPreserve bool, sse encrypt.ServerSide) (content *ClientContent, err *probe.Error)
List(ctx context.Context, isRecursive, isIncomplete, isFetchMeta bool, showDir DirOpt) <-chan *ClientContent
// Bucket operations
MakeBucket(region string, ignoreExisting, withLock bool) *probe.Error
MakeBucket(ctx context.Context, region string, ignoreExisting, withLock bool) *probe.Error
// Object lock config
SetObjectLockConfig(mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit) *probe.Error
GetObjectLockConfig() (mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit, perr *probe.Error)
SetObjectLockConfig(ctx context.Context, mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit) *probe.Error
GetObjectLockConfig(ctx context.Context) (mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit, perr *probe.Error)
// Access policy operations.
GetAccess() (access string, policyJSON string, error *probe.Error)
GetAccessRules() (policyRules map[string]string, error *probe.Error)
SetAccess(access string, isJSON bool) *probe.Error
GetAccess(ctx context.Context) (access string, policyJSON string, error *probe.Error)
GetAccessRules(ctx context.Context) (policyRules map[string]string, error *probe.Error)
SetAccess(ctx context.Context, access string, isJSON bool) *probe.Error
// I/O operations
Copy(source string, size int64, progress io.Reader, srcSSE, tgtSSE encrypt.ServerSide, metadata map[string]string, disableMultipart bool) *probe.Error
Copy(ctx context.Context, source string, size int64, progress io.Reader, srcSSE, tgtSSE encrypt.ServerSide, metadata map[string]string, disableMultipart, isPreserve bool) *probe.Error
// Runs select expression on object storage on specific files.
Select(expression string, sse encrypt.ServerSide, opts SelectObjectOpts) (io.ReadCloser, *probe.Error)
Select(ctx context.Context, expression string, sse encrypt.ServerSide, opts SelectObjectOpts) (io.ReadCloser, *probe.Error)
// I/O operations with metadata.
Get(sse encrypt.ServerSide) (reader io.ReadCloser, err *probe.Error)
Put(ctx context.Context, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide, md5, disableMultipart bool) (n int64, err *probe.Error)
Get(ctx context.Context, sse encrypt.ServerSide) (reader io.ReadCloser, err *probe.Error)
Put(ctx context.Context, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide, md5, disableMultipart, isPreserve bool) (n int64, err *probe.Error)
// Object Locking related API
PutObjectRetention(mode minio.RetentionMode, retainUntilDate time.Time, bypassGovernance bool) *probe.Error
PutObjectLegalHold(hold minio.LegalHoldStatus) *probe.Error
PutObjectRetention(ctx context.Context, mode minio.RetentionMode, retainUntilDate time.Time, bypassGovernance bool) *probe.Error
PutObjectLegalHold(ctx context.Context, hold minio.LegalHoldStatus) *probe.Error
// I/O operations with expiration
ShareDownload(expires time.Duration) (string, *probe.Error)
ShareUpload(bool, time.Duration, string) (string, map[string]string, *probe.Error)
ShareDownload(ctx context.Context, expires time.Duration) (string, *probe.Error)
ShareUpload(context.Context, bool, time.Duration, string) (string, map[string]string, *probe.Error)
// Watch events
Watch(options WatchOptions) (*WatchObject, *probe.Error)
Watch(ctx context.Context, options WatchOptions) (*WatchObject, *probe.Error)
// Delete operations
Remove(isIncomplete, isRemoveBucket, isBypass bool, contentCh <-chan *ClientContent) (errorCh <-chan *probe.Error)
Remove(ctx context.Context, isIncomplete, isRemoveBucket, isBypass bool, contentCh <-chan *ClientContent) (errorCh <-chan *probe.Error)
// GetURL returns back internal url
GetURL() ClientURL
AddUserAgent(app, version string)
// Tagging operations
GetTags() (*tags.Tags, *probe.Error)
SetTags(tags string) *probe.Error
DeleteTags() *probe.Error
GetTags(ctx context.Context) (map[string]string, *probe.Error)
SetTags(ctx context.Context, tags string) *probe.Error
DeleteTags(ctx context.Context) *probe.Error
// Lifecycle operations
GetLifecycle() (ilm.LifecycleConfiguration, *probe.Error)
SetLifecycle(lfcCfg ilm.LifecycleConfiguration) *probe.Error
GetLifecycle(ctx context.Context) (*lifecycle.Configuration, *probe.Error)
SetLifecycle(ctx context.Context, config *lifecycle.Configuration) *probe.Error
}
// ClientContent - Content container for content metadata
+64 -46
View File
@@ -33,8 +33,8 @@ import (
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
minio "github.com/minio/minio-go/v6"
"github.com/minio/minio-go/v6/pkg/encrypt"
minio "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/encrypt"
)
// decode if the key is encoded key and returns the key
@@ -104,10 +104,10 @@ func getEncKeys(ctx *cli.Context) (map[string][]prefixSSEPair, *probe.Error) {
// Check if the passed URL represents a folder. It may or may not exist yet.
// If it exists, we can easily check if it is a folder, if it doesn't exist,
// we can guess if the url is a folder from how it looks.
func isAliasURLDir(aliasURL string, keys map[string][]prefixSSEPair) bool {
func isAliasURLDir(ctx context.Context, aliasURL string, keys map[string][]prefixSSEPair) bool {
// If the target url exists, check if it is a directory
// and return immediately.
_, targetContent, err := url2Stat(aliasURL, false, keys)
_, targetContent, err := url2Stat(ctx, aliasURL, false, keys)
if err == nil {
return targetContent.Type.IsDir()
}
@@ -141,24 +141,24 @@ func isAliasURLDir(aliasURL string, keys map[string][]prefixSSEPair) bool {
}
// getSourceStreamMetadataFromURL gets a reader from URL.
func getSourceStreamMetadataFromURL(urlStr string, encKeyDB map[string][]prefixSSEPair) (reader io.ReadCloser,
func getSourceStreamMetadataFromURL(ctx context.Context, urlStr string, encKeyDB map[string][]prefixSSEPair) (reader io.ReadCloser,
metadata map[string]string, err *probe.Error) {
alias, urlStrFull, _, err := expandAlias(urlStr)
if err != nil {
return nil, nil, err.Trace(urlStr)
}
sseKey := getSSE(urlStr, encKeyDB[alias])
return getSourceStream(alias, urlStrFull, true, sseKey, false)
return getSourceStream(ctx, alias, urlStrFull, true, sseKey, false)
}
// getSourceStreamFromURL gets a reader from URL.
func getSourceStreamFromURL(urlStr string, encKeyDB map[string][]prefixSSEPair) (reader io.ReadCloser, err *probe.Error) {
func getSourceStreamFromURL(ctx context.Context, urlStr string, encKeyDB map[string][]prefixSSEPair) (reader io.ReadCloser, err *probe.Error) {
alias, urlStrFull, _, err := expandAlias(urlStr)
if err != nil {
return nil, err.Trace(urlStr)
}
sse := getSSE(urlStr, encKeyDB[alias])
reader, _, err = getSourceStream(alias, urlStrFull, false, sse, false)
reader, _, err = getSourceStream(ctx, alias, urlStrFull, false, sse, false)
return reader, err
}
@@ -210,12 +210,12 @@ func isReadAt(reader io.Reader) (ok bool) {
}
// getSourceStream gets a reader from URL.
func getSourceStream(alias string, urlStr string, fetchStat bool, sse encrypt.ServerSide, preserve bool) (reader io.ReadCloser, metadata map[string]string, err *probe.Error) {
func getSourceStream(ctx context.Context, alias string, urlStr string, fetchStat bool, sse encrypt.ServerSide, preserve bool) (reader io.ReadCloser, metadata map[string]string, err *probe.Error) {
sourceClnt, err := newClientFromAlias(alias, urlStr)
if err != nil {
return nil, nil, err.Trace(alias, urlStr)
}
reader, err = sourceClnt.Get(sse)
reader, err = sourceClnt.Get(ctx, sse)
if err != nil {
return nil, nil, err.Trace(alias, urlStr)
}
@@ -241,7 +241,7 @@ func getSourceStream(alias string, urlStr string, fetchStat bool, sse encrypt.Se
}
st.ETag = oinfo.ETag
} else {
st, err = sourceClnt.Stat(false, preserve, sse)
st, err = sourceClnt.Stat(ctx, false, preserve, sse)
if err != nil {
return nil, nil, err.Trace(alias, urlStr)
}
@@ -290,14 +290,14 @@ func putTargetRetention(ctx context.Context, alias string, urlStr string, metada
retainUntilDate = t.UTC()
}
}
if err := targetClnt.PutObjectRetention(lockMode, retainUntilDate, false); err != nil {
if err := targetClnt.PutObjectRetention(ctx, lockMode, retainUntilDate, false); err != nil {
return err.Trace(alias, urlStr)
}
return nil
}
// putTargetStream writes to URL from Reader.
func putTargetStream(ctx context.Context, alias, urlStr, mode, until, legalHold string, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide, md5, disableMultipart bool) (int64, *probe.Error) {
func putTargetStream(ctx context.Context, alias, urlStr, mode, until, legalHold string, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide, md5, disableMultipart, preserve bool) (int64, *probe.Error) {
targetClnt, err := newClientFromAlias(alias, urlStr)
if err != nil {
return 0, err.Trace(alias, urlStr)
@@ -312,7 +312,7 @@ func putTargetStream(ctx context.Context, alias, urlStr, mode, until, legalHold
if legalHold != "" {
metadata[AmzObjectLockLegalHold] = legalHold
}
n, err := targetClnt.Put(ctx, reader, size, metadata, progress, sse, md5, disableMultipart)
n, err := targetClnt.Put(ctx, reader, size, metadata, progress, sse, md5, disableMultipart, preserve)
if err != nil {
return n, err.Trace(alias, urlStr)
}
@@ -320,7 +320,7 @@ func putTargetStream(ctx context.Context, alias, urlStr, mode, until, legalHold
}
// putTargetStreamWithURL writes to URL from reader. If length=-1, read until EOF.
func putTargetStreamWithURL(urlStr string, reader io.Reader, size int64, sse encrypt.ServerSide, md5, disableMultipart bool, metadata map[string]string) (int64, *probe.Error) {
func putTargetStreamWithURL(urlStr string, reader io.Reader, size int64, sse encrypt.ServerSide, md5, disableMultipart, preserve bool, metadata map[string]string) (int64, *probe.Error) {
alias, urlStrFull, _, err := expandAlias(urlStr)
if err != nil {
return 0, err.Trace(alias, urlStr)
@@ -330,11 +330,11 @@ func putTargetStreamWithURL(urlStr string, reader io.Reader, size int64, sse enc
metadata = map[string]string{}
}
metadata["Content-Type"] = contentType
return putTargetStream(context.Background(), alias, urlStrFull, "", "", "", reader, size, metadata, nil, sse, md5, disableMultipart)
return putTargetStream(context.Background(), alias, urlStrFull, "", "", "", reader, size, metadata, nil, sse, md5, disableMultipart, preserve)
}
// copySourceToTargetURL copies to targetURL from source.
func copySourceToTargetURL(alias, urlStr, source, mode, until, legalHold string, size int64, progress io.Reader, srcSSE, tgtSSE encrypt.ServerSide, metadata map[string]string, disableMultipart bool) *probe.Error {
func copySourceToTargetURL(ctx context.Context, alias, urlStr, source, mode, until, legalHold string, size int64, progress io.Reader, srcSSE, tgtSSE encrypt.ServerSide, metadata map[string]string, disableMultipart, preserve bool) *probe.Error {
targetClnt, err := newClientFromAlias(alias, urlStr)
if err != nil {
@@ -344,7 +344,7 @@ func copySourceToTargetURL(alias, urlStr, source, mode, until, legalHold string,
metadata[AmzObjectLockMode] = mode
metadata[AmzObjectLockRetainUntilDate] = until
metadata[AmzObjectLockLegalHold] = legalHold
err = targetClnt.Copy(source, size, progress, srcSSE, tgtSSE, metadata, disableMultipart)
err = targetClnt.Copy(ctx, source, size, progress, srcSSE, tgtSSE, metadata, disableMultipart, preserve)
if err != nil {
return err.Trace(alias, urlStr)
@@ -369,23 +369,24 @@ func filterMetadata(metadata map[string]string) map[string]string {
// getAllMetadata - returns a map of user defined function
// by combining the usermetadata of object and values passed by attr keyword
func getAllMetadata(sourceAlias, sourceURLStr string, srcSSE encrypt.ServerSide, urls URLs, preserve bool) (map[string]string, *probe.Error) {
func getAllMetadata(ctx context.Context, sourceAlias, sourceURLStr string, srcSSE encrypt.ServerSide, urls URLs) (map[string]string, *probe.Error) {
metadata := make(map[string]string)
sourceClnt, err := newClientFromAlias(sourceAlias, sourceURLStr)
if err != nil {
return nil, err.Trace(sourceAlias, sourceURLStr)
}
st, err := sourceClnt.Stat(false, preserve, srcSSE)
st, err := sourceClnt.Stat(ctx, false, true, srcSSE)
if err != nil {
return nil, err.Trace(sourceAlias, sourceURLStr)
}
for k, v := range st.Metadata {
metadata[k] = v
metadata[http.CanonicalHeaderKey(k)] = v
}
for k, v := range urls.TargetContent.UserMetadata {
metadata[k] = v
metadata[http.CanonicalHeaderKey(k)] = v
}
return filterMetadata(metadata), nil
@@ -453,13 +454,25 @@ func uploadSourceToTargetURL(ctx context.Context, urls URLs, progress io.Reader,
// Optimize for server side copy if the host is same.
if sourceAlias == targetAlias {
// If no metadata populated already by the caller
// just do a Stat() to obtain the metadata.
if len(metadata) == 0 {
metadata, err = getAllMetadata(sourceAlias, sourceURL.String(), srcSSE, urls, preserve)
// preserve new metadata and save existing ones.
if preserve {
currentMetadata, err := getAllMetadata(ctx, sourceAlias, sourceURL.String(), srcSSE, urls)
if err != nil {
return urls.WithError(err.Trace(sourceURL.String()))
}
for k, v := range currentMetadata {
metadata[k] = v
}
}
// Get metadata from target content as well
for k, v := range urls.TargetContent.Metadata {
metadata[http.CanonicalHeaderKey(k)] = v
}
// Get userMetadata from target content as well
for k, v := range urls.TargetContent.UserMetadata {
metadata[http.CanonicalHeaderKey(k)] = v
}
sourcePath := filepath.ToSlash(sourceURL.Path)
@@ -468,34 +481,38 @@ func uploadSourceToTargetURL(ctx context.Context, urls URLs, progress io.Reader,
return urls.WithError(err.Trace(sourceURL.String()))
}
// Get metadata from target content as well
for k, v := range urls.TargetContent.Metadata {
metadata[k] = v
}
// Get userMetadata from target content as well
for k, v := range urls.TargetContent.UserMetadata {
metadata[k] = v
}
err = copySourceToTargetURL(targetAlias, targetURL.String(), sourcePath, mode, until,
legalHold, length, progress, srcSSE, tgtSSE, filterMetadata(metadata), urls.DisableMultipart)
err = copySourceToTargetURL(ctx, targetAlias, targetURL.String(), sourcePath, mode, until,
legalHold, length, progress, srcSSE, tgtSSE, filterMetadata(metadata), urls.DisableMultipart, preserve)
} else {
if urls.SourceContent.RetentionEnabled {
// If no metadata populated already by the caller
// just do a Stat() to obtain the metadata.
if len(metadata) == 0 {
metadata, err = getAllMetadata(sourceAlias, sourceURL.String(), srcSSE, urls, preserve)
// preserve new metadata and save existing ones.
if preserve {
currentMetadata, err := getAllMetadata(ctx, sourceAlias, sourceURL.String(), srcSSE, urls)
if err != nil {
return urls.WithError(err.Trace(sourceURL.String()))
}
for k, v := range currentMetadata {
metadata[k] = v
}
}
// Get metadata from target content as well
for k, v := range urls.TargetContent.Metadata {
metadata[http.CanonicalHeaderKey(k)] = v
}
// Get userMetadata from target content as well
for k, v := range urls.TargetContent.UserMetadata {
metadata[http.CanonicalHeaderKey(k)] = v
}
err = putTargetRetention(ctx, targetAlias, targetURL.String(), metadata)
return urls.WithError(err.Trace(sourceURL.String()))
}
var reader io.ReadCloser
// Proceed with regular stream copy.
reader, metadata, err = getSourceStream(sourceAlias, sourceURL.String(), true, srcSSE, preserve)
reader, metadata, err = getSourceStream(ctx, sourceAlias, sourceURL.String(), true, srcSSE, preserve)
if err != nil {
return urls.WithError(err.Trace(sourceURL.String()))
}
@@ -503,22 +520,23 @@ func uploadSourceToTargetURL(ctx context.Context, urls URLs, progress io.Reader,
// Get metadata from target content as well
for k, v := range urls.TargetContent.Metadata {
metadata[k] = v
metadata[http.CanonicalHeaderKey(k)] = v
}
// Get userMetadata from target content as well
for k, v := range urls.TargetContent.UserMetadata {
metadata[k] = v
metadata[http.CanonicalHeaderKey(k)] = v
}
if isReadAt(reader) {
_, err = putTargetStream(ctx, targetAlias, targetURL.String(), mode, until,
legalHold, reader, length, filterMetadata(metadata),
progress, tgtSSE, urls.MD5, urls.DisableMultipart)
progress, tgtSSE, urls.MD5, urls.DisableMultipart, preserve)
} else {
_, err = putTargetStream(ctx, targetAlias, targetURL.String(), mode, until,
legalHold, io.LimitReader(reader, length),
length, filterMetadata(metadata), progress, tgtSSE, urls.MD5,
urls.DisableMultipart)
urls.DisableMultipart, preserve)
}
}
if err != nil {
+16 -12
View File
@@ -18,6 +18,7 @@ package cmd
import (
"bufio"
"context"
"fmt"
"math/rand"
"os"
@@ -26,7 +27,7 @@ import (
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v6"
"github.com/minio/minio-go/v7"
"github.com/minio/minio/pkg/console"
"golang.org/x/crypto/ssh/terminal"
)
@@ -159,7 +160,7 @@ func addHost(alias string, hostCfgV9 hostConfigV9) {
// probeS3Signature - auto probe S3 server signature: issue a Stat call
// using v4 signature then v2 in case of failure.
func probeS3Signature(accessKey, secretKey, url string) (string, *probe.Error) {
func probeS3Signature(ctx context.Context, accessKey, secretKey, url string) (string, *probe.Error) {
probeBucketName := randString(60, rand.NewSource(time.Now().UnixNano()), "probe-bucket-sign-")
// Test s3 connection for API auto probe
s3Config := &Config{
@@ -178,7 +179,7 @@ func probeS3Signature(accessKey, secretKey, url string) (string, *probe.Error) {
return "", err
}
if _, err := s3Client.Stat(false, false, nil); err != nil {
if _, err := s3Client.Stat(ctx, false, false, nil); err != nil {
e := err.ToGoError()
if _, ok := e.(BucketDoesNotExist); ok {
// Bucket doesn't exist, means signature probing worked successfully.
@@ -209,7 +210,7 @@ func probeS3Signature(accessKey, secretKey, url string) (string, *probe.Error) {
// BuildS3Config constructs an S3 Config and does
// signature auto-probe when needed.
func BuildS3Config(url, accessKey, secretKey, api, lookup string) (*Config, *probe.Error) {
func BuildS3Config(ctx context.Context, url, accessKey, secretKey, api, lookup string) (*Config, *probe.Error) {
s3Config := NewS3Config(url, &hostConfigV9{
AccessKey: accessKey,
@@ -225,7 +226,7 @@ func BuildS3Config(url, accessKey, secretKey, api, lookup string) (*Config, *pro
return s3Config, nil
}
// Probe S3 signature version
api, err := probeS3Signature(accessKey, secretKey, url)
api, err := probeS3Signature(ctx, accessKey, secretKey, url)
if err != nil {
return nil, err.Trace(url, accessKey, secretKey, api, lookup)
}
@@ -272,21 +273,24 @@ func fetchHostKeys(args cli.Args) (string, string) {
return accessKey, secretKey
}
func mainConfigHostAdd(ctx *cli.Context) error {
func mainConfigHostAdd(cli *cli.Context) error {
console.SetColor("HostMessage", color.New(color.FgGreen))
var (
args = ctx.Args()
args = cli.Args()
alias = cleanAlias(args.Get(0))
url = trimTrailingSeparator(args.Get(1))
api = ctx.String("api")
lookup = ctx.String("lookup")
api = cli.String("api")
lookup = cli.String("lookup")
)
accessKey, secretKey := fetchHostKeys(args)
checkConfigHostAddSyntax(ctx, accessKey, secretKey)
checkConfigHostAddSyntax(cli, accessKey, secretKey)
s3Config, err := BuildS3Config(url, accessKey, secretKey, api, lookup)
fatalIf(err.Trace(ctx.Args()...), "Unable to initialize new config from the provided credentials.")
ctx, cancelHostAdd := context.WithCancel(globalContext)
defer cancelHostAdd()
s3Config, err := BuildS3Config(ctx, url, accessKey, secretKey, api, lookup)
fatalIf(err.Trace(cli.Args()...), "Unable to initialize new config from the provided credentials.")
addHost(alias, hostConfigV9{
URL: s3Config.HostURL,
+146 -50
View File
@@ -244,28 +244,28 @@ func doCopy(ctx context.Context, cpURLs URLs, pg ProgressReader, encKeyDB map[st
urls := uploadSourceToTargetURL(ctx, cpURLs, pg, encKeyDB, preserve)
if isMvCmd && urls.Error == nil {
bgRemove(sourcePath)
bgRemove(ctx, sourcePath)
}
return urls
}
// doCopyFake - Perform a fake copy to update the progress bar appropriately.
func doCopyFake(cpURLs URLs, pg Progress, isMvCmd bool) URLs {
func doCopyFake(ctx context.Context, cpURLs URLs, pg Progress, isMvCmd bool) URLs {
if progressReader, ok := pg.(*progressBar); ok {
progressReader.ProgressBar.Add64(cpURLs.SourceContent.Size)
}
if isMvCmd {
sourcePath := filepath.ToSlash(filepath.Join(cpURLs.SourceAlias, cpURLs.SourceContent.URL.Path))
bgRemove(sourcePath)
bgRemove(ctx, sourcePath)
}
return cpURLs
}
// doPrepareCopyURLs scans the source URL and prepares a list of objects for copying.
func doPrepareCopyURLs(session *sessionV8, cancelCopy context.CancelFunc) (totalBytes, totalObjects int64) {
func doPrepareCopyURLs(ctx context.Context, session *sessionV8, cancelCopy context.CancelFunc) (totalBytes, totalObjects int64) {
// Separate source and target. 'cp' can take only one target,
// but any number of sources.
sourceURLs := session.Header.CommandArgs[:len(session.Header.CommandArgs)-1]
@@ -289,7 +289,7 @@ func doPrepareCopyURLs(session *sessionV8, cancelCopy context.CancelFunc) (total
scanBar = scanBarFactory()
}
URLsCh := prepareCopyURLs(sourceURLs, targetURL, isRecursive, encKeyDB, olderThan, newerThan)
URLsCh := prepareCopyURLs(ctx, sourceURLs, targetURL, isRecursive, encKeyDB, olderThan, newerThan)
done := false
for !done {
select {
@@ -341,10 +341,7 @@ func doPrepareCopyURLs(session *sessionV8, cancelCopy context.CancelFunc) (total
return
}
func doCopySession(cli *cli.Context, session *sessionV8, encKeyDB map[string][]prefixSSEPair, isMvCmd bool) error {
ctx, cancelCopy := context.WithCancel(globalContext)
defer cancelCopy()
func doCopySession(ctx context.Context, cancelCopy context.CancelFunc, cli *cli.Context, session *sessionV8, encKeyDB map[string][]prefixSSEPair, isMvCmd bool) error {
var isCopied func(string) bool
var totalObjects, totalBytes int64
@@ -366,7 +363,7 @@ func doCopySession(cli *cli.Context, session *sessionV8, encKeyDB map[string][]p
isCopied = isLastFactory(session.Header.LastCopied)
if !session.HasData() {
totalBytes, totalObjects = doPrepareCopyURLs(session, cancelCopy)
totalBytes, totalObjects = doPrepareCopyURLs(ctx, session, cancelCopy)
} else {
totalBytes, totalObjects = session.Header.TotalBytes, session.Header.TotalObjects
}
@@ -403,7 +400,7 @@ func doCopySession(cli *cli.Context, session *sessionV8, encKeyDB map[string][]p
go func() {
totalBytes := int64(0)
for cpURLs := range prepareCopyURLs(sourceURLs, targetURL, isRecursive,
for cpURLs := range prepareCopyURLs(ctx, sourceURLs, targetURL, isRecursive,
encKeyDB, olderThan, newerThan) {
if cpURLs.Error != nil {
// Print in new line and adjust to top so that we
@@ -478,7 +475,7 @@ func doCopySession(cli *cli.Context, session *sessionV8, encKeyDB map[string][]p
cpURLs.TargetContent.RetentionEnabled = true
}
cpURLs.TargetContent.RetentionDuration = session.Header.CommandStringFlags[rdFlag]
cpURLs.TargetContent.LegalHold = session.Header.CommandStringFlags[lhFlag]
cpURLs.TargetContent.LegalHold = strings.ToUpper(session.Header.CommandStringFlags[lhFlag])
if cpURLs.TargetContent.LegalHold != "" {
cpURLs.TargetContent.LegalHoldEnabled = true
}
@@ -491,25 +488,27 @@ func doCopySession(cli *cli.Context, session *sessionV8, encKeyDB map[string][]p
cpURLs.TargetContent.RetentionDuration = rd
}
if lh := cli.String(lhFlag); lh != "" {
cpURLs.TargetContent.LegalHold = lh
cpURLs.TargetContent.LegalHold = strings.ToUpper(lh)
cpURLs.TargetContent.LegalHoldEnabled = true
}
}
if cli.String("attr") != "" {
userMetaMap, _ := getMetaDataEntry(cli.String("attr"))
for metaDataKey, metaDataVal := range userMetaMap {
cpURLs.TargetContent.UserMetadata[metaDataKey] = metaDataVal
}
}
preserve := cli.Bool("preserve")
if cli.String("attr") != "" {
preserve = true
userMetaMap, _ := getMetaDataEntry(cli.String("attr"))
for metadataKey, metaDataVal := range userMetaMap {
cpURLs.TargetContent.UserMetadata[metadataKey] = metaDataVal
}
}
cpURLs.MD5 = cli.Bool("md5")
cpURLs.DisableMultipart = cli.Bool("disable-multipart")
// Verify if previously copied, notify progress bar.
if isCopied != nil && isCopied(cpURLs.SourceContent.URL.String()) {
queueCh <- func() URLs {
return doCopyFake(cpURLs, pg, isMvCmd)
return doCopyFake(ctx, cpURLs, pg, isMvCmd)
}
} else {
queueCh <- func() URLs {
@@ -607,44 +606,141 @@ loop:
// validate the passed metadataString and populate the map
func getMetaDataEntry(metadataString string) (map[string]string, *probe.Error) {
metaDataMap := make(map[string]string)
for _, metaData := range strings.Split(metadataString, ";") {
metaDataEntry := strings.SplitN(metaData, "=", 2)
if len(metaDataEntry) != 2 {
return nil, probe.NewError(ErrInvalidMetadata)
r := strings.NewReader(metadataString)
type pToken int
const (
KEY pToken = iota
VALUE
)
type pState int
const (
NORMAL pState = iota
QSTRING
DQSTRING
)
var key, value strings.Builder
writeRune := func(ch rune, pt pToken) {
if pt == KEY {
key.WriteRune(ch)
} else if pt == VALUE {
value.WriteRune(ch)
} else {
panic("Invalid parser token type")
}
metaDataMap[http.CanonicalHeaderKey(metaDataEntry[0])] = metaDataEntry[1]
}
return metaDataMap, nil
ps := NORMAL
pt := KEY
p := 0
for ; ; p++ {
ch, _, err := r.ReadRune()
if err != nil {
//eof
if ps == QSTRING || ps == DQSTRING || pt == KEY {
return nil, probe.NewError(ErrInvalidMetadata)
}
metaDataMap[http.CanonicalHeaderKey(key.String())] = value.String()
return metaDataMap, nil
}
if ch == '"' {
if ps == DQSTRING {
ps = NORMAL
} else if ps == QSTRING {
writeRune(ch, pt)
} else if ps == NORMAL {
ps = DQSTRING
} else {
break
}
continue
}
if ch == '\'' {
if ps == QSTRING {
ps = NORMAL
} else if ps == DQSTRING {
writeRune(ch, pt)
} else if ps == NORMAL {
ps = QSTRING
} else {
break
}
continue
}
if ch == '=' {
if ps == QSTRING || ps == DQSTRING {
writeRune(ch, pt)
} else if pt == KEY {
pt = VALUE
} else if pt == VALUE {
writeRune(ch, pt)
} else {
break
}
continue
}
if ch == ';' {
if ps == QSTRING || ps == DQSTRING {
writeRune(ch, pt)
} else if pt == KEY {
return nil, probe.NewError(ErrInvalidMetadata)
} else if pt == VALUE {
metaDataMap[http.CanonicalHeaderKey(key.String())] = value.String()
key.Reset()
value.Reset()
pt = KEY
} else {
break
}
continue
}
writeRune(ch, pt)
}
fatalErr := fmt.Sprintf("Invalid parser state at index: %d", p)
panic(fatalErr)
}
// mainCopy is the entry point for cp command.
func mainCopy(ctx *cli.Context) error {
func mainCopy(cliCtx *cli.Context) error {
ctx, cancelCopy := context.WithCancel(globalContext)
defer cancelCopy()
// Parse encryption keys per command.
encKeyDB, err := getEncKeys(ctx)
encKeyDB, err := getEncKeys(cliCtx)
fatalIf(err, "Unable to parse encryption keys.")
// Parse metadata.
userMetaMap := make(map[string]string)
if ctx.String("attr") != "" {
userMetaMap, err = getMetaDataEntry(ctx.String("attr"))
fatalIf(err, "Unable to parse attribute %v", ctx.String("attr"))
if cliCtx.String("attr") != "" {
userMetaMap, err = getMetaDataEntry(cliCtx.String("attr"))
fatalIf(err, "Unable to parse attribute %v", cliCtx.String("attr"))
}
// check 'copy' cli arguments.
checkCopySyntax(ctx, encKeyDB, false)
checkCopySyntax(ctx, cliCtx, encKeyDB, false)
// Additional command specific theme customization.
console.SetColor("Copy", color.New(color.FgGreen, color.Bold))
recursive := ctx.Bool("recursive")
olderThan := ctx.String("older-than")
newerThan := ctx.String("newer-than")
storageClass := ctx.String("storage-class")
retentionMode := ctx.String(rmFlag)
retentionDuration := ctx.String(rdFlag)
legalHold := ctx.String(lhFlag)
recursive := cliCtx.Bool("recursive")
olderThan := cliCtx.String("older-than")
newerThan := cliCtx.String("newer-than")
storageClass := cliCtx.String("storage-class")
retentionMode := cliCtx.String(rmFlag)
retentionDuration := cliCtx.String(rdFlag)
legalHold := strings.ToUpper(cliCtx.String(lhFlag))
sseKeys := os.Getenv("MC_ENCRYPT_KEY")
if key := ctx.String("encrypt-key"); key != "" {
if key := cliCtx.String("encrypt-key"); key != "" {
sseKeys = key
}
@@ -652,12 +748,12 @@ func mainCopy(ctx *cli.Context) error {
sseKeys, err = getDecodedKey(sseKeys)
fatalIf(err, "Unable to parse encryption keys.")
}
sse := ctx.String("encrypt")
sse := cliCtx.String("encrypt")
var session *sessionV8
if ctx.Bool("continue") {
sessionID := getHash("cp", ctx.Args())
if cliCtx.Bool("continue") {
sessionID := getHash("cp", cliCtx.Args())
if isSessionExists(sessionID) {
session, err = loadSessionV8(sessionID)
fatalIf(err.Trace(sessionID), "Unable to load session.")
@@ -673,14 +769,14 @@ func mainCopy(ctx *cli.Context) error {
session.Header.CommandStringFlags[lhFlag] = legalHold
session.Header.CommandStringFlags["encrypt-key"] = sseKeys
session.Header.CommandStringFlags["encrypt"] = sse
session.Header.CommandBoolFlags["session"] = ctx.Bool("continue")
session.Header.CommandBoolFlags["session"] = cliCtx.Bool("continue")
if ctx.Bool("preserve") {
session.Header.CommandBoolFlags["preserve"] = ctx.Bool("preserve")
if cliCtx.Bool("preserve") {
session.Header.CommandBoolFlags["preserve"] = cliCtx.Bool("preserve")
}
session.Header.UserMetaData = userMetaMap
session.Header.CommandBoolFlags["md5"] = ctx.Bool("md5")
session.Header.CommandBoolFlags["disable-multipart"] = ctx.Bool("disable-multipart")
session.Header.CommandBoolFlags["md5"] = cliCtx.Bool("md5")
session.Header.CommandBoolFlags["disable-multipart"] = cliCtx.Bool("disable-multipart")
var e error
if session.Header.RootPath, e = os.Getwd(); e != nil {
@@ -689,11 +785,11 @@ func mainCopy(ctx *cli.Context) error {
}
// extract URLs.
session.Header.CommandArgs = ctx.Args()
session.Header.CommandArgs = cliCtx.Args()
}
}
e := doCopySession(ctx, session, encKeyDB, false)
e := doCopySession(ctx, cancelCopy, cliCtx, session, encKeyDB, false)
if session != nil {
session.Delete()
}
+12
View File
@@ -38,6 +38,18 @@ func TestParseMetaData(t *testing.T) {
{"key1:value1;key2:value2", nil, ErrInvalidMetadata, false},
// using no delimiter
{"key1:value1:key2:value2", nil, ErrInvalidMetadata, false},
//success: use value in quotes
{"Content-Disposition='form-data; name=\"description\"'", map[string]string{"Content-Disposition": "form-data; name=\"description\""}, nil, true},
//success: use value in double quotes
{"Content-Disposition=\"form-data; name='description'\"", map[string]string{"Content-Disposition": "form-data; name='description'"}, nil, true},
//fail: unterminated quote
{"Content-Disposition='form-data; name=\"description\"", nil, ErrInvalidMetadata, false},
//fail: unterminated double quote
{"Content-Disposition=\"form-data; name='description'", nil, ErrInvalidMetadata, false},
//success: use value and key in quotes
{"\"Content-Disposition\"='form-data; name=\"description\"'", map[string]string{"Content-Disposition": "form-data; name=\"description\""}, nil, true},
//success: use value and key in quotes
{"\"Content=Disposition;Other key part=this is also key data\"='form-data; name=\"description\"'", map[string]string{"Content=Disposition;Other key part=this is also key data": "form-data; name=\"description\""}, nil, true},
}
for idx, testCase := range metaDataCases {
+27 -26
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"fmt"
"runtime"
@@ -24,27 +25,27 @@ import (
"github.com/minio/minio/pkg/console"
)
func checkCopySyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair, isMvCmd bool) {
if len(ctx.Args()) < 2 {
func checkCopySyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair, isMvCmd bool) {
if len(cliCtx.Args()) < 2 {
if isMvCmd {
cli.ShowCommandHelpAndExit(ctx, "mv", 1) // last argument is exit code.
cli.ShowCommandHelpAndExit(cliCtx, "mv", 1) // last argument is exit code.
}
cli.ShowCommandHelpAndExit(ctx, "cp", 1) // last argument is exit code.
cli.ShowCommandHelpAndExit(cliCtx, "cp", 1) // last argument is exit code.
}
// extract URLs.
URLs := ctx.Args()
URLs := cliCtx.Args()
if len(URLs) < 2 {
fatalIf(errDummy().Trace(ctx.Args()...), "Unable to parse source and target arguments.")
fatalIf(errDummy().Trace(cliCtx.Args()...), "Unable to parse source and target arguments.")
}
srcURLs := URLs[:len(URLs)-1]
tgtURL := URLs[len(URLs)-1]
isRecursive := ctx.Bool("recursive")
isRecursive := cliCtx.Bool("recursive")
// Verify if source(s) exists.
for _, srcURL := range srcURLs {
_, _, err := url2Stat(srcURL, false, encKeyDB)
_, _, err := url2Stat(ctx, srcURL, false, encKeyDB)
if err != nil {
console.Fatalf("Unable to validate source %s\n", srcURL)
}
@@ -58,11 +59,11 @@ func checkCopySyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair, isMv
}
}
if ctx.String(rdFlag) != "" && ctx.String(rmFlag) == "" {
if cliCtx.String(rdFlag) != "" && cliCtx.String(rmFlag) == "" {
fatalIf(errInvalidArgument().Trace(), fmt.Sprintf("Both object retention flags `--%s` and `--%s` are required.\n", rdFlag, rmFlag))
}
if ctx.String(rdFlag) == "" && ctx.String(rmFlag) != "" {
if cliCtx.String(rdFlag) == "" && cliCtx.String(rmFlag) != "" {
fatalIf(errInvalidArgument().Trace(), fmt.Sprintf("Both object retention flags `--%s` and `--%s` are required.\n", rdFlag, rmFlag))
}
@@ -72,38 +73,38 @@ func checkCopySyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair, isMv
}
// Guess CopyURLsType based on source and target URLs.
copyURLsType, err := guessCopyURLType(srcURLs, tgtURL, isRecursive, encKeyDB)
copyURLsType, err := guessCopyURLType(ctx, srcURLs, tgtURL, isRecursive, encKeyDB)
if err != nil {
fatalIf(errInvalidArgument().Trace(), "Unable to guess the type of "+operation+" operation.")
}
switch copyURLsType {
case copyURLsTypeA: // File -> File.
checkCopySyntaxTypeA(srcURLs, tgtURL, encKeyDB, isMvCmd)
checkCopySyntaxTypeA(ctx, srcURLs, tgtURL, encKeyDB, isMvCmd)
case copyURLsTypeB: // File -> Folder.
checkCopySyntaxTypeB(srcURLs, tgtURL, encKeyDB, isMvCmd)
checkCopySyntaxTypeB(ctx, srcURLs, tgtURL, encKeyDB, isMvCmd)
case copyURLsTypeC: // Folder... -> Folder.
checkCopySyntaxTypeC(srcURLs, tgtURL, isRecursive, encKeyDB, isMvCmd)
checkCopySyntaxTypeC(ctx, srcURLs, tgtURL, isRecursive, encKeyDB, isMvCmd)
case copyURLsTypeD: // File1...FileN -> Folder.
checkCopySyntaxTypeD(srcURLs, tgtURL, encKeyDB, isMvCmd)
checkCopySyntaxTypeD(ctx, srcURLs, tgtURL, encKeyDB, isMvCmd)
default:
fatalIf(errInvalidArgument().Trace(), "Unable to guess the type of "+operation+" operation.")
}
// Preserve functionality not supported for windows
if ctx.Bool("preserve") && runtime.GOOS == "windows" {
if cliCtx.Bool("preserve") && runtime.GOOS == "windows" {
fatalIf(errInvalidArgument().Trace(), "Permissions are not preserved on windows platform.")
}
}
// checkCopySyntaxTypeA verifies if the source and target are valid file arguments.
func checkCopySyntaxTypeA(srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair, isMvCmd bool) {
func checkCopySyntaxTypeA(ctx context.Context, srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair, isMvCmd bool) {
// Check source.
if len(srcURLs) != 1 {
fatalIf(errInvalidArgument().Trace(), "Invalid number of source arguments.")
}
srcURL := srcURLs[0]
_, srcContent, err := url2Stat(srcURL, false, keys)
_, srcContent, err := url2Stat(ctx, srcURL, false, keys)
fatalIf(err.Trace(srcURL), "Unable to stat source `"+srcURL+"`.")
if !srcContent.Type.IsRegular() {
@@ -112,13 +113,13 @@ func checkCopySyntaxTypeA(srcURLs []string, tgtURL string, keys map[string][]pre
}
// checkCopySyntaxTypeB verifies if the source is a valid file and target is a valid folder.
func checkCopySyntaxTypeB(srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair, isMvCmd bool) {
func checkCopySyntaxTypeB(ctx context.Context, srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair, isMvCmd bool) {
// Check source.
if len(srcURLs) != 1 {
fatalIf(errInvalidArgument().Trace(), "Invalid number of source arguments.")
}
srcURL := srcURLs[0]
_, srcContent, err := url2Stat(srcURL, false, keys)
_, srcContent, err := url2Stat(ctx, srcURL, false, keys)
fatalIf(err.Trace(srcURL), "Unable to stat source `"+srcURL+"`.")
if !srcContent.Type.IsRegular() {
@@ -126,7 +127,7 @@ func checkCopySyntaxTypeB(srcURLs []string, tgtURL string, keys map[string][]pre
}
// Check target.
if _, tgtContent, err := url2Stat(tgtURL, false, keys); err == nil {
if _, tgtContent, err := url2Stat(ctx, tgtURL, false, keys); err == nil {
if !tgtContent.Type.IsDir() {
fatalIf(errInvalidArgument().Trace(tgtURL), "Target `"+tgtURL+"` is not a folder.")
}
@@ -134,21 +135,21 @@ func checkCopySyntaxTypeB(srcURLs []string, tgtURL string, keys map[string][]pre
}
// checkCopySyntaxTypeC verifies if the source is a valid recursive dir and target is a valid folder.
func checkCopySyntaxTypeC(srcURLs []string, tgtURL string, isRecursive bool, keys map[string][]prefixSSEPair, isMvCmd bool) {
func checkCopySyntaxTypeC(ctx context.Context, srcURLs []string, tgtURL string, isRecursive bool, keys map[string][]prefixSSEPair, isMvCmd bool) {
// Check source.
if len(srcURLs) != 1 {
fatalIf(errInvalidArgument().Trace(), "Invalid number of source arguments.")
}
// Check target.
if _, tgtContent, err := url2Stat(tgtURL, false, keys); err == nil {
if _, tgtContent, err := url2Stat(ctx, tgtURL, false, keys); err == nil {
if !tgtContent.Type.IsDir() {
fatalIf(errInvalidArgument().Trace(tgtURL), "Target `"+tgtURL+"` is not a folder.")
}
}
for _, srcURL := range srcURLs {
c, srcContent, err := url2Stat(srcURL, false, keys)
c, srcContent, err := url2Stat(ctx, srcURL, false, keys)
// incomplete uploads are not necessary for copy operation, no need to verify for them.
isIncomplete := false
if err != nil {
@@ -183,10 +184,10 @@ func checkCopySyntaxTypeC(srcURLs []string, tgtURL string, isRecursive bool, key
}
// checkCopySyntaxTypeD verifies if the source is a valid list of files and target is a valid folder.
func checkCopySyntaxTypeD(srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair, isMvCmd bool) {
func checkCopySyntaxTypeD(ctx context.Context, srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair, isMvCmd bool) {
// Source can be anything: file, dir, dir...
// Check target if it is a dir
if _, tgtContent, err := url2Stat(tgtURL, false, keys); err == nil {
if _, tgtContent, err := url2Stat(ctx, tgtURL, false, keys); err == nil {
if !tgtContent.Type.IsDir() {
fatalIf(errInvalidArgument().Trace(tgtURL), "Target `"+tgtURL+"` is not a folder.")
}
+19 -31
View File
@@ -17,7 +17,7 @@
package cmd
import (
"os"
"context"
"path/filepath"
"strings"
@@ -51,10 +51,10 @@ const (
// guessCopyURLType guesses the type of clientURL. This approach all allows prepareURL
// functions to accurately report failure causes.
func guessCopyURLType(sourceURLs []string, targetURL string, isRecursive bool, keys map[string][]prefixSSEPair) (copyURLsType, *probe.Error) {
func guessCopyURLType(ctx context.Context, sourceURLs []string, targetURL string, isRecursive bool, keys map[string][]prefixSSEPair) (copyURLsType, *probe.Error) {
if len(sourceURLs) == 1 { // 1 Source, 1 Target
sourceURL := sourceURLs[0]
_, sourceContent, err := url2Stat(sourceURL, false, keys)
_, sourceContent, err := url2Stat(ctx, sourceURL, false, keys)
if err != nil {
return copyURLsTypeInvalid, err
}
@@ -66,7 +66,7 @@ func guessCopyURLType(sourceURLs []string, targetURL string, isRecursive bool, k
}
// If target is a folder, it is Type B.
if isAliasURLDir(targetURL, keys) {
if isAliasURLDir(ctx, targetURL, keys) {
return copyURLsTypeB, nil
}
// else Type A.
@@ -74,7 +74,7 @@ func guessCopyURLType(sourceURLs []string, targetURL string, isRecursive bool, k
}
// Multiple source args and target is a folder. It is Type D.
if isAliasURLDir(targetURL, keys) {
if isAliasURLDir(ctx, targetURL, keys) {
return copyURLsTypeD, nil
}
@@ -83,13 +83,13 @@ func guessCopyURLType(sourceURLs []string, targetURL string, isRecursive bool, k
// SINGLE SOURCE - Type A: copy(f, f) -> copy(f, f)
// prepareCopyURLsTypeA - prepares target and source clientURLs for copying.
func prepareCopyURLsTypeA(sourceURL string, targetURL string, encKeyDB map[string][]prefixSSEPair) URLs {
func prepareCopyURLsTypeA(ctx context.Context, sourceURL string, targetURL string, encKeyDB map[string][]prefixSSEPair) URLs {
// Extract alias before fiddling with the clientURL.
sourceAlias, _, _ := mustExpandAlias(sourceURL)
// Find alias and expanded clientURL.
targetAlias, targetURL, _ := mustExpandAlias(targetURL)
_, sourceContent, err := url2Stat(sourceURL, false, encKeyDB)
_, sourceContent, err := url2Stat(ctx, sourceURL, false, encKeyDB)
if err != nil {
// Source does not exist or insufficient privileges.
return URLs{Error: err.Trace(sourceURL)}
@@ -116,13 +116,13 @@ func makeCopyContentTypeA(sourceAlias string, sourceContent *ClientContent, targ
// SINGLE SOURCE - Type B: copy(f, d) -> copy(f, d/f) -> A
// prepareCopyURLsTypeB - prepares target and source clientURLs for copying.
func prepareCopyURLsTypeB(sourceURL string, targetURL string, encKeyDB map[string][]prefixSSEPair) URLs {
func prepareCopyURLsTypeB(ctx context.Context, sourceURL string, targetURL string, encKeyDB map[string][]prefixSSEPair) URLs {
// Extract alias before fiddling with the clientURL.
sourceAlias, _, _ := mustExpandAlias(sourceURL)
// Find alias and expanded clientURL.
targetAlias, targetURL, _ := mustExpandAlias(targetURL)
_, sourceContent, err := url2Stat(sourceURL, false, encKeyDB)
_, sourceContent, err := url2Stat(ctx, sourceURL, false, encKeyDB)
if err != nil {
// Source does not exist or insufficient privileges.
return URLs{Error: err.Trace(sourceURL)}
@@ -150,7 +150,7 @@ func makeCopyContentTypeB(sourceAlias string, sourceContent *ClientContent, targ
// SINGLE SOURCE - Type C: copy(d1..., d2) -> []copy(d1/f, d1/d2/f) -> []A
// prepareCopyRecursiveURLTypeC - prepares target and source clientURLs for copying.
func prepareCopyURLsTypeC(sourceURL, targetURL string, isRecursive bool, encKeyDB map[string][]prefixSSEPair) <-chan URLs {
func prepareCopyURLsTypeC(ctx context.Context, sourceURL, targetURL string, isRecursive bool, encKeyDB map[string][]prefixSSEPair) <-chan URLs {
// Extract alias before fiddling with the clientURL.
sourceAlias, _, _ := mustExpandAlias(sourceURL)
// Find alias and expanded clientURL.
@@ -166,7 +166,7 @@ func prepareCopyURLsTypeC(sourceURL, targetURL string, isRecursive bool, encKeyD
}
isIncomplete := false
for sourceContent := range sourceClient.List(isRecursive, isIncomplete, false, DirNone) {
for sourceContent := range sourceClient.List(ctx, isRecursive, isIncomplete, false, DirNone) {
if sourceContent.Err != nil {
// Listing failed.
copyURLsCh <- URLs{Error: sourceContent.Err.Trace(sourceClient.GetURL().String())}
@@ -192,18 +192,6 @@ func makeCopyContentTypeC(sourceAlias string, sourceURL ClientURL, sourceContent
newSourceSuffix := filepath.ToSlash(newSourceURL.Path)
if pathSeparatorIndex > 1 {
sourcePrefix := filepath.ToSlash(sourceURL.Path[:pathSeparatorIndex])
// do not preserve unix cp behavior when copying a filesytem dir to
// objectstore.
if sourceAlias == "" && targetAlias != "" {
// Check if sourceURL.Path is a directory or not
fileInfo, err := os.Stat(sourceURL.Path)
if err != nil {
return URLs{Error: probe.NewError(err)}
}
if fileInfo.IsDir() {
sourcePrefix = filepath.ToSlash(sourceURL.Path)
}
}
newSourceSuffix = strings.TrimPrefix(newSourceSuffix, sourcePrefix)
}
newTargetURL := urlJoinPath(targetURL, newSourceSuffix)
@@ -212,12 +200,12 @@ func makeCopyContentTypeC(sourceAlias string, sourceURL ClientURL, sourceContent
// MULTI-SOURCE - Type D: copy([](f|d...), d) -> []B
// prepareCopyURLsTypeE - prepares target and source clientURLs for copying.
func prepareCopyURLsTypeD(sourceURLs []string, targetURL string, isRecursive bool, encKeyDB map[string][]prefixSSEPair) <-chan URLs {
func prepareCopyURLsTypeD(ctx context.Context, sourceURLs []string, targetURL string, isRecursive bool, encKeyDB map[string][]prefixSSEPair) <-chan URLs {
copyURLsCh := make(chan URLs)
go func(sourceURLs []string, targetURL string, copyURLsCh chan URLs) {
defer close(copyURLsCh)
for _, sourceURL := range sourceURLs {
for cpURLs := range prepareCopyURLsTypeC(sourceURL, targetURL, isRecursive, encKeyDB) {
for cpURLs := range prepareCopyURLsTypeC(ctx, sourceURL, targetURL, isRecursive, encKeyDB) {
copyURLsCh <- cpURLs
}
}
@@ -226,24 +214,24 @@ func prepareCopyURLsTypeD(sourceURLs []string, targetURL string, isRecursive boo
}
// prepareCopyURLs - prepares target and source clientURLs for copying.
func prepareCopyURLs(sourceURLs []string, targetURL string, isRecursive bool, encKeyDB map[string][]prefixSSEPair, olderThan, newerThan string) chan URLs {
func prepareCopyURLs(ctx context.Context, sourceURLs []string, targetURL string, isRecursive bool, encKeyDB map[string][]prefixSSEPair, olderThan, newerThan string) chan URLs {
copyURLsCh := make(chan URLs)
go func(sourceURLs []string, targetURL string, copyURLsCh chan URLs, encKeyDB map[string][]prefixSSEPair) {
defer close(copyURLsCh)
cpType, err := guessCopyURLType(sourceURLs, targetURL, isRecursive, encKeyDB)
cpType, err := guessCopyURLType(ctx, sourceURLs, targetURL, isRecursive, encKeyDB)
fatalIf(err.Trace(), "Unable to guess the type of copy operation.")
switch cpType {
case copyURLsTypeA:
copyURLsCh <- prepareCopyURLsTypeA(sourceURLs[0], targetURL, encKeyDB)
copyURLsCh <- prepareCopyURLsTypeA(ctx, sourceURLs[0], targetURL, encKeyDB)
case copyURLsTypeB:
copyURLsCh <- prepareCopyURLsTypeB(sourceURLs[0], targetURL, encKeyDB)
copyURLsCh <- prepareCopyURLsTypeB(ctx, sourceURLs[0], targetURL, encKeyDB)
case copyURLsTypeC:
for cURLs := range prepareCopyURLsTypeC(sourceURLs[0], targetURL, isRecursive, encKeyDB) {
for cURLs := range prepareCopyURLsTypeC(ctx, sourceURLs[0], targetURL, isRecursive, encKeyDB) {
copyURLsCh <- cURLs
}
case copyURLsTypeD:
for cURLs := range prepareCopyURLsTypeD(sourceURLs, targetURL, isRecursive, encKeyDB) {
for cURLs := range prepareCopyURLsTypeD(ctx, sourceURLs, targetURL, isRecursive, encKeyDB) {
copyURLsCh <- cURLs
}
default:
+20 -16
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"fmt"
"strings"
@@ -90,7 +91,7 @@ func (d diffMessage) String() string {
msg = console.Colorize("DiffSize", "! "+d.SecondURL)
case differInMetadata:
msg = console.Colorize("DiffMetadata", "! "+d.SecondURL)
case differInMMSourceMTime:
case differInAASourceMTime:
msg = console.Colorize("DiffMMSourceMTime", "! "+d.SecondURL)
default:
fatalIf(errDummy().Trace(d.FirstURL, d.SecondURL),
@@ -109,23 +110,23 @@ func (d diffMessage) JSON() string {
return string(diffJSONBytes)
}
func checkDiffSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
if len(ctx.Args()) != 2 {
cli.ShowCommandHelpAndExit(ctx, "diff", 1) // last argument is exit code
func checkDiffSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
if len(cliCtx.Args()) != 2 {
cli.ShowCommandHelpAndExit(cliCtx, "diff", 1) // last argument is exit code
}
for _, arg := range ctx.Args() {
for _, arg := range cliCtx.Args() {
if strings.TrimSpace(arg) == "" {
fatalIf(errInvalidArgument().Trace(ctx.Args()...), "Unable to validate empty argument.")
fatalIf(errInvalidArgument().Trace(cliCtx.Args()...), "Unable to validate empty argument.")
}
}
URLs := ctx.Args()
URLs := cliCtx.Args()
firstURL := URLs[0]
secondURL := URLs[1]
// Diff only works between two directories, verify them below.
// Verify if firstURL is accessible.
_, firstContent, err := url2Stat(firstURL, false, encKeyDB)
_, firstContent, err := url2Stat(ctx, firstURL, false, encKeyDB)
if err != nil {
fatalIf(err.Trace(firstURL), fmt.Sprintf("Unable to stat '%s'.", firstURL))
}
@@ -136,7 +137,7 @@ func checkDiffSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
}
// Verify if secondURL is accessible.
_, secondContent, err := url2Stat(secondURL, false, encKeyDB)
_, secondContent, err := url2Stat(ctx, secondURL, false, encKeyDB)
if err != nil {
fatalIf(err.Trace(secondURL), fmt.Sprintf("Unable to stat '%s'.", secondURL))
}
@@ -148,7 +149,7 @@ func checkDiffSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
}
// doDiffMain runs the diff.
func doDiffMain(firstURL, secondURL string) error {
func doDiffMain(ctx context.Context, firstURL, secondURL string) error {
// Source and targets are always directories
sourceSeparator := string(newClientURL(firstURL).Separator)
if !strings.HasSuffix(firstURL, sourceSeparator) {
@@ -176,7 +177,7 @@ func doDiffMain(firstURL, secondURL string) error {
}
// Diff first and second urls.
for diffMsg := range objectDifference(firstClient, secondClient, firstURL, secondURL, false) {
for diffMsg := range objectDifference(ctx, firstClient, secondClient, firstURL, secondURL, true) {
if diffMsg.Error != nil {
errorIf(diffMsg.Error, "Unable to calculate objects difference.")
// Ignore error and proceed to next object.
@@ -189,13 +190,16 @@ func doDiffMain(firstURL, secondURL string) error {
}
// mainDiff main for 'diff'.
func mainDiff(ctx *cli.Context) error {
func mainDiff(cliCtx *cli.Context) error {
ctx, cancelDiff := context.WithCancel(globalContext)
defer cancelDiff()
// Parse encryption keys per command.
encKeyDB, err := getEncKeys(ctx)
encKeyDB, err := getEncKeys(cliCtx)
fatalIf(err, "Unable to parse encryption keys.")
// check 'diff' cli arguments.
checkDiffSyntax(ctx, encKeyDB)
checkDiffSyntax(ctx, cliCtx, encKeyDB)
// Additional command specific theme customization.
console.SetColor("DiffMessage", color.New(color.FgGreen, color.Bold))
@@ -206,9 +210,9 @@ func mainDiff(ctx *cli.Context) error {
console.SetColor("DiffMetadata", color.New(color.FgYellow, color.Bold))
console.SetColor("DiffMMSourceMTime", color.New(color.FgYellow, color.Bold))
URLs := ctx.Args()
URLs := cliCtx.Args()
firstURL := URLs.Get(0)
secondURL := URLs.Get(1)
return doDiffMain(firstURL, secondURL)
return doDiffMain(ctx, firstURL, secondURL)
}
+69 -39
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"strings"
"time"
"unicode/utf8"
@@ -24,7 +25,7 @@ import (
// golang does not support flat keys for path matching, find does
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v6"
"github.com/minio/minio-go/v7"
"golang.org/x/text/unicode/norm"
)
@@ -38,7 +39,7 @@ const (
differInType // differs in type, exfile/directory
differInFirst // only in source (FIRST)
differInSecond // only in target (SECOND)
differInMMSourceMTime // differs in multi-master source modtime
differInAASourceMTime // differs in active-active source modtime
)
func (d differType) String() string {
@@ -49,7 +50,7 @@ func (d differType) String() string {
return "size"
case differInMetadata:
return "metadata"
case differInMMSourceMTime:
case differInAASourceMTime:
return "mm-source-mtime"
case differInType:
return "type"
@@ -61,25 +62,27 @@ func (d differType) String() string {
return "unknown"
}
const multiMasterSourceModTimeKey = "X-Amz-Meta-Mm-Source-Mtime"
const activeActiveSourceModTimeKey = "X-Amz-Meta-Mm-Source-Mtime"
func oldestNonNullTime(t1, t2 time.Time) time.Time {
if t1.IsZero() {
return t2
func getSourceModTimeKey(metadata map[string]string) string {
if metadata[activeActiveSourceModTimeKey] != "" {
return metadata[activeActiveSourceModTimeKey]
}
if t2.IsZero() {
return t1
if metadata[strings.ToLower(activeActiveSourceModTimeKey)] != "" {
return metadata[strings.ToLower(activeActiveSourceModTimeKey)]
}
if t1.Before(t2) {
return t1
if metadata[strings.ToLower("Mm-Source-Mtime")] != "" {
return metadata[strings.ToLower("Mm-Source-Mtime")]
}
return t2
if metadata["Mm-Source-Mtime"] != "" {
return metadata["Mm-Source-Mtime"]
}
return ""
}
// multiMasterModTimeUpdated tries to calculate if the object copy in the target
// activeActiveModTimeUpdated tries to calculate if the object copy in the target
// is older than the one in the source by comparing the modtime of the data.
func multiMasterModTimeUpdated(src, dst *ClientContent) bool {
func activeActiveModTimeUpdated(src, dst *ClientContent) bool {
if src == nil || dst == nil {
return false
}
@@ -91,25 +94,49 @@ func multiMasterModTimeUpdated(src, dst *ClientContent) bool {
return false
}
_, ok1 := src.UserMetadata[multiMasterSourceModTimeKey]
_, ok2 := dst.UserMetadata[multiMasterSourceModTimeKey]
if !ok1 && !ok2 {
// No multimaster context found, consider src & dst as similar
srcModTime := getSourceModTimeKey(src.UserMetadata)
dstModTime := getSourceModTimeKey(dst.UserMetadata)
if srcModTime == "" && dstModTime == "" {
// No active-active mirror context found, consider src & dst as similar
return false
}
srcOriginLastModified, _ := time.Parse(time.RFC3339Nano, src.UserMetadata[multiMasterSourceModTimeKey])
dstOriginLastModified, _ := time.Parse(time.RFC3339Nano, dst.UserMetadata[multiMasterSourceModTimeKey])
var srcOriginLastModified, dstOriginLastModified time.Time
var err error
if srcModTime != "" {
srcOriginLastModified, err = time.Parse(time.RFC3339Nano, srcModTime)
if err != nil {
// failure to parse source modTime, modTime tampered ignore the file
return false
}
}
if dstModTime != "" {
dstOriginLastModified, err = time.Parse(time.RFC3339Nano, dstModTime)
if err != nil {
// failure to parse source modTime, modTime tampered ignore the file
return false
}
}
srcActualModTime := oldestNonNullTime(src.Time, srcOriginLastModified)
dstActualModTime := oldestNonNullTime(dst.Time, dstOriginLastModified)
srcActualModTime := src.Time
if !srcOriginLastModified.IsZero() && srcOriginLastModified.After(src.Time) {
srcActualModTime = srcOriginLastModified
}
dstActualModTime := dst.Time
if !dstOriginLastModified.IsZero() && dstOriginLastModified.After(dst.Time) {
dstActualModTime = dstOriginLastModified
}
return srcActualModTime.After(dstActualModTime)
}
func metadataEqual(m1, m2 map[string]string) bool {
for k, v := range m1 {
if k == multiMasterSourceModTimeKey {
if k == activeActiveSourceModTimeKey {
continue
}
if k == strings.ToLower(activeActiveSourceModTimeKey) {
continue
}
if m2[k] != v {
@@ -117,7 +144,10 @@ func metadataEqual(m1, m2 map[string]string) bool {
}
}
for k, v := range m2 {
if k == multiMasterSourceModTimeKey {
if k == activeActiveSourceModTimeKey {
continue
}
if k == strings.ToLower(activeActiveSourceModTimeKey) {
continue
}
if m1[k] != v {
@@ -127,19 +157,19 @@ func metadataEqual(m1, m2 map[string]string) bool {
return true
}
func objectDifference(sourceClnt, targetClnt Client, sourceURL, targetURL string, isMetadata bool) (diffCh chan diffMessage) {
return difference(sourceClnt, targetClnt, sourceURL, targetURL, isMetadata, true, false, DirNone)
func objectDifference(ctx context.Context, sourceClnt, targetClnt Client, sourceURL, targetURL string, isMetadata bool) (diffCh chan diffMessage) {
return difference(ctx, sourceClnt, targetClnt, sourceURL, targetURL, isMetadata, true, false, DirNone)
}
func dirDifference(sourceClnt, targetClnt Client, sourceURL, targetURL string) (diffCh chan diffMessage) {
return difference(sourceClnt, targetClnt, sourceURL, targetURL, false, false, true, DirFirst)
func dirDifference(ctx context.Context, sourceClnt, targetClnt Client, sourceURL, targetURL string) (diffCh chan diffMessage) {
return difference(ctx, sourceClnt, targetClnt, sourceURL, targetURL, false, false, true, DirFirst)
}
func differenceInternal(sourceClnt, targetClnt Client, sourceURL, targetURL string, isMetadata bool, isRecursive, returnSimilar bool, dirOpt DirOpt, diffCh chan<- diffMessage) *probe.Error {
func differenceInternal(ctx context.Context, sourceClnt, targetClnt Client, sourceURL, targetURL string, isMetadata bool, isRecursive, returnSimilar bool, dirOpt DirOpt, diffCh chan<- diffMessage) *probe.Error {
// Set default values for listing.
isIncomplete := false // we will not compare any incomplete objects.
srcCh := sourceClnt.List(isRecursive, isIncomplete, isMetadata, dirOpt)
tgtCh := targetClnt.List(isRecursive, isIncomplete, isMetadata, dirOpt)
srcCh := sourceClnt.List(ctx, isRecursive, isIncomplete, isMetadata, dirOpt)
tgtCh := targetClnt.List(ctx, isRecursive, isIncomplete, isMetadata, dirOpt)
srcCtnt, srcOk := <-srcCh
tgtCtnt, tgtOk := <-tgtCh
@@ -245,11 +275,11 @@ func differenceInternal(sourceClnt, targetClnt Client, sourceURL, targetURL stri
firstContent: srcCtnt,
secondContent: tgtCtnt,
}
} else if multiMasterModTimeUpdated(srcCtnt, tgtCtnt) {
} else if activeActiveModTimeUpdated(srcCtnt, tgtCtnt) {
diffCh <- diffMessage{
FirstURL: srcCtnt.URL.String(),
SecondURL: tgtCtnt.URL.String(),
Diff: differInMMSourceMTime,
Diff: differInAASourceMTime,
firstContent: srcCtnt,
secondContent: tgtCtnt,
}
@@ -296,17 +326,17 @@ func differenceInternal(sourceClnt, targetClnt Client, sourceURL, targetURL stri
// objectDifference function finds the difference between all objects
// recursively in sorted order from source and target.
func difference(sourceClnt, targetClnt Client, sourceURL, targetURL string, isMetadata bool, isRecursive, returnSimilar bool, dirOpt DirOpt) (diffCh chan diffMessage) {
func difference(ctx context.Context, sourceClnt, targetClnt Client, sourceURL, targetURL string, isMetadata bool, isRecursive, returnSimilar bool, dirOpt DirOpt) (diffCh chan diffMessage) {
diffCh = make(chan diffMessage, 10000)
go func() {
defer close(diffCh)
doneCh := make(chan struct{}, 1)
defer close(doneCh)
retryCtx, cancel := context.WithCancel(ctx)
defer cancel()
for range newRetryTimerContinous(time.Second, time.Second*30, minio.MaxJitter, doneCh) {
err := differenceInternal(sourceClnt, targetClnt, sourceURL, targetURL,
for range newRetryTimerContinous(retryCtx, time.Second, time.Second*30, minio.MaxJitter) {
err := differenceInternal(retryCtx, sourceClnt, targetClnt, sourceURL, targetURL,
isMetadata, isRecursive, returnSimilar, dirOpt, diffCh)
if err != nil {
// handle this specifically for filesystem related errors.
+1 -1
View File
@@ -107,7 +107,7 @@ func du(urlStr string, depth int, encKeyDB map[string][]prefixSSEPair) (int64, e
isRecursive := false
isIncomplete := false
contentCh := clnt.List(isRecursive, isIncomplete, false, DirFirst)
contentCh := clnt.List(globalContext, isRecursive, isIncomplete, false, DirFirst)
size := int64(0)
for content := range contentCh {
if content.Err != nil {
+12 -8
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"strings"
"github.com/fatih/color"
@@ -104,19 +105,22 @@ func (u eventAddMessage) String() string {
return msg
}
func mainEventAdd(ctx *cli.Context) error {
func mainEventAdd(cliCtx *cli.Context) error {
ctx, cancelEventAdd := context.WithCancel(globalContext)
defer cancelEventAdd()
console.SetColor("Event", color.New(color.FgGreen, color.Bold))
checkEventAddSyntax(ctx)
checkEventAddSyntax(cliCtx)
args := ctx.Args()
args := cliCtx.Args()
path := args[0]
arn := args[1]
ignoreExisting := ctx.Bool("p")
ignoreExisting := cliCtx.Bool("p")
event := strings.Split(ctx.String("event"), ",")
prefix := ctx.String("prefix")
suffix := ctx.String("suffix")
event := strings.Split(cliCtx.String("event"), ",")
prefix := cliCtx.String("prefix")
suffix := cliCtx.String("suffix")
client, err := newClient(path)
if err != nil {
@@ -128,7 +132,7 @@ func mainEventAdd(ctx *cli.Context) error {
fatalIf(errDummy().Trace(), "The provided url doesn't point to a S3 server.")
}
err = s3Client.AddNotificationConfig(arn, event, prefix, suffix, ignoreExisting)
err = s3Client.AddNotificationConfig(ctx, arn, event, prefix, suffix, ignoreExisting)
fatalIf(err, "Cannot enable notification on the specified bucket.")
printMsg(eventAddMessage{
ARN: arn,
+8 -4
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"fmt"
"github.com/fatih/color"
@@ -96,14 +97,17 @@ func (u eventListMessage) String() string {
return msg
}
func mainEventList(ctx *cli.Context) error {
func mainEventList(cliCtx *cli.Context) error {
ctx, cancelEventList := context.WithCancel(globalContext)
defer cancelEventList()
console.SetColor("ARN", color.New(color.FgGreen, color.Bold))
console.SetColor("Event", color.New(color.FgCyan, color.Bold))
console.SetColor("Filter", color.New(color.Bold))
checkEventListSyntax(ctx)
checkEventListSyntax(cliCtx)
args := ctx.Args()
args := cliCtx.Args()
path := args[0]
arn := ""
if len(args) > 1 {
@@ -120,7 +124,7 @@ func mainEventList(ctx *cli.Context) error {
fatalIf(errDummy().Trace(), "The provided url doesn't point to a S3 server.")
}
configs, err := s3Client.ListNotificationConfigs(arn)
configs, err := s3Client.ListNotificationConfigs(ctx, arn)
fatalIf(err, "Cannot list notifications on the specified bucket.")
for _, config := range configs {
+11 -12
View File
@@ -17,10 +17,9 @@
package cmd
import (
"context"
"errors"
"github.com/minio/minio-go/v6"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/mc/pkg/colorjson"
@@ -102,12 +101,15 @@ func (u eventRemoveMessage) String() string {
return msg
}
func mainEventRemove(ctx *cli.Context) error {
func mainEventRemove(cliCtx *cli.Context) error {
ctx, cancelEventRemove := context.WithCancel(globalContext)
defer cancelEventRemove()
console.SetColor("Event", color.New(color.FgGreen, color.Bold))
checkEventRemoveSyntax(ctx)
checkEventRemoveSyntax(cliCtx)
args := ctx.Args()
args := cliCtx.Args()
path := args.Get(0)
arn := ""
@@ -126,15 +128,12 @@ func mainEventRemove(ctx *cli.Context) error {
}
// flags for the attributes of the even
event := ctx.String("event")
prefix := ctx.String("prefix")
suffix := ctx.String("suffix")
event := cliCtx.String("event")
prefix := cliCtx.String("prefix")
suffix := cliCtx.String("suffix")
err = s3Client.RemoveNotificationConfig(arn, event, prefix, suffix)
err = s3Client.RemoveNotificationConfig(ctx, arn, event, prefix, suffix)
if err != nil {
if err.Cause == minio.ErrNoNotificationConfigMatch {
fatalIf(err, "Remove event failed.")
}
fatalIf(err, "Cannot disable notification on the specified bucket.")
}
+32 -28
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"strings"
humanize "github.com/dustin/go-humanize"
@@ -154,8 +155,8 @@ EXAMPLES:
}
// checkFindSyntax - validate the passed arguments
func checkFindSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
args := ctx.Args()
func checkFindSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
args := cliCtx.Args()
if !args.Present() {
args = []string{"./"} // No args just default to present directory.
} else if args.Get(0) == "." {
@@ -170,10 +171,10 @@ func checkFindSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
// Extract input URLs and validate.
for _, url := range args {
_, _, err := url2Stat(url, false, encKeyDB)
_, _, err := url2Stat(ctx, url, false, encKeyDB)
if err != nil && !isURLPrefixExists(url, false) {
// Bucket name empty is a valid error for 'find myminio' unless we are using watch, treat it as such.
if _, ok := err.ToGoError().(BucketNameEmpty); ok && !ctx.Bool("watch") {
if _, ok := err.ToGoError().(BucketNameEmpty); ok && !cliCtx.Bool("watch") {
continue
}
fatalIf(err.Trace(url), "Unable to stat `"+url+"`.")
@@ -207,18 +208,21 @@ type findContext struct {
}
// mainFind - handler for mc find commands
func mainFind(ctx *cli.Context) error {
func mainFind(cliCtx *cli.Context) error {
ctx, cancelFind := context.WithCancel(globalContext)
defer cancelFind()
// Additional command specific theme customization.
console.SetColor("Find", color.New(color.FgGreen, color.Bold))
console.SetColor("FindExecErr", color.New(color.FgRed, color.Italic, color.Bold))
// Parse encryption keys per command.
encKeyDB, err := getEncKeys(ctx)
encKeyDB, err := getEncKeys(cliCtx)
fatalIf(err, "Unable to parse encryption keys.")
checkFindSyntax(ctx, encKeyDB)
checkFindSyntax(ctx, cliCtx, encKeyDB)
args := ctx.Args()
args := cliCtx.Args()
if !args.Present() {
args = []string{"./"} // Not args present default to present directory.
} else if args.Get(0) == "." {
@@ -230,11 +234,11 @@ func mainFind(ctx *cli.Context) error {
var olderThan, newerThan string
if ctx.String("older-than") != "" {
olderThan = ctx.String("older-than")
if cliCtx.String("older-than") != "" {
olderThan = cliCtx.String("older-than")
}
if ctx.String("newer-than") != "" {
newerThan = ctx.String("newer-than")
if cliCtx.String("newer-than") != "" {
newerThan = cliCtx.String("newer-than")
}
// Use 'e' to indicate Go error, this is a convention followed in `mc`. For probe.Error we call it
@@ -242,14 +246,14 @@ func mainFind(ctx *cli.Context) error {
var e error
var largerSize, smallerSize uint64
if ctx.String("larger") != "" {
largerSize, e = humanize.ParseBytes(ctx.String("larger"))
fatalIf(probe.NewError(e).Trace(ctx.String("larger")), "Unable to parse input bytes.")
if cliCtx.String("larger") != "" {
largerSize, e = humanize.ParseBytes(cliCtx.String("larger"))
fatalIf(probe.NewError(e).Trace(cliCtx.String("larger")), "Unable to parse input bytes.")
}
if ctx.String("smaller") != "" {
smallerSize, e = humanize.ParseBytes(ctx.String("smaller"))
fatalIf(probe.NewError(e).Trace(ctx.String("smaller")), "Unable to parse input bytes.")
if cliCtx.String("smaller") != "" {
smallerSize, e = humanize.ParseBytes(cliCtx.String("smaller"))
fatalIf(probe.NewError(e).Trace(cliCtx.String("smaller")), "Unable to parse input bytes.")
}
targetAlias, _, hostCfg, err := expandAlias(args[0])
@@ -260,20 +264,20 @@ func mainFind(ctx *cli.Context) error {
targetFullURL = hostCfg.URL
}
return doFind(&findContext{
Context: ctx,
maxDepth: ctx.Uint("maxdepth"),
execCmd: ctx.String("exec"),
printFmt: ctx.String("print"),
namePattern: ctx.String("name"),
pathPattern: ctx.String("path"),
regexPattern: ctx.String("regex"),
ignorePattern: ctx.String("ignore"),
return doFind(ctx, &findContext{
Context: cliCtx,
maxDepth: cliCtx.Uint("maxdepth"),
execCmd: cliCtx.String("exec"),
printFmt: cliCtx.String("print"),
namePattern: cliCtx.String("name"),
pathPattern: cliCtx.String("path"),
regexPattern: cliCtx.String("regex"),
ignorePattern: cliCtx.String("ignore"),
olderThan: olderThan,
newerThan: newerThan,
largerSize: largerSize,
smallerSize: smallerSize,
watch: ctx.Bool("watch"),
watch: cliCtx.Bool("watch"),
targetAlias: targetAlias,
targetURL: args[0],
targetFullURL: targetFullURL,
+18 -17
View File
@@ -18,6 +18,7 @@ package cmd
import (
"bytes"
"context"
"os"
"os/exec"
"path/filepath"
@@ -131,7 +132,7 @@ func execFind(command string) {
// watchFind - enables listening on the input path, listens for all file/object
// created actions. Asynchronously executes the input command line, also allows
// formatting for the command line in accordance with subsititution arguments.
func watchFind(ctx *findContext) {
func watchFind(ctxCtx context.Context, ctx *findContext) {
// Watch is not enabled, return quickly.
if !ctx.watch {
return
@@ -140,7 +141,7 @@ func watchFind(ctx *findContext) {
Recursive: true,
Events: []string{"put"},
}
watchObj, err := ctx.clnt.Watch(options)
watchObj, err := ctx.clnt.Watch(ctxCtx, options)
fatalIf(err.Trace(ctx.targetAlias), "Cannot watch with given options.")
// Loop until user CTRL-C the command line.
@@ -162,7 +163,7 @@ func watchFind(ctx *findContext) {
continue
}
find(ctx, contentMessage{
find(ctxCtx, ctx, contentMessage{
Key: getAliasedPath(ctx, event.Path),
Time: time,
Size: event.Size,
@@ -220,7 +221,7 @@ func getAliasedPath(ctx *findContext, path string) string {
return trimSuffixAtMaxDepth(ctx.targetURL, aliasedPath, separator, ctx.maxDepth)
}
func find(ctx *findContext, fileContent contentMessage) {
func find(ctxCtx context.Context, ctx *findContext, fileContent contentMessage) {
// Match the incoming content, didn't match return.
if !matchFind(ctx, fileContent) {
return
@@ -228,27 +229,27 @@ func find(ctx *findContext, fileContent contentMessage) {
// proceed to either exec, format the output string.
if ctx.execCmd != "" {
execFind(stringsReplace(ctx.execCmd, fileContent))
execFind(stringsReplace(ctxCtx, ctx.execCmd, fileContent))
return
}
if ctx.printFmt != "" {
fileContent.Key = stringsReplace(ctx.printFmt, fileContent)
fileContent.Key = stringsReplace(ctxCtx, ctx.printFmt, fileContent)
}
printMsg(findMessage{fileContent})
}
// doFind - find is main function body which interprets and executes
// all the input parameters.
func doFind(ctx *findContext) error {
func doFind(ctxCtx context.Context, ctx *findContext) error {
// If watch is enabled we will wait on the prefix perpetually
// for all I/O events until canceled by user, if watch is not enabled
// following defer is a no-op.
defer watchFind(ctx)
defer watchFind(ctxCtx, ctx)
var prevKeyName string
// iterate over all content which is within the given directory
for content := range ctx.clnt.List(true, false, false, DirNone) {
for content := range ctx.clnt.List(globalContext, true, false, false, DirNone) {
if content.Err != nil {
switch content.Err.ToGoError().(type) {
// handle this specifically for filesystem related errors.
@@ -288,11 +289,11 @@ func doFind(ctx *findContext) error {
// proceed to either exec, format the output string.
if ctx.execCmd != "" {
execFind(stringsReplace(ctx.execCmd, fileContent))
execFind(stringsReplace(ctxCtx, ctx.execCmd, fileContent))
continue
}
if ctx.printFmt != "" {
fileContent.Key = stringsReplace(ctx.printFmt, fileContent)
fileContent.Key = stringsReplace(ctxCtx, ctx.printFmt, fileContent)
}
printMsg(findMessage{fileContent})
@@ -305,7 +306,7 @@ func doFind(ctx *findContext) error {
// stringsReplace - formats the string to remove {} and replace each
// with the appropriate argument
func stringsReplace(args string, fileContent contentMessage) string {
func stringsReplace(ctx context.Context, args string, fileContent contentMessage) string {
// replace all instances of {}
str := args
if strings.Contains(str, "{}") {
@@ -359,12 +360,12 @@ func stringsReplace(args string, fileContent contentMessage) string {
// replace all instances of {url}
if strings.Contains(str, "{url}") {
str = strings.Replace(str, "{url}", getShareURL(fileContent.Key), -1)
str = strings.Replace(str, "{url}", getShareURL(ctx, fileContent.Key), -1)
}
// replace all instances of {"url"}
if strings.Contains(str, `{"url"}`) {
str = strings.Replace(str, `{"url"}`, strconv.Quote(getShareURL(fileContent.Key)), -1)
str = strings.Replace(str, `{"url"}`, strconv.Quote(getShareURL(ctx, fileContent.Key)), -1)
}
return str
@@ -414,14 +415,14 @@ var defaultSevenDays = time.Duration(604800) * time.Second
// getShareURL is used in conjunction with the {url} substitution
// argument to generate and return presigned URLs, returns error if any.
func getShareURL(path string) string {
func getShareURL(ctx context.Context, path string) string {
targetAlias, targetURLFull, _, err := expandAlias(path)
fatalIf(err.Trace(path), "Unable to expand alias.")
clnt, err := newClientFromAlias(targetAlias, targetURLFull)
fatalIf(err.Trace(targetAlias, targetURLFull), "Unable to initialize client instance from alias.")
content, err := clnt.Stat(false, false, nil)
content, err := clnt.Stat(ctx, false, false, nil)
fatalIf(err.Trace(targetURLFull, targetAlias), "Unable to lookup file/object.")
// Skip if its a directory.
@@ -434,7 +435,7 @@ func getShareURL(path string) string {
fatalIf(err.Trace(targetAlias, objectURL), "Unable to initialize new client from alias.")
// Set default expiry for each url (point of no longer valid), to be 7 days
shareURL, err := newClnt.ShareDownload(defaultSevenDays)
shareURL, err := newClnt.ShareDownload(ctx, defaultSevenDays)
fatalIf(err.Trace(targetAlias, objectURL), "Unable to generate share url.")
return shareURL
+2 -1
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"os/exec"
"strings"
"testing"
@@ -410,7 +411,7 @@ func TestStringReplace(t *testing.T) {
},
}
for i, testCase := range testCases {
gotStr := stringsReplace(testCase.str, testCase.content)
gotStr := stringsReplace(context.Background(), testCase.str, testCase.content)
if gotStr != testCase.expectedStr {
t.Errorf("Test %d: Expected %s, got %s", i+1, testCase.expectedStr, gotStr)
}
+5 -5
View File
@@ -83,11 +83,11 @@ func setGlobals(quiet, debug, json, noColor, insecure bool) {
// Set global states. NOTE: It is deliberately kept monolithic to ensure we dont miss out any flags.
func setGlobalsFromContext(ctx *cli.Context) error {
quiet := ctx.IsSet("quiet")
debug := ctx.IsSet("debug")
json := ctx.IsSet("json")
noColor := ctx.IsSet("no-color")
insecure := ctx.IsSet("insecure")
quiet := ctx.IsSet("quiet") || ctx.GlobalIsSet("quiet")
debug := ctx.IsSet("debug") || ctx.GlobalIsSet("debug")
json := ctx.IsSet("json") || ctx.GlobalIsSet("json")
noColor := ctx.IsSet("no-color") || ctx.GlobalIsSet("no-color")
insecure := ctx.IsSet("insecure") || ctx.GlobalIsSet("insecure")
setGlobals(quiet, debug, json, noColor, insecure)
return nil
}
+2 -1
View File
@@ -20,6 +20,7 @@ import (
"bufio"
"compress/bzip2"
"compress/gzip"
"context"
"io"
"io/ioutil"
"os"
@@ -84,7 +85,7 @@ func headURL(sourceURL string, encKeyDB map[string][]prefixSSEPair, nlines int64
default:
var err *probe.Error
var metadata map[string]string
if reader, metadata, err = getSourceStreamMetadataFromURL(sourceURL, encKeyDB); err != nil {
if reader, metadata, err = getSourceStreamMetadataFromURL(context.Background(), sourceURL, encKeyDB); err != nil {
return err.Trace(sourceURL)
}
ctype := metadata["Content-Type"]
+13 -8
View File
@@ -17,6 +17,8 @@
package cmd
import (
"context"
"github.com/minio/cli"
"github.com/minio/mc/cmd/ilm"
json "github.com/minio/mc/pkg/colorjson"
@@ -51,7 +53,7 @@ EXAMPLES:
2. Add rule for testbucket on s3. Both expiry and transition are number of days.
{{.Prompt}} {{.HelpName}} --id "Docs" --prefix "doc/" \
--expiry-days "200" --transition-days "300 days" \
--expiry-days "300" --transition-days "200" \
--storage-class "GLACIER" s3/testbucket
3. Add rule for testbucket on s3. Only expiry is given as number of days and transition is not set.
@@ -129,30 +131,33 @@ func checkILMAddSyntax(ctx *cli.Context) {
}
// Calls SetBucketLifecycle with the XML representation of lifecycleConfiguration type.
func mainILMAdd(ctx *cli.Context) error {
checkILMAddSyntax(ctx)
func mainILMAdd(cliCtx *cli.Context) error {
ctx, cancelILMAdd := context.WithCancel(globalContext)
defer cancelILMAdd()
checkILMAddSyntax(cliCtx)
setILMDisplayColorScheme()
args := ctx.Args()
args := cliCtx.Args()
urlStr := args.Get(0)
client, err := newClient(urlStr)
fatalIf(err.Trace(urlStr), "Unable to initialize client for "+urlStr)
// Configuration that is already set.
lfcCfg, err := client.GetLifecycle()
lfcCfg, err := client.GetLifecycle(ctx)
fatalIf(err.Trace(args...), "Unable to fetch lifecycle rules for "+urlStr)
// Configuration that needs to be set is returned by ilm.GetILMConfigToSet.
// A new rule is added or the rule (if existing) is replaced
lfcCfg, err = ilm.ApplyNewILMConfig(ctx, lfcCfg)
lfcCfg, err = ilm.ApplyNewILMConfig(cliCtx, lfcCfg)
fatalIf(err.Trace(args...), "Unable to generate new lifecyle rules for the input")
fatalIf(client.SetLifecycle(lfcCfg).Trace(urlStr), "Unable to set new lifecycle rules")
fatalIf(client.SetLifecycle(ctx, lfcCfg).Trace(urlStr), "Unable to set new lifecycle rules")
printMsg(ilmAddMessage{
Status: "success",
Target: urlStr,
ID: ctx.String("id"),
ID: cliCtx.String("id"),
})
return nil
+16 -12
View File
@@ -17,12 +17,13 @@
package cmd
import (
"context"
"errors"
"github.com/minio/cli"
"github.com/minio/mc/cmd/ilm"
json "github.com/minio/mc/pkg/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v7/pkg/lifecycle"
)
var ilmExportCmd = cli.Command{
@@ -50,13 +51,13 @@ EXAMPLES:
}
type ilmExportMessage struct {
Status string `json:"status"`
Target string `json:"target"`
ILMConfig ilm.LifecycleConfiguration `json:"ilmConfig"`
Status string `json:"status"`
Target string `json:"target"`
Config *lifecycle.Configuration `json:"config"`
}
func (i ilmExportMessage) String() string {
msgBytes, e := json.MarshalIndent(i.ILMConfig, "", " ")
msgBytes, e := json.MarshalIndent(i.Config, "", " ")
fatalIf(probe.NewError(e), "Unable to export ILM configuration")
return string(msgBytes)
@@ -76,17 +77,20 @@ func checkILMExportSyntax(ctx *cli.Context) {
}
}
func mainILMExport(ctx *cli.Context) error {
checkILMExportSyntax(ctx)
func mainILMExport(cliCtx *cli.Context) error {
ctx, cancelILMExport := context.WithCancel(globalContext)
defer cancelILMExport()
checkILMExportSyntax(cliCtx)
setILMDisplayColorScheme()
args := ctx.Args()
args := cliCtx.Args()
urlStr := args.Get(0)
client, err := newClient(urlStr)
fatalIf(err.Trace(args...), "Unable to initialize client for "+urlStr+".")
ilmCfg, err := client.GetLifecycle()
ilmCfg, err := client.GetLifecycle(ctx)
fatalIf(err.Trace(args...), "Unable to get lifecycle configuration")
if len(ilmCfg.Rules) == 0 {
fatalIf(probe.NewError(errors.New("lifecycle configuration not set")).Trace(urlStr),
@@ -94,9 +98,9 @@ func mainILMExport(ctx *cli.Context) error {
}
printMsg(ilmExportMessage{
Status: "success",
Target: urlStr,
ILMConfig: ilmCfg,
Status: "success",
Target: urlStr,
Config: ilmCfg,
})
return nil
+16 -10
View File
@@ -17,12 +17,13 @@
package cmd
import (
"context"
"os"
"github.com/minio/cli"
"github.com/minio/mc/cmd/ilm"
json "github.com/minio/mc/pkg/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v7/pkg/lifecycle"
"github.com/minio/minio/pkg/console"
)
@@ -66,15 +67,17 @@ func (i ilmImportMessage) JSON() string {
}
// readILMConfig read from stdin, returns XML.
func readILMConfig() (ilm.LifecycleConfiguration, *probe.Error) {
func readILMConfig() (*lifecycle.Configuration, *probe.Error) {
// User is expected to enter the lifecycleConfiguration instance contents in JSON format
var ilmCfg ilm.LifecycleConfiguration
var cfg = lifecycle.NewConfiguration()
// Consume json from STDIN
dec := json.NewDecoder(os.Stdin)
if e := dec.Decode(&ilmCfg); e != nil {
return ilmCfg, probe.NewError(e)
if e := dec.Decode(cfg); e != nil {
return cfg, probe.NewError(e)
}
return ilmCfg, nil
return cfg, nil
}
// checkILMImportSyntax - validate arguments passed by user
@@ -84,11 +87,14 @@ func checkILMImportSyntax(ctx *cli.Context) {
}
}
func mainILMImport(ctx *cli.Context) error {
checkILMImportSyntax(ctx)
func mainILMImport(cliCtx *cli.Context) error {
ctx, cancelILMImport := context.WithCancel(globalContext)
defer cancelILMImport()
checkILMImportSyntax(cliCtx)
setILMDisplayColorScheme()
args := ctx.Args()
args := cliCtx.Args()
urlStr := args.Get(0)
client, err := newClient(urlStr)
@@ -97,7 +103,7 @@ func mainILMImport(ctx *cli.Context) error {
ilmCfg, err := readILMConfig()
fatalIf(err.Trace(args...), "Unable to read ILM configuration")
fatalIf(client.SetLifecycle(ilmCfg).Trace(urlStr), "Unable to set new lifecycle rules")
fatalIf(client.SetLifecycle(ctx, ilmCfg).Trace(urlStr), "Unable to set new lifecycle rules")
printMsg(ilmImportMessage{
Status: "success",
+18 -13
View File
@@ -18,6 +18,7 @@ package cmd
import (
"bytes"
"context"
"errors"
"strconv"
"strings"
@@ -26,6 +27,7 @@ import (
"github.com/minio/mc/cmd/ilm"
json "github.com/minio/mc/pkg/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v7/pkg/lifecycle"
"github.com/minio/minio/pkg/console"
)
@@ -81,10 +83,10 @@ EXAMPLES:
}
type ilmListMessage struct {
Status string `json:"status"`
Target string `json:"target"`
Context *cli.Context `json:"-"`
ILMConfig ilm.LifecycleConfiguration `json:"ilmConfig"`
Status string `json:"status"`
Target string `json:"target"`
Context *cli.Context `json:"-"`
Config *lifecycle.Configuration `json:"config"`
}
func (i ilmListMessage) String() string {
@@ -101,7 +103,7 @@ func (i ilmListMessage) String() string {
var tagRows map[string][]string
var tbl PrettyTable
ilm.PopulateILMDataForDisplay(i.ILMConfig, &hdrLabelIndexMap, &alignedHdrLabels,
ilm.PopulateILMDataForDisplay(i.Config, &hdrLabelIndexMap, &alignedHdrLabels,
&cellDataNoTags, &cellDataWithTags, &tagRows,
showAll, showMinimum, showExpiry, showTransition)
@@ -253,17 +255,20 @@ func getILMRowsWithTags(tbl *PrettyTable, cellDataWithTags *[][]string, newRows
return rows
}
func mainILMList(ctx *cli.Context) error {
checkILMListSyntax(ctx)
func mainILMList(cliCtx *cli.Context) error {
ctx, cancelILMList := context.WithCancel(globalContext)
defer cancelILMList()
checkILMListSyntax(cliCtx)
setILMDisplayColorScheme()
args := ctx.Args()
args := cliCtx.Args()
urlStr := args.Get(0)
client, err := newClient(urlStr)
fatalIf(err.Trace(urlStr), "Unable to initialize client for "+urlStr)
ilmCfg, err := client.GetLifecycle()
ilmCfg, err := client.GetLifecycle(ctx)
fatalIf(err.Trace(args...), "Unable to get lifecycle")
if len(ilmCfg.Rules) == 0 {
@@ -272,10 +277,10 @@ func mainILMList(ctx *cli.Context) error {
}
printMsg(ilmListMessage{
Status: "success",
Target: urlStr,
Context: ctx,
ILMConfig: ilmCfg,
Status: "success",
Target: urlStr,
Context: cliCtx,
Config: ilmCfg,
})
return nil
+16 -12
View File
@@ -17,6 +17,8 @@
package cmd
import (
"context"
"github.com/minio/cli"
"github.com/minio/mc/cmd/ilm"
json "github.com/minio/mc/pkg/colorjson"
@@ -54,7 +56,6 @@ USAGE:
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
DESCRIPTION:
Remove a lifecycle configuration rule for the bucket by ID, optionally you can remove
all the lifecycle rules on a bucket with '--all --force' option.
@@ -63,7 +64,7 @@ EXAMPLES:
1. Remove the lifecycle management configuration rule given by ID "Documents" for testbucket on alias 'myminio'. ID is case sensitive.
{{.Prompt}} {{.HelpName}} --id "Documents" myminio/testbucket
2. Remove ALL the lifecycle management configuration rules for testbucket on alias 'myminio'.
2. Remove ALL the lifecycle management configuration rules for testbucket on alias 'myminio'.
Because the result is complete removal, the use of --force flag is enforced.
{{.Prompt}} {{.HelpName}} --all --force myminio/testbucket
`,
@@ -112,33 +113,36 @@ func checkILMRemoveSyntax(ctx *cli.Context) {
}
}
func mainILMRemove(ctx *cli.Context) error {
checkILMRemoveSyntax(ctx)
func mainILMRemove(cliCtx *cli.Context) error {
ctx, cancelILMImport := context.WithCancel(globalContext)
defer cancelILMImport()
checkILMRemoveSyntax(cliCtx)
setILMDisplayColorScheme()
args := ctx.Args()
args := cliCtx.Args()
urlStr := args.Get(0)
client, err := newClient(urlStr)
fatalIf(err.Trace(args...), "Unable to initialize client for "+urlStr+".")
ilmCfg, err := client.GetLifecycle()
ilmCfg, err := client.GetLifecycle(ctx)
fatalIf(err.Trace(urlStr), "Unable to fetch lifecycle rules")
ilmAll := ctx.Bool("all")
ilmForce := ctx.Bool("force")
ilmAll := cliCtx.Bool("all")
ilmForce := cliCtx.Bool("force")
if ilmAll && ilmForce {
ilmCfg.Rules = nil // Remove all rules
} else {
ilmCfg, err = ilm.RemoveILMRule(ilmCfg, ctx.String("id"))
fatalIf(err.Trace(urlStr, ctx.String("id")), "Unable to remove rule by id")
ilmCfg, err = ilm.RemoveILMRule(ilmCfg, cliCtx.String("id"))
fatalIf(err.Trace(urlStr, cliCtx.String("id")), "Unable to remove rule by id")
}
fatalIf(client.SetLifecycle(ilmCfg).Trace(urlStr), "Unable to set lifecycle rules")
fatalIf(client.SetLifecycle(ctx, ilmCfg).Trace(urlStr), "Unable to set lifecycle rules")
printMsg(ilmRmMessage{
Status: "success",
ID: ctx.String("id"),
ID: cliCtx.String("id"),
All: ilmAll,
Target: urlStr,
})
-105
View File
@@ -1,105 +0,0 @@
/*
* MinIO Client (C) 2020 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Package ilm contains all the ilm related functionality. TO BE ACCESSED VIA GET FUNCTIONS or Operation-related Global functions.
package ilm
import (
"encoding/xml"
"time"
)
// AbortIncompleteMultipartUpload structure
type AbortIncompleteMultipartUpload struct {
XMLName xml.Name `xml:"AbortIncompleteMultipartUpload,omitempty" json:"-"`
DaysAfterInitiation int64 `xml:"DaysAfterInitiation,omitempty" json:"DaysAfterInitiation,omitempty"`
}
// NoncurrentVersionTransition structure
type NoncurrentVersionTransition struct {
XMLName xml.Name `xml:"NoncurrentVersionTransition,omitempty" json:"-"`
StorageClass string `xml:"StorageClass,omitempty" json:"StorageClass,omitempty"`
TransitionInDays int `xml:"TransitionInDays,omitempty" json:"TransitionInDays,omitempty"`
}
// LifecycleTag structure key/value pair representing an object tag to apply lifecycle configuration
type LifecycleTag struct {
XMLName xml.Name `xml:"Tag,omitempty" json:"-"`
Key string `xml:"Key,omitempty" json:"Key,omitempty"`
Value string `xml:"Value,omitempty" json:"Value,omitempty"`
}
// LifecycleTransition structure - transition details of lifecycle configuration
type LifecycleTransition struct {
XMLName xml.Name `xml:"Transition" json:"-"`
TransitionDate *time.Time `xml:"Date,omitempty" json:"Date,omitempty"`
StorageClass string `xml:"StorageClass,omitempty" json:"StorageClass,omitempty"`
TransitionInDays int `xml:"Days,omitempty" json:"Days,omitempty"`
}
// IsSet is transition set
func (t LifecycleTransition) IsSet() bool {
return t.TransitionDate != nil && !t.TransitionDate.IsZero() || t.TransitionInDays > 0
}
// LifecycleAndOperator And Rule for LifecycleTag, to be used in LifecycleRuleFilter
type LifecycleAndOperator struct {
XMLName xml.Name `xml:"And,omitempty" json:"-"`
Prefix string `xml:"Prefix,omitempty" json:"Prefix,omitempty"`
Tags []LifecycleTag `xml:"Tag,omitempty" json:"Tags,omitempty"`
}
// LifecycleRuleFilter will be used in selecting rule(s) for lifecycle configuration
type LifecycleRuleFilter struct {
XMLName xml.Name `xml:"Filter" json:"-"`
And *LifecycleAndOperator `xml:"And,omitempty" json:"And,omitempty"`
Prefix string `xml:"Prefix,omitempty" json:"Prefix,omitempty"`
Tag *LifecycleTag `xml:"Tag,omitempty" json:"-"`
}
// LifecycleExpiration structure - expiration details of lifecycle configuration
type LifecycleExpiration struct {
XMLName xml.Name `xml:"Expiration,omitempty" json:"-"`
ExpirationDate *time.Time `xml:"Date,omitempty" json:"Date,omitempty"`
ExpirationInDays int `xml:"Days,omitempty" json:"Days,omitempty"`
}
// IsSet - is LifecycleExpiration set?
func (e LifecycleExpiration) IsSet() bool {
return e.ExpirationDate != nil && !e.ExpirationDate.IsZero() || e.ExpirationInDays > 0
}
// LifecycleRule represents a single rule in lifecycle configuration
type LifecycleRule struct {
XMLName xml.Name `xml:"Rule,omitempty" json:"-"`
AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `xml:"AbortIncompleteMultipartUpload,omitempty" json:"AbortIncompleteMultipartUpload,omitempty"`
Expiration *LifecycleExpiration `xml:"Expiration,omitempty" json:"Expiration,omitempty"`
ID string `xml:"ID" json:"ID"`
RuleFilter *LifecycleRuleFilter `xml:"Filter,omitempty" json:"Filter,omitempty"`
NoncurrentVersionTransition *NoncurrentVersionTransition `xml:"NoncurrentVersionTransition,omitempty" json:"NoncurrentVersionTransition,omitempty"`
NoncurrentVersionTransitions []NoncurrentVersionTransition `xml:"NoncurrentVersionTransitions,omitempty" json:"NoncurrentVersionTransitions,omitempty"`
Prefix string `xml:"Prefix,omitempty" json:"Prefix,omitempty"`
Status string `xml:"Status" json:"Status"`
Transition *LifecycleTransition `xml:"Transition,omitempty" json:"Transition,omitempty"`
Transitions []LifecycleTransition `xml:"Transitions,omitempty" json:"Transitions,omitempty"`
TagFilters []LifecycleTag `xml:"Tag,omitempty" json:"Tags,omitempty"`
}
// LifecycleConfiguration is a collection of LifecycleRule objects.
type LifecycleConfiguration struct {
XMLName xml.Name `xml:"LifecycleConfiguration,omitempty" json:"-"`
Rules []LifecycleRule `xml:"Rule"`
}
+24 -29
View File
@@ -23,6 +23,7 @@ import (
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v7/pkg/lifecycle"
)
const defaultILMDateFormat string = "2006-01-02"
@@ -73,7 +74,10 @@ func getRightAligned(label string, maxLen int) string {
}
// RemoveILMRule - Remove the ILM rule (with ilmID) from the configuration in XML that is provided.
func RemoveILMRule(lfcCfg LifecycleConfiguration, ilmID string) (LifecycleConfiguration, *probe.Error) {
func RemoveILMRule(lfcCfg *lifecycle.Configuration, ilmID string) (*lifecycle.Configuration, *probe.Error) {
if lfcCfg == nil {
return lfcCfg, probe.NewError(fmt.Errorf("lifecycle configuration not set"))
}
if len(lfcCfg.Rules) == 0 {
return lfcCfg, probe.NewError(fmt.Errorf("lifecycle configuration not set"))
}
@@ -105,69 +109,60 @@ type lifecycleOptions struct {
StorageClass string
}
func (opts lifecycleOptions) ToConfig(lfcCfg LifecycleConfiguration) (LifecycleConfiguration, *probe.Error) {
ilmExpiry, err := parseExpiry(opts.ExpiryDate, opts.ExpiryDays)
func (opts lifecycleOptions) ToConfig(config *lifecycle.Configuration) (*lifecycle.Configuration, *probe.Error) {
expiry, err := parseExpiry(opts.ExpiryDate, opts.ExpiryDays)
if err != nil {
return lfcCfg, err.Trace(opts.ExpiryDate, opts.ExpiryDays)
return nil, err.Trace(opts.ExpiryDate, opts.ExpiryDays)
}
ilmTransition, err := parseTransition(opts.StorageClass, opts.TransitionDate, opts.TransitionDays)
transition, err := parseTransition(opts.StorageClass, opts.TransitionDate, opts.TransitionDays)
if err != nil {
return lfcCfg, err.Trace(opts.StorageClass, opts.TransitionDate, opts.TransitionDays)
return nil, err.Trace(opts.StorageClass, opts.TransitionDate, opts.TransitionDays)
}
andVal := LifecycleAndOperator{
andVal := lifecycle.And{
Tags: extractILMTags(opts.Tags),
}
filter := LifecycleRuleFilter{Prefix: opts.Prefix}
filter := lifecycle.Filter{Prefix: opts.Prefix}
if len(andVal.Tags) > 0 {
filter.And = &andVal
filter.And = andVal
filter.And.Prefix = opts.Prefix
filter.Prefix = ""
}
var expP *LifecycleExpiration
var transP *LifecycleTransition
if ilmTransition.IsSet() {
transP = &ilmTransition
}
if ilmExpiry.IsSet() {
expP = &ilmExpiry
}
newRule := LifecycleRule{
newRule := lifecycle.Rule{
ID: opts.ID,
RuleFilter: &filter,
RuleFilter: filter,
Status: func() string {
if opts.Status {
return "Enabled"
}
return "Disabled"
}(),
Expiration: expP,
Transition: transP,
Expiration: expiry,
Transition: transition,
}
if err := validateILMRule(newRule); err != nil {
return lfcCfg, err.Trace(opts.ID)
return nil, err.Trace(opts.ID)
}
ruleFound := false
for i, rule := range lfcCfg.Rules {
for i, rule := range config.Rules {
if rule.ID != newRule.ID {
continue
}
lfcCfg.Rules[i] = newRule
config.Rules[i] = newRule
ruleFound = true
break
}
if !ruleFound {
lfcCfg.Rules = append(lfcCfg.Rules, newRule)
config.Rules = append(config.Rules, newRule)
}
return lfcCfg, nil
return config, nil
}
func getLifecycleOptions(ctx *cli.Context) lifecycleOptions {
@@ -186,7 +181,7 @@ func getLifecycleOptions(ctx *cli.Context) lifecycleOptions {
// ApplyNewILMConfig apply new lifecycle rules to existing lifecycle configuration, this
// function returns modified/overwritten rules if any.
func ApplyNewILMConfig(ctx *cli.Context, lfcCfg LifecycleConfiguration) (LifecycleConfiguration, *probe.Error) {
func ApplyNewILMConfig(ctx *cli.Context, config *lifecycle.Configuration) (*lifecycle.Configuration, *probe.Error) {
opts := getLifecycleOptions(ctx)
return opts.ToConfig(lfcCfg)
return opts.ToConfig(config)
}
+46 -46
View File
@@ -23,17 +23,18 @@ import (
"time"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v7/pkg/lifecycle"
)
// Extracts the tags provided by user. The tagfilter array will be put in lifecycleRule structure.
func extractILMTags(tagLabelVal string) []LifecycleTag {
var ilmTagKVList []LifecycleTag
func extractILMTags(tagLabelVal string) []lifecycle.Tag {
var ilmTagKVList []lifecycle.Tag
for _, tag := range strings.Split(tagLabelVal, tagSeperator) {
if tag == "" {
// split returns empty for empty tagLabelVal, skip it.
continue
}
lfcTag := LifecycleTag{}
lfcTag := lifecycle.Tag{}
kvs := strings.SplitN(tag, keyValSeperator, 2)
if len(kvs) == 2 {
lfcTag.Key = kvs[0]
@@ -49,41 +50,40 @@ func extractILMTags(tagLabelVal string) []LifecycleTag {
// Some of these rules are enforced by Amazon S3 standards.
// For example: Transition has to happen before Expiry.
// Storage class must be specified if transition date/days is provided.
func validateTranExpDate(rule LifecycleRule) error {
expirySet := (rule.Expiration != nil)
expiryDateSet := expirySet && rule.Expiration.ExpirationDate != nil && !rule.Expiration.ExpirationDate.IsZero()
expiryDaySet := expirySet && rule.Expiration.ExpirationInDays > 0
func validateTranExpDate(rule lifecycle.Rule) error {
expiryDateSet := rule.Expiration.IsDateNull()
expiryDaySet := rule.Expiration.IsDaysNull()
transitionSet := (rule.Transition != nil)
transitionDateSet := transitionSet && (rule.Transition.TransitionDate != nil && !rule.Transition.TransitionDate.IsZero())
transitionDaySet := transitionSet && (rule.Transition.TransitionInDays > 0)
transitionSet := !rule.Transition.IsNull()
transitionDateSet := transitionSet && !rule.Transition.IsDateNull()
transitionDaySet := transitionSet && !rule.Transition.IsDaysNull()
errMsg := "Error in Transition/Expiration Date/days compatibility. Transition should happen before Expiration"
if transitionDateSet && expiryDateSet {
if rule.Expiration.ExpirationDate.Before(*(rule.Transition.TransitionDate)) {
if rule.Expiration.Date.Before(rule.Transition.Date.Time) {
return errors.New(errMsg)
}
}
if transitionDaySet && expiryDaySet {
if rule.Transition.TransitionInDays >= rule.Expiration.ExpirationInDays {
if rule.Transition.Days >= rule.Expiration.Days {
return errors.New(errMsg)
}
}
return nil
}
func validateTranDays(rule LifecycleRule) error {
transitionSet := (rule.Transition != nil)
transitionDaySet := transitionSet && (rule.Transition.TransitionInDays > 0)
if transitionDaySet && rule.Transition.TransitionInDays < 30 && strings.ToLower(rule.Transition.StorageClass) == "standard_ia" {
func validateTranDays(rule lifecycle.Rule) error {
transitionSet := !rule.Transition.IsNull()
transitionDaySet := transitionSet && !rule.Transition.IsDaysNull()
if transitionDaySet && rule.Transition.Days < 30 && strings.ToLower(rule.Transition.StorageClass) == "standard_ia" {
return errors.New("Transition Date/Days are less than or equal to 30 when Storage class is STANDARD_IA")
}
return nil
}
// Amazon S3 requires a minimum of one action for a rule to be added.
func validateRuleAction(rule LifecycleRule) error {
expirySet := (rule.Expiration != nil)
transitionSet := (rule.Transition != nil)
func validateRuleAction(rule lifecycle.Rule) error {
expirySet := !rule.Expiration.IsNull()
transitionSet := !rule.Transition.IsNull()
if !expirySet && !transitionSet {
errMsg := "At least one action (Expiry or Transition) needs to be specified in a rule."
return errors.New(errMsg)
@@ -92,28 +92,28 @@ func validateRuleAction(rule LifecycleRule) error {
}
// Check if any date is before than cur date
func validateTranExpCurdate(rule LifecycleRule) error {
var err error
expirySet := (rule.Expiration != nil)
transitionSet := (rule.Transition != nil)
transitionDateSet := transitionSet && (rule.Transition.TransitionDate != nil && !rule.Transition.TransitionDate.IsZero())
expiryDateSet := expirySet && rule.Expiration.ExpirationDate != nil && !rule.Expiration.ExpirationDate.IsZero()
func validateTranExpCurdate(rule lifecycle.Rule) error {
var e error
expirySet := !rule.Expiration.IsNull()
transitionSet := !rule.Transition.IsNull()
transitionDateSet := transitionSet && !rule.Transition.IsDateNull()
expiryDateSet := expirySet && !rule.Expiration.IsDateNull()
currentTime := time.Now()
curTimeStr := currentTime.Format(defaultILMDateFormat)
currentTime, err = time.Parse(defaultILMDateFormat, curTimeStr)
if err != nil {
return err
currentTime, e = time.Parse(defaultILMDateFormat, curTimeStr)
if e != nil {
return e
}
if expirySet && expiryDateSet && rule.Expiration.ExpirationDate.Before(currentTime) {
err = errors.New("Expiry date falls before or on today's date")
} else if transitionSet && transitionDateSet && rule.Transition.TransitionDate.Before(currentTime) {
err = errors.New("Transition date falls before or on today's date")
if expirySet && expiryDateSet && rule.Expiration.Date.Before(currentTime) {
e = errors.New("Expiry date falls before or on today's date")
} else if transitionSet && transitionDateSet && rule.Transition.Date.Before(currentTime) {
e = errors.New("Transition date falls before or on today's date")
}
return err
return e
}
// Check S3 compatibility for the new rule and some other basic checks.
func validateILMRule(rule LifecycleRule) *probe.Error {
func validateILMRule(rule lifecycle.Rule) *probe.Error {
if e := validateRuleAction(rule); e != nil {
return probe.NewError(e)
}
@@ -130,23 +130,23 @@ func validateILMRule(rule LifecycleRule) *probe.Error {
}
// Returns valid lifecycleTransition to be included in lifecycleRule
func parseTransition(storageClass, transitionDateStr, transitionDayStr string) (transition LifecycleTransition, err *probe.Error) {
func parseTransition(storageClass, transitionDateStr, transitionDayStr string) (transition lifecycle.Transition, err *probe.Error) {
storageClass = strings.ToUpper(storageClass) // Just-in-case the user has entered lower case characters.
if storageClass != "" {
if transitionDateStr != "" {
transitionDate, e := time.Parse(defaultILMDateFormat, transitionDateStr)
if e != nil {
return LifecycleTransition{}, probe.NewError(e)
return lifecycle.Transition{}, probe.NewError(e)
}
transition.TransitionDate = &transitionDate
transition.Date = lifecycle.ExpirationDate{Time: transitionDate}
} else if transitionDayStr != "" {
transitionDay, e := strconv.Atoi(transitionDayStr)
if e != nil {
return LifecycleTransition{}, probe.NewError(e)
return lifecycle.Transition{}, probe.NewError(e)
}
transition.TransitionInDays = transitionDay
transition.Days = lifecycle.ExpirationDays(transitionDay)
} else {
return LifecycleTransition{}, probe.NewError(errors.New("if storage class is set a valid transitionDate or transitionDay must be set"))
return lifecycle.Transition{}, probe.NewError(errors.New("if storage class is set a valid transitionDate or transitionDay must be set"))
}
transition.StorageClass = storageClass
}
@@ -155,16 +155,16 @@ func parseTransition(storageClass, transitionDateStr, transitionDayStr string) (
}
// Returns lifecycleExpiration to be included in lifecycleRule
func parseExpiry(expiryDateStr, expiryDayStr string) (lfcExp LifecycleExpiration, err *probe.Error) {
func parseExpiry(expiryDateStr, expiryDayStr string) (lfcExp lifecycle.Expiration, err *probe.Error) {
if expiryDateStr != "" {
date, e := time.Parse(defaultILMDateFormat, expiryDateStr)
if e != nil {
return LifecycleExpiration{}, probe.NewError(e)
return lifecycle.Expiration{}, probe.NewError(e)
}
if date.IsZero() {
return LifecycleExpiration{}, probe.NewError(errors.New("expiration date cannot be set to zero"))
return lifecycle.Expiration{}, probe.NewError(errors.New("expiration date cannot be set to zero"))
}
lfcExp.ExpirationDate = &date
lfcExp.Date = lifecycle.ExpirationDate{Time: date}
}
if expiryDayStr != "" {
@@ -173,9 +173,9 @@ func parseExpiry(expiryDateStr, expiryDayStr string) (lfcExp LifecycleExpiration
return lfcExp, probe.NewError(e)
}
if days == 0 {
return LifecycleExpiration{}, probe.NewError(errors.New("expiration days cannot be set to zero"))
return lifecycle.Expiration{}, probe.NewError(errors.New("expiration days cannot be set to zero"))
}
lfcExp.ExpirationInDays = days
lfcExp.Days = lifecycle.ExpirationDays(days)
}
return lfcExp, nil
+54 -66
View File
@@ -18,13 +18,15 @@ package ilm
import (
"strconv"
"github.com/minio/minio-go/v7/pkg/lifecycle"
)
const (
// rule ID field column width in table output
idColumnWidth int = 12
idColumnWidth int = 16
// rule prefix field column width in table output
prefixColumnWidth int = 10
prefixColumnWidth int = 16
// StatusColumnWidth column width in table output
statusColumnWidth int = 12
// ExpiryColumnWidth column width in table output
@@ -100,7 +102,7 @@ type showDetails struct {
// PopulateILMDataForDisplay based on showDetails determined by user input, populate the ILM display
// table with information. Table is constructed row-by-row. Headers are first, then the rest of the rows.
func PopulateILMDataForDisplay(ilmCfg LifecycleConfiguration, rowCheck *map[string]int, alignedHdrLabels *[]string,
func PopulateILMDataForDisplay(ilmCfg *lifecycle.Configuration, rowCheck *map[string]int, alignedHdrLabels *[]string,
cellDataNoTags *[][]string, cellDataWithTags *[][]string, tagRows *map[string][]string,
showAll, showMin, showExpiry, showTransition bool) {
@@ -201,18 +203,16 @@ func checkAddTableCellRows(rowArr *[]string, rowCheck map[string]int, showOpts s
}
// The right kind of tick is returned. Cross-tick if expiry is not set.
func getExpiryTick(rule LifecycleRule) string {
func getExpiryTick(rule lifecycle.Rule) string {
expiryTick := crossTickCell
expiryDateSet := rule.Expiration != nil && rule.Expiration.ExpirationDate != nil && !rule.Expiration.ExpirationDate.IsZero()
expirySet := rule.Expiration != nil && (expiryDateSet || rule.Expiration.ExpirationInDays > 0)
if expirySet {
if !rule.Expiration.IsNull() {
expiryTick = tickCell
}
return expiryTick
}
// The right kind of tick is returned. Cross-tick if status is 'Disabled' & tick if status is 'Enabled'.
func getStatusTick(rule LifecycleRule) string {
func getStatusTick(rule lifecycle.Rule) string {
statusTick := crossTickCell
if rule.Status == statusLabelKey {
statusTick = tickCell
@@ -221,26 +221,22 @@ func getStatusTick(rule LifecycleRule) string {
}
// Expiry date. 'YYYY-MM-DD'. Set for 00:00:00 GMT as per the standard.
func getExpiryDateVal(rule LifecycleRule) string {
func getExpiryDateVal(rule lifecycle.Rule) string {
expiryDate := blankCell
expirySet := (rule.Expiration != nil)
expiryDateSet := expirySet && rule.Expiration.ExpirationDate != nil && !rule.Expiration.ExpirationDate.IsZero()
if expiryDateSet {
expiryDate = strconv.Itoa(rule.Expiration.ExpirationDate.Day()) + " " +
rule.Expiration.ExpirationDate.Month().String()[0:3] + " " +
strconv.Itoa(rule.Expiration.ExpirationDate.Year())
} else if expirySet && rule.Expiration.ExpirationInDays > 0 {
expiryDate = strconv.Itoa(rule.Expiration.ExpirationInDays) + " day(s)"
if !rule.Expiration.IsDateNull() {
expiryDate = strconv.Itoa(rule.Expiration.Date.Day()) + " " +
rule.Expiration.Date.Month().String()[0:3] + " " +
strconv.Itoa(rule.Expiration.Date.Year())
} else if !rule.Expiration.IsDateNull() {
expiryDate = strconv.Itoa(int(rule.Expiration.Days)) + " day(s)"
}
return expiryDate
}
// Cross-tick if Transition is not set.
func getTransitionTick(rule LifecycleRule) string {
transitionSet := rule.Transition != nil
transitionDateSet := transitionSet && ((rule.Transition.TransitionDate != nil &&
!rule.Transition.TransitionDate.IsZero()) ||
rule.Transition.TransitionInDays > 0)
func getTransitionTick(rule lifecycle.Rule) string {
transitionSet := !rule.Transition.IsNull()
transitionDateSet := transitionSet && !rule.Transition.IsDateNull()
if !transitionSet || !transitionDateSet {
return crossTickCell
}
@@ -248,26 +244,25 @@ func getTransitionTick(rule LifecycleRule) string {
}
// Transition date. 'YYYY-MM-DD'. Set for 00:00:00 GMT as per the standard.
func getTransitionDate(rule LifecycleRule) string {
func getTransitionDate(rule lifecycle.Rule) string {
transitionDate := blankCell
transitionSet := (rule.Transition != nil)
transitionDateSet := transitionSet && (rule.Transition.TransitionDate != nil &&
!rule.Transition.TransitionDate.IsZero())
transitionDaySet := transitionSet && (rule.Transition.TransitionInDays > 0)
transitionSet := !rule.Transition.IsNull()
transitionDateSet := transitionSet && !rule.Transition.IsDateNull()
transitionDaySet := transitionSet && !rule.Transition.IsDaysNull()
if transitionDateSet {
transitionDate = strconv.Itoa(rule.Transition.TransitionDate.Day()) + " " +
rule.Transition.TransitionDate.Month().String()[0:3] + " " +
strconv.Itoa(rule.Transition.TransitionDate.Year())
transitionDate = strconv.Itoa(rule.Transition.Date.Day()) + " " +
rule.Transition.Date.Month().String()[0:3] + " " +
strconv.Itoa(rule.Transition.Date.Year())
} else if transitionDaySet {
transitionDate = strconv.Itoa(rule.Transition.TransitionInDays) + " day(s)"
transitionDate = strconv.Itoa(int(rule.Transition.Days)) + " day(s)"
}
return transitionDate
}
// Storage class name for transition.
func getStorageClassName(rule LifecycleRule) string {
func getStorageClassName(rule lifecycle.Rule) string {
storageClass := blankCell
transitionSet := (rule.Transition != nil)
transitionSet := !rule.Transition.IsNull()
storageClassAvail := transitionSet && (rule.Transition.StorageClass != "")
if storageClassAvail {
storageClass = rule.Transition.StorageClass
@@ -276,13 +271,12 @@ func getStorageClassName(rule LifecycleRule) string {
}
// Array of Tag strings, each in key:value format
func getTagArr(rule LifecycleRule) []string {
tagArr := rule.TagFilters
tagLth := len(rule.TagFilters)
if len(rule.TagFilters) == 0 && rule.RuleFilter != nil && rule.RuleFilter.And != nil {
tagLth = len(rule.RuleFilter.And.Tags)
tagArr = rule.RuleFilter.And.Tags
func getTagArr(rule lifecycle.Rule) []string {
if rule.RuleFilter.And.IsEmpty() {
return []string{}
}
tagArr := rule.RuleFilter.And.Tags
tagLth := len(tagArr)
tagCellArr := make([]string, len(tagArr))
for tagIdx := 0; tagIdx < tagLth; tagIdx++ {
tagCellArr[tagIdx] = (tagArr[tagIdx].Key + ":" + tagArr[tagIdx].Value)
@@ -302,28 +296,29 @@ func checkAddTableCell(rowArr *[]string, rowCheck map[string]int, cellInfo table
if colIdx, ok := rowCheck[cellInfo.labelKey]; ok {
if len(cellInfo.label)%2 != 0 && len(cellInfo.label) < cellInfo.columnWidth {
cellInfo.label += " "
} else if len(cellInfo.label) > (cellInfo.columnWidth - 2) { // 2 dots to indicate text longer than column width
cellInfo.label = cellInfo.label[:(cellInfo.columnWidth-6)] + ".."
}
(*rowArr)[colIdx] = getAlignedText(cellInfo.label, cellInfo.align, cellInfo.columnWidth)
}
}
// GetILMShowDataWithoutTags - Without tags
func getILMShowDataWithoutTags(cellInfo *[][]string, rowCheck map[string]int, info LifecycleConfiguration, showOpts showDetails) {
func getILMShowDataWithoutTags(cellInfo *[][]string, rowCheck map[string]int, info *lifecycle.Configuration, showOpts showDetails) {
*cellInfo = make([][]string, 0)
count := 0
for index := 0; index < len(info.Rules); index++ {
rule := info.Rules[index]
showExpiry := (rule.Expiration != nil) && ((rule.Expiration.ExpirationDate != nil && !rule.Expiration.ExpirationDate.IsZero()) ||
rule.Expiration.ExpirationInDays > 0)
transitionSet := (rule.Transition != nil) && ((rule.Transition.TransitionDate != nil && !rule.Transition.TransitionDate.IsZero()) ||
rule.Transition.TransitionInDays > 0)
showExpiry := !rule.Expiration.IsNull()
transitionSet := !rule.Transition.IsNull()
skipExpTran := (showOpts.expiry && !showExpiry) || (showOpts.transition && !transitionSet)
if skipExpTran {
continue
}
tagPresent := (rule.RuleFilter != nil) && (rule.RuleFilter.And != nil)
if len(rule.TagFilters) > 0 || (tagPresent && len(rule.RuleFilter.And.Tags) > 0) {
tagPresent := !rule.RuleFilter.And.IsEmpty()
if tagPresent {
continue
}
*cellInfo = append(*cellInfo, make([]string, 0))
@@ -350,16 +345,14 @@ func getILMShowDataWithoutTags(cellInfo *[][]string, rowCheck map[string]int, in
}
// GetILMShowDataWithTags Just the data with extra rows for extra tags
func getILMShowDataWithTags(cellInfo *[][]string, newRows map[string][]string, rowCheck map[string]int, info LifecycleConfiguration, showOpts showDetails) {
func getILMShowDataWithTags(cellInfo *[][]string, newRows map[string][]string, rowCheck map[string]int, info *lifecycle.Configuration, showOpts showDetails) {
*cellInfo = make([][]string, 0)
count := 0
for index := 0; index < len(info.Rules); index++ {
rule := info.Rules[index]
showExpiry := (rule.Expiration != nil) && ((rule.Expiration.ExpirationDate != nil && !rule.Expiration.ExpirationDate.IsZero()) ||
rule.Expiration.ExpirationInDays > 0)
transitionSet := (rule.Transition != nil) && ((rule.Transition.TransitionDate != nil && !rule.Transition.TransitionDate.IsZero()) ||
rule.Transition.TransitionInDays > 0)
showExpiry := !rule.Expiration.IsNull()
transitionSet := !rule.Transition.IsNull()
skipExpTran := (showOpts.expiry && !showExpiry) || (showOpts.transition && !transitionSet)
if skipExpTran {
continue
@@ -391,26 +384,24 @@ func getILMShowDataWithTags(cellInfo *[][]string, newRows map[string][]string, r
}
}
func getPrefixVal(rule LifecycleRule) string {
func getPrefixVal(rule lifecycle.Rule) string {
prefixVal := ""
switch {
case rule.Prefix != "":
prefixVal = rule.Prefix
case rule.RuleFilter != nil && rule.RuleFilter.And != nil && rule.RuleFilter.And.Prefix != "":
case !rule.RuleFilter.And.IsEmpty():
prefixVal = rule.RuleFilter.And.Prefix
case rule.RuleFilter != nil && rule.RuleFilter.Prefix != "":
case rule.RuleFilter.Prefix != "":
prefixVal = rule.RuleFilter.Prefix
}
return prefixVal
}
func showExpiryDetails(rule LifecycleRule, showOpts showDetails) bool {
func showExpiryDetails(rule lifecycle.Rule, showOpts showDetails) bool {
if showOpts.allAvailable {
return true
}
expirySet := (rule.Expiration != nil) &&
((rule.Expiration.ExpirationDate != nil && !rule.Expiration.ExpirationDate.IsZero()) ||
rule.Expiration.ExpirationInDays > 0)
expirySet := !rule.Expiration.IsNull()
return (expirySet && (showOpts.allAvailable || showOpts.expiry))
@@ -424,27 +415,24 @@ func showTransitionTick(showOpts showDetails) bool {
return (showOpts.allAvailable || showOpts.minimum)
}
func showTransitionDetails(rule LifecycleRule, showOpts showDetails) bool {
func showTransitionDetails(rule lifecycle.Rule, showOpts showDetails) bool {
if showOpts.allAvailable {
return true
}
transitionSet := (rule.Transition != nil) &&
((rule.Transition.TransitionDate != nil && !rule.Transition.TransitionDate.IsZero()) ||
rule.Transition.TransitionInDays > 0)
transitionSet := !rule.Transition.IsNull()
transitionDetailsShow := (showOpts.allAvailable || showOpts.transition)
return transitionSet && transitionDetailsShow
}
func showTags(rule LifecycleRule, showOpts showDetails) bool {
func showTags(rule lifecycle.Rule, showOpts showDetails) bool {
if showOpts.minimum {
return false
}
tagSet := showOpts.allAvailable ||
(len(rule.TagFilters) > 0 || (rule.RuleFilter != nil && rule.RuleFilter.And != nil && (len(rule.RuleFilter.And.Tags) > 0)))
tagSet := showOpts.allAvailable || !rule.RuleFilter.And.IsEmpty()
return tagSet
}
func getColumns(info LifecycleConfiguration, rowCheck map[string]int, alignedHdrLabels *[]string, showOpts showDetails) {
func getColumns(info *lifecycle.Configuration, rowCheck map[string]int, alignedHdrLabels *[]string, showOpts showDetails) {
tagIn := false // Keep tag in the end
colIdx := 0
colWidthTbl := getILMColumnWidthTable()
+8 -4
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"encoding/json"
"fmt"
"strings"
@@ -24,7 +25,7 @@ import (
"github.com/fatih/color"
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
minio "github.com/minio/minio-go/v6"
minio "github.com/minio/minio-go/v7"
"github.com/minio/minio/pkg/console"
)
@@ -86,12 +87,15 @@ func (l legalHoldCmdMessage) JSON() string {
// setRetention - Set Retention for all objects within a given prefix.
func setLegalHold(urlStr string, lhold minio.LegalHoldStatus, isRecursive bool) error {
ctx, cancelLegalHold := context.WithCancel(globalContext)
defer cancelLegalHold()
clnt, err := newClient(urlStr)
if err != nil {
fatalIf(err.Trace(), "Cannot parse the provided url.")
}
if !isRecursive {
err = clnt.PutObjectLegalHold(lhold)
err = clnt.PutObjectLegalHold(ctx, lhold)
if err != nil {
errorIf(err.Trace(urlStr), "Failed to set legal hold on `"+urlStr+"` successfully")
} else {
@@ -107,7 +111,7 @@ func setLegalHold(urlStr string, lhold minio.LegalHoldStatus, isRecursive bool)
alias, _, _ := mustExpandAlias(urlStr)
var cErr error
errorsFound := false
for content := range clnt.List(isRecursive, false, false, DirNone) {
for content := range clnt.List(ctx, isRecursive, false, false, DirNone) {
if content.Err != nil {
errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.")
cErr = exitStatus(globalErrorExitStatus) // Set the exit status.
@@ -119,7 +123,7 @@ func setLegalHold(urlStr string, lhold minio.LegalHoldStatus, isRecursive bool)
errorIf(content.Err.Trace(clnt.GetURL().String()), "Invalid URL")
continue
}
probeErr := newClnt.PutObjectLegalHold(lhold)
probeErr := newClnt.PutObjectLegalHold(ctx, lhold)
if probeErr != nil {
errorsFound = true
errorIf(probeErr.Trace(content.URL.Path), "Failed to set legal hold on `"+content.URL.Path+"` successfully")
+7 -3
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"fmt"
"strconv"
"strings"
@@ -25,7 +26,7 @@ import (
"github.com/minio/cli"
json "github.com/minio/mc/pkg/colorjson"
"github.com/minio/mc/pkg/probe"
minio "github.com/minio/minio-go/v6"
minio "github.com/minio/minio-go/v7"
"github.com/minio/minio/pkg/console"
)
@@ -99,11 +100,14 @@ func lock(urlStr string, mode minio.RetentionMode, validity uint64, unit minio.V
fatalIf(err.Trace(), "Cannot parse the provided url.")
}
ctx, cancelLock := context.WithCancel(globalContext)
defer cancelLock()
if clearLock || mode != "" {
err = client.SetObjectLockConfig(mode, validity, unit)
err = client.SetObjectLockConfig(ctx, mode, validity, unit)
fatalIf(err, "Cannot enable object lock configuration on the specified bucket.")
} else {
mode, validity, unit, err = client.GetObjectLockConfig()
mode, validity, unit, err = client.GetObjectLockConfig(ctx)
fatalIf(err, "Cannot get object lock configuration on the specified bucket.")
}
+19 -16
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"strings"
"github.com/fatih/color"
@@ -76,9 +77,9 @@ EXAMPLES:
}
// checkListSyntax - validate all the passed arguments
func checkListSyntax(ctx *cli.Context) {
args := ctx.Args()
if !ctx.Args().Present() {
func checkListSyntax(ctx context.Context, cliCtx *cli.Context) {
args := cliCtx.Args()
if !cliCtx.Args().Present() {
args = []string{"."}
}
for _, arg := range args {
@@ -87,11 +88,11 @@ func checkListSyntax(ctx *cli.Context) {
}
}
// extract URLs.
URLs := ctx.Args()
isIncomplete := ctx.Bool("incomplete")
URLs := cliCtx.Args()
isIncomplete := cliCtx.Bool("incomplete")
for _, url := range URLs {
_, _, err := url2Stat(url, false, nil)
_, _, err := url2Stat(ctx, url, false, nil)
if err != nil && !isURLPrefixExists(url, isIncomplete) {
// Bucket name empty is a valid error for 'ls myminio',
// treat it as such.
@@ -106,23 +107,26 @@ func checkListSyntax(ctx *cli.Context) {
}
// mainList - is a handler for mc ls command
func mainList(ctx *cli.Context) error {
func mainList(cliCtx *cli.Context) error {
ctx, cancelList := context.WithCancel(globalContext)
defer cancelList()
// Additional command specific theme customization.
console.SetColor("File", color.New(color.Bold))
console.SetColor("Dir", color.New(color.FgCyan, color.Bold))
console.SetColor("Size", color.New(color.FgYellow))
console.SetColor("Time", color.New(color.FgGreen))
// check 'ls' cli arguments.
checkListSyntax(ctx)
// check 'ls' cliCtx arguments.
checkListSyntax(ctx, cliCtx)
// Set command flags from context.
isRecursive := ctx.Bool("recursive")
isIncomplete := ctx.Bool("incomplete")
isRecursive := cliCtx.Bool("recursive")
isIncomplete := cliCtx.Bool("incomplete")
args := ctx.Args()
args := cliCtx.Args()
// mimic operating system tool behavior.
if !ctx.Args().Present() {
if !cliCtx.Args().Present() {
args = []string{"."}
}
@@ -130,10 +134,9 @@ func mainList(ctx *cli.Context) error {
for _, targetURL := range args {
clnt, err := newClient(targetURL)
fatalIf(err.Trace(targetURL), "Unable to initialize target `"+targetURL+"`.")
if !strings.HasSuffix(targetURL, string(clnt.GetURL().Separator)) {
var st *ClientContent
st, err = clnt.Stat(isIncomplete, false, nil)
st, err = clnt.Stat(ctx, isIncomplete, false, nil)
if st != nil && err == nil && st.Type.IsDir() {
targetURL = targetURL + string(clnt.GetURL().Separator)
clnt, err = newClient(targetURL)
@@ -141,7 +144,7 @@ func mainList(ctx *cli.Context) error {
}
}
if e := doList(clnt, isRecursive, isIncomplete); e != nil {
if e := doList(ctx, clnt, isRecursive, isIncomplete); e != nil {
cErr = e
}
}
+4 -2
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"fmt"
"path/filepath"
"runtime"
@@ -106,14 +107,15 @@ func getKey(c *ClientContent) string {
}
// doList - list all entities inside a folder.
func doList(clnt Client, isRecursive, isIncomplete bool) error {
func doList(ctx context.Context, clnt Client, isRecursive, isIncomplete bool) error {
prefixPath := clnt.GetURL().Path
separator := string(clnt.GetURL().Separator)
if !strings.HasSuffix(prefixPath, separator) {
prefixPath = prefixPath[:strings.LastIndex(prefixPath, separator)+1]
}
var cErr error
for content := range clnt.List(isRecursive, isIncomplete, false, DirNone) {
for content := range clnt.List(ctx, isRecursive, isIncomplete, false, DirNone) {
if content.Err != nil {
switch content.Err.ToGoError().(type) {
// handle this specifically for filesystem related errors.
+11 -5
View File
@@ -73,6 +73,7 @@ VERSION:
// Main starts mc application
func Main(args []string) {
if len(args) > 1 {
switch args[1] {
case "mc", filepath.Base(args[0]):
@@ -255,15 +256,20 @@ func installAutoCompletion() {
}
func registerBefore(ctx *cli.Context) error {
// Set the config directory.
setMcConfigDir(ctx.GlobalString("config-dir"))
// Migrate any old version of config / state files to newer format.
migrate()
if ctx.IsSet("config-dir") {
// Set the config directory.
setMcConfigDir(ctx.String("config-dir"))
} else if ctx.GlobalIsSet("config-dir") {
// Set the config directory.
setMcConfigDir(ctx.GlobalString("config-dir"))
}
// Set global flags.
setGlobalsFromContext(ctx)
// Migrate any old version of config / state files to newer format.
migrate()
// Initialize default config files.
initMC()
+15 -10
View File
@@ -17,6 +17,8 @@
package cmd
import (
"context"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/mc/pkg/colorjson"
@@ -103,28 +105,28 @@ func (s makeBucketMessage) JSON() string {
}
// Validate command line arguments.
func checkMakeBucketSyntax(ctx *cli.Context) {
if !ctx.Args().Present() {
cli.ShowCommandHelpAndExit(ctx, "mb", 1) // last argument is exit code
func checkMakeBucketSyntax(cliCtx *cli.Context) {
if !cliCtx.Args().Present() {
cli.ShowCommandHelpAndExit(cliCtx, "mb", 1) // last argument is exit code
}
}
// mainMakeBucket is entry point for mb command.
func mainMakeBucket(ctx *cli.Context) error {
func mainMakeBucket(cli *cli.Context) error {
// check 'mb' cli arguments.
checkMakeBucketSyntax(ctx)
checkMakeBucketSyntax(cli)
// Additional command speific theme customization.
console.SetColor("MakeBucket", color.New(color.FgGreen, color.Bold))
// Save region.
region := ctx.String("region")
ignoreExisting := ctx.Bool("p")
withLock := ctx.Bool("l")
region := cli.String("region")
ignoreExisting := cli.Bool("p")
withLock := cli.Bool("l")
var cErr error
for _, targetURL := range ctx.Args() {
for _, targetURL := range cli.Args() {
// Instantiate client for URL.
clnt, err := newClient(targetURL)
if err != nil {
@@ -133,8 +135,11 @@ func mainMakeBucket(ctx *cli.Context) error {
continue
}
ctx, cancelMakeBucket := context.WithCancel(globalContext)
defer cancelMakeBucket()
// Make bucket.
err = clnt.MakeBucket(region, ignoreExisting, withLock)
err = clnt.MakeBucket(ctx, region, ignoreExisting, withLock)
if err != nil {
switch err.ToGoError().(type) {
case BucketNameEmpty:
+132 -156
View File
@@ -31,7 +31,7 @@ import (
"github.com/minio/cli"
json "github.com/minio/mc/pkg/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v6/pkg/encrypt"
"github.com/minio/minio-go/v7/pkg/encrypt"
"github.com/minio/minio/pkg/console"
)
@@ -72,9 +72,14 @@ var (
Name: "md5",
Usage: "force all upload(s) to calculate md5sum checksum",
},
cli.StringFlag{
Name: "multi-master",
Usage: "enable multi-master multi-site setup",
cli.BoolFlag{
Name: "multi-master",
Usage: "enable multi-master multi-site setup",
Hidden: true,
},
cli.BoolFlag{
Name: "active-active",
Usage: "enable active-active multi-site setup",
},
cli.BoolFlag{
Name: "disable-multipart",
@@ -174,9 +179,9 @@ EXAMPLES:
14. Mirror a local folder recursively to Amazon S3 cloud storage and preserve all local file attributes.
{{.Prompt}} {{.HelpName}} -a backup/ s3/archive
15. Cross mirror between sites in a multi-master deployment.
Site-A: {{.Prompt}} {{.HelpName}} --watch --multi-master siteA siteB
Site-B: {{.Prompt}} {{.HelpName}} --watch --multi-master siteB siteA
15. Cross mirror between sites in a active-active deployment.
Site-A: {{.Prompt}} {{.HelpName}} --watch --active-active siteA siteB
Site-B: {{.Prompt}} {{.HelpName}} --watch --active-active siteB siteA
`,
}
@@ -208,17 +213,7 @@ type mirrorJob struct {
sourceURL string
targetURL string
isFake, isRemove, isOverwrite bool
isWatch, isPreserve bool
md5, disableMultipart bool
olderThan, newerThan string
storageClass string
userMetadata map[string]string
excludeOptions []string
encKeyDB map[string][]prefixSSEPair
multiMasterEnable bool
opts mirrorOptions
}
// mirrorMessage container for file mirror messages
@@ -246,8 +241,8 @@ func (m mirrorMessage) JSON() string {
}
// doRemove - removes files on target.
func (mj *mirrorJob) doRemove(sURLs URLs) URLs {
if mj.isFake {
func (mj *mirrorJob) doRemove(ctx context.Context, sURLs URLs) URLs {
if mj.opts.isFake {
return sURLs.WithError(nil)
}
@@ -262,7 +257,7 @@ func (mj *mirrorJob) doRemove(sURLs URLs) URLs {
contentCh <- &ClientContent{URL: *newClientURL(sURLs.TargetContent.URL.Path)}
close(contentCh)
isRemoveBucket := false
errorCh := clnt.Remove(false, isRemoveBucket, false, contentCh)
errorCh := clnt.Remove(ctx, false, isRemoveBucket, false, contentCh)
for pErr := range errorCh {
if pErr != nil {
switch pErr.ToGoError().(type) {
@@ -280,13 +275,13 @@ func (mj *mirrorJob) doRemove(sURLs URLs) URLs {
// doMirror - Mirror an object to multiple destination. URLs status contains a copy of sURLs and error if any.
func (mj *mirrorJob) doMirrorWatch(ctx context.Context, targetPath string, tgtSSE encrypt.ServerSide, sURLs URLs) URLs {
shouldQueue := false
if !mj.isOverwrite && !mj.multiMasterEnable {
if !mj.opts.isOverwrite && !mj.opts.activeActive {
targetClient, err := newClient(targetPath)
if err != nil {
// cannot create targetclient
return sURLs.WithError(err)
}
_, err = targetClient.Stat(false, false, tgtSSE)
_, err = targetClient.Stat(ctx, false, false, tgtSSE)
if err == nil {
if !sURLs.SourceContent.RetentionEnabled && !sURLs.SourceContent.LegalHoldEnabled {
return sURLs.WithError(probe.NewError(ObjectAlreadyExists{}))
@@ -294,7 +289,7 @@ func (mj *mirrorJob) doMirrorWatch(ctx context.Context, targetPath string, tgtSS
} // doesn't exist
shouldQueue = true
}
if shouldQueue || mj.isOverwrite || mj.multiMasterEnable {
if shouldQueue || mj.opts.isOverwrite || mj.opts.activeActive {
// adjust total, because we want to show progress of
// the item still queued to be copied.
mj.status.Add(sURLs.SourceContent.Size)
@@ -316,7 +311,7 @@ func (mj *mirrorJob) doMirror(ctx context.Context, sURLs URLs) URLs {
// For a fake mirror make sure we update respective progress bars
// and accounting readers under relevant conditions.
if mj.isFake {
if mj.opts.isFake {
if sURLs.SourceContent != nil {
mj.status.Add(sURLs.SourceContent.Size)
}
@@ -335,22 +330,23 @@ func (mj *mirrorJob) doMirror(ctx context.Context, sURLs URLs) URLs {
// Initialize target metadata.
sURLs.TargetContent.Metadata = make(map[string]string)
if mj.storageClass != "" {
sURLs.TargetContent.Metadata["X-Amz-Storage-Class"] = mj.storageClass
if mj.opts.storageClass != "" {
sURLs.TargetContent.Metadata["X-Amz-Storage-Class"] = mj.opts.storageClass
}
if mj.multiMasterEnable {
if mj.opts.activeActive {
srcModTime := getSourceModTimeKey(sURLs.SourceContent.Metadata)
// If the source object already has source modtime attribute set, then
// use it in target. Otherwise use the S3 modtime instead.
if sURLs.SourceContent.Metadata[multiMasterSourceModTimeKey] != "" {
sURLs.TargetContent.Metadata[multiMasterSourceModTimeKey] = sURLs.SourceContent.Metadata[multiMasterSourceModTimeKey]
if srcModTime != "" {
sURLs.TargetContent.Metadata[activeActiveSourceModTimeKey] = srcModTime
} else {
sURLs.TargetContent.Metadata[multiMasterSourceModTimeKey] = sURLs.SourceContent.Time.Format(time.RFC3339Nano)
sURLs.TargetContent.Metadata[activeActiveSourceModTimeKey] = sURLs.SourceContent.Time.Format(time.RFC3339Nano)
}
}
// Initialize additional target user metadata.
sURLs.TargetContent.UserMetadata = mj.userMetadata
sURLs.TargetContent.UserMetadata = mj.opts.userMetadata
sourcePath := filepath.ToSlash(filepath.Join(sourceAlias, sourceURL.Path))
targetPath := filepath.ToSlash(filepath.Join(targetAlias, targetURL.Path))
@@ -361,9 +357,9 @@ func (mj *mirrorJob) doMirror(ctx context.Context, sURLs URLs) URLs {
TotalCount: sURLs.TotalCount,
TotalSize: sURLs.TotalSize,
})
sURLs.MD5 = mj.md5
sURLs.DisableMultipart = mj.disableMultipart
return uploadSourceToTargetURL(ctx, sURLs, mj.status, mj.encKeyDB, mj.isPreserve)
sURLs.MD5 = mj.opts.md5
sURLs.DisableMultipart = mj.opts.disableMultipart
return uploadSourceToTargetURL(ctx, sURLs, mj.status, mj.opts.encKeyDB, mj.opts.isMetadata)
}
// Update progress status
@@ -390,7 +386,7 @@ func (mj *mirrorJob) monitorMirrorStatus() (errDuringMirror bool) {
errorIf(sURLs.Error.Trace(), "Failed to perform mirroring.")
errDuringMirror = true
}
if mj.multiMasterEnable {
if mj.opts.activeActive {
close(mj.stopCh)
break
}
@@ -438,7 +434,7 @@ func (mj *mirrorJob) watchMirrorEvents(ctx context.Context, events []EventInfo)
// joined to the targetURL.
sourceSuffix := strings.TrimPrefix(eventPath, sourceURLFull)
//Skip the object, if it matches the Exclude options provided
if matchExcludeOptions(mj.excludeOptions, sourceSuffix) {
if matchExcludeOptions(mj.opts.excludeOptions, sourceSuffix) {
continue
}
@@ -447,7 +443,7 @@ func (mj *mirrorJob) watchMirrorEvents(ctx context.Context, events []EventInfo)
// newClient needs the unexpanded path, newCLientURL needs the expanded path
targetAlias, expandedTargetPath, _ := mustExpandAlias(targetPath)
targetURL := newClientURL(expandedTargetPath)
tgtSSE := getSSE(targetPath, mj.encKeyDB[targetAlias])
tgtSSE := getSSE(targetPath, mj.opts.encKeyDB[targetAlias])
if (event.Type == EventCreate) ||
(event.Type == EventCreateCopy) ||
@@ -465,13 +461,14 @@ func (mj *mirrorJob) watchMirrorEvents(ctx context.Context, events []EventInfo)
},
TargetAlias: targetAlias,
TargetContent: &ClientContent{URL: *targetURL},
MD5: mj.md5,
DisableMultipart: mj.disableMultipart,
encKeyDB: mj.encKeyDB,
MD5: mj.opts.md5,
DisableMultipart: mj.opts.disableMultipart,
encKeyDB: mj.opts.encKeyDB,
}
if mj.multiMasterEnable &&
mirrorURL.SourceContent.Metadata[multiMasterSourceModTimeKey] != "" {
// If source has multi-master attributes, it means that the
if mj.opts.activeActive &&
(getSourceModTimeKey(mirrorURL.SourceContent.Metadata) != "" ||
getSourceModTimeKey(mirrorURL.SourceContent.UserMetadata) != "") {
// If source has active-active attributes, it means that the
// object was uploaded by "mc mirror", hence ignore the event
// to avoid copying it.
continue
@@ -488,15 +485,15 @@ func (mj *mirrorJob) watchMirrorEvents(ctx context.Context, events []EventInfo)
SourceContent: nil,
TargetAlias: targetAlias,
TargetContent: &ClientContent{URL: *targetURL},
MD5: mj.md5,
DisableMultipart: mj.disableMultipart,
encKeyDB: mj.encKeyDB,
MD5: mj.opts.md5,
DisableMultipart: mj.opts.disableMultipart,
encKeyDB: mj.opts.encKeyDB,
}
mirrorURL.TotalCount = mj.status.GetCounts()
mirrorURL.TotalSize = mj.status.Get()
if mirrorURL.TargetContent != nil && (mj.isRemove || mj.multiMasterEnable) {
if mirrorURL.TargetContent != nil && (mj.opts.isRemove || mj.opts.activeActive) {
mj.queueCh <- func() URLs {
return mj.doRemove(mirrorURL)
return mj.doRemove(ctx, mirrorURL)
}
}
}
@@ -536,8 +533,8 @@ func (mj *mirrorJob) watchMirror(ctx context.Context, stopParallel func()) {
}
}
func (mj *mirrorJob) watchURL(sourceClient Client) *probe.Error {
return mj.watcher.Join(sourceClient, true)
func (mj *mirrorJob) watchURL(ctx context.Context, sourceClient Client) *probe.Error {
return mj.watcher.Join(ctx, sourceClient, true)
}
// Fetch urls that need to be mirrored
@@ -546,8 +543,7 @@ func (mj *mirrorJob) startMirror(ctx context.Context, cancelMirror context.Cance
mj.m.Lock()
defer mj.m.Unlock()
isMetadata := len(mj.userMetadata) > 0 || mj.isPreserve
URLsCh := prepareMirrorURLs(mj.sourceURL, mj.targetURL, mj.isFake, mj.isOverwrite, mj.isRemove, isMetadata, mj.excludeOptions, mj.encKeyDB)
URLsCh := prepareMirrorURLs(ctx, mj.sourceURL, mj.targetURL, mj.opts)
for {
select {
@@ -562,10 +558,10 @@ func (mj *mirrorJob) startMirror(ctx context.Context, cancelMirror context.Cance
}
if sURLs.SourceContent != nil {
if mj.olderThan != "" && isOlder(sURLs.SourceContent.Time, mj.olderThan) {
if isOlder(sURLs.SourceContent.Time, mj.opts.olderThan) {
continue
}
if mj.newerThan != "" && isNewer(sURLs.SourceContent.Time, mj.newerThan) {
if isNewer(sURLs.SourceContent.Time, mj.opts.newerThan) {
continue
}
}
@@ -573,6 +569,7 @@ func (mj *mirrorJob) startMirror(ctx context.Context, cancelMirror context.Cance
if sURLs.SourceContent != nil {
mj.status.Add(sURLs.SourceContent.Size)
}
mj.status.SetTotal(mj.status.Get()).Update()
mj.status.AddCounts(1)
@@ -585,9 +582,9 @@ func (mj *mirrorJob) startMirror(ctx context.Context, cancelMirror context.Cance
mj.queueCh <- func() URLs {
return mj.doMirror(ctx, sURLs)
}
} else if sURLs.TargetContent != nil && mj.isRemove {
} else if sURLs.TargetContent != nil && mj.opts.isRemove {
mj.queueCh <- func() URLs {
return mj.doRemove(sURLs)
return mj.doRemove(ctx, sURLs)
}
}
case <-globalContext.Done():
@@ -606,7 +603,7 @@ func (mj *mirrorJob) mirror(ctx context.Context, cancelMirror context.CancelFunc
var wg sync.WaitGroup
// Starts watcher loop for watching for new events.
if mj.isWatch {
if mj.opts.isWatch {
wg.Add(1)
go func() {
defer wg.Done()
@@ -624,7 +621,7 @@ func (mj *mirrorJob) mirror(ctx context.Context, cancelMirror context.CancelFunc
go func() {
defer wg.Done()
stopParallel := func() {
if !mj.isWatch {
if !mj.opts.isWatch {
close(mj.queueCh)
mj.parallel.wait()
cancelMirror()
@@ -643,32 +640,15 @@ func (mj *mirrorJob) mirror(ctx context.Context, cancelMirror context.CancelFunc
return mj.monitorMirrorStatus()
}
func newMirrorJob(srcURL, dstURL string, isFake, isRemove, isOverwrite, isWatch, isPreserve, multiMasterEnable bool, excludeOptions []string, olderThan, newerThan string, storageClass string, userMetadata map[string]string, encKeyDB map[string][]prefixSSEPair, md5, disableMultipart bool) *mirrorJob {
if multiMasterEnable {
isPreserve = true
}
func newMirrorJob(srcURL, dstURL string, opts mirrorOptions) *mirrorJob {
mj := mirrorJob{
stopCh: make(chan struct{}),
sourceURL: srcURL,
targetURL: dstURL,
isFake: isFake,
isRemove: isRemove,
isOverwrite: isOverwrite,
isWatch: isWatch,
isPreserve: isPreserve || multiMasterEnable,
md5: md5,
disableMultipart: disableMultipart,
excludeOptions: excludeOptions,
olderThan: olderThan,
newerThan: newerThan,
storageClass: storageClass,
userMetadata: userMetadata,
encKeyDB: encKeyDB,
statusCh: make(chan URLs),
watcher: NewWatcher(UTCNow()),
multiMasterEnable: multiMasterEnable,
opts: opts,
statusCh: make(chan URLs),
watcher: NewWatcher(UTCNow()),
}
mj.parallel, mj.queueCh = newParallelManager(mj.statusCh)
@@ -687,8 +667,8 @@ func newMirrorJob(srcURL, dstURL string, isFake, isRemove, isOverwrite, isWatch,
}
// copyBucketPolicies - copy policies from source to dest
func copyBucketPolicies(srcClt, dstClt Client, isOverwrite bool) *probe.Error {
rules, err := srcClt.GetAccessRules()
func copyBucketPolicies(ctx context.Context, srcClt, dstClt Client, isOverwrite bool) *probe.Error {
rules, err := srcClt.GetAccessRules(ctx)
if err != nil {
switch err.ToGoError().(type) {
case APINotImplemented:
@@ -698,14 +678,14 @@ func copyBucketPolicies(srcClt, dstClt Client, isOverwrite bool) *probe.Error {
}
// Set found rules to target bucket if permitted
for _, r := range rules {
originalRule, _, err := dstClt.GetAccess()
originalRule, _, err := dstClt.GetAccess(ctx)
if err != nil {
return err
}
// Set rule only if it doesn't exist in the target bucket
// or force flag is activated
if originalRule == "none" || isOverwrite {
err = dstClt.SetAccess(r, false)
err = dstClt.SetAccess(ctx, r, false)
if err != nil {
return err
}
@@ -738,20 +718,20 @@ func getEventPathURLWin(srcURL, eventPath string) string {
}
// runMirror - mirrors all buckets to another S3 server
func runMirror(srcURL, dstURL string, ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) bool {
func runMirror(ctx context.Context, cancelMirror context.CancelFunc, srcURL, dstURL string, cli *cli.Context, encKeyDB map[string][]prefixSSEPair) bool {
// This is kept for backward compatibility, `--force` means
// --overwrite.
isOverwrite := ctx.Bool("force")
isOverwrite := cli.Bool("force")
if !isOverwrite {
isOverwrite = ctx.Bool("overwrite")
isOverwrite = cli.Bool("overwrite")
}
// Parse metadata.
userMetaMap := make(map[string]string)
if ctx.String("attr") != "" {
userMetadata := make(map[string]string)
if cli.String("attr") != "" {
var err *probe.Error
userMetaMap, err = getMetaDataEntry(ctx.String("attr"))
fatalIf(err, "Unable to parse attribute %v", ctx.String("attr"))
userMetadata, err = getMetaDataEntry(cli.String("attr"))
fatalIf(err, "Unable to parse attribute %v", cli.String("attr"))
}
srcClt, err := newClient(srcURL)
@@ -775,34 +755,29 @@ func runMirror(srcURL, dstURL string, ctx *cli.Context, encKeyDB map[string][]pr
}
// Create a new mirror job and execute it
mj := newMirrorJob(srcURL, dstURL,
ctx.Bool("fake"),
ctx.Bool("remove"),
isOverwrite,
ctx.Bool("watch"),
ctx.Bool("a"),
ctx.Bool("multi-master"),
ctx.StringSlice("exclude"),
ctx.String("older-than"),
ctx.String("newer-than"),
ctx.String("storage-class"),
userMetaMap,
encKeyDB,
ctx.Bool("md5"),
ctx.Bool("disable-multipart"),
)
go func() {
<-globalContext.Done()
os.Exit(globalErrorExitStatus)
}()
mj := newMirrorJob(srcURL, dstURL, mirrorOptions{
isFake: cli.Bool("fake"),
isRemove: cli.Bool("remove"),
isOverwrite: isOverwrite,
isWatch: cli.Bool("watch") || cli.Bool("multi-master") || cli.Bool("active-active"),
isMetadata: cli.Bool("a") || cli.Bool("multi-master") || cli.Bool("active-active") || len(userMetadata) > 0,
md5: cli.Bool("md5"),
disableMultipart: cli.Bool("disable-multipart"),
excludeOptions: cli.StringSlice("exclude"),
olderThan: cli.String("older-than"),
newerThan: cli.String("newer-than"),
storageClass: cli.String("storage-class"),
userMetadata: userMetadata,
encKeyDB: encKeyDB,
activeActive: cli.Bool("multi-master") || cli.Bool("active-active"),
})
if mirrorAllBuckets {
// Synchronize buckets using dirDifference function
for d := range dirDifference(srcClt, dstClt, srcURL, dstURL) {
for d := range dirDifference(ctx, srcClt, dstClt, srcURL, dstURL) {
if d.Error != nil {
if mj.multiMasterEnable {
errorIf(d.Error, "Failed to start mirroring.")
if mj.opts.activeActive {
errorIf(d.Error, "Failed to start mirroring.. retrying")
return true
}
mj.status.fatalIf(d.Error, "Failed to start mirroring.")
@@ -821,104 +796,102 @@ func runMirror(srcURL, dstURL string, ctx *cli.Context, encKeyDB map[string][]pr
if d.Diff == differInFirst {
withLock := false
mode, validity, unit, err := newSrcClt.GetObjectLockConfig()
mode, validity, unit, err := newSrcClt.GetObjectLockConfig(ctx)
if err == nil {
withLock = true
}
// Bucket only exists in the source, create the same bucket in the destination
if err := newDstClt.MakeBucket(ctx.String("region"), false, withLock); err != nil {
if err := newDstClt.MakeBucket(ctx, cli.String("region"), false, withLock); err != nil {
errorIf(err, "Unable to create bucket at `"+newTgtURL+"`.")
continue
}
// object lock configuration set on bucket
if mode != "" {
errorIf(newDstClt.SetObjectLockConfig(mode, validity, unit),
errorIf(newDstClt.SetObjectLockConfig(ctx, mode, validity, unit),
"Unable to set object lock config in `"+newTgtURL+"`.")
}
errorIf(copyBucketPolicies(newSrcClt, newDstClt, isOverwrite),
errorIf(copyBucketPolicies(ctx, newSrcClt, newDstClt, isOverwrite),
"Unable to copy bucket policies to `"+newDstClt.GetURL().String()+"`.")
}
if mj.isWatch {
if mj.opts.isWatch {
// monitor mode will watch the source folders for changes,
// and queue them for copying.
if err := mj.watchURL(newSrcClt); err != nil {
if mj.multiMasterEnable {
errorIf(err, "Failed to start monitoring.")
if err := mj.watchURL(ctx, newSrcClt); err != nil {
if mj.opts.activeActive {
errorIf(err, "Failed to start monitoring.. retrying")
return true
}
mj.status.fatalIf(err, "Failed to start monitoring.")
}
}
}
} else if _, err := dstClt.Stat(false, false, nil); err != nil {
} else if _, err := dstClt.Stat(ctx, false, false, nil); err != nil {
withLock := false
mode, validity, unit, err := srcClt.GetObjectLockConfig()
mode, validity, unit, err := srcClt.GetObjectLockConfig(ctx)
if err == nil {
withLock = true
}
// Create bucket if it doesn't exist at destination.
// ignore if already exists.
if mj.multiMasterEnable {
err = dstClt.MakeBucket(ctx.String("region"), true, withLock)
if mj.opts.activeActive {
err = dstClt.MakeBucket(ctx, cli.String("region"), true, withLock)
errorIf(err, "Unable to create bucket at `"+dstURL+"`.")
if err != nil {
return true
}
} else {
mj.status.fatalIf(dstClt.MakeBucket(ctx.String("region"), true, withLock),
mj.status.fatalIf(dstClt.MakeBucket(ctx, cli.String("region"), true, withLock),
"Unable to create bucket at `"+dstURL+"`.")
}
// object lock configuration set on bucket
if mode != "" {
err = dstClt.SetObjectLockConfig(mode, validity, unit)
err = dstClt.SetObjectLockConfig(ctx, mode, validity, unit)
errorIf(err, "Unable to set object lock config in `"+dstURL+"`.")
if err != nil && mj.multiMasterEnable {
if err != nil && mj.opts.activeActive {
return true
}
}
err = copyBucketPolicies(srcClt, dstClt, isOverwrite)
err = copyBucketPolicies(ctx, srcClt, dstClt, isOverwrite)
errorIf(err, "Unable to copy bucket policies to `"+dstClt.GetURL().String()+"`.")
if err != nil && mj.multiMasterEnable {
if err != nil && mj.opts.activeActive {
return true
}
}
if !mirrorAllBuckets && mj.isWatch {
if !mirrorAllBuckets && mj.opts.isWatch {
// monitor mode will watch the source folders for changes,
// and queue them for copying.
if err := mj.watchURL(srcClt); err != nil {
if mj.multiMasterEnable {
errorIf(err, "Failed to start monitoring.")
if err := mj.watchURL(ctx, srcClt); err != nil {
if mj.opts.activeActive {
errorIf(err, "Failed to start monitoring.. retrying")
return true
}
mj.status.fatalIf(err, "Failed to start monitoring.")
}
}
ctxt, cancelMirror := context.WithCancel(context.Background())
defer cancelMirror()
// Start mirroring job
return mj.mirror(ctxt, cancelMirror)
return mj.mirror(ctx, cancelMirror)
}
// Main entry point for mirror command.
func mainMirror(ctx *cli.Context) error {
func mainMirror(cliCtx *cli.Context) error {
ctx, cancelMirror := context.WithCancel(globalContext)
defer cancelMirror()
// Parse encryption keys per command.
encKeyDB, err := getEncKeys(ctx)
encKeyDB, err := getEncKeys(cliCtx)
fatalIf(err, "Unable to parse encryption keys.")
// check 'mirror' cli arguments.
checkMirrorSyntax(ctx, encKeyDB)
checkMirrorSyntax(ctx, cliCtx, encKeyDB)
// Additional command specific theme customization.
console.SetColor("Mirror", color.New(color.FgGreen, color.Bold))
args := ctx.Args()
args := cliCtx.Args()
srcURL := args[0]
tgtURL := args[1]
@@ -932,16 +905,19 @@ func mainMirror(ctx *cli.Context) error {
}
}
if ctx.Bool("multi-master") {
for {
runMirror(srcURL, tgtURL, ctx, encKeyDB)
time.Sleep(time.Second * 2)
for {
select {
case <-ctx.Done():
return exitStatus(globalErrorExitStatus)
default:
if errorDetected := runMirror(ctx, cancelMirror, srcURL, tgtURL, cliCtx, encKeyDB); errorDetected {
if cliCtx.Bool("multi-master") || cliCtx.Bool("active-active") {
time.Sleep(2 * time.Second)
continue
}
return exitStatus(globalErrorExitStatus)
}
return nil
}
}
if errorDetected := runMirror(srcURL, tgtURL, ctx, encKeyDB); errorDetected {
return exitStatus(globalErrorExitStatus)
}
return nil
}
+31 -19
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"fmt"
"runtime"
"strings"
@@ -31,19 +32,19 @@ import (
// mirror(d1..., d2) -> []mirror(d1/f, d2/d1/f)
// checkMirrorSyntax(URLs []string)
func checkMirrorSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
if len(ctx.Args()) != 2 {
cli.ShowCommandHelpAndExit(ctx, "mirror", 1) // last argument is exit code.
func checkMirrorSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
if len(cliCtx.Args()) != 2 {
cli.ShowCommandHelpAndExit(cliCtx, "mirror", 1) // last argument is exit code.
}
// extract URLs.
URLs := ctx.Args()
URLs := cliCtx.Args()
srcURL := URLs[0]
tgtURL := URLs[1]
if ctx.Bool("force") && ctx.Bool("remove") {
if cliCtx.Bool("force") && cliCtx.Bool("remove") {
errorIf(errInvalidArgument().Trace(URLs...), "`--force` is deprecated please use `--overwrite` instead with `--remove` for the same functionality.")
} else if ctx.Bool("force") {
} else if cliCtx.Bool("force") {
errorIf(errInvalidArgument().Trace(URLs...), "`--force` is deprecated please use `--overwrite` instead for the same functionality.")
}
@@ -62,16 +63,16 @@ func checkMirrorSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
// Mirror with preserve option on windows
// only works for object storage to object storage
if runtime.GOOS == "windows" && ctx.Bool("a") {
if runtime.GOOS == "windows" && cliCtx.Bool("a") {
if srcClient.Type == fileSystem || destClient.Type == fileSystem {
errorIf(errInvalidArgument(), "Preserve functionality on windows support object storage to object storage transfer only.")
}
}
/****** Generic rules *******/
if !ctx.Bool("watch") {
_, srcContent, err := url2Stat(srcURL, false, encKeyDB)
// incomplete uploads are not necessary for copy operation, no need to verify for them.
if !cliCtx.Bool("watch") && !cliCtx.Bool("active-active") && !cliCtx.Bool("multi-master") {
_, srcContent, err := url2Stat(ctx, srcURL, false, encKeyDB)
// incomplete uploads are not necessary for mirror operation, no need to verify for them.
isIncomplete := false
if err != nil && !isURLPrefixExists(srcURL, isIncomplete) {
errorIf(err.Trace(srcURL), "Unable to stat source `"+srcURL+"`.")
@@ -95,7 +96,7 @@ func matchExcludeOptions(excludeOptions []string, srcSuffix string) bool {
return false
}
func deltaSourceTarget(sourceURL, targetURL string, isFake, isOverwrite, isRemove, isMetadata bool, excludeOptions []string, URLsCh chan<- URLs, encKeyDB map[string][]prefixSSEPair) {
func deltaSourceTarget(ctx context.Context, sourceURL, targetURL string, opts mirrorOptions, URLsCh chan<- URLs) {
// source and targets are always directories
sourceSeparator := string(newClientURL(sourceURL).Separator)
if !strings.HasSuffix(sourceURL, sourceSeparator) {
@@ -125,7 +126,7 @@ func deltaSourceTarget(sourceURL, targetURL string, isFake, isOverwrite, isRemov
}
// List both source and target, compare and return values through channel.
for diffMsg := range objectDifference(sourceClnt, targetClnt, sourceURL, targetURL, isMetadata) {
for diffMsg := range objectDifference(ctx, sourceClnt, targetClnt, sourceURL, targetURL, opts.isMetadata) {
if diffMsg.Error != nil {
// Send all errors through the channel
URLsCh <- URLs{Error: diffMsg.Error}
@@ -134,13 +135,13 @@ func deltaSourceTarget(sourceURL, targetURL string, isFake, isOverwrite, isRemov
srcSuffix := strings.TrimPrefix(diffMsg.FirstURL, sourceURL)
//Skip the source object if it matches the Exclude options provided
if matchExcludeOptions(excludeOptions, srcSuffix) {
if matchExcludeOptions(opts.excludeOptions, srcSuffix) {
continue
}
tgtSuffix := strings.TrimPrefix(diffMsg.SecondURL, targetURL)
//Skip the target object if it matches the Exclude options provided
if matchExcludeOptions(excludeOptions, tgtSuffix) {
if matchExcludeOptions(opts.excludeOptions, tgtSuffix) {
continue
}
@@ -149,8 +150,8 @@ func deltaSourceTarget(sourceURL, targetURL string, isFake, isOverwrite, isRemov
// No difference, continue.
case differInType:
URLsCh <- URLs{Error: errInvalidTarget(diffMsg.SecondURL)}
case differInSize, differInMetadata, differInMMSourceMTime:
if !isOverwrite && !isFake {
case differInSize, differInMetadata, differInAASourceMTime:
if !opts.isOverwrite && !opts.isFake && !opts.activeActive {
// Size or time or etag differs but --overwrite not set.
URLsCh <- URLs{Error: errOverWriteNotAllowed(diffMsg.SecondURL)}
continue
@@ -180,7 +181,7 @@ func deltaSourceTarget(sourceURL, targetURL string, isFake, isOverwrite, isRemov
TargetContent: targetContent,
}
case differInSecond:
if !isRemove && !isFake {
if !opts.isRemove && !opts.isFake {
continue
}
URLsCh <- URLs{
@@ -195,9 +196,20 @@ func deltaSourceTarget(sourceURL, targetURL string, isFake, isOverwrite, isRemov
}
}
type mirrorOptions struct {
isFake, isOverwrite, activeActive bool
isWatch, isRemove, isMetadata bool
excludeOptions []string
encKeyDB map[string][]prefixSSEPair
md5, disableMultipart bool
olderThan, newerThan string
storageClass string
userMetadata map[string]string
}
// Prepares urls that need to be copied or removed based on requested options.
func prepareMirrorURLs(sourceURL string, targetURL string, isFake, isOverwrite, isRemove, isMetadata bool, excludeOptions []string, encKeyDB map[string][]prefixSSEPair) <-chan URLs {
func prepareMirrorURLs(ctx context.Context, sourceURL string, targetURL string, opts mirrorOptions) <-chan URLs {
URLsCh := make(chan URLs)
go deltaSourceTarget(sourceURL, targetURL, isFake, isOverwrite, isRemove, isMetadata, excludeOptions, URLsCh, encKeyDB)
go deltaSourceTarget(ctx, sourceURL, targetURL, opts, URLsCh)
return URLsCh
}
+33 -29
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"errors"
"fmt"
"os"
@@ -181,7 +182,7 @@ func (rm *removeManager) readErrors(errorCh <-chan *probe.Error, targetURL strin
}()
}
func (rm *removeManager) add(targetAlias, targetURL string) {
func (rm *removeManager) add(ctx context.Context, targetAlias, targetURL string) {
if atomic.LoadInt32(&rm.isClosed) != 0 {
return
}
@@ -198,7 +199,7 @@ func (rm *removeManager) add(targetAlias, targetURL string) {
}
contentCh := make(chan *ClientContent)
errorCh := client.Remove(false, false, false, contentCh)
errorCh := client.Remove(ctx, false, false, false, contentCh)
rm.readErrors(errorCh, targetURL)
clientInfo = &removeClientInfo{
@@ -236,7 +237,7 @@ var rmManager = &removeManager{
doneCh: make(chan struct{}),
}
func bgRemove(url string) {
func bgRemove(ctx context.Context, url string) {
remove := func(targetAlias, targetURL string) {
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
if pErr != nil {
@@ -246,7 +247,7 @@ func bgRemove(url string) {
contentCh := make(chan *ClientContent, 1)
contentCh <- &ClientContent{URL: *newClientURL(targetURL)}
close(contentCh)
errorCh := clnt.Remove(false, false, false, contentCh)
errorCh := clnt.Remove(ctx, false, false, false, contentCh)
for pErr := range errorCh {
if pErr != nil {
errorIf(pErr.Trace(url), "Failed to remove `"+url+"`.")
@@ -266,27 +267,30 @@ func bgRemove(url string) {
return
}
rmManager.add(targetAlias, targetURL)
rmManager.add(ctx, targetAlias, targetURL)
}
// mainMove is the entry point for mv command.
func mainMove(ctx *cli.Context) error {
func mainMove(cliCtx *cli.Context) error {
ctx, cancelMove := context.WithCancel(globalContext)
defer cancelMove()
// Parse encryption keys per command.
encKeyDB, err := getEncKeys(ctx)
encKeyDB, err := getEncKeys(cliCtx)
fatalIf(err, "Unable to parse encryption keys.")
// Parse metadata.
userMetaMap := make(map[string]string)
if ctx.String("attr") != "" {
userMetaMap, err = getMetaDataEntry(ctx.String("attr"))
fatalIf(err, "Unable to parse attribute %v", ctx.String("attr"))
if cliCtx.String("attr") != "" {
userMetaMap, err = getMetaDataEntry(cliCtx.String("attr"))
fatalIf(err, "Unable to parse attribute %v", cliCtx.String("attr"))
}
// check 'copy' cli arguments.
checkCopySyntax(ctx, encKeyDB, true)
checkCopySyntax(ctx, cliCtx, encKeyDB, true)
if ctx.NArg() == 2 {
args := ctx.Args()
if cliCtx.NArg() == 2 {
args := cliCtx.Args()
srcURL := args.Get(0)
dstURL := args.Get(1)
if srcURL == dstURL {
@@ -294,14 +298,14 @@ func mainMove(ctx *cli.Context) error {
}
}
for _, urlStr := range ctx.Args() {
for _, urlStr := range cliCtx.Args() {
client, err := newClient(urlStr)
if err != nil {
fatalIf(err.Trace(), "Cannot parse the provided url.")
}
if s3Client, ok := client.(*S3Client); ok {
if _, _, _, err = s3Client.GetObjectLockConfig(); err == nil {
if _, _, _, err = s3Client.GetObjectLockConfig(ctx); err == nil {
fatalIf(probe.NewError(errors.New("")), fmt.Sprintf("Object lock configuration is enabled on the specified bucket in alias %v.", urlStr))
}
}
@@ -310,12 +314,12 @@ func mainMove(ctx *cli.Context) error {
// Additional command speific theme customization.
console.SetColor("Copy", color.New(color.FgGreen, color.Bold))
recursive := ctx.Bool("recursive")
olderThan := ctx.String("older-than")
newerThan := ctx.String("newer-than")
storageClass := ctx.String("storage-class")
recursive := cliCtx.Bool("recursive")
olderThan := cliCtx.String("older-than")
newerThan := cliCtx.String("newer-than")
storageClass := cliCtx.String("storage-class")
sseKeys := os.Getenv("MC_ENCRYPT_KEY")
if key := ctx.String("encrypt-key"); key != "" {
if key := cliCtx.String("encrypt-key"); key != "" {
sseKeys = key
}
@@ -323,12 +327,12 @@ func mainMove(ctx *cli.Context) error {
sseKeys, err = getDecodedKey(sseKeys)
fatalIf(err, "Unable to parse encryption keys.")
}
sse := ctx.String("encrypt")
sse := cliCtx.String("encrypt")
var session *sessionV8
if ctx.Bool("continue") {
sessionID := getHash("mv", ctx.Args())
if cliCtx.Bool("continue") {
sessionID := getHash("mv", cliCtx.Args())
if isSessionExists(sessionID) {
session, err = loadSessionV8(sessionID)
fatalIf(err.Trace(sessionID), "Unable to load session.")
@@ -341,13 +345,13 @@ func mainMove(ctx *cli.Context) error {
session.Header.CommandStringFlags["storage-class"] = storageClass
session.Header.CommandStringFlags["encrypt-key"] = sseKeys
session.Header.CommandStringFlags["encrypt"] = sse
session.Header.CommandBoolFlags["session"] = ctx.Bool("continue")
session.Header.CommandBoolFlags["session"] = cliCtx.Bool("continue")
if ctx.Bool("preserve") {
session.Header.CommandBoolFlags["preserve"] = ctx.Bool("preserve")
if cliCtx.Bool("preserve") {
session.Header.CommandBoolFlags["preserve"] = cliCtx.Bool("preserve")
}
session.Header.UserMetaData = userMetaMap
session.Header.CommandBoolFlags["disable-multipart"] = ctx.Bool("disable-multipart")
session.Header.CommandBoolFlags["disable-multipart"] = cliCtx.Bool("disable-multipart")
var e error
if session.Header.RootPath, e = os.Getwd(); e != nil {
@@ -356,11 +360,11 @@ func mainMove(ctx *cli.Context) error {
}
// extract URLs.
session.Header.CommandArgs = ctx.Args()
session.Header.CommandArgs = cliCtx.Args()
}
}
e := doCopySession(ctx, session, encKeyDB, true)
e := doCopySession(ctx, cancelMove, cliCtx, session, encKeyDB, true)
if session != nil {
session.Delete()
}
+1 -1
View File
@@ -90,7 +90,7 @@ func pipe(targetURL string, encKeyDB map[string][]prefixSSEPair, storageClass st
if storageClass != "" {
metadata = map[string]string{"X-Amz-Storage-Class": storageClass}
}
_, err := putTargetStreamWithURL(targetURL, os.Stdin, -1, sseKey, false, false, metadata)
_, err := putTargetStreamWithURL(targetURL, os.Stdin, -1, sseKey, false, false, false, metadata)
// TODO: See if this check is necessary.
switch e := err.ToGoError().(type) {
case *os.PathError:
+27 -14
View File
@@ -18,6 +18,7 @@ package cmd
import (
"bytes"
"context"
"io"
"net/url"
"os"
@@ -253,20 +254,20 @@ func accessPermToString(perm accessPerms) string {
}
// doSetAccess do set access.
func doSetAccess(targetURL string, targetPERMS accessPerms) *probe.Error {
func doSetAccess(ctx context.Context, targetURL string, targetPERMS accessPerms) *probe.Error {
clnt, err := newClient(targetURL)
if err != nil {
return err.Trace(targetURL)
}
policy := accessPermToString(targetPERMS)
if err = clnt.SetAccess(policy, false); err != nil {
if err = clnt.SetAccess(ctx, policy, false); err != nil {
return err.Trace(targetURL, string(targetPERMS))
}
return nil
}
// doSetAccessJSON do set access JSON.
func doSetAccessJSON(targetURL string, targetPERMS accessPerms) *probe.Error {
func doSetAccessJSON(ctx context.Context, targetURL string, targetPERMS accessPerms) *probe.Error {
clnt, err := newClient(targetURL)
if err != nil {
return err.Trace(targetURL)
@@ -289,7 +290,7 @@ func doSetAccessJSON(targetURL string, targetPERMS accessPerms) *probe.Error {
}
configBytes := configBuf[:n]
if err = clnt.SetAccess(string(configBytes), true); err != nil {
if err = clnt.SetAccess(ctx, string(configBytes), true); err != nil {
return err.Trace(targetURL, string(targetPERMS))
}
return nil
@@ -314,12 +315,12 @@ func stringToAccessPerm(perm string) accessPerms {
}
// doGetAccess do get access.
func doGetAccess(targetURL string) (perms accessPerms, policyStr string, err *probe.Error) {
func doGetAccess(ctx context.Context, targetURL string) (perms accessPerms, policyStr string, err *probe.Error) {
clnt, err := newClient(targetURL)
if err != nil {
return "", "", err.Trace(targetURL)
}
perm, policyJSON, err := clnt.GetAccess()
perm, policyJSON, err := clnt.GetAccess(ctx)
if err != nil {
return "", "", err.Trace(targetURL)
}
@@ -327,18 +328,21 @@ func doGetAccess(targetURL string) (perms accessPerms, policyStr string, err *pr
}
// doGetAccessRules do get access rules.
func doGetAccessRules(targetURL string) (r map[string]string, err *probe.Error) {
func doGetAccessRules(ctx context.Context, targetURL string) (r map[string]string, err *probe.Error) {
clnt, err := newClient(targetURL)
if err != nil {
return map[string]string{}, err.Trace(targetURL)
}
return clnt.GetAccessRules()
return clnt.GetAccessRules(ctx)
}
// Run policy list command
func runPolicyListCmd(args cli.Args) {
ctx, cancelPolicyList := context.WithCancel(globalContext)
defer cancelPolicyList()
targetURL := args.First()
policies, err := doGetAccessRules(targetURL)
policies, err := doGetAccessRules(ctx, targetURL)
if err != nil {
switch err.ToGoError().(type) {
case APINotImplemented:
@@ -354,11 +358,14 @@ func runPolicyListCmd(args cli.Args) {
// Run policy links command
func runPolicyLinksCmd(args cli.Args, recursive bool) {
ctx, cancelPolicyLinks := context.WithCancel(globalContext)
defer cancelPolicyLinks()
// Get alias/bucket/prefix argument
targetURL := args.First()
// Fetch all policies associated to the passed url
policies, err := doGetAccessRules(targetURL)
policies, err := doGetAccessRules(ctx, targetURL)
if err != nil {
switch err.ToGoError().(type) {
case APINotImplemented:
@@ -394,7 +401,7 @@ func runPolicyLinksCmd(args cli.Args, recursive bool) {
clnt, err := newClient(newURL)
fatalIf(err.Trace(newURL), "Unable to initialize target `"+targetURL+"`.")
// Search for public objects
for content := range clnt.List(isRecursive, isIncomplete, false, DirFirst) {
for content := range clnt.List(globalContext, isRecursive, isIncomplete, false, DirFirst) {
if content.Err != nil {
errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.")
continue
@@ -422,15 +429,21 @@ func runPolicyLinksCmd(args cli.Args, recursive bool) {
// Run policy cmd to fetch set permission
func runPolicyCmd(args cli.Args) {
ctx, cancelPolicy := context.WithCancel(globalContext)
defer cancelPolicy()
var operation, policyStr string
var probeErr *probe.Error
perms := accessPerms(args.Get(1))
targetURL := args.Get(2)
if perms.isValidAccessPERM() {
probeErr = doSetAccess(targetURL, perms)
operation = "set"
probeErr = doSetAccess(ctx, targetURL, perms)
if probeErr == nil {
perms, _, probeErr = doGetAccess(ctx, targetURL)
}
} else if perms.isValidAccessFile() {
probeErr = doSetAccessJSON(targetURL, perms)
probeErr = doSetAccessJSON(ctx, targetURL, perms)
operation = "set-json"
} else {
targetURL = args.Get(1)
@@ -438,7 +451,7 @@ func runPolicyCmd(args cli.Args) {
if args.First() == "get-json" {
operation = "get-json"
}
perms, policyStr, probeErr = doGetAccess(targetURL)
perms, policyStr, probeErr = doGetAccess(ctx, targetURL)
}
// Upon error exit.
+23 -23
View File
@@ -93,17 +93,17 @@ func (s removeBucketMessage) JSON() string {
}
// Validate command line arguments.
func checkRbSyntax(ctx *cli.Context) {
if !ctx.Args().Present() {
func checkRbSyntax(ctx context.Context, cliCtx *cli.Context) {
if !cliCtx.Args().Present() {
exitCode := 1
cli.ShowCommandHelpAndExit(ctx, "rb", exitCode)
cli.ShowCommandHelpAndExit(cliCtx, "rb", exitCode)
}
// Set command flags from context.
isForce := ctx.Bool("force")
isDangerous := ctx.Bool("dangerous")
isForce := cliCtx.Bool("force")
isDangerous := cliCtx.Bool("dangerous")
for _, url := range ctx.Args() {
if isNamespaceRemoval(url) {
for _, url := range cliCtx.Args() {
if isNamespaceRemoval(ctx, url) {
if isForce && isDangerous {
continue
}
@@ -114,10 +114,7 @@ func checkRbSyntax(ctx *cli.Context) {
}
// deletes a bucket and all its contents
func deleteBucket(url string) *probe.Error {
ctx, cancelCopy := context.WithCancel(globalContext)
defer cancelCopy()
func deleteBucket(ctx context.Context, url string) *probe.Error {
targetAlias, targetURL, _ := mustExpandAlias(url)
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
if pErr != nil {
@@ -126,11 +123,11 @@ func deleteBucket(url string) *probe.Error {
var isIncomplete bool
isRemoveBucket := true
contentCh := make(chan *ClientContent)
errorCh := clnt.Remove(isIncomplete, isRemoveBucket, false, contentCh)
errorCh := clnt.Remove(ctx, isIncomplete, isRemoveBucket, false, contentCh)
go func() {
defer close(contentCh)
for content := range clnt.List(true, false, false, DirLast) {
for content := range clnt.List(ctx, true, false, false, DirLast) {
if content.Err != nil {
contentCh <- content
continue
@@ -175,12 +172,12 @@ func deleteBucket(url string) *probe.Error {
// isNamespaceRemoval returns true if alias
// is not qualified by bucket
func isNamespaceRemoval(url string) bool {
func isNamespaceRemoval(ctx context.Context, url string) bool {
// clean path for aliases like s3/.
//Note: UNC path using / works properly in go 1.9.2 even though it breaks the UNC specification.
url = filepath.ToSlash(filepath.Clean(url))
// namespace removal applies only for non FS. So filter out if passed url represents a directory
if !isAliasURLDir(url, nil) {
if !isAliasURLDir(ctx, url, nil) {
_, path := url2Alias(url)
return (path == "")
}
@@ -188,16 +185,19 @@ func isNamespaceRemoval(url string) bool {
}
// mainRemoveBucket is entry point for rb command.
func mainRemoveBucket(ctx *cli.Context) error {
func mainRemoveBucket(cliCtx *cli.Context) error {
ctx, cancelRemoveBucket := context.WithCancel(globalContext)
defer cancelRemoveBucket()
// check 'rb' cli arguments.
checkRbSyntax(ctx)
isForce := ctx.Bool("force")
checkRbSyntax(ctx, cliCtx)
isForce := cliCtx.Bool("force")
// Additional command specific theme customization.
console.SetColor("RemoveBucket", color.New(color.FgGreen, color.Bold))
var cErr error
for _, targetURL := range ctx.Args() {
for _, targetURL := range cliCtx.Args() {
// Instantiate client for URL.
clnt, err := newClient(targetURL)
if err != nil {
@@ -205,7 +205,7 @@ func mainRemoveBucket(ctx *cli.Context) error {
cErr = exitStatus(globalErrorExitStatus)
continue
}
_, err = clnt.Stat(false, false, nil)
_, err = clnt.Stat(ctx, false, false, nil)
if err != nil {
switch err.ToGoError().(type) {
case BucketNameEmpty:
@@ -218,7 +218,7 @@ func mainRemoveBucket(ctx *cli.Context) error {
}
isEmpty := true
for range clnt.List(true, false, false, DirNone) {
for range clnt.List(ctx, true, false, false, DirNone) {
isEmpty = false
break
}
@@ -227,10 +227,10 @@ func mainRemoveBucket(ctx *cli.Context) error {
fatalIf(errDummy().Trace(), "`"+targetURL+"` is not empty. Retry this command with ‘--force’ flag if you want to remove `"+targetURL+"` and all its contents")
}
e := deleteBucket(targetURL)
e := deleteBucket(ctx, targetURL)
fatalIf(e.Trace(targetURL), "Failed to remove `"+targetURL+"`.")
if !isNamespaceRemoval(targetURL) {
if !isNamespaceRemoval(ctx, targetURL) {
printMsg(removeBucketMessage{
Bucket: targetURL, Status: "success",
})
+7 -3
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"fmt"
"strconv"
"strings"
@@ -26,7 +27,7 @@ import (
"github.com/minio/cli"
json "github.com/minio/mc/pkg/colorjson"
"github.com/minio/mc/pkg/probe"
minio "github.com/minio/minio-go/v6"
minio "github.com/minio/minio-go/v7"
"github.com/minio/minio/pkg/console"
)
@@ -116,6 +117,9 @@ func getRetainUntilDate(validity uint64, unit minio.ValidityUnit) (string, *prob
// setRetention - Set Retention for all objects within a given prefix.
func setRetention(urlStr string, mode minio.RetentionMode, validity uint64, unit minio.ValidityUnit, bypassGovernance, isRecursive bool) error {
ctx, cancelSetRetention := context.WithCancel(globalContext)
defer cancelSetRetention()
clnt, err := newClient(urlStr)
if err != nil {
fatalIf(err.Trace(), "Cannot parse the provided url.")
@@ -130,7 +134,7 @@ func setRetention(urlStr string, mode minio.RetentionMode, validity uint64, unit
alias, _, _ := mustExpandAlias(urlStr)
var cErr error
for content := range clnt.List(isRecursive, false, false, DirNone) {
for content := range clnt.List(ctx, isRecursive, false, false, DirNone) {
if content.Err != nil {
errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to list folder.")
cErr = exitStatus(globalErrorExitStatus) // Set the exit status.
@@ -152,7 +156,7 @@ func setRetention(urlStr string, mode minio.RetentionMode, validity uint64, unit
errorIf(err.Trace(clnt.GetURL().String()), "Invalid URL")
continue
}
err = newClnt.PutObjectRetention(mode, retainUntil, bypassGovernance)
err = newClnt.PutObjectRetention(ctx, mode, retainUntil, bypassGovernance)
if err != nil {
printMsg(retentionCmdMessage{
Mode: mode,
+10 -6
View File
@@ -18,11 +18,12 @@
package cmd
import (
"context"
"math/rand"
"sync"
"time"
"github.com/minio/minio-go/v6"
"github.com/minio/minio-go/v7"
)
// lockedRandSource provides protected rand source, implements rand.Source interface.
@@ -51,7 +52,7 @@ func (r *lockedRandSource) Seed(seed int64) {
var random = rand.New(&lockedRandSource{src: rand.NewSource(time.Now().UTC().UnixNano())})
// newRetryTimerContinous creates a timer with exponentially increasing delays forever.
func newRetryTimerContinous(unit time.Duration, cap time.Duration, jitter float64, doneCh chan struct{}) <-chan int {
func newRetryTimerContinous(ctx context.Context, unit time.Duration, cap time.Duration, jitter float64) <-chan int {
attemptCh := make(chan int)
// normalize jitter to the range [0, 1.0]
@@ -86,14 +87,17 @@ func newRetryTimerContinous(unit time.Duration, cap time.Duration, jitter float6
var nextBackoff int
for {
select {
// Attempts starts.
case attemptCh <- nextBackoff:
nextBackoff++
case <-doneCh:
// Stop the routine.
case <-ctx.Done():
return
}
select {
case <-time.After(exponentialBackoffWait(nextBackoff)):
case <-ctx.Done():
return
}
time.Sleep(exponentialBackoffWait(nextBackoff))
}
}()
return attemptCh
+35 -25
View File
@@ -18,6 +18,7 @@ package cmd
import (
"bufio"
"context"
"fmt"
"os"
"path/filepath"
@@ -148,20 +149,20 @@ func (r rmMessage) JSON() string {
}
// Validate command line arguments.
func checkRmSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
func checkRmSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
// Set command flags from context.
isForce := ctx.Bool("force")
isRecursive := ctx.Bool("recursive")
isStdin := ctx.Bool("stdin")
isDangerous := ctx.Bool("dangerous")
isForce := cliCtx.Bool("force")
isRecursive := cliCtx.Bool("recursive")
isStdin := cliCtx.Bool("stdin")
isDangerous := cliCtx.Bool("dangerous")
isNamespaceRemoval := false
for _, url := range ctx.Args() {
for _, url := range cliCtx.Args() {
// clean path for aliases like s3/.
// Note: UNC path using / works properly in go 1.9.2 even though it breaks the UNC specification.
url = filepath.ToSlash(filepath.Clean(url))
// namespace removal applies only for non FS. So filter out if passed url represents a directory
dir := isAliasURLDir(url, encKeyDB)
dir := isAliasURLDir(ctx, url, encKeyDB)
if !dir {
_, path := url2Alias(url)
isNamespaceRemoval = (path == "")
@@ -176,9 +177,9 @@ func checkRmSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
"Removal requires --recursive flag. This operation is *IRREVERSIBLE*. Please review carefully before performing this *DANGEROUS* operation.")
}
}
if !ctx.Args().Present() && !isStdin {
if !cliCtx.Args().Present() && !isStdin {
exitCode := 1
cli.ShowCommandHelpAndExit(ctx, "rm", exitCode)
cli.ShowCommandHelpAndExit(cliCtx, "rm", exitCode)
}
// For all recursive operations make sure to check for 'force' flag.
@@ -197,8 +198,11 @@ func checkRmSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
}
func removeSingle(url string, isIncomplete, isFake, isForce, isBypass bool, olderThan, newerThan string, encKeyDB map[string][]prefixSSEPair) error {
ctx, cancelRemoveSingle := context.WithCancel(globalContext)
defer cancelRemoveSingle()
isRecursive := false
contents, pErr := statURL(url, isIncomplete, isRecursive, encKeyDB)
contents, pErr := statURL(ctx, url, isIncomplete, isRecursive, encKeyDB)
if pErr != nil {
errorIf(pErr.Trace(url), "Failed to remove `"+url+"`.")
return exitStatus(globalErrorExitStatus)
@@ -243,7 +247,7 @@ func removeSingle(url string, isIncomplete, isFake, isForce, isBypass bool, olde
contentCh <- &ClientContent{URL: *newClientURL(targetURL)}
close(contentCh)
isRemoveBucket := false
errorCh := clnt.Remove(isIncomplete, isRemoveBucket, isBypass, contentCh)
errorCh := clnt.Remove(ctx, isIncomplete, isRemoveBucket, isBypass, contentCh)
for pErr := range errorCh {
if pErr != nil {
errorIf(pErr.Trace(url), "Failed to remove `"+url+"`.")
@@ -260,6 +264,9 @@ func removeSingle(url string, isIncomplete, isFake, isForce, isBypass bool, olde
}
func removeRecursive(url string, isIncomplete, isFake, isBypass bool, olderThan, newerThan string, encKeyDB map[string][]prefixSSEPair) error {
ctx, cancelRemoveRecursive := context.WithCancel(globalContext)
defer cancelRemoveRecursive()
targetAlias, targetURL, _ := mustExpandAlias(url)
clnt, pErr := newClientFromAlias(targetAlias, targetURL)
if pErr != nil {
@@ -269,10 +276,10 @@ func removeRecursive(url string, isIncomplete, isFake, isBypass bool, olderThan,
contentCh := make(chan *ClientContent)
isRemoveBucket := false
errorCh := clnt.Remove(isIncomplete, isRemoveBucket, isBypass, contentCh)
errorCh := clnt.Remove(ctx, isIncomplete, isRemoveBucket, isBypass, contentCh)
isRecursive := true
for content := range clnt.List(isRecursive, isIncomplete, false, DirNone) {
for content := range clnt.List(ctx, isRecursive, isIncomplete, false, DirNone) {
if content.Err != nil {
errorIf(content.Err.Trace(url), "Failed to remove `"+url+"` recursively.")
switch content.Err.ToGoError().(type) {
@@ -340,23 +347,26 @@ func removeRecursive(url string, isIncomplete, isFake, isBypass bool, olderThan,
}
// main for rm command.
func mainRm(ctx *cli.Context) error {
func mainRm(cliCtx *cli.Context) error {
ctx, cancelRm := context.WithCancel(globalContext)
defer cancelRm()
// Parse encryption keys per command.
encKeyDB, err := getEncKeys(ctx)
encKeyDB, err := getEncKeys(cliCtx)
fatalIf(err, "Unable to parse encryption keys.")
// check 'rm' cli arguments.
checkRmSyntax(ctx, encKeyDB)
checkRmSyntax(ctx, cliCtx, encKeyDB)
// rm specific flags.
isIncomplete := ctx.Bool("incomplete")
isRecursive := ctx.Bool("recursive")
isFake := ctx.Bool("fake")
isStdin := ctx.Bool("stdin")
isBypass := ctx.Bool(bypass)
olderThan := ctx.String("older-than")
newerThan := ctx.String("newer-than")
isForce := ctx.Bool("force")
isIncomplete := cliCtx.Bool("incomplete")
isRecursive := cliCtx.Bool("recursive")
isFake := cliCtx.Bool("fake")
isStdin := cliCtx.Bool("stdin")
isBypass := cliCtx.Bool(bypass)
olderThan := cliCtx.String("older-than")
newerThan := cliCtx.String("newer-than")
isForce := cliCtx.Bool("force")
// Set color.
console.SetColor("Remove", color.New(color.FgGreen, color.Bold))
@@ -364,7 +374,7 @@ func mainRm(ctx *cli.Context) error {
var rerr error
var e error
// Support multiple targets.
for _, url := range ctx.Args() {
for _, url := range cliCtx.Args() {
if isRecursive {
e = removeRecursive(url, isIncomplete, isFake, isBypass, olderThan, newerThan, encKeyDB)
} else {
+24 -20
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"strings"
"time"
@@ -66,15 +67,15 @@ EXAMPLES:
}
// checkShareDownloadSyntax - validate command-line args.
func checkShareDownloadSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
args := ctx.Args()
func checkShareDownloadSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
args := cliCtx.Args()
if !args.Present() {
cli.ShowCommandHelpAndExit(ctx, "download", 1) // last argument is exit code.
cli.ShowCommandHelpAndExit(cliCtx, "download", 1) // last argument is exit code.
}
// Parse expiry.
expiry := shareDefaultExpiry
expireArg := ctx.String("expire")
expireArg := cliCtx.String("expire")
if expireArg != "" {
var e error
expiry, e = time.ParseDuration(expireArg)
@@ -90,10 +91,10 @@ func checkShareDownloadSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEP
}
// Validate if object exists only if the `--recursive` flag was NOT specified
isRecursive := ctx.Bool("recursive")
isRecursive := cliCtx.Bool("recursive")
if !isRecursive {
for _, url := range ctx.Args() {
_, _, err := url2Stat(url, false, encKeyDB)
for _, url := range cliCtx.Args() {
_, _, err := url2Stat(ctx, url, false, encKeyDB)
if err != nil {
fatalIf(err.Trace(url), "Unable to stat `"+url+"`.")
}
@@ -102,7 +103,7 @@ func checkShareDownloadSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEP
}
// doShareURL share files from target.
func doShareDownloadURL(targetURL string, isRecursive bool, expiry time.Duration) *probe.Error {
func doShareDownloadURL(ctx context.Context, targetURL string, isRecursive bool, expiry time.Duration) *probe.Error {
targetAlias, targetURLFull, _, err := expandAlias(targetURL)
if err != nil {
return err.Trace(targetURL)
@@ -125,7 +126,7 @@ func doShareDownloadURL(targetURL string, isRecursive bool, expiry time.Duration
// Channel which will receive objects whose URLs need to be shared
objectsCh := make(chan *ClientContent)
content, err := clnt.Stat(isIncomplete, false, nil)
content, err := clnt.Stat(ctx, isIncomplete, false, nil)
if err != nil {
return err.Trace(clnt.GetURL().String())
}
@@ -146,7 +147,7 @@ func doShareDownloadURL(targetURL string, isRecursive bool, expiry time.Duration
// Recursive mode: Share list of objects
go func() {
defer close(objectsCh)
for content := range clnt.List(isRecursive, isIncomplete, false, DirNone) {
for content := range clnt.List(ctx, isRecursive, isIncomplete, false, DirNone) {
objectsCh <- content
}
}()
@@ -168,7 +169,7 @@ func doShareDownloadURL(targetURL string, isRecursive bool, expiry time.Duration
}
// Generate share URL.
shareURL, err := newClnt.ShareDownload(expiry)
shareURL, err := newClnt.ShareDownload(ctx, expiry)
if err != nil {
// add objectURL and expiry as part of the trace arguments.
return err.Trace(objectURL, "expiry="+expiry.String())
@@ -190,13 +191,16 @@ func doShareDownloadURL(targetURL string, isRecursive bool, expiry time.Duration
}
// main for share download.
func mainShareDownload(ctx *cli.Context) error {
func mainShareDownload(cliCtx *cli.Context) error {
ctx, cancelShareDownload := context.WithCancel(globalContext)
defer cancelShareDownload()
// Parse encryption keys per command.
encKeyDB, err := getEncKeys(ctx)
encKeyDB, err := getEncKeys(cliCtx)
fatalIf(err, "Unable to parse encryption keys.")
// check input arguments.
checkShareDownloadSyntax(ctx, encKeyDB)
checkShareDownloadSyntax(ctx, cliCtx, encKeyDB)
// Initialize share config folder.
initShareConfig()
@@ -205,16 +209,16 @@ func mainShareDownload(ctx *cli.Context) error {
shareSetColor()
// Set command flags from context.
isRecursive := ctx.Bool("recursive")
isRecursive := cliCtx.Bool("recursive")
expiry := shareDefaultExpiry
if ctx.String("expire") != "" {
if cliCtx.String("expire") != "" {
var e error
expiry, e = time.ParseDuration(ctx.String("expire"))
fatalIf(probe.NewError(e), "Unable to parse expire=`"+ctx.String("expire")+"`.")
expiry, e = time.ParseDuration(cliCtx.String("expire"))
fatalIf(probe.NewError(e), "Unable to parse expire=`"+cliCtx.String("expire")+"`.")
}
for _, targetURL := range ctx.Args() {
err := doShareDownloadURL(targetURL, isRecursive, expiry)
for _, targetURL := range cliCtx.Args() {
err := doShareDownloadURL(ctx, targetURL, isRecursive, expiry)
if err != nil {
switch err.ToGoError().(type) {
case APINotImplemented:
+2 -1
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"fmt"
"strings"
"time"
@@ -149,7 +150,7 @@ func doShareUploadURL(objectURL string, isRecursive bool, expiry time.Duration,
}
// Generate pre-signed access info.
shareURL, uploadInfo, err := clnt.ShareUpload(isRecursive, expiry, contentType)
shareURL, uploadInfo, err := clnt.ShareUpload(context.Background(), isRecursive, expiry, contentType)
if err != nil {
return err.Trace(objectURL, "expiry="+expiry.String(), "contentType="+contentType)
}
+2
View File
@@ -35,8 +35,10 @@ func trapSignals(sig ...os.Signal) {
<-sigCh
// Once signal has been received stop signal Notify handler.
signal.Stop(sigCh)
// Cancel the global context
globalCancel()
}
+18 -11
View File
@@ -20,6 +20,7 @@ import (
"bufio"
"compress/bzip2"
"compress/gzip"
"context"
"errors"
"fmt"
"io"
@@ -31,7 +32,7 @@ import (
"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v6"
"github.com/minio/minio-go/v7"
"github.com/minio/minio/pkg/mimedb"
)
@@ -308,7 +309,7 @@ func getCSVHeader(sourceURL string, encKeyDB map[string][]prefixSSEPair) ([]stri
default:
var err *probe.Error
var metadata map[string]string
if r, metadata, err = getSourceStreamMetadataFromURL(sourceURL, encKeyDB); err != nil {
if r, metadata, err = getSourceStreamMetadataFromURL(globalContext, sourceURL, encKeyDB); err != nil {
return nil, err.Trace(sourceURL)
}
ctype := metadata["Content-Type"]
@@ -381,6 +382,9 @@ func isCSVOrJSON(inOpts map[string]map[string]string) bool {
}
func sqlSelect(targetURL, expression string, encKeyDB map[string][]prefixSSEPair, selOpts SelectObjectOpts, csvHdrs []string, writeHdr bool) *probe.Error {
ctx, cancelSelect := context.WithCancel(globalContext)
defer cancelSelect()
alias, _, _, err := expandAlias(targetURL)
if err != nil {
return err.Trace(targetURL)
@@ -392,7 +396,7 @@ func sqlSelect(targetURL, expression string, encKeyDB map[string][]prefixSSEPair
}
sseKey := getSSE(targetURL, encKeyDB[alias])
outputer, err := targetClnt.Select(expression, sseKey, selOpts)
outputer, err := targetClnt.Select(ctx, expression, sseKey, selOpts)
if err != nil {
return err.Trace(targetURL, expression)
}
@@ -430,28 +434,31 @@ func checkSQLSyntax(ctx *cli.Context) {
}
// mainSQL is the main entry point for sql command.
func mainSQL(ctx *cli.Context) error {
func mainSQL(cliCtx *cli.Context) error {
ctx, cancelSQL := context.WithCancel(globalContext)
defer cancelSQL()
var (
csvHdrs []string
selOpts SelectObjectOpts
query string
)
// Parse encryption keys per command.
encKeyDB, err := getEncKeys(ctx)
encKeyDB, err := getEncKeys(cliCtx)
fatalIf(err, "Unable to parse encryption keys.")
// validate sql input arguments.
checkSQLSyntax(ctx)
checkSQLSyntax(cliCtx)
// extract URLs.
URLs := ctx.Args()
URLs := cliCtx.Args()
writeHdr := true
for _, url := range URLs {
if _, targetContent, err := url2Stat(url, false, encKeyDB); err != nil {
if _, targetContent, err := url2Stat(ctx, url, false, encKeyDB); err != nil {
errorIf(err.Trace(url), "Unable to run sql for "+url+".")
continue
} else if !targetContent.Type.IsDir() {
if writeHdr {
query, csvHdrs, selOpts = getAndValidateArgs(ctx, encKeyDB, url)
query, csvHdrs, selOpts = getAndValidateArgs(cliCtx, encKeyDB, url)
}
errorIf(sqlSelect(url, query, encKeyDB, selOpts, csvHdrs, writeHdr).Trace(url), "Unable to run sql")
writeHdr = false
@@ -464,13 +471,13 @@ func mainSQL(ctx *cli.Context) error {
continue
}
for content := range clnt.List(ctx.Bool("recursive"), false, false, DirNone) {
for content := range clnt.List(ctx, cliCtx.Bool("recursive"), false, false, DirNone) {
if content.Err != nil {
errorIf(content.Err.Trace(url), "Unable to list on target `"+url+"`.")
continue
}
if writeHdr {
query, csvHdrs, selOpts = getAndValidateArgs(ctx, encKeyDB, targetAlias+content.URL.Path)
query, csvHdrs, selOpts = getAndValidateArgs(cliCtx, encKeyDB, targetAlias+content.URL.Path)
}
contentType := mimedb.TypeByExtension(filepath.Ext(content.URL.Path))
for _, cTypeSuffix := range supportedContentTypes {
+17 -13
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"strings"
"github.com/fatih/color"
@@ -73,23 +74,23 @@ EXAMPLES:
}
// checkStatSyntax - validate all the passed arguments
func checkStatSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
if !ctx.Args().Present() {
cli.ShowCommandHelpAndExit(ctx, "stat", 1) // last argument is exit code
func checkStatSyntax(ctx context.Context, cliCtx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
if !cliCtx.Args().Present() {
cli.ShowCommandHelpAndExit(cliCtx, "stat", 1) // last argument is exit code
}
args := ctx.Args()
args := cliCtx.Args()
for _, arg := range args {
if strings.TrimSpace(arg) == "" {
fatalIf(errInvalidArgument().Trace(args...), "Unable to validate empty argument.")
}
}
// extract URLs.
URLs := ctx.Args()
URLs := cliCtx.Args()
isIncomplete := false
for _, url := range URLs {
_, _, err := url2Stat(url, false, encKeyDB)
_, _, err := url2Stat(ctx, url, false, encKeyDB)
if err != nil && !isURLPrefixExists(url, isIncomplete) {
fatalIf(err.Trace(url), "Unable to stat `"+url+"`.")
}
@@ -97,7 +98,10 @@ func checkStatSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) {
}
// mainStat - is a handler for mc stat command
func mainStat(ctx *cli.Context) error {
func mainStat(cliCtx *cli.Context) error {
ctx, cancelStat := context.WithCancel(globalContext)
defer cancelStat()
// Additional command specific theme customization.
console.SetColor("Name", color.New(color.Bold, color.FgCyan))
console.SetColor("Date", color.New(color.FgWhite))
@@ -106,24 +110,24 @@ func mainStat(ctx *cli.Context) error {
console.SetColor("Metadata", color.New(color.FgWhite))
// Parse encryption keys per command.
encKeyDB, err := getEncKeys(ctx)
encKeyDB, err := getEncKeys(cliCtx)
fatalIf(err, "Unable to parse encryption keys.")
// check 'stat' cli arguments.
checkStatSyntax(ctx, encKeyDB)
checkStatSyntax(ctx, cliCtx, encKeyDB)
// Set command flags from context.
isRecursive := ctx.Bool("recursive")
isRecursive := cliCtx.Bool("recursive")
args := ctx.Args()
args := cliCtx.Args()
// mimic operating system tool behavior.
if !ctx.Args().Present() {
if !cliCtx.Args().Present() {
args = []string{"."}
}
var cErr error
for _, targetURL := range args {
stats, err := statURL(targetURL, false, isRecursive, encKeyDB)
stats, err := statURL(ctx, targetURL, false, isRecursive, encKeyDB)
if err != nil {
fatalIf(err, "Unable to stat `"+targetURL+"`.")
}
+4 -3
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"fmt"
"path/filepath"
"strings"
@@ -127,7 +128,7 @@ func getStandardizedURL(targetURL string) string {
}
// statURL - simple or recursive listing
func statURL(targetURL string, isIncomplete, isRecursive bool, encKeyDB map[string][]prefixSSEPair) ([]*ClientContent, *probe.Error) {
func statURL(ctx context.Context, targetURL string, isIncomplete, isRecursive bool, encKeyDB map[string][]prefixSSEPair) ([]*ClientContent, *probe.Error) {
var stats []*ClientContent
var clnt Client
clnt, err := newClient(targetURL)
@@ -143,7 +144,7 @@ func statURL(targetURL string, isIncomplete, isRecursive bool, encKeyDB map[stri
prefixPath = prefixPath[:strings.LastIndex(prefixPath, separator)+1]
}
var cErr error
for content := range clnt.List(isRecursive, isIncomplete, false, DirNone) {
for content := range clnt.List(ctx, isRecursive, isIncomplete, false, DirNone) {
if content.Err != nil {
switch content.Err.ToGoError().(type) {
// handle this specifically for filesystem related errors.
@@ -176,7 +177,7 @@ func statURL(targetURL string, isIncomplete, isRecursive bool, encKeyDB map[stri
return nil, errTargetNotFound(targetURL).Trace(url, standardizedURL)
}
_, stat, err := url2Stat(url, true, encKeyDB)
_, stat, err := url2Stat(ctx, url, true, encKeyDB)
if err != nil {
stat = content
}
+18 -9
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"errors"
"fmt"
"sort"
@@ -26,6 +27,7 @@ import (
"github.com/minio/cli"
json "github.com/minio/mc/pkg/colorjson"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio-go/v7"
"github.com/minio/minio/pkg/console"
)
@@ -100,20 +102,27 @@ func (t tagListMessage) String() string {
return strings.Join(strs, "\n")
}
func mainListTag(ctx *cli.Context) error {
if len(ctx.Args()) != 1 {
cli.ShowCommandHelpAndExit(ctx, "list", globalErrorExitStatus)
func mainListTag(cliCtx *cli.Context) error {
ctx, cancelListTag := context.WithCancel(globalContext)
defer cancelListTag()
if len(cliCtx.Args()) != 1 {
cli.ShowCommandHelpAndExit(cliCtx, "list", globalErrorExitStatus)
}
targetURL := ctx.Args().Get(0)
targetURL := cliCtx.Args().Get(0)
clnt, err := newClient(targetURL)
fatalIf(err, "Unable to initialize target "+targetURL)
tags, err := clnt.GetTags()
fatalIf(err, "Unable to fetch tags for "+targetURL)
tagsMap, err := clnt.GetTags(ctx)
if err != nil {
if minio.ToErrorResponse(err.ToGoError()).Code == "NoSuchTagSet" {
fatalIf(probe.NewError(errors.New("check 'mc tag set --help' on how to set tags")), "No tags found for "+targetURL)
}
fatalIf(err, "Unable to fetch tags for "+targetURL)
}
tagMap := tags.ToMap()
if len(tagMap) == 0 {
if len(tagsMap) == 0 {
fatalIf(probe.NewError(errors.New("check 'mc tag set --help' on how to set tags")), "No tags found for "+targetURL)
}
@@ -122,7 +131,7 @@ func mainListTag(ctx *cli.Context) error {
console.SetColor("Value", color.New(color.FgYellow))
printMsg(tagListMessage{
Tags: tagMap,
Tags: tagsMap,
Status: "success",
URL: targetURL,
})
+9 -4
View File
@@ -17,6 +17,8 @@
package cmd
import (
"context"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/mc/pkg/colorjson"
@@ -74,15 +76,18 @@ func checkRemoveTagSyntax(ctx *cli.Context) {
}
}
func mainRemoveTag(ctx *cli.Context) error {
checkRemoveTagSyntax(ctx)
func mainRemoveTag(cliCtx *cli.Context) error {
ctx, cancelList := context.WithCancel(globalContext)
defer cancelList()
checkRemoveTagSyntax(cliCtx)
console.SetColor("Remove", color.New(color.FgGreen))
targetURL := ctx.Args().Get(0)
targetURL := cliCtx.Args().Get(0)
clnt, pErr := newClient(targetURL)
fatalIf(pErr, "Unable to initialize target "+targetURL)
pErr = clnt.DeleteTags()
pErr = clnt.DeleteTags(ctx)
fatalIf(pErr, "Unable to remove tags for "+targetURL)
printMsg(tagRemoveMessage{
+11 -6
View File
@@ -17,6 +17,8 @@
package cmd
import (
"context"
"github.com/fatih/color"
"github.com/minio/cli"
json "github.com/minio/mc/pkg/colorjson"
@@ -75,17 +77,20 @@ func checkSetTagSyntax(ctx *cli.Context) {
}
}
func mainSetTag(ctx *cli.Context) error {
checkSetTagSyntax(ctx)
func mainSetTag(cliCtx *cli.Context) error {
ctx, cancelSetTag := context.WithCancel(globalContext)
defer cancelSetTag()
checkSetTagSyntax(cliCtx)
console.SetColor("List", color.New(color.FgGreen))
targetURL := ctx.Args().Get(0)
tags := ctx.Args().Get(1)
targetURL := cliCtx.Args().Get(0)
tags := cliCtx.Args().Get(1)
clnt, err := newClient(targetURL)
fatalIf(err.Trace(ctx.Args()...), "Unable to initialize target "+targetURL)
fatalIf(err.Trace(cliCtx.Args()...), "Unable to initialize target "+targetURL)
fatalIf(clnt.SetTags(tags).Trace(tags), "Failed to set tags for "+targetURL)
fatalIf(clnt.SetTags(ctx, tags).Trace(tags), "Failed to set tags for "+targetURL)
printMsg(tagSetMessage{
Status: "success",
+20 -17
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"errors"
"fmt"
"path/filepath"
@@ -105,11 +106,11 @@ EXAMPLES:
}
// checkTreeSyntax - validate all the passed arguments
func checkTreeSyntax(ctx *cli.Context) {
args := ctx.Args()
func checkTreeSyntax(ctx context.Context, cliCtx *cli.Context) {
args := cliCtx.Args()
if ctx.IsSet("depth") {
if ctx.Int("depth") < -1 || ctx.Int("depth") == 0 {
if cliCtx.IsSet("depth") {
if cliCtx.Int("depth") < -1 || cliCtx.Int("depth") == 0 {
fatalIf(errInvalidArgument().Trace(args...), "please set a proper depth, for example: '--depth 1' to limit the tree output, default (-1) output displays everything")
}
}
@@ -119,14 +120,14 @@ func checkTreeSyntax(ctx *cli.Context) {
}
for _, url := range args {
if _, _, err := url2Stat(url, false, nil); err != nil && !isURLPrefixExists(url, false) {
if _, _, err := url2Stat(ctx, url, false, nil); err != nil && !isURLPrefixExists(url, false) {
fatalIf(err.Trace(url), "Unable to tree `"+url+"`.")
}
}
}
// doTree - list all entities inside a folder in a tree format.
func doTree(url string, level int, leaf bool, branchString string, depth int, includeFiles bool) error {
func doTree(ctx context.Context, url string, level int, leaf bool, branchString string, depth int, includeFiles bool) error {
targetAlias, targetURL, _ := mustExpandAlias(url)
if !strings.HasSuffix(targetURL, "/") {
@@ -206,7 +207,7 @@ func doTree(url string, level int, leaf bool, branchString string, depth int, in
}
if depth == -1 || level <= depth {
if err := doTree(url, level+1, end, currbranchString, depth, includeFiles); err != nil {
if err := doTree(ctx, url, level+1, end, currbranchString, depth, includeFiles); err != nil {
return err
}
}
@@ -215,7 +216,7 @@ func doTree(url string, level int, leaf bool, branchString string, depth int, in
return nil
}
for content := range clnt.List(false, false, false, DirNone) {
for content := range clnt.List(ctx, false, false, false, DirNone) {
if !includeFiles && !content.Type.IsDir() {
continue
@@ -245,27 +246,29 @@ func doTree(url string, level int, leaf bool, branchString string, depth int, in
}
// mainTree - is a handler for mc tree command
func mainTree(ctx *cli.Context) error {
func mainTree(cliCtx *cli.Context) error {
ctx, cancelList := context.WithCancel(globalContext)
defer cancelList()
// check 'tree' cli arguments.
checkTreeSyntax(ctx)
// check 'tree' cliCtx arguments.
checkTreeSyntax(ctx, cliCtx)
console.SetColor("File", color.New(color.Bold))
console.SetColor("Dir", color.New(color.FgCyan, color.Bold))
args := ctx.Args()
args := cliCtx.Args()
// mimic operating system tool behavior.
if !ctx.Args().Present() {
if !cliCtx.Args().Present() {
args = []string{"."}
}
includeFiles := ctx.Bool("files")
depth := ctx.Int("depth")
includeFiles := cliCtx.Bool("files")
depth := cliCtx.Int("depth")
var cErr error
for _, targetURL := range args {
if !globalJSON {
if e := doTree(targetURL, 1, false, "", depth, includeFiles); e != nil {
if e := doTree(ctx, targetURL, 1, false, "", depth, includeFiles); e != nil {
cErr = e
}
} else {
@@ -275,7 +278,7 @@ func mainTree(ctx *cli.Context) error {
}
clnt, err := newClientFromAlias(targetAlias, targetURL)
fatalIf(err.Trace(targetURL), "Unable to initialize target `"+targetURL+"`.")
if e := doList(clnt, true, false); e != nil {
if e := doList(ctx, clnt, true, false); e != nil {
cErr = e
}
}
+2
View File
@@ -30,6 +30,7 @@ import (
"github.com/fatih/color"
"github.com/inconshreveable/go-update"
"github.com/mattn/go-ieproxy"
isatty "github.com/mattn/go-isatty"
"github.com/minio/cli"
json "github.com/minio/mc/pkg/colorjson"
@@ -243,6 +244,7 @@ func downloadReleaseURL(releaseChecksumURL string, timeout time.Duration) (conte
client := &http.Client{
Timeout: timeout,
Transport: &http.Transport{
Proxy: ieproxy.GetProxyFunc(),
// need to close connection after usage.
DisableKeepAlives: true,
},
+13 -14
View File
@@ -28,8 +28,8 @@ import (
"strings"
"time"
"github.com/minio/minio-go/v6"
"github.com/minio/minio-go/v6/pkg/encrypt"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/encrypt"
"github.com/minio/mc/pkg/ioutils"
"github.com/minio/mc/pkg/probe"
@@ -163,25 +163,24 @@ func lineTrunc(content string, maxLen int) string {
// isOlder returns true if the passed object is older than olderRef
func isOlder(ti time.Time, olderRef string) bool {
objectAge := UTCNow().Sub(ti)
var e error
var olderThan time.Duration
if olderRef != "" {
olderThan, e = ioutils.ParseDurationTime(olderRef)
fatalIf(probe.NewError(e), "Unable to parse olderThan=`"+olderRef+"`.")
if olderRef == "" {
return false
}
objectAge := time.Since(ti)
olderThan, e := ioutils.ParseDurationTime(olderRef)
fatalIf(probe.NewError(e), "Unable to parse olderThan=`"+olderRef+"`.")
return objectAge < olderThan
}
// isNewer returns true if the passed object is newer than newerRef
func isNewer(ti time.Time, newerRef string) bool {
objectAge := UTCNow().Sub(ti)
var e error
var newerThan time.Duration
if newerRef != "" {
newerThan, e = ioutils.ParseDurationTime(newerRef)
fatalIf(probe.NewError(e), "Unable to parse newerThan=`"+newerRef+"`.")
if newerRef == "" {
return false
}
objectAge := time.Since(ti)
newerThan, e := ioutils.ParseDurationTime(newerRef)
fatalIf(probe.NewError(e), "Unable to parse newerThan=`"+newerRef+"`.")
return objectAge >= newerThan
}
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"reflect"
"testing"
"github.com/minio/minio-go/v6/pkg/encrypt"
"github.com/minio/minio-go/v7/pkg/encrypt"
)
func TestParseEncryptionKeys(t *testing.T) {
+12 -8
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"fmt"
"strings"
"sync"
@@ -129,21 +130,21 @@ func (u watchMessage) String() string {
return msg
}
func mainWatch(ctx *cli.Context) error {
func mainWatch(cliCtx *cli.Context) error {
console.SetColor("Time", color.New(color.FgGreen))
console.SetColor("Size", color.New(color.FgYellow))
console.SetColor("EventType", color.New(color.FgCyan, color.Bold))
console.SetColor("ObjectName", color.New(color.Bold))
checkWatchSyntax(ctx)
checkWatchSyntax(cliCtx)
args := ctx.Args()
args := cliCtx.Args()
path := args[0]
prefix := ctx.String("prefix")
suffix := ctx.String("suffix")
events := strings.Split(ctx.String("events"), ",")
recursive := ctx.Bool("recursive")
prefix := cliCtx.String("prefix")
suffix := cliCtx.String("suffix")
events := strings.Split(cliCtx.String("events"), ",")
recursive := cliCtx.Bool("recursive")
s3Client, pErr := newClient(path)
if pErr != nil {
@@ -157,8 +158,11 @@ func mainWatch(ctx *cli.Context) error {
Suffix: suffix,
}
ctx, cancelWatch := context.WithCancel(globalContext)
defer cancelWatch()
// Start watching on events
wo, err := s3Client.Watch(options)
wo, err := s3Client.Watch(ctx, options)
fatalIf(err, "Cannot watch on the specified bucket.")
// Initialize.. waitgroup to track the go-routine.
+3 -2
View File
@@ -17,6 +17,7 @@
package cmd
import (
"context"
"sync"
"time"
@@ -140,8 +141,8 @@ func (w *Watcher) Wait() {
}
// Join the watcher with client
func (w *Watcher) Join(client Client, recursive bool) *probe.Error {
wo, err := client.Watch(WatchOptions{
func (w *Watcher) Join(ctx context.Context, client Client, recursive bool) *probe.Error {
wo, err := client.Watch(ctx, WatchOptions{
Recursive: recursive,
Events: []string{"put", "delete"},
})
+80
View File
@@ -0,0 +1,80 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior, in compliance with the
licensing terms applying to the Project developments.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful. However, these actions shall respect the
licensing terms of the Project Developments that will always supersede such
Code of Conduct.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at dev@min.io. The project team
will review and investigate all complaints, and will respond in a way that it deems
appropriate to the circumstances. The project team is obligated to maintain
confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
This version includes a clarification to ensure that the code of conduct is in
compliance with the free software licensing terms of the project.
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
+7 -12
View File
@@ -7,29 +7,24 @@ require (
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/dustin/go-humanize v1.0.0
github.com/fatih/color v1.7.0
github.com/golang/groupcache v0.0.0-20191002201903-404acd9df4cc // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.9.4 // indirect
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf
github.com/klauspost/compress v1.10.3
github.com/kurin/blazer v0.5.4-0.20200327014341-8f90a40f8af7 // indirect
github.com/mattn/go-ieproxy v0.0.1
github.com/mattn/go-isatty v0.0.8
github.com/mattn/go-runewidth v0.0.5 // indirect
github.com/minio/cli v1.22.0
github.com/minio/minio v0.0.0-20200527010300-cccf2de129da
github.com/minio/minio-go/v6 v6.0.56-0.20200522164946-44a5f2e3b76b
github.com/minio/minio v0.0.0-20200714163805-778e9c864f67
github.com/minio/minio-go/v7 v7.0.0-20200717002236-16b4b137ee4b
github.com/minio/sha256-simd v0.1.1
github.com/mitchellh/go-homedir v1.1.0
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pkg/profile v1.3.0
github.com/pkg/xattr v0.4.1
github.com/posener/complete v1.2.2-0.20190702141536-6ffe496ea953
github.com/rjeczalik/notify v0.9.2
github.com/ugorji/go v1.1.7 // indirect
golang.org/x/crypto v0.0.0-20200214034016-1d94cc7ab1c6
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
golang.org/x/text v0.3.2
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
golang.org/x/net v0.0.0-20200707034311-ab3426394381
golang.org/x/text v0.3.3
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f
gopkg.in/h2non/filetype.v1 v1.0.5
gopkg.in/ini.v1 v1.55.0 // indirect
gopkg.in/yaml.v2 v2.2.8
)
+160 -186
View File
@@ -2,18 +2,20 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.39.0 h1:UgQP9na6OTfp4dsAiz/eFpFA1C6tPdH5wiRdi19tuMw=
cloud.google.com/go v0.39.0/go.mod h1:rVLT6fkc8chs9sfPtFc1SBH6em7n+ZoXaG+87tDISts=
contrib.go.opencensus.io/exporter/ocagent v0.5.0/go.mod h1:ImxhfLRpxoYiSq891pBrLVhN+qmP8BTVvdH2YLs7Gl0=
git.apache.org/thrift.git v0.13.0 h1:/3bz5WZ+sqYArk7MBBBbDufMxKKOA56/6JO6psDpUDY=
git.apache.org/thrift.git v0.13.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/Azure/azure-pipeline-go v0.2.1 h1:OLBdZJ3yvOn2MezlWvbrBMTEUQC72zAftRZOMdj5HYo=
github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
github.com/Azure/azure-storage-blob-go v0.8.0 h1:53qhf0Oxa0nOjgbDeeYPUeyiNmafAFEY95rZLK0Tj6o=
github.com/Azure/azure-storage-blob-go v0.8.0/go.mod h1:lPI3aLPpuLTeUwh1sViKXFxwl2B6teiRqI0deQUvsw0=
github.com/Azure/go-autorest v11.7.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg=
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/Shopify/sarama v1.24.1 h1:svn9vfN3R1Hz21WR2Gj0VW9ehaDGkiOS+VqlIcZOkMI=
github.com/Shopify/sarama v1.24.1/go.mod h1:fGP8eQ6PugKEI0iUETYYtnP6d1pH/bdDMTel1X5ajsU=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
@@ -37,9 +39,7 @@ github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cheggaaa/pb v1.0.28 h1:kWGpdAcSp3MxMU9CCHOwz/8V0kCHN4+9yQm2MzWuI98=
@@ -47,32 +47,31 @@ github.com/cheggaaa/pb v1.0.28/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXH
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa h1:OaNxuTZr7kxeODyLWsRMC+OD03aFUH+mW6r2d+MWa5Y=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
github.com/colinmarc/hdfs/v2 v2.1.1 h1:x0hw/m+o3UE20Scso/KCkvYNc9Di39TBlCfGMkJ1/a0=
github.com/colinmarc/hdfs/v2 v2.1.1/go.mod h1:M3x+k8UKKmxtFu++uAZ0OtDU8jR3jnaZIAc6yK4Ue0c=
github.com/coredns/coredns v1.4.0 h1:RubBkYmkByUqZWWkjRHvNLnUHgkRVqAWgSMmRFvpE1A=
github.com/coredns/coredns v1.4.0/go.mod h1:zASH/MVDgR6XZTbxvOnsZfffS+31vg6Ackf/wo1+AM0=
github.com/coreos/bbolt v1.3.3 h1:n6AiVyVRKQFNb6mJlwESEvvLoDyiTzXX7ORAUlkeBdY=
github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.12+incompatible h1:pAWNwdf7QiT1zfaWyqCtNZQWCLByQyA3JrSQyuYAqnQ=
github.com/coreos/etcd v3.3.12+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28=
github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dchest/siphash v1.2.1 h1:4cLinnzVJDKxTCl9B01807Yiy+W7ZzVHj/KIroQRvT4=
github.com/dchest/siphash v1.2.1/go.mod h1:q+IRvb2gOSrUnYoPqHiyHXS0FOBBOdl6tONBlVnOnt4=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/djherbis/atime v1.0.0 h1:ySLvBAM0EvOGaX7TI4dAM5lWj+RdJUCKtGSEHN8SGBg=
github.com/djherbis/atime v1.0.0/go.mod h1:5W+KBIuTwVGcqjIfaTwt+KSYX1o6uep8dtevevQP/f8=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eapache/go-resiliency v1.1.0 h1:1NtRmCAqadE2FN4ZcN6g90TP3uk8cg9rn9eNK2197aU=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-resiliency v1.2.0 h1:v7g92e/KSN71Rq7vSThKaWIq68fL4YHvWyiUKorFR1Q=
github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8/yCZMuEPMUDHG0CW/brkkEp8mzqk2+ODEitlw=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
@@ -81,6 +80,9 @@ github.com/eclipse/paho.mqtt.golang v1.2.0 h1:1F8mhG9+aO5/xpdtFkW4SxOJB67ukuDC3t
github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts=
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/etcd-io/gofail v0.0.0-20190801230047-ad7f989257ca/go.mod h1:49H/RkXP8pKaZy4h0d+NW16rSLhyVBt4o6VLJbmOqDE=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
@@ -88,28 +90,26 @@ github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga
github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/frankban/quicktest v1.4.1/go.mod h1:36zfPVQyHxymz4cH7wlDmVwDrJuljRB60qkgn7rorfQ=
github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew=
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191002201903-404acd9df4cc h1:55rEp52jU6bkyslZ1+C/7NGfpQsEc6pxGLAGDOctqbw=
github.com/golang/groupcache v0.0.0-20191002201903-404acd9df4cc/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903 h1:LbsanbbD6LieFkXbj9YNNBupiGHJgFeLpO0j0Fza1h8=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -117,6 +117,12 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
@@ -128,34 +134,33 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4 h1:hU4mGcQI4DaAYW+IbTun+2qEZVFxK0ySjQLTbS0VQKc=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20190328170749-bb2674552d8f h1:4Gslotqbs16iAg+1KR/XdabIfq8TlAWHdwS5QJFksLc=
github.com/gopherjs/gopherjs v0.0.0-20190328170749-bb2674552d8f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/handlers v1.4.0 h1:XulKRWSQK5uChr4pEgSE4Tc/OcmnU9GJuSwdog/tZsA=
github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/mux v1.7.0 h1:tOSd0UKHQd6urX6ApfOn4XdBMY6Sh1MfxV3kmaazO+U=
github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg=
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/mux v1.7.5-0.20200711200521-98cb6bf42e08 h1:kPna6oIGlRXWmg/jkKfxbpvsl+0DHYnw1qQwN+6+gyA=
github.com/gorilla/mux v1.7.5-0.20200711200521-98cb6bf42e08/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk=
github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c h1:Lh2aW+HnU2Nbe1gqD9SOJLJxW1jBMmQOktN2acDyJk8=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4 h1:z53tR0945TRRQO/fLEVPI6SMv7ZflF0TEaTAoU7tOzg=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 h1:THDBEeQ9xZ8JEaCLyLQqXMMdRqNr0QAUJTIkQAUtFjg=
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.4 h1:5xLhQjsk4zqPf9EHCrja2qFZMx+yBqkO3XgJ14bNnU0=
github.com/grpc-ecosystem/grpc-gateway v1.9.4/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
@@ -164,7 +169,6 @@ github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI=
github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
@@ -177,6 +181,7 @@ github.com/hashicorp/go-rootcerts v1.0.1 h1:DMo4fmknnz0E0evoNYnV48RjWndOsmd6OW+0
github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
github.com/hashicorp/go-uuid v0.0.0-20180228145832-27454136f036/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
@@ -186,7 +191,7 @@ github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/raft v1.1.1-0.20190703171940-f639636d18e0/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
github.com/hashicorp/raft v1.1.2/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk=
github.com/hashicorp/vault/api v1.0.4 h1:j08Or/wryXT4AcHj1oCbMd7IijXcKzYUGw59LGu9onU=
github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q=
@@ -196,98 +201,86 @@ github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKe
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8=
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jcmturner/gofork v0.0.0-20180107083740-2aebee971930/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03 h1:FUwcHNlEqkqLjLBdCp5PRlCFijNjvcYANOZXzCfXwCM=
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.9.4/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.10.1 h1:a/QY0o9S6wCi0XhxaMX/QmusicNUqCqFugR6WKPOSoQ=
github.com/klauspost/compress v1.10.1/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.10.3 h1:OP96hzwJVBIHYU52pVTI6CczrxPvrGfgqF9N5eTO0Q8=
github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/cpuid v1.2.2 h1:1xAgYebNnsb9LKCdLOvFWtAxGU/33mjJtyOVbmUa0Us=
github.com/klauspost/cpuid v1.2.2/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.2.4 h1:EBfaK0SWSwk+fgk6efYFWdzl8MwRWoOO1gkmiaTXPW4=
github.com/klauspost/cpuid v1.2.4/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s=
github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4=
github.com/klauspost/pgzip v1.2.1 h1:oIPZROsWuPHpOdMVWLuJZXwgjhrW8r1yEX8UqMyeNHM=
github.com/klauspost/pgzip v1.2.1/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/klauspost/readahead v1.3.1 h1:QqXNYvm+VvqYcbrRT4LojUciM0XrznFRIDrbHiJtu/0=
github.com/klauspost/readahead v1.3.1/go.mod h1:AH9juHzNH7xqdqFHrMRSHeH2Ps+vFf+kblDqzPFiLJg=
github.com/klauspost/reedsolomon v1.9.3 h1:N/VzgeMfHmLc+KHMD1UL/tNkfXAt8FnUqlgXGIduwAY=
github.com/klauspost/reedsolomon v1.9.3/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4=
github.com/klauspost/reedsolomon v1.9.7 h1:+azeqnT4iNG9UEcWC+7utJ4xXQ9S8pSlkZor0DOArEQ=
github.com/klauspost/reedsolomon v1.9.7/go.mod h1:+8WD025Xpby8/kG5h/HDPIFhiiuGEtZOKw+5Y4drAD8=
github.com/klauspost/reedsolomon v1.9.9 h1:qCL7LZlv17xMixl55nq2/Oa1Y86nfO8EqDfv2GHND54=
github.com/klauspost/reedsolomon v1.9.9/go.mod h1:O7yFFHiQwDR6b2t63KPUpccPtNdp5ADgh1gg4fd12wo=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kurin/blazer v0.5.4-0.20200327014341-8f90a40f8af7 h1:smZXPopqRVVywwzou4WYWvUbJvSAzIDFizfWElpmAqY=
github.com/kurin/blazer v0.5.4-0.20200327014341-8f90a40f8af7/go.mod h1:4FCXMUWo9DllR2Do4TtBd377ezyAJ51vB5uTBjt0pGU=
github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY=
github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mailru/easyjson v0.0.0-20180730094502-03f2033d19d5 h1:0x4qcEHDpruK6ML/m/YSlFUUu0UpRD3I2PHsNCuGnyA=
github.com/mailru/easyjson v0.0.0-20180730094502-03f2033d19d5/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
github.com/mattn/go-ieproxy v0.0.0-20190805055040-f9202b1cfdeb h1:hXqqXzQtJbENrsb+rsIqkVqcg4FUJL0SQFGw08Dgivw=
github.com/mattn/go-ieproxy v0.0.0-20190805055040-f9202b1cfdeb/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
github.com/mattn/go-ieproxy v0.0.1 h1:qiyop7gCflfhwCzGyeT0gro3sF9AIg9HU98JORTkqfI=
github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.5 h1:jrGtp51JOKTWgvLFzfG6OtZOJcK2sEnzc/U+zw7TtbA=
github.com/mattn/go-runewidth v0.0.5/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.1.8 h1:1QYRAKU3lN5cRfLCkPU08hwvLJFhvjP6MqNMmQz6ZVI=
github.com/miekg/dns v1.1.8/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/minio/cli v1.22.0 h1:VTQm7lmXm3quxO917X3p+el1l0Ca5X3S4PM2ruUYO68=
github.com/minio/cli v1.22.0/go.mod h1:bYxnK0uS629N3Bq+AOZZ+6lwF77Sodk4+UL9vNuXhOY=
github.com/minio/gokrb5/v7 v7.2.5 h1:GPnlzrvEol/uJHouCEQ382Gd+w4in5s4wCTQ4umDki8=
github.com/minio/gokrb5/v7 v7.2.5/go.mod h1:z6fE6twrvMN004M+KRTHnmtfpxsBIztP0PVsak0/4f8=
github.com/minio/hdfs/v3 v3.0.1 h1:MMpqqS9CtuBTYrsMYZMWfDPmWemRf11zhcvj+mbKUYc=
github.com/minio/hdfs/v3 v3.0.1/go.mod h1:6ALh9HsAwG9xAXdpdrZJcSY0vR6z3K+9XIz6Y9pQG/c=
github.com/minio/highwayhash v1.0.0 h1:iMSDhgUILCr0TNm8LWlSjF8N0ZIj2qbO8WHp6Q/J2BA=
github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc=
github.com/minio/lsync v1.0.1 h1:AVvILxA976xc27hstd1oR+X9PQG0sPSom1MNb1ImfUs=
github.com/minio/lsync v1.0.1/go.mod h1:tCFzfo0dlvdGl70IT4IAK/5Wtgb0/BrTmo/jE8pArKA=
github.com/minio/minio v0.0.0-20200421050159-282c9f790a03 h1:qEWJAXNbLp1Uovs9gzPQ8gWGFY8X+58WcttySAMgny0=
github.com/minio/minio v0.0.0-20200421050159-282c9f790a03/go.mod h1:zBua5AiljGs1Irdl2XEyiJjvZVCVDIG8gjozzRBcVlw=
github.com/minio/minio v0.0.0-20200506184406-a2ccba69e563 h1:1HoqFH4py7JBKeLkKtPUrL8CsrucHsUcvrvyrisPgtA=
github.com/minio/minio v0.0.0-20200506184406-a2ccba69e563/go.mod h1:+HURmfnikX5JaBIms97fh5J5eMrAUOOoy6jjz33twdI=
github.com/minio/minio v0.0.0-20200527010300-cccf2de129da h1:LFUiyczxM3CsE3RXQObCkIrVUpOWL4GBBfeRDnTciTc=
github.com/minio/minio v0.0.0-20200527010300-cccf2de129da/go.mod h1:lRWfQGPeCrdr0kZapZWd5qYfe+Xyjann9wP62D4pGNo=
github.com/minio/minio-go/v6 v6.0.53 h1:8jzpwiOzZ5Iz7/goFWqNZRICbyWYShbb5rARjrnSCNI=
github.com/minio/minio-go/v6 v6.0.53/go.mod h1:DIvC/IApeHX8q1BAMVCXSXwpmrmM+I+iBvhvztQorfI=
github.com/minio/minio-go/v6 v6.0.55-0.20200425081427-89eebdef2af0/go.mod h1:KQMM+/44DSlSGSQWSfRrAZ12FVMmpWNuX37i2AX0jfI=
github.com/minio/minio-go/v6 v6.0.56-0.20200502013257-a81c8c13cc3f h1:ifHrI8+exqLi5RztIWWKS5k+Wu+W7DJisVXwNaCH2zs=
github.com/minio/minio-go/v6 v6.0.56-0.20200502013257-a81c8c13cc3f/go.mod h1:KQMM+/44DSlSGSQWSfRrAZ12FVMmpWNuX37i2AX0jfI=
github.com/minio/minio-go/v6 v6.0.56-0.20200522164946-44a5f2e3b76b h1:hY8tAl7MwUuUB9ZqVDXEnrIqCuEy3dfU1RH0cZ7gu+o=
github.com/minio/minio-go/v6 v6.0.56-0.20200522164946-44a5f2e3b76b/go.mod h1:KQMM+/44DSlSGSQWSfRrAZ12FVMmpWNuX37i2AX0jfI=
github.com/minio/parquet-go v0.0.0-20200414234858-838cfa8aae61 h1:pUSI/WKPdd77gcuoJkSzhJ4wdS8OMDOsOu99MtpXEQA=
github.com/minio/parquet-go v0.0.0-20200414234858-838cfa8aae61/go.mod h1:4trzEJ7N1nBTd5Tt7OCZT5SEin+WiAXpdJ/WgPkESA8=
github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4=
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
github.com/minio/minio v0.0.0-20200714163805-778e9c864f67 h1:xMg87xvLhrw2jeE6xGx/uuFr2iIksfszITGdHhWURnA=
github.com/minio/minio v0.0.0-20200714163805-778e9c864f67/go.mod h1:0WThPBMICOt5eEGT3XyaUy0cxYmoGhmJEvvRbiVqbYU=
github.com/minio/minio-go/v7 v7.0.0-20200714085548-47e386e2cde8 h1:Xh5yHlXj/367YMabi7tWHol1AslXcuAFWaedBtGgbU0=
github.com/minio/minio-go/v7 v7.0.0-20200714085548-47e386e2cde8/go.mod h1:QTstSRgetEDVpqiEpFniLoCslH4d9cNAa4BtjuRQrwE=
github.com/minio/minio-go/v7 v7.0.0-20200717002236-16b4b137ee4b h1:aNa+ApHn0FYMFdwfI9IqLFLajN/FoHpqLdN20emn+Ck=
github.com/minio/minio-go/v7 v7.0.0-20200717002236-16b4b137ee4b/go.mod h1:dJ80Mv2HeGkYLH1sqS/ksz07ON6csH3S6JUMSQ2zAns=
github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
github.com/minio/simdjson-go v0.1.5-0.20200303142138-b17fe061ea37 h1:pDeao6M5AEd8hwTtGmE0pVKomlL56JFRa5SiXDZAuJE=
@@ -304,8 +297,8 @@ github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUb
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mmcloughlin/avo v0.0.0-20200303042253-6df701fe672f h1:4a8aNS/kCsM3TZnLO0jUzMAch5+XYh5Poe74nqatJcw=
github.com/mmcloughlin/avo v0.0.0-20200303042253-6df701fe672f/go.mod h1:L0u9qfRMLNBO97u6pPukRp6ncoQz0Q25W69fvtht3vA=
github.com/mmcloughlin/avo v0.0.0-20200523190732-4439b6b2c061 h1:UCU8+cLbbvyxi0sQ9fSeoEhZgvrrD9HKMtX6Gmc1vk8=
github.com/mmcloughlin/avo v0.0.0-20200523190732-4439b6b2c061/go.mod h1:wqKykBG2QzQDJEzvRkcS8x6MiSJkF52hXZsXcjaB3ls=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -315,24 +308,20 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/montanaflynn/stats v0.5.0 h1:2EkzeTSqBB4V4bJwWrt5gIIrZmpJBcoIRGS2kWLgzmk=
github.com/montanaflynn/stats v0.5.0/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nats-io/gnatsd v1.4.1/go.mod h1:nqco77VO78hLCJpIcVfygDP2rPGfsEHkGTUk94uh5DQ=
github.com/nats-io/go-nats v1.7.2/go.mod h1:+t7RHT5ApZebkrQdnn6AhQJmhJJiKAvJUio1PiiCtj0=
github.com/nats-io/go-nats-streaming v0.4.4/go.mod h1:gfq4R3c9sKAINOpelo0gn/b9QDMBZnmrttcsNF+lqyo=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
github.com/nats-io/jwt v0.3.2 h1:+RB5hMpXUUA2dfxuhBTEkMOrYmM+gKIZYS1KjSostMI=
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
github.com/nats-io/nats-server v1.4.1/go.mod h1:c8f/fHd2B6Hgms3LtCaI7y6pC4WD1f4SUxcCud5vhBc=
github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
github.com/nats-io/nats-streaming-server v0.14.2/go.mod h1:RyqtDJZvMZO66YmyjIYdIvS69zu/wDAkyNWa8PIUa5c=
github.com/nats-io/nats.go v1.9.1 h1:ik3HbLhZ0YABLto7iX80pZLPw/6dx3T+++MZJwLnMrQ=
github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nats-server/v2 v2.1.7/go.mod h1:rbRrRE/Iv93O/rUvZ9dh4NfT0Cm9HWjW/BqOWLGgYiE=
github.com/nats-io/nats-streaming-server v0.18.0/go.mod h1:Y9Aiif2oANuoKazQrs4wXtF3jqt6p97ODQg68lR5TnY=
github.com/nats-io/nats.go v1.10.0 h1:L8qnKaofSfNFbXg0C5F71LdjPRnmQwSsA4ukmkt1TvY=
github.com/nats-io/nats.go v1.10.0/go.mod h1:AjGArbfyR50+afOUotNX2Xs5SYHf+CoOa5HH1eEl2HE=
github.com/nats-io/nkeys v0.1.3 h1:6JrEfig+HzTH85yxzhSVbjHRJv9cn0p6n3IngIcM5/k=
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
github.com/nats-io/nkeys v0.1.4 h1:aEsHIssIk6ETN5m2/MD8Y4B2X7FfXrBAUdkyRvbVYzA=
github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/nats-io/stan.go v0.4.5 h1:lPZ9y1jVGiXcTaUc1SnEIWPYfh0avuEiHBePNJYgpPk=
github.com/nats-io/stan.go v0.4.5/go.mod h1:Ji7mK6gRZJSH1nc3ZJH6vi7zn/QnZhpR9Arm4iuzsUQ=
github.com/nats-io/stan.go v0.7.0 h1:sMVHD9RkxPOl6PJfDVBQd+gbxWkApeYl6GrH+10msO4=
github.com/nats-io/stan.go v0.7.0/go.mod h1:Ci6mUIpGQTjl++MqK2XzkWI/0vF+Bl72uScx7ejSYmU=
github.com/ncw/directio v1.0.5 h1:JSUBhdjEvVaJvOoyPAbcW0fnd0tvRXD76wEfZ1KcQz4=
github.com/ncw/directio v1.0.5/go.mod h1:rX/pKEYkOXBGOggmcyJeJGloCkleSvphPx2eV3t6ROk=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
@@ -340,8 +329,7 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
github.com/nsqio/go-nsq v1.0.7 h1:O0pIZJYTf+x7cZBA0UMY8WxFG79lYTURmWzAAh48ljY=
github.com/nsqio/go-nsq v1.0.7/go.mod h1:XP5zaUs3pqf+Q71EqUJs3HYfBIqfK6G83WQMdNN+Ito=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pborman/getopt v0.0.0-20180729010549-6fdd0a2c7117/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ=
@@ -364,36 +352,29 @@ github.com/posener/complete v1.2.2-0.20190702141536-6ffe496ea953 h1:oBvgW8IvwF27
github.com/posener/complete v1.2.2-0.20190702141536-6ffe496ea953/go.mod h1:6gapUrK/U1TAN7ciCoNRIdVC5sbdBTUh1DKN0g6uH7E=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829 h1:D+CiwcpGTW6pL6bv6KI3KbyEyCKyS+1JWS2h8PNDnGA=
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
github.com/prometheus/client_golang v0.9.3 h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8=
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.2.0 h1:kUZDBDTdBVBYBj5Tmh2NZLlF60mfjA27rM34b+cVwNU=
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1 h1:/K3IL0Z1quvmJ7X0A1AwNEK7CRkVK3YwfOU/QAL4WGg=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81 h1:zQTtDd7fQiF9e80lbl+ShnD9/5NSq5r1EhcS8955ECg=
github.com/rcrowley/go-metrics v0.0.0-20190704165056-9c2d0518ed81/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8=
github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI=
github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
@@ -402,23 +383,21 @@ github.com/secure-io/sio-go v0.3.0/go.mod h1:D3KmXgKETffyYxBdFRN+Hpd2WzhzqS0EQwT
github.com/shirou/gopsutil v2.20.3-0.20200314133625-53cec6b37e6a+incompatible h1:YiKUe2ZOmfpDBH4OSyxwkx/mjNqHHnNhOtZ2mPyRme8=
github.com/shirou/gopsutil v2.20.3-0.20200314133625-53cec6b37e6a+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.5.0 h1:1N5EYkVAPEywqZRJd7cwnRtCb6xJx7NH3T3WUTF980Q=
github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v0.0.0-20190401211740-f487f9de1cd3 h1:hBSHahWMEgzwRyS6dRpxY0XyjZsHyQ61s084wo5PJe0=
github.com/smartystreets/assertions v0.0.0-20190401211740-f487f9de1cd3/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
github.com/spf13/pflag v1.0.1 h1:aCvUg6QPl3ibpQUxyLkrEkCHtPqYJL4x9AuhqVqFis4=
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94 h1:0ngsPmuP6XIjiFRNFYlvKwSr5zff2v+uPHaffZ6/M4k=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -427,8 +406,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/tidwall/gjson v1.3.5 h1:2oW9FBNu8qt9jy5URgrzsVx/T/KSn3qn/smJQ0crlDQ=
github.com/tidwall/gjson v1.3.5/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
@@ -437,17 +414,12 @@ github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/sjson v1.0.4 h1:UcdIRXff12Lpnu3OLtZvnc03g4vH2suXDXhBwBqmzYg=
github.com/tidwall/sjson v1.0.4/go.mod h1:bURseu1nuBkFpIES5cz6zBtjmYeOQmEESshn7VpF15Y=
github.com/tinylib/msgp v1.1.1 h1:TnCZ3FIuKeaIy+F45+Cnp+caqdXGy4z74HvwXN+570Y=
github.com/tinylib/msgp v1.1.1/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tinylib/msgp v1.1.2 h1:gWmO7n0Ys2RBEb7GPYB9Ujq8Mk5p2U08lRnmMcGy6BQ=
github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8 h1:ndzgwNDnKIqyCvHTXaCqh9KlOWKvBry6nuXMJmonVsE=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a h1:0R4NLDRDZX6JcmhJgXi5E4b8Wg84ihbmUKp/GvSPEzc=
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
github.com/willf/bitset v1.1.10 h1:NotGKqX0KwQ72NUzqrjZq5ipPNDQex9lo3WpaS8L2sc=
@@ -461,40 +433,35 @@ github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/etcd/v3 v3.3.0-rc.0.0.20200707003333-58bb8ae09f8e h1:HZQLoe71Q24wVyDrGBRcVuogx32U+cPlcm/WoSLUI6c=
go.etcd.io/etcd/v3 v3.3.0-rc.0.0.20200707003333-58bb8ae09f8e/go.mod h1:UENlOa05tkNvLx9VnNziSerG4Ro74upGK6Apd4v6M/Y=
go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.11.0 h1:gSmpCfs+R47a4yQPAI4xJ0IPDLTRGXskm6UelqNXpqE=
go.uber.org/zap v1.11.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM=
go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo=
go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
golang.org/x/arch v0.0.0-20190909030613-46d78d1859ac/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200214034016-1d94cc7ab1c6 h1:Sy5bstxEqwwbYs6n0/pBuxKENqOeZUgD45Gp3Q3pqLg=
golang.org/x/crypto v0.0.0-20200214034016-1d94cc7ab1c6/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 h1:DZhuSZLsGlFL4CmhA8BcRA0mnthyA/nZ00AqCUo7vHg=
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@@ -511,19 +478,19 @@ golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 h1:Wo7BWFiOk0QRFMLYMqJGFMd9CgUAcGx7V+qEg/h5IBI=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA=
golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -546,18 +513,27 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191112214154-59a1497f0cea/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
@@ -565,39 +541,40 @@ golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
golang.org/x/tools v0.0.0-20190914235951-31e00f45c22e h1:nOOVVcLC+/3MeovP40q5lCiWmP1Z1DaN8yn8ngU63hw=
golang.org/x/tools v0.0.0-20190914235951-31e00f45c22e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200428211428-0c9eba77bc32 h1:Xvf3ZQTm5bjXPxhI7g+dwqsCqadK1rcNtwtszuatetk=
golang.org/x/tools v0.0.0-20200428211428-0c9eba77bc32/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200502202811-ed308ab3e770 h1:M9Fif0OxNji8w+HvmhVQ8KJtiZOsjU9RgslJGhn95XE=
golang.org/x/tools v0.0.0-20200502202811-ed308ab3e770/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200425043458-8463f397d07c h1:iHhCR0b26amDCiiO+kBguKZom9aMF+NrFxh9zeKR/XU=
golang.org/x/tools v0.0.0-20200425043458-8463f397d07c/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.5.0 h1:lj9SyhMzyoa38fgFF0oO2T6pjs5IzkLPKfVtxpyCRMM=
google.golang.org/api v0.5.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.0 h1:Tfd7cKwKbFRsI8RMAD3oqqw7JPFRrvFlOsfbgVkjOOw=
google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190513181449-d00d292a067c/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw=
google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzycHdkp5cLA7DpE+GKjSslYhM=
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=
@@ -606,16 +583,13 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk=
gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/cheggaaa/pb.v1 v1.0.25 h1:Ev7yu1/f6+d+b3pi5vPdRPc6nNtP1umSfcWiEfRqv6I=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/h2non/filetype.v1 v1.0.5 h1:CC1jjJjoEhNVbMhXYalmGBhOBK2V70Q1N850wt/98/Y=
gopkg.in/h2non/filetype.v1 v1.0.5/go.mod h1:M0yem4rwSX5lLVrkEuRRp2/NinFMD5vgJ4DlAhZcfNo=
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.48.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.55.0 h1:E8yzL5unfpW3M6fz/eB7Cb5MQAYSZ7GKo4Qth+N2sgQ=
gopkg.in/ini.v1 v1.55.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.57.0 h1:9unxIsFcTt4I55uWluz+UmL95q4kdJ0buvQ1ZIqVQww=
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/jcmturner/aescts.v1 v1.0.1 h1:cVVZBK2b1zY26haWB4vbBiZrfFQnfbTVrE3xZq6hrEw=
gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo=
gopkg.in/jcmturner/dnsutils.v1 v1.0.1 h1:cIuC1OLRGZrld+16ZJvvZxVJeKPsvd5eUIvxfoN5hSM=
@@ -624,6 +598,8 @@ gopkg.in/jcmturner/goidentity.v3 v3.0.0 h1:1duIyWiTaYvVx3YX2CYtpJbUFd7/UuPYCfgXt
gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4=
gopkg.in/jcmturner/gokrb5.v7 v7.2.3 h1:hHMV/yKPwMnJhPuPx7pH2Uw/3Qyf+thJYlisUc44010=
gopkg.in/jcmturner/gokrb5.v7 v7.2.3/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM=
gopkg.in/jcmturner/gokrb5.v7 v7.3.0 h1:0709Jtq/6QXEuWRfAm260XqlpcwL1vxtO1tUE2qK8Z4=
gopkg.in/jcmturner/gokrb5.v7 v7.3.0/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM=
gopkg.in/jcmturner/rpc.v1 v1.1.0 h1:QHIUxTX1ISuAv9dD2wJ9HWQVuWDX/Zc0PfeC2tjc4rU=
gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8=
gopkg.in/ldap.v3 v3.0.3 h1:YKRHW/2sIl05JsCtx/5ZuUueFuJyoj/6+DGXe3wp6ro=
@@ -637,8 +613,6 @@ gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHO
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
@@ -646,6 +620,6 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=