repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
partition
stringclasses
1 value
minio/mc
cmd/policy-main.go
checkPolicySyntax
func checkPolicySyntax(ctx *cli.Context) { argsLength := len(ctx.Args()) // Always print a help message when we have extra arguments if argsLength > 2 { cli.ShowCommandHelpAndExit(ctx, "policy", 1) // last argument is exit code. } // Always print a help message when no arguments specified if argsLength < 1 { ...
go
func checkPolicySyntax(ctx *cli.Context) { argsLength := len(ctx.Args()) // Always print a help message when we have extra arguments if argsLength > 2 { cli.ShowCommandHelpAndExit(ctx, "policy", 1) // last argument is exit code. } // Always print a help message when no arguments specified if argsLength < 1 { ...
[ "func", "checkPolicySyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "argsLength", ":=", "len", "(", "ctx", ".", "Args", "(", ")", ")", "\n", "// Always print a help message when we have extra arguments", "if", "argsLength", ">", "2", "{", "cli", "."...
// checkPolicySyntax check for incoming syntax.
[ "checkPolicySyntax", "check", "for", "incoming", "syntax", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/policy-main.go#L169-L206
train
minio/mc
cmd/policy-main.go
accessPermToString
func accessPermToString(perm accessPerms) string { policy := "" switch perm { case accessNone: policy = "none" case accessDownload: policy = "readonly" case accessUpload: policy = "writeonly" case accessPublic: policy = "readwrite" case accessCustom: policy = "custom" } return policy }
go
func accessPermToString(perm accessPerms) string { policy := "" switch perm { case accessNone: policy = "none" case accessDownload: policy = "readonly" case accessUpload: policy = "writeonly" case accessPublic: policy = "readwrite" case accessCustom: policy = "custom" } return policy }
[ "func", "accessPermToString", "(", "perm", "accessPerms", ")", "string", "{", "policy", ":=", "\"", "\"", "\n", "switch", "perm", "{", "case", "accessNone", ":", "policy", "=", "\"", "\"", "\n", "case", "accessDownload", ":", "policy", "=", "\"", "\"", "...
// Convert an accessPerms to a string recognizable by minio-go
[ "Convert", "an", "accessPerms", "to", "a", "string", "recognizable", "by", "minio", "-", "go" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/policy-main.go#L209-L224
train
minio/mc
cmd/policy-main.go
doSetAccess
func doSetAccess(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 { return err.Trace(targetURL, string(targetPERMS)) } return n...
go
func doSetAccess(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 { return err.Trace(targetURL, string(targetPERMS)) } return n...
[ "func", "doSetAccess", "(", "targetURL", "string", ",", "targetPERMS", "accessPerms", ")", "*", "probe", ".", "Error", "{", "clnt", ",", "err", ":=", "newClient", "(", "targetURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", ".", "Trace", ...
// doSetAccess do set access.
[ "doSetAccess", "do", "set", "access", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/policy-main.go#L227-L237
train
minio/mc
cmd/policy-main.go
doSetAccessJSON
func doSetAccessJSON(targetURL string, targetPERMS accessPerms) *probe.Error { clnt, err := newClient(targetURL) if err != nil { return err.Trace(targetURL) } fileReader, e := os.Open(string(targetPERMS)) if e != nil { fatalIf(probe.NewError(e).Trace(), "Unable to set policy for `"+targetURL+"`.") } defer fi...
go
func doSetAccessJSON(targetURL string, targetPERMS accessPerms) *probe.Error { clnt, err := newClient(targetURL) if err != nil { return err.Trace(targetURL) } fileReader, e := os.Open(string(targetPERMS)) if e != nil { fatalIf(probe.NewError(e).Trace(), "Unable to set policy for `"+targetURL+"`.") } defer fi...
[ "func", "doSetAccessJSON", "(", "targetURL", "string", ",", "targetPERMS", "accessPerms", ")", "*", "probe", ".", "Error", "{", "clnt", ",", "err", ":=", "newClient", "(", "targetURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", ".", "Trac...
// doSetAccessJSON do set access JSON.
[ "doSetAccessJSON", "do", "set", "access", "JSON", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/policy-main.go#L240-L267
train
minio/mc
cmd/policy-main.go
doGetAccess
func doGetAccess(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() if err != nil { return "", "", err.Trace(targetURL) } return stringToAccessPerm(perm),...
go
func doGetAccess(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() if err != nil { return "", "", err.Trace(targetURL) } return stringToAccessPerm(perm),...
[ "func", "doGetAccess", "(", "targetURL", "string", ")", "(", "perms", "accessPerms", ",", "policyStr", "string", ",", "err", "*", "probe", ".", "Error", ")", "{", "clnt", ",", "err", ":=", "newClient", "(", "targetURL", ")", "\n", "if", "err", "!=", "n...
// doGetAccess do get access.
[ "doGetAccess", "do", "get", "access", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/policy-main.go#L288-L298
train
minio/mc
cmd/policy-main.go
doGetAccessRules
func doGetAccessRules(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() }
go
func doGetAccessRules(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() }
[ "func", "doGetAccessRules", "(", "targetURL", "string", ")", "(", "r", "map", "[", "string", "]", "string", ",", "err", "*", "probe", ".", "Error", ")", "{", "clnt", ",", "err", ":=", "newClient", "(", "targetURL", ")", "\n", "if", "err", "!=", "nil"...
// doGetAccessRules do get access rules.
[ "doGetAccessRules", "do", "get", "access", "rules", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/policy-main.go#L301-L307
train
minio/mc
cmd/policy-main.go
runPolicyListCmd
func runPolicyListCmd(args cli.Args) { targetURL := args.First() policies, err := doGetAccessRules(targetURL) if err != nil { switch err.ToGoError().(type) { case APINotImplemented: fatalIf(err.Trace(), "Unable to list policies of a non S3 url `"+targetURL+"`.") default: fatalIf(err.Trace(targetURL), "Un...
go
func runPolicyListCmd(args cli.Args) { targetURL := args.First() policies, err := doGetAccessRules(targetURL) if err != nil { switch err.ToGoError().(type) { case APINotImplemented: fatalIf(err.Trace(), "Unable to list policies of a non S3 url `"+targetURL+"`.") default: fatalIf(err.Trace(targetURL), "Un...
[ "func", "runPolicyListCmd", "(", "args", "cli", ".", "Args", ")", "{", "targetURL", ":=", "args", ".", "First", "(", ")", "\n", "policies", ",", "err", ":=", "doGetAccessRules", "(", "targetURL", ")", "\n", "if", "err", "!=", "nil", "{", "switch", "err...
// Run policy list command
[ "Run", "policy", "list", "command" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/policy-main.go#L310-L324
train
minio/mc
cmd/policy-main.go
runPolicyLinksCmd
func runPolicyLinksCmd(args cli.Args, recursive bool) { // Get alias/bucket/prefix argument targetURL := args.First() // Fetch all policies associated to the passed url policies, err := doGetAccessRules(targetURL) if err != nil { switch err.ToGoError().(type) { case APINotImplemented: fatalIf(err.Trace(), ...
go
func runPolicyLinksCmd(args cli.Args, recursive bool) { // Get alias/bucket/prefix argument targetURL := args.First() // Fetch all policies associated to the passed url policies, err := doGetAccessRules(targetURL) if err != nil { switch err.ToGoError().(type) { case APINotImplemented: fatalIf(err.Trace(), ...
[ "func", "runPolicyLinksCmd", "(", "args", "cli", ".", "Args", ",", "recursive", "bool", ")", "{", "// Get alias/bucket/prefix argument", "targetURL", ":=", "args", ".", "First", "(", ")", "\n\n", "// Fetch all policies associated to the passed url", "policies", ",", "...
// Run policy links command
[ "Run", "policy", "links", "command" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/policy-main.go#L327-L392
train
minio/mc
cmd/policy-main.go
runPolicyCmd
func runPolicyCmd(args cli.Args) { var operation, policyStr string var probeErr *probe.Error perms := accessPerms(args.Get(0)) targetURL := args.Get(1) if perms.isValidAccessPERM() { probeErr = doSetAccess(targetURL, perms) operation = "set" } else if perms.isValidAccessFile() { probeErr = doSetAccessJSON(t...
go
func runPolicyCmd(args cli.Args) { var operation, policyStr string var probeErr *probe.Error perms := accessPerms(args.Get(0)) targetURL := args.Get(1) if perms.isValidAccessPERM() { probeErr = doSetAccess(targetURL, perms) operation = "set" } else if perms.isValidAccessFile() { probeErr = doSetAccessJSON(t...
[ "func", "runPolicyCmd", "(", "args", "cli", ".", "Args", ")", "{", "var", "operation", ",", "policyStr", "string", "\n", "var", "probeErr", "*", "probe", ".", "Error", "\n", "perms", ":=", "accessPerms", "(", "args", ".", "Get", "(", "0", ")", ")", "...
// Run policy cmd to fetch set permission
[ "Run", "policy", "cmd", "to", "fetch", "set", "permission" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/policy-main.go#L395-L434
train
minio/mc
cmd/session-list.go
listSessions
func listSessions() *probe.Error { var bySessions []*sessionV8 for _, sid := range getSessionIDs() { session, err := loadSessionV8(sid) if err != nil { continue // Skip 'broken' session during listing } session.Close() // Session close right here. bySessions = append(bySessions, session) } // sort sess...
go
func listSessions() *probe.Error { var bySessions []*sessionV8 for _, sid := range getSessionIDs() { session, err := loadSessionV8(sid) if err != nil { continue // Skip 'broken' session during listing } session.Close() // Session close right here. bySessions = append(bySessions, session) } // sort sess...
[ "func", "listSessions", "(", ")", "*", "probe", ".", "Error", "{", "var", "bySessions", "[", "]", "*", "sessionV8", "\n", "for", "_", ",", "sid", ":=", "range", "getSessionIDs", "(", ")", "{", "session", ",", "err", ":=", "loadSessionV8", "(", "sid", ...
// listSessions list all current sessions.
[ "listSessions", "list", "all", "current", "sessions", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session-list.go#L50-L66
train
minio/mc
pkg/console/console.go
consolePrintln
func consolePrintln(tag string, c *color.Color, a ...interface{}) { privateMutex.Lock() defer privateMutex.Unlock() switch tag { case "Debug": // if no arguments are given do not invoke debug printer. if len(a) == 0 { return } output := color.Output color.Output = stderrColoredOutput if isatty.IsTer...
go
func consolePrintln(tag string, c *color.Color, a ...interface{}) { privateMutex.Lock() defer privateMutex.Unlock() switch tag { case "Debug": // if no arguments are given do not invoke debug printer. if len(a) == 0 { return } output := color.Output color.Output = stderrColoredOutput if isatty.IsTer...
[ "func", "consolePrintln", "(", "tag", "string", ",", "c", "*", "color", ".", "Color", ",", "a", "...", "interface", "{", "}", ")", "{", "privateMutex", ".", "Lock", "(", ")", "\n", "defer", "privateMutex", ".", "Unlock", "(", ")", "\n\n", "switch", "...
// consolePrintln - same as print with a new line.
[ "consolePrintln", "-", "same", "as", "print", "with", "a", "new", "line", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/pkg/console/console.go#L284-L340
train
minio/mc
pkg/console/console.go
DisplayTable
func (t *Table) DisplayTable(rows [][]string) error { numRows := len(rows) numCols := len(rows[0]) if numRows != len(t.RowColors) { return fmt.Errorf("row count and row-colors mismatch") } // Compute max. column widths maxColWidths := make([]int, numCols) for _, row := range rows { if len(row) != len(t.Alig...
go
func (t *Table) DisplayTable(rows [][]string) error { numRows := len(rows) numCols := len(rows[0]) if numRows != len(t.RowColors) { return fmt.Errorf("row count and row-colors mismatch") } // Compute max. column widths maxColWidths := make([]int, numCols) for _, row := range rows { if len(row) != len(t.Alig...
[ "func", "(", "t", "*", "Table", ")", "DisplayTable", "(", "rows", "[", "]", "[", "]", "string", ")", "error", "{", "numRows", ":=", "len", "(", "rows", ")", "\n", "numCols", ":=", "len", "(", "rows", "[", "0", "]", ")", "\n", "if", "numRows", "...
// DisplayTable - prints the table
[ "DisplayTable", "-", "prints", "the", "table" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/pkg/console/console.go#L378-L440
train
minio/mc
cmd/event-remove.go
checkEventRemoveSyntax
func checkEventRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { cli.ShowCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code } if len(ctx.Args()) == 1 && !ctx.Bool("force") { fatalIf(probe.NewError(errors.New("")), "--force flag needs to be passed to remove all buck...
go
func checkEventRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { cli.ShowCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code } if len(ctx.Args()) == 1 && !ctx.Bool("force") { fatalIf(probe.NewError(errors.New("")), "--force flag needs to be passed to remove all buck...
[ "func", "checkEventRemoveSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "==", "0", "||", "len", "(", "ctx", ".", "Args", "(", ")", ")", ">", "2", "{", "cli", ".", "ShowCommandHelpAn...
// checkEventRemoveSyntax - validate all the passed arguments
[ "checkEventRemoveSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/event-remove.go#L64-L71
train
minio/mc
cmd/event-remove.go
JSON
func (u eventRemoveMessage) JSON() string { u.Status = "success" eventRemoveMessageJSONBytes, e := json.MarshalIndent(u, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(eventRemoveMessageJSONBytes) }
go
func (u eventRemoveMessage) JSON() string { u.Status = "success" eventRemoveMessageJSONBytes, e := json.MarshalIndent(u, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(eventRemoveMessageJSONBytes) }
[ "func", "(", "u", "eventRemoveMessage", ")", "JSON", "(", ")", "string", "{", "u", ".", "Status", "=", "\"", "\"", "\n", "eventRemoveMessageJSONBytes", ",", "e", ":=", "json", ".", "MarshalIndent", "(", "u", ",", "\"", "\"", ",", "\"", "\"", ")", "\n...
// JSON jsonified remove message.
[ "JSON", "jsonified", "remove", "message", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/event-remove.go#L80-L85
train
minio/mc
cmd/accounting-reader.go
newAccounter
func newAccounter(total int64) *accounter { acct := &accounter{ Total: total, startTime: time.Now(), startValue: 0, refreshRate: time.Millisecond * 200, isFinished: make(chan struct{}), currentValue: -1, } go acct.writer() return acct }
go
func newAccounter(total int64) *accounter { acct := &accounter{ Total: total, startTime: time.Now(), startValue: 0, refreshRate: time.Millisecond * 200, isFinished: make(chan struct{}), currentValue: -1, } go acct.writer() return acct }
[ "func", "newAccounter", "(", "total", "int64", ")", "*", "accounter", "{", "acct", ":=", "&", "accounter", "{", "Total", ":", "total", ",", "startTime", ":", "time", ".", "Now", "(", ")", ",", "startValue", ":", "0", ",", "refreshRate", ":", "time", ...
// Instantiate a new accounter.
[ "Instantiate", "a", "new", "accounter", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/accounting-reader.go#L44-L55
train
minio/mc
cmd/accounting-reader.go
write
func (a *accounter) write(current int64) float64 { fromStart := time.Since(a.startTime) currentFromStart := current - a.startValue if currentFromStart > 0 { speed := float64(currentFromStart) / (float64(fromStart) / float64(time.Second)) return speed } return 0.0 }
go
func (a *accounter) write(current int64) float64 { fromStart := time.Since(a.startTime) currentFromStart := current - a.startValue if currentFromStart > 0 { speed := float64(currentFromStart) / (float64(fromStart) / float64(time.Second)) return speed } return 0.0 }
[ "func", "(", "a", "*", "accounter", ")", "write", "(", "current", "int64", ")", "float64", "{", "fromStart", ":=", "time", ".", "Since", "(", "a", ".", "startTime", ")", "\n", "currentFromStart", ":=", "current", "-", "a", ".", "startValue", "\n", "if"...
// write calculate the final speed.
[ "write", "calculate", "the", "final", "speed", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/accounting-reader.go#L58-L66
train
minio/mc
cmd/accounting-reader.go
writer
func (a *accounter) writer() { a.Update() for { select { case <-a.isFinished: return case <-time.After(a.refreshRate): a.Update() } } }
go
func (a *accounter) writer() { a.Update() for { select { case <-a.isFinished: return case <-time.After(a.refreshRate): a.Update() } } }
[ "func", "(", "a", "*", "accounter", ")", "writer", "(", ")", "{", "a", ".", "Update", "(", ")", "\n", "for", "{", "select", "{", "case", "<-", "a", ".", "isFinished", ":", "return", "\n", "case", "<-", "time", ".", "After", "(", "a", ".", "refr...
// writer update new accounting data for a specified refreshRate.
[ "writer", "update", "new", "accounting", "data", "for", "a", "specified", "refreshRate", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/accounting-reader.go#L69-L79
train
minio/mc
cmd/accounting-reader.go
Stat
func (a *accounter) Stat() accountStat { var acntStat accountStat a.finishOnce.Do(func() { close(a.isFinished) acntStat.Total = a.Total acntStat.Transferred = atomic.LoadInt64(&a.current) acntStat.Speed = a.write(atomic.LoadInt64(&a.current)) }) return acntStat }
go
func (a *accounter) Stat() accountStat { var acntStat accountStat a.finishOnce.Do(func() { close(a.isFinished) acntStat.Total = a.Total acntStat.Transferred = atomic.LoadInt64(&a.current) acntStat.Speed = a.write(atomic.LoadInt64(&a.current)) }) return acntStat }
[ "func", "(", "a", "*", "accounter", ")", "Stat", "(", ")", "accountStat", "{", "var", "acntStat", "accountStat", "\n", "a", ".", "finishOnce", ".", "Do", "(", "func", "(", ")", "{", "close", "(", "a", ".", "isFinished", ")", "\n", "acntStat", ".", ...
// Stat provides current stats captured.
[ "Stat", "provides", "current", "stats", "captured", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/accounting-reader.go#L110-L119
train
minio/mc
cmd/accounting-reader.go
Update
func (a *accounter) Update() { c := atomic.LoadInt64(&a.current) if c != a.currentValue { a.write(c) a.currentValue = c } }
go
func (a *accounter) Update() { c := atomic.LoadInt64(&a.current) if c != a.currentValue { a.write(c) a.currentValue = c } }
[ "func", "(", "a", "*", "accounter", ")", "Update", "(", ")", "{", "c", ":=", "atomic", ".", "LoadInt64", "(", "&", "a", ".", "current", ")", "\n", "if", "c", "!=", "a", ".", "currentValue", "{", "a", ".", "write", "(", "c", ")", "\n", "a", "....
// Update update with new values loaded atomically.
[ "Update", "update", "with", "new", "values", "loaded", "atomically", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/accounting-reader.go#L122-L128
train
minio/mc
cmd/accounting-reader.go
Set
func (a *accounter) Set(n int64) *accounter { atomic.StoreInt64(&a.current, n) return a }
go
func (a *accounter) Set(n int64) *accounter { atomic.StoreInt64(&a.current, n) return a }
[ "func", "(", "a", "*", "accounter", ")", "Set", "(", "n", "int64", ")", "*", "accounter", "{", "atomic", ".", "StoreInt64", "(", "&", "a", ".", "current", ",", "n", ")", "\n", "return", "a", "\n", "}" ]
// Set sets the current value atomically.
[ "Set", "sets", "the", "current", "value", "atomically", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/accounting-reader.go#L131-L134
train
minio/mc
cmd/accounting-reader.go
Add
func (a *accounter) Add(n int64) int64 { return atomic.AddInt64(&a.current, n) }
go
func (a *accounter) Add(n int64) int64 { return atomic.AddInt64(&a.current, n) }
[ "func", "(", "a", "*", "accounter", ")", "Add", "(", "n", "int64", ")", "int64", "{", "return", "atomic", ".", "AddInt64", "(", "&", "a", ".", "current", ",", "n", ")", "\n", "}" ]
// Add add to current value atomically.
[ "Add", "add", "to", "current", "value", "atomically", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/accounting-reader.go#L142-L144
train
minio/mc
cmd/accounting-reader.go
Read
func (a *accounter) Read(p []byte) (n int, err error) { n = len(p) a.Add(int64(n)) return }
go
func (a *accounter) Read(p []byte) (n int, err error) { n = len(p) a.Add(int64(n)) return }
[ "func", "(", "a", "*", "accounter", ")", "Read", "(", "p", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "n", "=", "len", "(", "p", ")", "\n", "a", ".", "Add", "(", "int64", "(", "n", ")", ")", "\n", "return", "\n...
// Read implements Reader which internally updates current value.
[ "Read", "implements", "Reader", "which", "internally", "updates", "current", "value", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/accounting-reader.go#L147-L151
train
minio/mc
cmd/mirror-main.go
String
func (m mirrorMessage) String() string { return console.Colorize("Mirror", fmt.Sprintf("`%s` -> `%s`", m.Source, m.Target)) }
go
func (m mirrorMessage) String() string { return console.Colorize("Mirror", fmt.Sprintf("`%s` -> `%s`", m.Source, m.Target)) }
[ "func", "(", "m", "mirrorMessage", ")", "String", "(", ")", "string", "{", "return", "console", ".", "Colorize", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "m", ".", "Source", ",", "m", ".", "Target", ")", ")", "\n", "}" ]
// String colorized mirror message
[ "String", "colorized", "mirror", "message" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/mirror-main.go#L202-L204
train
minio/mc
cmd/mirror-main.go
JSON
func (m mirrorMessage) JSON() string { m.Status = "success" mirrorMessageBytes, e := json.MarshalIndent(m, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(mirrorMessageBytes) }
go
func (m mirrorMessage) JSON() string { m.Status = "success" mirrorMessageBytes, e := json.MarshalIndent(m, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(mirrorMessageBytes) }
[ "func", "(", "m", "mirrorMessage", ")", "JSON", "(", ")", "string", "{", "m", ".", "Status", "=", "\"", "\"", "\n", "mirrorMessageBytes", ",", "e", ":=", "json", ".", "MarshalIndent", "(", "m", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "fatalIf"...
// JSON jsonified mirror message
[ "JSON", "jsonified", "mirror", "message" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/mirror-main.go#L207-L213
train
minio/mc
cmd/mirror-main.go
doRemove
func (mj *mirrorJob) doRemove(sURLs URLs) URLs { if mj.isFake { return sURLs.WithError(nil) } // Construct proper path with alias. targetWithAlias := filepath.Join(sURLs.TargetAlias, sURLs.TargetContent.URL.Path) clnt, pErr := newClient(targetWithAlias) if pErr != nil { return sURLs.WithError(pErr) } cont...
go
func (mj *mirrorJob) doRemove(sURLs URLs) URLs { if mj.isFake { return sURLs.WithError(nil) } // Construct proper path with alias. targetWithAlias := filepath.Join(sURLs.TargetAlias, sURLs.TargetContent.URL.Path) clnt, pErr := newClient(targetWithAlias) if pErr != nil { return sURLs.WithError(pErr) } cont...
[ "func", "(", "mj", "*", "mirrorJob", ")", "doRemove", "(", "sURLs", "URLs", ")", "URLs", "{", "if", "mj", ".", "isFake", "{", "return", "sURLs", ".", "WithError", "(", "nil", ")", "\n", "}", "\n\n", "// Construct proper path with alias.", "targetWithAlias", ...
// doRemove - removes files on target.
[ "doRemove", "-", "removes", "files", "on", "target", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/mirror-main.go#L216-L245
train
minio/mc
cmd/mirror-main.go
doMirror
func (mj *mirrorJob) doMirror(ctx context.Context, cancelMirror context.CancelFunc, sURLs URLs) URLs { if sURLs.Error != nil { // Erroneous sURLs passed. return sURLs.WithError(sURLs.Error.Trace()) } //s For a fake mirror make sure we update respective progress bars // and accounting readers under relevant cond...
go
func (mj *mirrorJob) doMirror(ctx context.Context, cancelMirror context.CancelFunc, sURLs URLs) URLs { if sURLs.Error != nil { // Erroneous sURLs passed. return sURLs.WithError(sURLs.Error.Trace()) } //s For a fake mirror make sure we update respective progress bars // and accounting readers under relevant cond...
[ "func", "(", "mj", "*", "mirrorJob", ")", "doMirror", "(", "ctx", "context", ".", "Context", ",", "cancelMirror", "context", ".", "CancelFunc", ",", "sURLs", "URLs", ")", "URLs", "{", "if", "sURLs", ".", "Error", "!=", "nil", "{", "// Erroneous sURLs passe...
// doMirror - Mirror an object to multiple destination. URLs status contains a copy of sURLs and error if any.
[ "doMirror", "-", "Mirror", "an", "object", "to", "multiple", "destination", ".", "URLs", "status", "contains", "a", "copy", "of", "sURLs", "and", "error", "if", "any", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/mirror-main.go#L248-L286
train
minio/mc
cmd/mirror-main.go
monitorMirrorStatus
func (mj *mirrorJob) monitorMirrorStatus() (errDuringMirror bool) { // now we want to start the progress bar mj.status.Start() defer mj.status.Finish() for sURLs := range mj.statusCh { if sURLs.Error != nil { switch { case sURLs.SourceContent != nil: if !isErrIgnored(sURLs.Error) { errorIf(sURLs.E...
go
func (mj *mirrorJob) monitorMirrorStatus() (errDuringMirror bool) { // now we want to start the progress bar mj.status.Start() defer mj.status.Finish() for sURLs := range mj.statusCh { if sURLs.Error != nil { switch { case sURLs.SourceContent != nil: if !isErrIgnored(sURLs.Error) { errorIf(sURLs.E...
[ "func", "(", "mj", "*", "mirrorJob", ")", "monitorMirrorStatus", "(", ")", "(", "errDuringMirror", "bool", ")", "{", "// now we want to start the progress bar", "mj", ".", "status", ".", "Start", "(", ")", "\n", "defer", "mj", ".", "status", ".", "Finish", "...
// Update progress status
[ "Update", "progress", "status" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/mirror-main.go#L289-L324
train
minio/mc
cmd/mirror-main.go
startMirror
func (mj *mirrorJob) startMirror(ctx context.Context, cancelMirror context.CancelFunc) { var totalBytes int64 var totalObjects int64 stopParallel := func() { close(mj.queueCh) mj.parallel.wait() } URLsCh := prepareMirrorURLs(mj.sourceURL, mj.targetURL, mj.isFake, mj.isOverwrite, mj.isRemove, mj.excludeOption...
go
func (mj *mirrorJob) startMirror(ctx context.Context, cancelMirror context.CancelFunc) { var totalBytes int64 var totalObjects int64 stopParallel := func() { close(mj.queueCh) mj.parallel.wait() } URLsCh := prepareMirrorURLs(mj.sourceURL, mj.targetURL, mj.isFake, mj.isOverwrite, mj.isRemove, mj.excludeOption...
[ "func", "(", "mj", "*", "mirrorJob", ")", "startMirror", "(", "ctx", "context", ".", "Context", ",", "cancelMirror", "context", ".", "CancelFunc", ")", "{", "var", "totalBytes", "int64", "\n", "var", "totalObjects", "int64", "\n\n", "stopParallel", ":=", "fu...
// Fetch urls that need to be mirrored
[ "Fetch", "urls", "that", "need", "to", "be", "mirrored" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/mirror-main.go#L487-L547
train
minio/mc
cmd/mirror-main.go
mirror
func (mj *mirrorJob) mirror(ctx context.Context, cancelMirror context.CancelFunc) bool { var wg sync.WaitGroup // Starts watcher loop for watching for new events. if mj.isWatch { wg.Add(1) go func() { defer wg.Done() mj.watchMirror(ctx, cancelMirror) }() } // Start mirroring. wg.Add(1) go func() {...
go
func (mj *mirrorJob) mirror(ctx context.Context, cancelMirror context.CancelFunc) bool { var wg sync.WaitGroup // Starts watcher loop for watching for new events. if mj.isWatch { wg.Add(1) go func() { defer wg.Done() mj.watchMirror(ctx, cancelMirror) }() } // Start mirroring. wg.Add(1) go func() {...
[ "func", "(", "mj", "*", "mirrorJob", ")", "mirror", "(", "ctx", "context", ".", "Context", ",", "cancelMirror", "context", ".", "CancelFunc", ")", "bool", "{", "var", "wg", "sync", ".", "WaitGroup", "\n\n", "// Starts watcher loop for watching for new events.", ...
// when using a struct for copying, we could save a lot of passing of variables
[ "when", "using", "a", "struct", "for", "copying", "we", "could", "save", "a", "lot", "of", "passing", "of", "variables" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/mirror-main.go#L550-L577
train
minio/mc
cmd/mirror-main.go
copyBucketPolicies
func copyBucketPolicies(srcClt, dstClt Client, isOverwrite bool) *probe.Error { rules, err := srcClt.GetAccessRules() if err != nil { return err } // Set found rules to target bucket if permitted for _, r := range rules { originalRule, _, err := dstClt.GetAccess() if err != nil { return err } // Set r...
go
func copyBucketPolicies(srcClt, dstClt Client, isOverwrite bool) *probe.Error { rules, err := srcClt.GetAccessRules() if err != nil { return err } // Set found rules to target bucket if permitted for _, r := range rules { originalRule, _, err := dstClt.GetAccess() if err != nil { return err } // Set r...
[ "func", "copyBucketPolicies", "(", "srcClt", ",", "dstClt", "Client", ",", "isOverwrite", "bool", ")", "*", "probe", ".", "Error", "{", "rules", ",", "err", ":=", "srcClt", ".", "GetAccessRules", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// copyBucketPolicies - copy policies from source to dest
[ "copyBucketPolicies", "-", "copy", "policies", "from", "source", "to", "dest" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/mirror-main.go#L616-L637
train
minio/mc
cmd/mirror-main.go
mainMirror
func mainMirror(ctx *cli.Context) error { // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatalIf(err, "Unable to parse encryption keys.") // check 'mirror' cli arguments. checkMirrorSyntax(ctx, encKeyDB) // Additional command specific theme customization. console.SetColor("Mirror", colo...
go
func mainMirror(ctx *cli.Context) error { // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatalIf(err, "Unable to parse encryption keys.") // check 'mirror' cli arguments. checkMirrorSyntax(ctx, encKeyDB) // Additional command specific theme customization. console.SetColor("Mirror", colo...
[ "func", "mainMirror", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "// Parse encryption keys per command.", "encKeyDB", ",", "err", ":=", "getEncKeys", "(", "ctx", ")", "\n", "fatalIf", "(", "err", ",", "\"", "\"", ")", "\n\n", "// check 'mirro...
// Main entry point for mirror command.
[ "Main", "entry", "point", "for", "mirror", "command", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/mirror-main.go#L731-L752
train
minio/mc
cmd/urls.go
WithError
func (m URLs) WithError(err *probe.Error) URLs { m.Error = err return m }
go
func (m URLs) WithError(err *probe.Error) URLs { m.Error = err return m }
[ "func", "(", "m", "URLs", ")", "WithError", "(", "err", "*", "probe", ".", "Error", ")", "URLs", "{", "m", ".", "Error", "=", "err", "\n", "return", "m", "\n", "}" ]
// WithError sets the error and returns object
[ "WithError", "sets", "the", "error", "and", "returns", "object" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/urls.go#L36-L39
train
minio/mc
cmd/urls.go
Equal
func (m URLs) Equal(n URLs) bool { if m.SourceContent == nil && n.SourceContent == nil { } else if m.SourceContent != nil && n.SourceContent == nil { return false } else if m.SourceContent == nil && n.SourceContent != nil { return false } else if m.SourceContent.URL != n.SourceContent.URL { return false } ...
go
func (m URLs) Equal(n URLs) bool { if m.SourceContent == nil && n.SourceContent == nil { } else if m.SourceContent != nil && n.SourceContent == nil { return false } else if m.SourceContent == nil && n.SourceContent != nil { return false } else if m.SourceContent.URL != n.SourceContent.URL { return false } ...
[ "func", "(", "m", "URLs", ")", "Equal", "(", "n", "URLs", ")", "bool", "{", "if", "m", ".", "SourceContent", "==", "nil", "&&", "n", ".", "SourceContent", "==", "nil", "{", "}", "else", "if", "m", ".", "SourceContent", "!=", "nil", "&&", "n", "."...
// Equal tests if both urls are equal
[ "Equal", "tests", "if", "both", "urls", "are", "equal" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/urls.go#L42-L62
train
minio/mc
cmd/common-methods.go
getEncKeys
func getEncKeys(ctx *cli.Context) (map[string][]prefixSSEPair, *probe.Error) { sseServer := os.Getenv("MC_ENCRYPT") if prefix := ctx.String("encrypt"); prefix != "" { sseServer = prefix } sseKeys := os.Getenv("MC_ENCRYPT_KEY") if keyPrefix := ctx.String("encrypt-key"); keyPrefix != "" { if sseServer != "" && ...
go
func getEncKeys(ctx *cli.Context) (map[string][]prefixSSEPair, *probe.Error) { sseServer := os.Getenv("MC_ENCRYPT") if prefix := ctx.String("encrypt"); prefix != "" { sseServer = prefix } sseKeys := os.Getenv("MC_ENCRYPT_KEY") if keyPrefix := ctx.String("encrypt-key"); keyPrefix != "" { if sseServer != "" && ...
[ "func", "getEncKeys", "(", "ctx", "*", "cli", ".", "Context", ")", "(", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ",", "*", "probe", ".", "Error", ")", "{", "sseServer", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "pr...
// parse and return encryption key pairs per alias.
[ "parse", "and", "return", "encryption", "key", "pairs", "per", "alias", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L36-L56
train
minio/mc
cmd/common-methods.go
isAliasURLDir
func isAliasURLDir(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) if err == nil { return targetContent.Type.IsDir() } _, expandedURL, _ := mustExpandAlias(aliasU...
go
func isAliasURLDir(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) if err == nil { return targetContent.Type.IsDir() } _, expandedURL, _ := mustExpandAlias(aliasU...
[ "func", "isAliasURLDir", "(", "aliasURL", "string", ",", "keys", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "bool", "{", "// If the target url exists, check if it is a directory", "// and return immediately.", "_", ",", "targetContent", ",", "err", ":=...
// 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.
[ "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", ...
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L61-L95
train
minio/mc
cmd/common-methods.go
getSourceStreamMetadataFromURL
func getSourceStreamMetadataFromURL(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 ge...
go
func getSourceStreamMetadataFromURL(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 ge...
[ "func", "getSourceStreamMetadataFromURL", "(", "urlStr", "string", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "(", "reader", "io", ".", "ReadCloser", ",", "metadata", "map", "[", "string", "]", "string", ",", "err", "*", "p...
// getSourceStreamMetadataFromURL gets a reader from URL.
[ "getSourceStreamMetadataFromURL", "gets", "a", "reader", "from", "URL", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L98-L106
train
minio/mc
cmd/common-methods.go
getSourceStreamFromURL
func getSourceStreamFromURL(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, fa...
go
func getSourceStreamFromURL(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, fa...
[ "func", "getSourceStreamFromURL", "(", "urlStr", "string", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "(", "reader", "io", ".", "ReadCloser", ",", "err", "*", "probe", ".", "Error", ")", "{", "alias", ",", "urlStrFull", "...
// getSourceStreamFromURL gets a reader from URL.
[ "getSourceStreamFromURL", "gets", "a", "reader", "from", "URL", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L109-L117
train
minio/mc
cmd/common-methods.go
getSourceStream
func getSourceStream(alias string, urlStr string, fetchStat bool, sse encrypt.ServerSide) (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) if er...
go
func getSourceStream(alias string, urlStr string, fetchStat bool, sse encrypt.ServerSide) (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) if er...
[ "func", "getSourceStream", "(", "alias", "string", ",", "urlStr", "string", ",", "fetchStat", "bool", ",", "sse", "encrypt", ".", "ServerSide", ")", "(", "reader", "io", ".", "ReadCloser", ",", "metadata", "map", "[", "string", "]", "string", ",", "err", ...
// getSourceStream gets a reader from URL.
[ "getSourceStream", "gets", "a", "reader", "from", "URL", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L120-L168
train
minio/mc
cmd/common-methods.go
putTargetStream
func putTargetStream(ctx context.Context, alias string, urlStr string, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide) (int64, *probe.Error) { targetClnt, err := newClientFromAlias(alias, urlStr) if err != nil { return 0, err.Trace(alias, urlStr) } n, err := t...
go
func putTargetStream(ctx context.Context, alias string, urlStr string, reader io.Reader, size int64, metadata map[string]string, progress io.Reader, sse encrypt.ServerSide) (int64, *probe.Error) { targetClnt, err := newClientFromAlias(alias, urlStr) if err != nil { return 0, err.Trace(alias, urlStr) } n, err := t...
[ "func", "putTargetStream", "(", "ctx", "context", ".", "Context", ",", "alias", "string", ",", "urlStr", "string", ",", "reader", "io", ".", "Reader", ",", "size", "int64", ",", "metadata", "map", "[", "string", "]", "string", ",", "progress", "io", ".",...
// putTargetStream writes to URL from Reader.
[ "putTargetStream", "writes", "to", "URL", "from", "Reader", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L171-L181
train
minio/mc
cmd/common-methods.go
putTargetStreamWithURL
func putTargetStreamWithURL(urlStr string, reader io.Reader, size int64, sse encrypt.ServerSide) (int64, *probe.Error) { alias, urlStrFull, _, err := expandAlias(urlStr) if err != nil { return 0, err.Trace(alias, urlStr) } contentType := guessURLContentType(urlStr) metadata := map[string]string{ "Content-Type"...
go
func putTargetStreamWithURL(urlStr string, reader io.Reader, size int64, sse encrypt.ServerSide) (int64, *probe.Error) { alias, urlStrFull, _, err := expandAlias(urlStr) if err != nil { return 0, err.Trace(alias, urlStr) } contentType := guessURLContentType(urlStr) metadata := map[string]string{ "Content-Type"...
[ "func", "putTargetStreamWithURL", "(", "urlStr", "string", ",", "reader", "io", ".", "Reader", ",", "size", "int64", ",", "sse", "encrypt", ".", "ServerSide", ")", "(", "int64", ",", "*", "probe", ".", "Error", ")", "{", "alias", ",", "urlStrFull", ",", ...
// putTargetStreamWithURL writes to URL from reader. If length=-1, read until EOF.
[ "putTargetStreamWithURL", "writes", "to", "URL", "from", "reader", ".", "If", "length", "=", "-", "1", "read", "until", "EOF", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L184-L194
train
minio/mc
cmd/common-methods.go
copySourceToTargetURL
func copySourceToTargetURL(alias string, urlStr string, source string, size int64, progress io.Reader, srcSSE, tgtSSE encrypt.ServerSide, metadata map[string]string) *probe.Error { targetClnt, err := newClientFromAlias(alias, urlStr) if err != nil { return err.Trace(alias, urlStr) } err = targetClnt.Copy(source, ...
go
func copySourceToTargetURL(alias string, urlStr string, source string, size int64, progress io.Reader, srcSSE, tgtSSE encrypt.ServerSide, metadata map[string]string) *probe.Error { targetClnt, err := newClientFromAlias(alias, urlStr) if err != nil { return err.Trace(alias, urlStr) } err = targetClnt.Copy(source, ...
[ "func", "copySourceToTargetURL", "(", "alias", "string", ",", "urlStr", "string", ",", "source", "string", ",", "size", "int64", ",", "progress", "io", ".", "Reader", ",", "srcSSE", ",", "tgtSSE", "encrypt", ".", "ServerSide", ",", "metadata", "map", "[", ...
// copySourceToTargetURL copies to targetURL from source.
[ "copySourceToTargetURL", "copies", "to", "targetURL", "from", "source", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L197-L207
train
minio/mc
cmd/common-methods.go
createUserMetadata
func createUserMetadata(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 := so...
go
func createUserMetadata(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 := so...
[ "func", "createUserMetadata", "(", "sourceAlias", ",", "sourceURLStr", "string", ",", "srcSSE", "encrypt", ".", "ServerSide", ",", "urls", "URLs", ")", "(", "map", "[", "string", "]", "string", ",", "*", "probe", ".", "Error", ")", "{", "metadata", ":=", ...
// createUserMetadata - returns a map of user defined function // by combining the usermetadata of object and values passed by attr keyword
[ "createUserMetadata", "-", "returns", "a", "map", "of", "user", "defined", "function", "by", "combining", "the", "usermetadata", "of", "object", "and", "values", "passed", "by", "attr", "keyword" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L211-L232
train
minio/mc
cmd/common-methods.go
uploadSourceToTargetURL
func uploadSourceToTargetURL(ctx context.Context, urls URLs, progress io.Reader, encKeyDB map[string][]prefixSSEPair) URLs { sourceAlias := urls.SourceAlias sourceURL := urls.SourceContent.URL targetAlias := urls.TargetAlias targetURL := urls.TargetContent.URL length := urls.SourceContent.Size sourcePath := file...
go
func uploadSourceToTargetURL(ctx context.Context, urls URLs, progress io.Reader, encKeyDB map[string][]prefixSSEPair) URLs { sourceAlias := urls.SourceAlias sourceURL := urls.SourceContent.URL targetAlias := urls.TargetAlias targetURL := urls.TargetContent.URL length := urls.SourceContent.Size sourcePath := file...
[ "func", "uploadSourceToTargetURL", "(", "ctx", "context", ".", "Context", ",", "urls", "URLs", ",", "progress", "io", ".", "Reader", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "URLs", "{", "sourceAlias", ":=", "urls", ".", ...
// uploadSourceToTargetURL - uploads to targetURL from source. // optionally optimizes copy for object sizes <= 5GiB by using // server side copy operation.
[ "uploadSourceToTargetURL", "-", "uploads", "to", "targetURL", "from", "source", ".", "optionally", "optimizes", "copy", "for", "object", "sizes", "<", "=", "5GiB", "by", "using", "server", "side", "copy", "operation", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L237-L293
train
minio/mc
cmd/common-methods.go
newClientFromAlias
func newClientFromAlias(alias, urlStr string) (Client, *probe.Error) { alias, _, hostCfg, err := expandAlias(alias) if err != nil { return nil, err.Trace(alias, urlStr) } if hostCfg == nil { // No matching host config. So we treat it like a // filesystem. fsClient, fsErr := fsNew(urlStr) if fsErr != nil ...
go
func newClientFromAlias(alias, urlStr string) (Client, *probe.Error) { alias, _, hostCfg, err := expandAlias(alias) if err != nil { return nil, err.Trace(alias, urlStr) } if hostCfg == nil { // No matching host config. So we treat it like a // filesystem. fsClient, fsErr := fsNew(urlStr) if fsErr != nil ...
[ "func", "newClientFromAlias", "(", "alias", ",", "urlStr", "string", ")", "(", "Client", ",", "*", "probe", ".", "Error", ")", "{", "alias", ",", "_", ",", "hostCfg", ",", "err", ":=", "expandAlias", "(", "alias", ")", "\n", "if", "err", "!=", "nil",...
// newClientFromAlias gives a new client interface for matching // alias entry in the mc config file. If no matching host config entry // is found, fs client is returned.
[ "newClientFromAlias", "gives", "a", "new", "client", "interface", "for", "matching", "alias", "entry", "in", "the", "mc", "config", "file", ".", "If", "no", "matching", "host", "config", "entry", "is", "found", "fs", "client", "is", "returned", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L298-L321
train
minio/mc
cmd/common-methods.go
newClient
func newClient(aliasedURL string) (Client, *probe.Error) { alias, urlStrFull, hostCfg, err := expandAlias(aliasedURL) if err != nil { return nil, err.Trace(aliasedURL) } // Verify if the aliasedURL is a real URL, fail in those cases // indicating the user to add alias. if hostCfg == nil && urlRgx.MatchString(al...
go
func newClient(aliasedURL string) (Client, *probe.Error) { alias, urlStrFull, hostCfg, err := expandAlias(aliasedURL) if err != nil { return nil, err.Trace(aliasedURL) } // Verify if the aliasedURL is a real URL, fail in those cases // indicating the user to add alias. if hostCfg == nil && urlRgx.MatchString(al...
[ "func", "newClient", "(", "aliasedURL", "string", ")", "(", "Client", ",", "*", "probe", ".", "Error", ")", "{", "alias", ",", "urlStrFull", ",", "hostCfg", ",", "err", ":=", "expandAlias", "(", "aliasedURL", ")", "\n", "if", "err", "!=", "nil", "{", ...
// newClient gives a new client interface
[ "newClient", "gives", "a", "new", "client", "interface" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/common-methods.go#L327-L338
train
minio/mc
cmd/admin-policy-list.go
checkAdminPolicyListSyntax
func checkAdminPolicyListSyntax(ctx *cli.Context) { if len(ctx.Args()) < 1 || len(ctx.Args()) > 2 { cli.ShowCommandHelpAndExit(ctx, "list", 1) // last argument is exit code } }
go
func checkAdminPolicyListSyntax(ctx *cli.Context) { if len(ctx.Args()) < 1 || len(ctx.Args()) > 2 { cli.ShowCommandHelpAndExit(ctx, "list", 1) // last argument is exit code } }
[ "func", "checkAdminPolicyListSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "<", "1", "||", "len", "(", "ctx", ".", "Args", "(", ")", ")", ">", "2", "{", "cli", ".", "ShowCommandHel...
// checkAdminPolicyListSyntax - validate all the passed arguments
[ "checkAdminPolicyListSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-policy-list.go#L55-L59
train
minio/mc
cmd/admin-policy-list.go
mainAdminPolicyList
func mainAdminPolicyList(ctx *cli.Context) error { checkAdminPolicyListSyntax(ctx) console.SetColor("PolicyMessage", color.New(color.FgGreen)) console.SetColor("Policy", color.New(color.FgBlue)) // Get the alias parameter from cli args := ctx.Args() aliasedURL := args.Get(0) // Create a new MinIO Admin Client...
go
func mainAdminPolicyList(ctx *cli.Context) error { checkAdminPolicyListSyntax(ctx) console.SetColor("PolicyMessage", color.New(color.FgGreen)) console.SetColor("Policy", color.New(color.FgBlue)) // Get the alias parameter from cli args := ctx.Args() aliasedURL := args.Get(0) // Create a new MinIO Admin Client...
[ "func", "mainAdminPolicyList", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "checkAdminPolicyListSyntax", "(", "ctx", ")", "\n\n", "console", ".", "SetColor", "(", "\"", "\"", ",", "color", ".", "New", "(", "color", ".", "FgGreen", ")", ")"...
// mainAdminPolicyList is the handle for "mc admin policy add" command.
[ "mainAdminPolicyList", "is", "the", "handle", "for", "mc", "admin", "policy", "add", "command", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-policy-list.go#L62-L98
train
minio/mc
cmd/mirror-url.go
prepareMirrorURLs
func prepareMirrorURLs(sourceURL string, targetURL string, isFake, isOverwrite, isRemove bool, excludeOptions []string, encKeyDB map[string][]prefixSSEPair) <-chan URLs { URLsCh := make(chan URLs) go deltaSourceTarget(sourceURL, targetURL, isFake, isOverwrite, isRemove, excludeOptions, URLsCh, encKeyDB) return URLsC...
go
func prepareMirrorURLs(sourceURL string, targetURL string, isFake, isOverwrite, isRemove bool, excludeOptions []string, encKeyDB map[string][]prefixSSEPair) <-chan URLs { URLsCh := make(chan URLs) go deltaSourceTarget(sourceURL, targetURL, isFake, isOverwrite, isRemove, excludeOptions, URLsCh, encKeyDB) return URLsC...
[ "func", "prepareMirrorURLs", "(", "sourceURL", "string", ",", "targetURL", "string", ",", "isFake", ",", "isOverwrite", ",", "isRemove", "bool", ",", "excludeOptions", "[", "]", "string", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ...
// Prepares urls that need to be copied or removed based on requested options.
[ "Prepares", "urls", "that", "need", "to", "be", "copied", "or", "removed", "based", "on", "requested", "options", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/mirror-url.go#L190-L194
train
minio/mc
cmd/admin-profile-start.go
mainAdminProfileStart
func mainAdminProfileStart(ctx *cli.Context) error { // Check for command syntax checkAdminProfileStartSyntax(ctx) // Get the alias parameter from cli args := ctx.Args() aliasedURL := args.Get(0) profilerType := ctx.String("type") // Create a new MinIO Admin Client client, err := newAdminClient(aliasedURL) ...
go
func mainAdminProfileStart(ctx *cli.Context) error { // Check for command syntax checkAdminProfileStartSyntax(ctx) // Get the alias parameter from cli args := ctx.Args() aliasedURL := args.Get(0) profilerType := ctx.String("type") // Create a new MinIO Admin Client client, err := newAdminClient(aliasedURL) ...
[ "func", "mainAdminProfileStart", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "// Check for command syntax", "checkAdminProfileStartSyntax", "(", "ctx", ")", "\n\n", "// Get the alias parameter from cli", "args", ":=", "ctx", ".", "Args", "(", ")", "\n...
// mainAdminProfileStart - the entry function of profile command
[ "mainAdminProfileStart", "-", "the", "entry", "function", "of", "profile", "command" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-profile-start.go#L88-L111
train
minio/mc
cmd/config-utils.go
trimTrailingSeparator
func trimTrailingSeparator(hostURL string) string { separator := string(newClientURL(hostURL).Separator) return strings.TrimSuffix(hostURL, separator) }
go
func trimTrailingSeparator(hostURL string) string { separator := string(newClientURL(hostURL).Separator) return strings.TrimSuffix(hostURL, separator) }
[ "func", "trimTrailingSeparator", "(", "hostURL", "string", ")", "string", "{", "separator", ":=", "string", "(", "newClientURL", "(", "hostURL", ")", ".", "Separator", ")", "\n", "return", "strings", ".", "TrimSuffix", "(", "hostURL", ",", "separator", ")", ...
// trimTrailingSeparator - Remove trailing separator.
[ "trimTrailingSeparator", "-", "Remove", "trailing", "separator", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/config-utils.go#L45-L48
train
minio/mc
cmd/config-utils.go
isValidHostURL
func isValidHostURL(hostURL string) (ok bool) { if strings.TrimSpace(hostURL) != "" { url := newClientURL(hostURL) if url.Scheme == "https" || url.Scheme == "http" { if url.Path == "/" { ok = true } } } return ok }
go
func isValidHostURL(hostURL string) (ok bool) { if strings.TrimSpace(hostURL) != "" { url := newClientURL(hostURL) if url.Scheme == "https" || url.Scheme == "http" { if url.Path == "/" { ok = true } } } return ok }
[ "func", "isValidHostURL", "(", "hostURL", "string", ")", "(", "ok", "bool", ")", "{", "if", "strings", ".", "TrimSpace", "(", "hostURL", ")", "!=", "\"", "\"", "{", "url", ":=", "newClientURL", "(", "hostURL", ")", "\n", "if", "url", ".", "Scheme", "...
// isValidHostURL - validate input host url.
[ "isValidHostURL", "-", "validate", "input", "host", "url", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/config-utils.go#L51-L61
train
minio/mc
cmd/config-utils.go
isValidAPI
func isValidAPI(api string) (ok bool) { switch strings.ToLower(api) { case "s3v2", "s3v4": ok = true } return ok }
go
func isValidAPI(api string) (ok bool) { switch strings.ToLower(api) { case "s3v2", "s3v4": ok = true } return ok }
[ "func", "isValidAPI", "(", "api", "string", ")", "(", "ok", "bool", ")", "{", "switch", "strings", ".", "ToLower", "(", "api", ")", "{", "case", "\"", "\"", ",", "\"", "\"", ":", "ok", "=", "true", "\n", "}", "\n", "return", "ok", "\n", "}" ]
// isValidAPI - Validates if API signature string of supported type.
[ "isValidAPI", "-", "Validates", "if", "API", "signature", "string", "of", "supported", "type", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/config-utils.go#L64-L70
train
minio/mc
cmd/config-utils.go
isValidLookup
func isValidLookup(lookup string) (ok bool) { l := strings.TrimSpace(lookup) l = strings.ToLower(lookup) for _, v := range []string{"dns", "path", "auto"} { if l == v { return true } } return false }
go
func isValidLookup(lookup string) (ok bool) { l := strings.TrimSpace(lookup) l = strings.ToLower(lookup) for _, v := range []string{"dns", "path", "auto"} { if l == v { return true } } return false }
[ "func", "isValidLookup", "(", "lookup", "string", ")", "(", "ok", "bool", ")", "{", "l", ":=", "strings", ".", "TrimSpace", "(", "lookup", ")", "\n", "l", "=", "strings", ".", "ToLower", "(", "lookup", ")", "\n", "for", "_", ",", "v", ":=", "range"...
// isValidLookup - validates if bucket lookup is of valid type
[ "isValidLookup", "-", "validates", "if", "bucket", "lookup", "is", "of", "valid", "type" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/config-utils.go#L73-L82
train
minio/mc
cmd/admin-user-remove.go
checkAdminUserRemoveSyntax
func checkAdminUserRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { cli.ShowCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code } }
go
func checkAdminUserRemoveSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { cli.ShowCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code } }
[ "func", "checkAdminUserRemoveSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "2", "{", "cli", ".", "ShowCommandHelpAndExit", "(", "ctx", ",", "\"", "\"", ",", "1", ")", "// last ar...
// checkAdminUserRemoveSyntax - validate all the passed arguments
[ "checkAdminUserRemoveSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-user-remove.go#L48-L52
train
minio/mc
cmd/admin-user-remove.go
mainAdminUserRemove
func mainAdminUserRemove(ctx *cli.Context) error { checkAdminUserRemoveSyntax(ctx) console.SetColor("UserMessage", color.New(color.FgGreen)) // Get the alias parameter from cli args := ctx.Args() aliasedURL := args.Get(0) // Create a new MinIO Admin Client client, err := newAdminClient(aliasedURL) fatalIf(er...
go
func mainAdminUserRemove(ctx *cli.Context) error { checkAdminUserRemoveSyntax(ctx) console.SetColor("UserMessage", color.New(color.FgGreen)) // Get the alias parameter from cli args := ctx.Args() aliasedURL := args.Get(0) // Create a new MinIO Admin Client client, err := newAdminClient(aliasedURL) fatalIf(er...
[ "func", "mainAdminUserRemove", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "checkAdminUserRemoveSyntax", "(", "ctx", ")", "\n\n", "console", ".", "SetColor", "(", "\"", "\"", ",", "color", ".", "New", "(", "color", ".", "FgGreen", ")", ")"...
// mainAdminUserRemove is the handle for "mc admin user remove" command.
[ "mainAdminUserRemove", "is", "the", "handle", "for", "mc", "admin", "user", "remove", "command", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-user-remove.go#L55-L77
train
minio/mc
cmd/admin-user-list.go
checkAdminUserListSyntax
func checkAdminUserListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { cli.ShowCommandHelpAndExit(ctx, "list", 1) // last argument is exit code } }
go
func checkAdminUserListSyntax(ctx *cli.Context) { if len(ctx.Args()) != 1 { cli.ShowCommandHelpAndExit(ctx, "list", 1) // last argument is exit code } }
[ "func", "checkAdminUserListSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "1", "{", "cli", ".", "ShowCommandHelpAndExit", "(", "ctx", ",", "\"", "\"", ",", "1", ")", "// last argu...
// checkAdminUserListSyntax - validate all the passed arguments
[ "checkAdminUserListSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-user-list.go#L48-L52
train
minio/mc
cmd/admin-user-list.go
mainAdminUserList
func mainAdminUserList(ctx *cli.Context) error { checkAdminUserListSyntax(ctx) // Additional command speific theme customization. console.SetColor("UserMessage", color.New(color.FgGreen)) console.SetColor("AccessKey", color.New(color.FgBlue)) console.SetColor("PolicyName", color.New(color.FgYellow)) console.SetC...
go
func mainAdminUserList(ctx *cli.Context) error { checkAdminUserListSyntax(ctx) // Additional command speific theme customization. console.SetColor("UserMessage", color.New(color.FgGreen)) console.SetColor("AccessKey", color.New(color.FgBlue)) console.SetColor("PolicyName", color.New(color.FgYellow)) console.SetC...
[ "func", "mainAdminUserList", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "checkAdminUserListSyntax", "(", "ctx", ")", "\n\n", "// Additional command speific theme customization.", "console", ".", "SetColor", "(", "\"", "\"", ",", "color", ".", "New"...
// mainAdminUserList is the handle for "mc admin user list" command.
[ "mainAdminUserList", "is", "the", "handle", "for", "mc", "admin", "user", "list", "command", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-user-list.go#L55-L84
train
minio/mc
cmd/share-download-main.go
checkShareDownloadSyntax
func checkShareDownloadSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) { args := ctx.Args() if !args.Present() { cli.ShowCommandHelpAndExit(ctx, "download", 1) // last argument is exit code. } // Parse expiry. expiry := shareDefaultExpiry expireArg := ctx.String("expire") if expireArg != "" { ...
go
func checkShareDownloadSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) { args := ctx.Args() if !args.Present() { cli.ShowCommandHelpAndExit(ctx, "download", 1) // last argument is exit code. } // Parse expiry. expiry := shareDefaultExpiry expireArg := ctx.String("expire") if expireArg != "" { ...
[ "func", "checkShareDownloadSyntax", "(", "ctx", "*", "cli", ".", "Context", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "!", "args", ".", "Present", "(", ")"...
// checkShareDownloadSyntax - validate command-line args.
[ "checkShareDownloadSyntax", "-", "validate", "command", "-", "line", "args", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share-download-main.go#L70-L103
train
minio/mc
cmd/share-download-main.go
doShareDownloadURL
func doShareDownloadURL(targetURL string, isRecursive bool, expiry time.Duration) *probe.Error { targetAlias, targetURLFull, _, err := expandAlias(targetURL) if err != nil { return err.Trace(targetURL) } clnt, err := newClientFromAlias(targetAlias, targetURLFull) if err != nil { return err.Trace(targetURL) } ...
go
func doShareDownloadURL(targetURL string, isRecursive bool, expiry time.Duration) *probe.Error { targetAlias, targetURLFull, _, err := expandAlias(targetURL) if err != nil { return err.Trace(targetURL) } clnt, err := newClientFromAlias(targetAlias, targetURLFull) if err != nil { return err.Trace(targetURL) } ...
[ "func", "doShareDownloadURL", "(", "targetURL", "string", ",", "isRecursive", "bool", ",", "expiry", "time", ".", "Duration", ")", "*", "probe", ".", "Error", "{", "targetAlias", ",", "targetURLFull", ",", "_", ",", "err", ":=", "expandAlias", "(", "targetUR...
// doShareURL share files from target.
[ "doShareURL", "share", "files", "from", "target", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share-download-main.go#L106-L192
train
minio/mc
cmd/share-download-main.go
mainShareDownload
func mainShareDownload(ctx *cli.Context) error { // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatalIf(err, "Unable to parse encryption keys.") // check input arguments. checkShareDownloadSyntax(ctx, encKeyDB) // Initialize share config folder. initShareConfig() // Additional command...
go
func mainShareDownload(ctx *cli.Context) error { // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatalIf(err, "Unable to parse encryption keys.") // check input arguments. checkShareDownloadSyntax(ctx, encKeyDB) // Initialize share config folder. initShareConfig() // Additional command...
[ "func", "mainShareDownload", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "// Parse encryption keys per command.", "encKeyDB", ",", "err", ":=", "getEncKeys", "(", "ctx", ")", "\n", "fatalIf", "(", "err", ",", "\"", "\"", ")", "\n\n", "// check...
// main for share download.
[ "main", "for", "share", "download", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share-download-main.go#L195-L230
train
minio/mc
cmd/share-upload-main.go
checkShareUploadSyntax
func checkShareUploadSyntax(ctx *cli.Context) { args := ctx.Args() if !args.Present() { cli.ShowCommandHelpAndExit(ctx, "upload", 1) // last argument is exit code. } // Set command flags from context. isRecursive := ctx.Bool("recursive") expireArg := ctx.String("expire") // Parse expiry. expiry := shareDefa...
go
func checkShareUploadSyntax(ctx *cli.Context) { args := ctx.Args() if !args.Present() { cli.ShowCommandHelpAndExit(ctx, "upload", 1) // last argument is exit code. } // Set command flags from context. isRecursive := ctx.Bool("recursive") expireArg := ctx.String("expire") // Parse expiry. expiry := shareDefa...
[ "func", "checkShareUploadSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "args", ":=", "ctx", ".", "Args", "(", ")", "\n", "if", "!", "args", ".", "Present", "(", ")", "{", "cli", ".", "ShowCommandHelpAndExit", "(", "ctx", ",", "\"", "\"",...
// checkShareUploadSyntax - validate command-line args.
[ "checkShareUploadSyntax", "-", "validate", "command", "-", "line", "args", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share-upload-main.go#L72-L107
train
minio/mc
cmd/share-upload-main.go
makeCurlCmd
func makeCurlCmd(key, postURL string, isRecursive bool, uploadInfo map[string]string) (string, *probe.Error) { postURL += " " curlCommand := "curl " + postURL for k, v := range uploadInfo { if k == "key" { key = v continue } curlCommand += fmt.Sprintf("-F %s=%s ", k, v) } // If key starts with is enabl...
go
func makeCurlCmd(key, postURL string, isRecursive bool, uploadInfo map[string]string) (string, *probe.Error) { postURL += " " curlCommand := "curl " + postURL for k, v := range uploadInfo { if k == "key" { key = v continue } curlCommand += fmt.Sprintf("-F %s=%s ", k, v) } // If key starts with is enabl...
[ "func", "makeCurlCmd", "(", "key", ",", "postURL", "string", ",", "isRecursive", "bool", ",", "uploadInfo", "map", "[", "string", "]", "string", ")", "(", "string", ",", "*", "probe", ".", "Error", ")", "{", "postURL", "+=", "\"", "\"", "\n", "curlComm...
// makeCurlCmd constructs curl command-line.
[ "makeCurlCmd", "constructs", "curl", "command", "-", "line", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share-upload-main.go#L110-L128
train
minio/mc
cmd/share-upload-main.go
saveSharedURL
func saveSharedURL(objectURL string, shareURL string, expiry time.Duration, contentType string) *probe.Error { // Load previously saved upload-shares. shareDB := newShareDBV1() if err := shareDB.Load(getShareUploadsFile()); err != nil { return err.Trace(getShareUploadsFile()) } // Make new entries to uploadsDB....
go
func saveSharedURL(objectURL string, shareURL string, expiry time.Duration, contentType string) *probe.Error { // Load previously saved upload-shares. shareDB := newShareDBV1() if err := shareDB.Load(getShareUploadsFile()); err != nil { return err.Trace(getShareUploadsFile()) } // Make new entries to uploadsDB....
[ "func", "saveSharedURL", "(", "objectURL", "string", ",", "shareURL", "string", ",", "expiry", "time", ".", "Duration", ",", "contentType", "string", ")", "*", "probe", ".", "Error", "{", "// Load previously saved upload-shares.", "shareDB", ":=", "newShareDBV1", ...
// save shared URL to disk.
[ "save", "shared", "URL", "to", "disk", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share-upload-main.go#L131-L143
train
minio/mc
cmd/share-upload-main.go
doShareUploadURL
func doShareUploadURL(objectURL string, isRecursive bool, expiry time.Duration, contentType string) *probe.Error { clnt, err := newClient(objectURL) if err != nil { return err.Trace(objectURL) } // Generate pre-signed access info. shareURL, uploadInfo, err := clnt.ShareUpload(isRecursive, expiry, contentType) ...
go
func doShareUploadURL(objectURL string, isRecursive bool, expiry time.Duration, contentType string) *probe.Error { clnt, err := newClient(objectURL) if err != nil { return err.Trace(objectURL) } // Generate pre-signed access info. shareURL, uploadInfo, err := clnt.ShareUpload(isRecursive, expiry, contentType) ...
[ "func", "doShareUploadURL", "(", "objectURL", "string", ",", "isRecursive", "bool", ",", "expiry", "time", ".", "Duration", ",", "contentType", "string", ")", "*", "probe", ".", "Error", "{", "clnt", ",", "err", ":=", "newClient", "(", "objectURL", ")", "\...
// doShareUploadURL uploads files to the target.
[ "doShareUploadURL", "uploads", "files", "to", "the", "target", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share-upload-main.go#L146-L176
train
minio/mc
cmd/share-upload-main.go
mainShareUpload
func mainShareUpload(ctx *cli.Context) error { // check input arguments. checkShareUploadSyntax(ctx) // Initialize share config folder. initShareConfig() // Additional command speific theme customization. shareSetColor() // Set command flags from context. isRecursive := ctx.Bool("recursive") expireArg := c...
go
func mainShareUpload(ctx *cli.Context) error { // check input arguments. checkShareUploadSyntax(ctx) // Initialize share config folder. initShareConfig() // Additional command speific theme customization. shareSetColor() // Set command flags from context. isRecursive := ctx.Bool("recursive") expireArg := c...
[ "func", "mainShareUpload", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "// check input arguments.", "checkShareUploadSyntax", "(", "ctx", ")", "\n\n", "// Initialize share config folder.", "initShareConfig", "(", ")", "\n\n", "// Additional command speific ...
// main for share upload command.
[ "main", "for", "share", "upload", "command", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/share-upload-main.go#L179-L213
train
minio/mc
cmd/event-add.go
checkEventAddSyntax
func checkEventAddSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { cli.ShowCommandHelpAndExit(ctx, "add", 1) // last argument is exit code } }
go
func checkEventAddSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { cli.ShowCommandHelpAndExit(ctx, "add", 1) // last argument is exit code } }
[ "func", "checkEventAddSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "2", "{", "cli", ".", "ShowCommandHelpAndExit", "(", "ctx", ",", "\"", "\"", ",", "1", ")", "// last argument ...
// checkEventAddSyntax - validate all the passed arguments
[ "checkEventAddSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/event-add.go#L73-L77
train
minio/mc
cmd/event-add.go
JSON
func (u eventAddMessage) JSON() string { u.Status = "success" eventAddMessageJSONBytes, e := json.MarshalIndent(u, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(eventAddMessageJSONBytes) }
go
func (u eventAddMessage) JSON() string { u.Status = "success" eventAddMessageJSONBytes, e := json.MarshalIndent(u, "", " ") fatalIf(probe.NewError(e), "Unable to marshal into JSON.") return string(eventAddMessageJSONBytes) }
[ "func", "(", "u", "eventAddMessage", ")", "JSON", "(", ")", "string", "{", "u", ".", "Status", "=", "\"", "\"", "\n", "eventAddMessageJSONBytes", ",", "e", ":=", "json", ".", "MarshalIndent", "(", "u", ",", "\"", "\"", ",", "\"", "\"", ")", "\n", "...
// JSON jsonified update message.
[ "JSON", "jsonified", "update", "message", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/event-add.go#L89-L94
train
minio/mc
cmd/admin-service-stop.go
checkAdminServiceStopSyntax
func checkAdminServiceStopSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { cli.ShowCommandHelpAndExit(ctx, "stop", 1) // last argument is exit code } }
go
func checkAdminServiceStopSyntax(ctx *cli.Context) { if len(ctx.Args()) == 0 || len(ctx.Args()) > 2 { cli.ShowCommandHelpAndExit(ctx, "stop", 1) // last argument is exit code } }
[ "func", "checkAdminServiceStopSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "==", "0", "||", "len", "(", "ctx", ".", "Args", "(", ")", ")", ">", "2", "{", "cli", ".", "ShowCommandH...
// checkAdminServiceStopSyntax - validate all the passed arguments
[ "checkAdminServiceStopSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-service-stop.go#L70-L74
train
minio/mc
cmd/config-validate.go
validateConfigVersion
func validateConfigVersion(config *configV9) (bool, string) { if config.Version != globalMCConfigVersion { return false, fmt.Sprintf("Config version '%s' does not match mc config version '%s', please update your binary.\n", config.Version, globalMCConfigVersion) } return true, "" }
go
func validateConfigVersion(config *configV9) (bool, string) { if config.Version != globalMCConfigVersion { return false, fmt.Sprintf("Config version '%s' does not match mc config version '%s', please update your binary.\n", config.Version, globalMCConfigVersion) } return true, "" }
[ "func", "validateConfigVersion", "(", "config", "*", "configV9", ")", "(", "bool", ",", "string", ")", "{", "if", "config", ".", "Version", "!=", "globalMCConfigVersion", "{", "return", "false", ",", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "c...
// Check if version of the config is valid
[ "Check", "if", "version", "of", "the", "config", "is", "valid" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/config-validate.go#L25-L31
train
minio/mc
cmd/config-validate.go
validateConfigFile
func validateConfigFile(config *configV9) (bool, []string) { ok, err := validateConfigVersion(config) var validationSuccessful = true var errors []string if !ok { validationSuccessful = false errors = append(errors, err) } hosts := config.Hosts for _, hostConfig := range hosts { hostConfigHealthOk, hostErr...
go
func validateConfigFile(config *configV9) (bool, []string) { ok, err := validateConfigVersion(config) var validationSuccessful = true var errors []string if !ok { validationSuccessful = false errors = append(errors, err) } hosts := config.Hosts for _, hostConfig := range hosts { hostConfigHealthOk, hostErr...
[ "func", "validateConfigFile", "(", "config", "*", "configV9", ")", "(", "bool", ",", "[", "]", "string", ")", "{", "ok", ",", "err", ":=", "validateConfigVersion", "(", "config", ")", "\n", "var", "validationSuccessful", "=", "true", "\n", "var", "errors",...
// Verifies the config file of the MinIO Client
[ "Verifies", "the", "config", "file", "of", "the", "MinIO", "Client" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/config-validate.go#L34-L51
train
minio/mc
cmd/main.go
Main
func Main() { if len(os.Args) > 1 { switch os.Args[1] { case "mc", "-install", "-uninstall": mainComplete() return } } // Enable profiling supported modes are [cpu, mem, block]. // ``MC_PROFILER`` supported options are [cpu, mem, block]. switch os.Getenv("MC_PROFILER") { case "cpu": defer profile.S...
go
func Main() { if len(os.Args) > 1 { switch os.Args[1] { case "mc", "-install", "-uninstall": mainComplete() return } } // Enable profiling supported modes are [cpu, mem, block]. // ``MC_PROFILER`` supported options are [cpu, mem, block]. switch os.Getenv("MC_PROFILER") { case "cpu": defer profile.S...
[ "func", "Main", "(", ")", "{", "if", "len", "(", "os", ".", "Args", ")", ">", "1", "{", "switch", "os", ".", "Args", "[", "1", "]", "{", "case", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ":", "mainComplete", "(", ")", "\n", "return", "\...
// Main starts mc application
[ "Main", "starts", "mc", "application" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/main.go#L66-L107
train
minio/mc
cmd/main.go
commandNotFound
func commandNotFound(ctx *cli.Context, command string) { msg := fmt.Sprintf("`%s` is not a mc command. See `mc --help`.", command) closestCommands := findClosestCommands(command) if len(closestCommands) > 0 { msg += fmt.Sprintf("\n\nDid you mean one of these?\n") if len(closestCommands) == 1 { cmd := closestC...
go
func commandNotFound(ctx *cli.Context, command string) { msg := fmt.Sprintf("`%s` is not a mc command. See `mc --help`.", command) closestCommands := findClosestCommands(command) if len(closestCommands) > 0 { msg += fmt.Sprintf("\n\nDid you mean one of these?\n") if len(closestCommands) == 1 { cmd := closestC...
[ "func", "commandNotFound", "(", "ctx", "*", "cli", ".", "Context", ",", "command", "string", ")", "{", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "command", ")", "\n", "closestCommands", ":=", "findClosestCommands", "(", "command", ")", "\...
// Function invoked when invalid command is passed.
[ "Function", "invoked", "when", "invalid", "command", "is", "passed", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/main.go#L110-L125
train
minio/mc
cmd/main.go
checkConfig
func checkConfig() { // Refresh the config once. loadMcConfig = loadMcConfigFactory() // Ensures config file is sane. config, err := loadMcConfig() // Verify if the path is accesible before validating the config fatalIf(err.Trace(mustGetMcConfigPath()), "Unable to access configuration file.") // Validate and pr...
go
func checkConfig() { // Refresh the config once. loadMcConfig = loadMcConfigFactory() // Ensures config file is sane. config, err := loadMcConfig() // Verify if the path is accesible before validating the config fatalIf(err.Trace(mustGetMcConfigPath()), "Unable to access configuration file.") // Validate and pr...
[ "func", "checkConfig", "(", ")", "{", "// Refresh the config once.", "loadMcConfig", "=", "loadMcConfigFactory", "(", ")", "\n", "// Ensures config file is sane.", "config", ",", "err", ":=", "loadMcConfig", "(", ")", "\n", "// Verify if the path is accesible before validat...
// Check for sane config environment early on and gracefully report.
[ "Check", "for", "sane", "config", "environment", "early", "on", "and", "gracefully", "report", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/main.go#L128-L149
train
minio/mc
cmd/main.go
initMC
func initMC() { // Check if mc config exists. if !isMcConfigExists() { err := saveMcConfig(newMcConfig()) fatalIf(err.Trace(), "Unable to save new mc config.") if !globalQuiet && !globalJSON { console.Infoln("Configuration written to `" + mustGetMcConfigPath() + "`. Please update your access credentials.") ...
go
func initMC() { // Check if mc config exists. if !isMcConfigExists() { err := saveMcConfig(newMcConfig()) fatalIf(err.Trace(), "Unable to save new mc config.") if !globalQuiet && !globalJSON { console.Infoln("Configuration written to `" + mustGetMcConfigPath() + "`. Please update your access credentials.") ...
[ "func", "initMC", "(", ")", "{", "// Check if mc config exists.", "if", "!", "isMcConfigExists", "(", ")", "{", "err", ":=", "saveMcConfig", "(", "newMcConfig", "(", ")", ")", "\n", "fatalIf", "(", "err", ".", "Trace", "(", ")", ",", "\"", "\"", ")", "...
// initMC - initialize 'mc'.
[ "initMC", "-", "initialize", "mc", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/main.go#L188-L225
train
minio/mc
cmd/main.go
findClosestCommands
func findClosestCommands(command string) []string { var closestCommands []string for _, value := range commandsTree.PrefixMatch(command) { closestCommands = append(closestCommands, value.(string)) } sort.Strings(closestCommands) // Suggest other close commands - allow missed, wrongly added and even transposed ch...
go
func findClosestCommands(command string) []string { var closestCommands []string for _, value := range commandsTree.PrefixMatch(command) { closestCommands = append(closestCommands, value.(string)) } sort.Strings(closestCommands) // Suggest other close commands - allow missed, wrongly added and even transposed ch...
[ "func", "findClosestCommands", "(", "command", "string", ")", "[", "]", "string", "{", "var", "closestCommands", "[", "]", "string", "\n", "for", "_", ",", "value", ":=", "range", "commandsTree", ".", "PrefixMatch", "(", "command", ")", "{", "closestCommands...
// findClosestCommands to match a given string with commands trie tree.
[ "findClosestCommands", "to", "match", "a", "given", "string", "with", "commands", "trie", "tree", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/main.go#L250-L267
train
minio/mc
cmd/pretty-table.go
newPrettyTable
func newPrettyTable(separator string, cols ...Field) PrettyTable { return PrettyTable{ cols: cols, separator: separator, } }
go
func newPrettyTable(separator string, cols ...Field) PrettyTable { return PrettyTable{ cols: cols, separator: separator, } }
[ "func", "newPrettyTable", "(", "separator", "string", ",", "cols", "...", "Field", ")", "PrettyTable", "{", "return", "PrettyTable", "{", "cols", ":", "cols", ",", "separator", ":", "separator", ",", "}", "\n", "}" ]
// newPrettyTable - creates a new pretty table
[ "newPrettyTable", "-", "creates", "a", "new", "pretty", "table" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/pretty-table.go#L38-L43
train
minio/mc
cmd/pretty-table.go
buildRow
func (t PrettyTable) buildRow(contents ...string) (line string) { dots := "..." // totalColumns is the minimum of the number of fields config // and the number of contents elements. totalColumns := len(contents) if len(t.cols) < totalColumns { totalColumns = len(t.cols) } // Format fields and construct messa...
go
func (t PrettyTable) buildRow(contents ...string) (line string) { dots := "..." // totalColumns is the minimum of the number of fields config // and the number of contents elements. totalColumns := len(contents) if len(t.cols) < totalColumns { totalColumns = len(t.cols) } // Format fields and construct messa...
[ "func", "(", "t", "PrettyTable", ")", "buildRow", "(", "contents", "...", "string", ")", "(", "line", "string", ")", "{", "dots", ":=", "\"", "\"", "\n\n", "// totalColumns is the minimum of the number of fields config", "// and the number of contents elements.", "total...
// buildRow - creates a string which represents a line table given // some fields contents.
[ "buildRow", "-", "creates", "a", "string", "which", "represents", "a", "line", "table", "given", "some", "fields", "contents", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/pretty-table.go#L47-L84
train
minio/mc
cmd/session-migrate.go
migrateSessionV7ToV8
func migrateSessionV7ToV8() { for _, sid := range getSessionIDs() { sV7, err := loadSessionV7(sid) if err != nil { if os.IsNotExist(err.ToGoError()) { continue } fatalIf(err.Trace(sid), "Unable to load version `7`. Migration failed please report this issue at https://github.com/minio/mc/issues.") } ...
go
func migrateSessionV7ToV8() { for _, sid := range getSessionIDs() { sV7, err := loadSessionV7(sid) if err != nil { if os.IsNotExist(err.ToGoError()) { continue } fatalIf(err.Trace(sid), "Unable to load version `7`. Migration failed please report this issue at https://github.com/minio/mc/issues.") } ...
[ "func", "migrateSessionV7ToV8", "(", ")", "{", "for", "_", ",", "sid", ":=", "range", "getSessionIDs", "(", ")", "{", "sV7", ",", "err", ":=", "loadSessionV7", "(", "sid", ")", "\n", "if", "err", "!=", "nil", "{", "if", "os", ".", "IsNotExist", "(", ...
// Migrates session header version '7' to '8'. The only // change was the adding of insecure global flag
[ "Migrates", "session", "header", "version", "7", "to", "8", ".", "The", "only", "change", "was", "the", "adding", "of", "insecure", "global", "flag" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session-migrate.go#L30-L81
train
minio/mc
cmd/session-migrate.go
migrateSessionV6ToV7
func migrateSessionV6ToV7() { for _, sid := range getSessionIDs() { sV6Header, err := loadSessionV6Header(sid) if err != nil { if os.IsNotExist(err.ToGoError()) { continue } fatalIf(err.Trace(sid), "Unable to load version `6`. Migration failed please report this issue at https://github.com/minio/mc/is...
go
func migrateSessionV6ToV7() { for _, sid := range getSessionIDs() { sV6Header, err := loadSessionV6Header(sid) if err != nil { if os.IsNotExist(err.ToGoError()) { continue } fatalIf(err.Trace(sid), "Unable to load version `6`. Migration failed please report this issue at https://github.com/minio/mc/is...
[ "func", "migrateSessionV6ToV7", "(", ")", "{", "for", "_", ",", "sid", ":=", "range", "getSessionIDs", "(", ")", "{", "sV6Header", ",", "err", ":=", "loadSessionV6Header", "(", "sid", ")", "\n", "if", "err", "!=", "nil", "{", "if", "os", ".", "IsNotExi...
// Migrates session header version '6' to '7'. Only change is // LastRemoved field which was added in version '7'.
[ "Migrates", "session", "header", "version", "6", "to", "7", ".", "Only", "change", "is", "LastRemoved", "field", "which", "was", "added", "in", "version", "7", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session-migrate.go#L85-L130
train
minio/mc
cmd/rm-main.go
mainRm
func mainRm(ctx *cli.Context) error { // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatalIf(err, "Unable to parse encryption keys.") // check 'rm' cli arguments. checkRmSyntax(ctx, encKeyDB) // rm specific flags. isIncomplete := ctx.Bool("incomplete") isRecursive := ctx.Bool("recursiv...
go
func mainRm(ctx *cli.Context) error { // Parse encryption keys per command. encKeyDB, err := getEncKeys(ctx) fatalIf(err, "Unable to parse encryption keys.") // check 'rm' cli arguments. checkRmSyntax(ctx, encKeyDB) // rm specific flags. isIncomplete := ctx.Bool("incomplete") isRecursive := ctx.Bool("recursiv...
[ "func", "mainRm", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "// Parse encryption keys per command.", "encKeyDB", ",", "err", ":=", "getEncKeys", "(", "ctx", ")", "\n", "fatalIf", "(", "err", ",", "\"", "\"", ")", "\n\n", "// check 'rm' cli a...
// main for rm command.
[ "main", "for", "rm", "command", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/rm-main.go#L315-L369
train
minio/mc
pkg/colorjson/indent.go
Compact
func Compact(dst *bytes.Buffer, src []byte) error { return compact(dst, src, false) }
go
func Compact(dst *bytes.Buffer, src []byte) error { return compact(dst, src, false) }
[ "func", "Compact", "(", "dst", "*", "bytes", ".", "Buffer", ",", "src", "[", "]", "byte", ")", "error", "{", "return", "compact", "(", "dst", ",", "src", ",", "false", ")", "\n", "}" ]
// Compact appends to dst the JSON-encoded src with // insignificant space characters elided.
[ "Compact", "appends", "to", "dst", "the", "JSON", "-", "encoded", "src", "with", "insignificant", "space", "characters", "elided", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/pkg/colorjson/indent.go#L23-L25
train
minio/mc
cmd/cp-url-syntax.go
checkCopySyntaxTypeA
func checkCopySyntaxTypeA(srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair) { // Check source. if len(srcURLs) != 1 { fatalIf(errInvalidArgument().Trace(), "Invalid number of source arguments.") } srcURL := srcURLs[0] _, srcContent, err := url2Stat(srcURL, false, keys) fatalIf(err.Trace(srcURL),...
go
func checkCopySyntaxTypeA(srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair) { // Check source. if len(srcURLs) != 1 { fatalIf(errInvalidArgument().Trace(), "Invalid number of source arguments.") } srcURL := srcURLs[0] _, srcContent, err := url2Stat(srcURL, false, keys) fatalIf(err.Trace(srcURL),...
[ "func", "checkCopySyntaxTypeA", "(", "srcURLs", "[", "]", "string", ",", "tgtURL", "string", ",", "keys", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "{", "// Check source.", "if", "len", "(", "srcURLs", ")", "!=", "1", "{", "fatalIf", "("...
// checkCopySyntaxTypeA verifies if the source and target are valid file arguments.
[ "checkCopySyntaxTypeA", "verifies", "if", "the", "source", "and", "target", "are", "valid", "file", "arguments", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/cp-url-syntax.go#L78-L90
train
minio/mc
cmd/cp-url-syntax.go
checkCopySyntaxTypeB
func checkCopySyntaxTypeB(srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair) { // Check source. if len(srcURLs) != 1 { fatalIf(errInvalidArgument().Trace(), "Invalid number of source arguments.") } srcURL := srcURLs[0] _, srcContent, err := url2Stat(srcURL, false, keys) fatalIf(err.Trace(srcURL),...
go
func checkCopySyntaxTypeB(srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair) { // Check source. if len(srcURLs) != 1 { fatalIf(errInvalidArgument().Trace(), "Invalid number of source arguments.") } srcURL := srcURLs[0] _, srcContent, err := url2Stat(srcURL, false, keys) fatalIf(err.Trace(srcURL),...
[ "func", "checkCopySyntaxTypeB", "(", "srcURLs", "[", "]", "string", ",", "tgtURL", "string", ",", "keys", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "{", "// Check source.", "if", "len", "(", "srcURLs", ")", "!=", "1", "{", "fatalIf", "("...
// checkCopySyntaxTypeB verifies if the source is a valid file and target is a valid folder.
[ "checkCopySyntaxTypeB", "verifies", "if", "the", "source", "is", "a", "valid", "file", "and", "target", "is", "a", "valid", "folder", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/cp-url-syntax.go#L93-L112
train
minio/mc
cmd/cp-url-syntax.go
checkCopySyntaxTypeC
func checkCopySyntaxTypeC(srcURLs []string, tgtURL string, isRecursive bool, keys map[string][]prefixSSEPair) { // Check source. if len(srcURLs) != 1 { fatalIf(errInvalidArgument().Trace(), "Invalid number of source arguments.") } // Check target. if _, tgtContent, err := url2Stat(tgtURL, false, keys); err == n...
go
func checkCopySyntaxTypeC(srcURLs []string, tgtURL string, isRecursive bool, keys map[string][]prefixSSEPair) { // Check source. if len(srcURLs) != 1 { fatalIf(errInvalidArgument().Trace(), "Invalid number of source arguments.") } // Check target. if _, tgtContent, err := url2Stat(tgtURL, false, keys); err == n...
[ "func", "checkCopySyntaxTypeC", "(", "srcURLs", "[", "]", "string", ",", "tgtURL", "string", ",", "isRecursive", "bool", ",", "keys", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "{", "// Check source.", "if", "len", "(", "srcURLs", ")", "!="...
// checkCopySyntaxTypeC verifies if the source is a valid recursive dir and target is a valid folder.
[ "checkCopySyntaxTypeC", "verifies", "if", "the", "source", "is", "a", "valid", "recursive", "dir", "and", "target", "is", "a", "valid", "folder", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/cp-url-syntax.go#L115-L153
train
minio/mc
cmd/cp-url-syntax.go
checkCopySyntaxTypeD
func checkCopySyntaxTypeD(srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair) { // 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.Type.IsDir() { fatalIf(errInvalidArgument().Trace(tgtURL),...
go
func checkCopySyntaxTypeD(srcURLs []string, tgtURL string, keys map[string][]prefixSSEPair) { // 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.Type.IsDir() { fatalIf(errInvalidArgument().Trace(tgtURL),...
[ "func", "checkCopySyntaxTypeD", "(", "srcURLs", "[", "]", "string", ",", "tgtURL", "string", ",", "keys", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "{", "// Source can be anything: file, dir, dir...", "// Check target if it is a dir", "if", "_", ","...
// checkCopySyntaxTypeD verifies if the source is a valid list of files and target is a valid folder.
[ "checkCopySyntaxTypeD", "verifies", "if", "the", "source", "is", "a", "valid", "list", "of", "files", "and", "target", "is", "a", "valid", "folder", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/cp-url-syntax.go#L156-L164
train
minio/mc
cmd/stat-main.go
checkStatSyntax
func checkStatSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) { if !ctx.Args().Present() { cli.ShowCommandHelpAndExit(ctx, "stat", 1) // last argument is exit code } args := ctx.Args() for _, arg := range args { if strings.TrimSpace(arg) == "" { fatalIf(errInvalidArgument().Trace(args...), "Un...
go
func checkStatSyntax(ctx *cli.Context, encKeyDB map[string][]prefixSSEPair) { if !ctx.Args().Present() { cli.ShowCommandHelpAndExit(ctx, "stat", 1) // last argument is exit code } args := ctx.Args() for _, arg := range args { if strings.TrimSpace(arg) == "" { fatalIf(errInvalidArgument().Trace(args...), "Un...
[ "func", "checkStatSyntax", "(", "ctx", "*", "cli", ".", "Context", ",", "encKeyDB", "map", "[", "string", "]", "[", "]", "prefixSSEPair", ")", "{", "if", "!", "ctx", ".", "Args", "(", ")", ".", "Present", "(", ")", "{", "cli", ".", "ShowCommandHelpAn...
// checkStatSyntax - validate all the passed arguments
[ "checkStatSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/stat-main.go#L72-L93
train
minio/mc
cmd/stat-main.go
mainStat
func mainStat(ctx *cli.Context) error { // Additional command specific theme customization. console.SetColor("Name", color.New(color.Bold, color.FgCyan)) console.SetColor("Date", color.New(color.FgWhite)) console.SetColor("Size", color.New(color.FgWhite)) console.SetColor("ETag", color.New(color.FgWhite)) consol...
go
func mainStat(ctx *cli.Context) error { // Additional command specific theme customization. console.SetColor("Name", color.New(color.Bold, color.FgCyan)) console.SetColor("Date", color.New(color.FgWhite)) console.SetColor("Size", color.New(color.FgWhite)) console.SetColor("ETag", color.New(color.FgWhite)) consol...
[ "func", "mainStat", "(", "ctx", "*", "cli", ".", "Context", ")", "error", "{", "// Additional command specific theme customization.", "console", ".", "SetColor", "(", "\"", "\"", ",", "color", ".", "New", "(", "color", ".", "Bold", ",", "color", ".", "FgCyan...
// mainStat - is a handler for mc stat command
[ "mainStat", "-", "is", "a", "handler", "for", "mc", "stat", "command" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/stat-main.go#L96-L139
train
minio/mc
cmd/scan-bar.go
fixateScanBar
func fixateScanBar(text string, width int) string { if len([]rune(text)) > width { // Trim text to fit within the screen trimSize := len([]rune(text)) - width + 3 //"..." if trimSize < len([]rune(text)) { text = "..." + text[trimSize:] } } else { text += strings.Repeat(" ", width-len([]rune(text))) } r...
go
func fixateScanBar(text string, width int) string { if len([]rune(text)) > width { // Trim text to fit within the screen trimSize := len([]rune(text)) - width + 3 //"..." if trimSize < len([]rune(text)) { text = "..." + text[trimSize:] } } else { text += strings.Repeat(" ", width-len([]rune(text))) } r...
[ "func", "fixateScanBar", "(", "text", "string", ",", "width", "int", ")", "string", "{", "if", "len", "(", "[", "]", "rune", "(", "text", ")", ")", ">", "width", "{", "// Trim text to fit within the screen", "trimSize", ":=", "len", "(", "[", "]", "rune"...
// fixateScanBar truncates or stretches text to fit within the terminal size.
[ "fixateScanBar", "truncates", "or", "stretches", "text", "to", "fit", "within", "the", "terminal", "size", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/scan-bar.go#L28-L39
train
minio/mc
cmd/scan-bar.go
scanBarFactory
func scanBarFactory() scanBarFunc { fileCount := 0 // Cursor animate channel. cursorCh := cursorAnimate() return func(source string) { scanPrefix := fmt.Sprintf("[%s] %s ", humanize.Comma(int64(fileCount)), <-cursorCh) source = fixateScanBar(source, globalTermWidth-len([]rune(scanPrefix))) barText := scanPre...
go
func scanBarFactory() scanBarFunc { fileCount := 0 // Cursor animate channel. cursorCh := cursorAnimate() return func(source string) { scanPrefix := fmt.Sprintf("[%s] %s ", humanize.Comma(int64(fileCount)), <-cursorCh) source = fixateScanBar(source, globalTermWidth-len([]rune(scanPrefix))) barText := scanPre...
[ "func", "scanBarFactory", "(", ")", "scanBarFunc", "{", "fileCount", ":=", "0", "\n\n", "// Cursor animate channel.", "cursorCh", ":=", "cursorAnimate", "(", ")", "\n", "return", "func", "(", "source", "string", ")", "{", "scanPrefix", ":=", "fmt", ".", "Sprin...
// scanBarFactory returns a progress bar function to report URL scanning.
[ "scanBarFactory", "returns", "a", "progress", "bar", "function", "to", "report", "URL", "scanning", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/scan-bar.go#L45-L57
train
minio/mc
cmd/session.go
createSessionDir
func createSessionDir() *probe.Error { sessionDir, err := getSessionDir() if err != nil { return err.Trace() } if e := os.MkdirAll(sessionDir, 0700); e != nil { return probe.NewError(e) } return nil }
go
func createSessionDir() *probe.Error { sessionDir, err := getSessionDir() if err != nil { return err.Trace() } if e := os.MkdirAll(sessionDir, 0700); e != nil { return probe.NewError(e) } return nil }
[ "func", "createSessionDir", "(", ")", "*", "probe", ".", "Error", "{", "sessionDir", ",", "err", ":=", "getSessionDir", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", ".", "Trace", "(", ")", "\n", "}", "\n\n", "if", "e", ":=", "os"...
// createSessionDir - create session directory.
[ "createSessionDir", "-", "create", "session", "directory", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session.go#L40-L50
train
minio/mc
cmd/session.go
getSessionDir
func getSessionDir() (string, *probe.Error) { configDir, err := getMcConfigDir() if err != nil { return "", err.Trace() } sessionDir := filepath.Join(configDir, globalSessionDir) return sessionDir, nil }
go
func getSessionDir() (string, *probe.Error) { configDir, err := getMcConfigDir() if err != nil { return "", err.Trace() } sessionDir := filepath.Join(configDir, globalSessionDir) return sessionDir, nil }
[ "func", "getSessionDir", "(", ")", "(", "string", ",", "*", "probe", ".", "Error", ")", "{", "configDir", ",", "err", ":=", "getMcConfigDir", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", ".", "Trace", "(", ")", ...
// getSessionDir - get session directory.
[ "getSessionDir", "-", "get", "session", "directory", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session.go#L53-L61
train
minio/mc
cmd/session.go
isSessionDirExists
func isSessionDirExists() bool { sessionDir, err := getSessionDir() fatalIf(err.Trace(), "Unable to determine session folder.") if _, e := os.Stat(sessionDir); e != nil { return false } return true }
go
func isSessionDirExists() bool { sessionDir, err := getSessionDir() fatalIf(err.Trace(), "Unable to determine session folder.") if _, e := os.Stat(sessionDir); e != nil { return false } return true }
[ "func", "isSessionDirExists", "(", ")", "bool", "{", "sessionDir", ",", "err", ":=", "getSessionDir", "(", ")", "\n", "fatalIf", "(", "err", ".", "Trace", "(", ")", ",", "\"", "\"", ")", "\n\n", "if", "_", ",", "e", ":=", "os", ".", "Stat", "(", ...
// isSessionDirExists - verify if session directory exists.
[ "isSessionDirExists", "-", "verify", "if", "session", "directory", "exists", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session.go#L64-L72
train
minio/mc
cmd/session.go
getSessionFile
func getSessionFile(sid string) (string, *probe.Error) { sessionDir, err := getSessionDir() if err != nil { return "", err.Trace() } sessionFile := filepath.Join(sessionDir, sid+".json") return sessionFile, nil }
go
func getSessionFile(sid string) (string, *probe.Error) { sessionDir, err := getSessionDir() if err != nil { return "", err.Trace() } sessionFile := filepath.Join(sessionDir, sid+".json") return sessionFile, nil }
[ "func", "getSessionFile", "(", "sid", "string", ")", "(", "string", ",", "*", "probe", ".", "Error", ")", "{", "sessionDir", ",", "err", ":=", "getSessionDir", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", ".", "T...
// getSessionFile - get current session file.
[ "getSessionFile", "-", "get", "current", "session", "file", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session.go#L75-L83
train
minio/mc
cmd/session.go
isSessionExists
func isSessionExists(sid string) bool { sessionFile, err := getSessionFile(sid) fatalIf(err.Trace(sid), "Unable to determine session filename for `"+sid+"`.") if _, e := os.Stat(sessionFile); e != nil { return false } return true // Session exists. }
go
func isSessionExists(sid string) bool { sessionFile, err := getSessionFile(sid) fatalIf(err.Trace(sid), "Unable to determine session filename for `"+sid+"`.") if _, e := os.Stat(sessionFile); e != nil { return false } return true // Session exists. }
[ "func", "isSessionExists", "(", "sid", "string", ")", "bool", "{", "sessionFile", ",", "err", ":=", "getSessionFile", "(", "sid", ")", "\n", "fatalIf", "(", "err", ".", "Trace", "(", "sid", ")", ",", "\"", "\"", "+", "sid", "+", "\"", "\"", ")", "\...
// isSessionExists verifies if given session exists.
[ "isSessionExists", "verifies", "if", "given", "session", "exists", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session.go#L86-L95
train
minio/mc
cmd/session.go
getSessionDataFile
func getSessionDataFile(sid string) (string, *probe.Error) { sessionDir, err := getSessionDir() if err != nil { return "", err.Trace() } sessionDataFile := filepath.Join(sessionDir, sid+".data") return sessionDataFile, nil }
go
func getSessionDataFile(sid string) (string, *probe.Error) { sessionDir, err := getSessionDir() if err != nil { return "", err.Trace() } sessionDataFile := filepath.Join(sessionDir, sid+".data") return sessionDataFile, nil }
[ "func", "getSessionDataFile", "(", "sid", "string", ")", "(", "string", ",", "*", "probe", ".", "Error", ")", "{", "sessionDir", ",", "err", ":=", "getSessionDir", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", ".", ...
// getSessionDataFile - get session data file for a given session.
[ "getSessionDataFile", "-", "get", "session", "data", "file", "for", "a", "given", "session", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session.go#L98-L106
train
minio/mc
cmd/session.go
getSessionIDs
func getSessionIDs() (sids []string) { sessionDir, err := getSessionDir() fatalIf(err.Trace(), "Unable to access session folder.") sessionList, e := filepath.Glob(sessionDir + "/*.json") fatalIf(probe.NewError(e), "Unable to access session folder `"+sessionDir+"`.") for _, path := range sessionList { sids = ap...
go
func getSessionIDs() (sids []string) { sessionDir, err := getSessionDir() fatalIf(err.Trace(), "Unable to access session folder.") sessionList, e := filepath.Glob(sessionDir + "/*.json") fatalIf(probe.NewError(e), "Unable to access session folder `"+sessionDir+"`.") for _, path := range sessionList { sids = ap...
[ "func", "getSessionIDs", "(", ")", "(", "sids", "[", "]", "string", ")", "{", "sessionDir", ",", "err", ":=", "getSessionDir", "(", ")", "\n", "fatalIf", "(", "err", ".", "Trace", "(", ")", ",", "\"", "\"", ")", "\n\n", "sessionList", ",", "e", ":=...
// getSessionIDs - get all active sessions.
[ "getSessionIDs", "-", "get", "all", "active", "sessions", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session.go#L109-L120
train
minio/mc
cmd/session.go
removeSessionFile
func removeSessionFile(sid string) { sessionFile, err := getSessionFile(sid) if err != nil { return } os.Remove(sessionFile) }
go
func removeSessionFile(sid string) { sessionFile, err := getSessionFile(sid) if err != nil { return } os.Remove(sessionFile) }
[ "func", "removeSessionFile", "(", "sid", "string", ")", "{", "sessionFile", ",", "err", ":=", "getSessionFile", "(", "sid", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "os", ".", "Remove", "(", "sessionFile", ")", "\n", "}" ]
// removeSessionFile - remove the session file, ending with .json
[ "removeSessionFile", "-", "remove", "the", "session", "file", "ending", "with", ".", "json" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session.go#L123-L129
train
minio/mc
cmd/session.go
removeSessionDataFile
func removeSessionDataFile(sid string) { dataFile, err := getSessionDataFile(sid) if err != nil { return } os.Remove(dataFile) }
go
func removeSessionDataFile(sid string) { dataFile, err := getSessionDataFile(sid) if err != nil { return } os.Remove(dataFile) }
[ "func", "removeSessionDataFile", "(", "sid", "string", ")", "{", "dataFile", ",", "err", ":=", "getSessionDataFile", "(", "sid", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "os", ".", "Remove", "(", "dataFile", ")", "\n", "}" ]
// removeSessionDataFile - remove the session data file, ending with .data
[ "removeSessionDataFile", "-", "remove", "the", "session", "data", "file", "ending", "with", ".", "data" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/session.go#L132-L138
train
minio/mc
cmd/runtime-checks.go
checkGoVersion
func checkGoVersion() { runtimeVersion := runtime.Version() // Checking version is always successful with go tip if strings.HasPrefix(runtimeVersion, "devel") { return } // Parsing golang version curVersion, e := version.NewVersion(runtimeVersion[2:]) if e != nil { console.Fatalln("Unable to determine curr...
go
func checkGoVersion() { runtimeVersion := runtime.Version() // Checking version is always successful with go tip if strings.HasPrefix(runtimeVersion, "devel") { return } // Parsing golang version curVersion, e := version.NewVersion(runtimeVersion[2:]) if e != nil { console.Fatalln("Unable to determine curr...
[ "func", "checkGoVersion", "(", ")", "{", "runtimeVersion", ":=", "runtime", ".", "Version", "(", ")", "\n\n", "// Checking version is always successful with go tip", "if", "strings", ".", "HasPrefix", "(", "runtimeVersion", ",", "\"", "\"", ")", "{", "return", "\n...
// check if minimum Go version is met.
[ "check", "if", "minimum", "Go", "version", "is", "met", "." ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/runtime-checks.go#L29-L53
train
minio/mc
cmd/admin-user-enable.go
checkAdminUserEnableSyntax
func checkAdminUserEnableSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { cli.ShowCommandHelpAndExit(ctx, "enable", 1) // last argument is exit code } }
go
func checkAdminUserEnableSyntax(ctx *cli.Context) { if len(ctx.Args()) != 2 { cli.ShowCommandHelpAndExit(ctx, "enable", 1) // last argument is exit code } }
[ "func", "checkAdminUserEnableSyntax", "(", "ctx", "*", "cli", ".", "Context", ")", "{", "if", "len", "(", "ctx", ".", "Args", "(", ")", ")", "!=", "2", "{", "cli", ".", "ShowCommandHelpAndExit", "(", "ctx", ",", "\"", "\"", ",", "1", ")", "// last ar...
// checkAdminUserEnableSyntax - validate all the passed arguments
[ "checkAdminUserEnableSyntax", "-", "validate", "all", "the", "passed", "arguments" ]
f0f156aca82e451c80b05d5be8eb01a04fee29dd
https://github.com/minio/mc/blob/f0f156aca82e451c80b05d5be8eb01a04fee29dd/cmd/admin-user-enable.go#L49-L53
train