id int32 0 167k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
125,400 | minio/minio | pkg/iam/policy/statement.go | UnmarshalJSON | func (statement *Statement) UnmarshalJSON(data []byte) error {
// subtype to avoid recursive call to UnmarshalJSON()
type subStatement Statement
var ss subStatement
if err := json.Unmarshal(data, &ss); err != nil {
return err
}
s := Statement(ss)
if err := s.isValid(); err != nil {
return err
}
*stateme... | go | func (statement *Statement) UnmarshalJSON(data []byte) error {
// subtype to avoid recursive call to UnmarshalJSON()
type subStatement Statement
var ss subStatement
if err := json.Unmarshal(data, &ss); err != nil {
return err
}
s := Statement(ss)
if err := s.isValid(); err != nil {
return err
}
*stateme... | [
"func",
"(",
"statement",
"*",
"Statement",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"// subtype to avoid recursive call to UnmarshalJSON()",
"type",
"subStatement",
"Statement",
"\n",
"var",
"ss",
"subStatement",
"\n\n",
"if",
"err",
... | // UnmarshalJSON - decodes JSON data to Statement. | [
"UnmarshalJSON",
"-",
"decodes",
"JSON",
"data",
"to",
"Statement",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/iam/policy/statement.go#L111-L128 |
125,401 | minio/minio | pkg/lock/lock_solaris.go | Open | func Open(path string, flag int, perm os.FileMode) (*os.File, error) {
return os.OpenFile(path, flag, perm)
} | go | func Open(path string, flag int, perm os.FileMode) (*os.File, error) {
return os.OpenFile(path, flag, perm)
} | [
"func",
"Open",
"(",
"path",
"string",
",",
"flag",
"int",
",",
"perm",
"os",
".",
"FileMode",
")",
"(",
"*",
"os",
".",
"File",
",",
"error",
")",
"{",
"return",
"os",
".",
"OpenFile",
"(",
"path",
",",
"flag",
",",
"perm",
")",
"\n",
"}"
] | // Open - Call os.OpenFile | [
"Open",
"-",
"Call",
"os",
".",
"OpenFile"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/lock/lock_solaris.go#L103-L105 |
125,402 | minio/minio | pkg/policy/action.go | isObjectAction | func (action Action) isObjectAction() bool {
switch action {
case AbortMultipartUploadAction, DeleteObjectAction, GetObjectAction:
fallthrough
case ListMultipartUploadPartsAction, PutObjectAction:
return true
}
return false
} | go | func (action Action) isObjectAction() bool {
switch action {
case AbortMultipartUploadAction, DeleteObjectAction, GetObjectAction:
fallthrough
case ListMultipartUploadPartsAction, PutObjectAction:
return true
}
return false
} | [
"func",
"(",
"action",
"Action",
")",
"isObjectAction",
"(",
")",
"bool",
"{",
"switch",
"action",
"{",
"case",
"AbortMultipartUploadAction",
",",
"DeleteObjectAction",
",",
"GetObjectAction",
":",
"fallthrough",
"\n",
"case",
"ListMultipartUploadPartsAction",
",",
... | // isObjectAction - returns whether action is object type or not. | [
"isObjectAction",
"-",
"returns",
"whether",
"action",
"is",
"object",
"type",
"or",
"not",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/action.go#L89-L98 |
125,403 | minio/minio | pkg/policy/action.go | IsValid | func (action Action) IsValid() bool {
switch action {
case AbortMultipartUploadAction, CreateBucketAction, DeleteBucketAction:
fallthrough
case DeleteBucketPolicyAction, DeleteObjectAction, GetBucketLocationAction:
fallthrough
case GetBucketNotificationAction, GetBucketPolicyAction, GetObjectAction:
fallthrou... | go | func (action Action) IsValid() bool {
switch action {
case AbortMultipartUploadAction, CreateBucketAction, DeleteBucketAction:
fallthrough
case DeleteBucketPolicyAction, DeleteObjectAction, GetBucketLocationAction:
fallthrough
case GetBucketNotificationAction, GetBucketPolicyAction, GetObjectAction:
fallthrou... | [
"func",
"(",
"action",
"Action",
")",
"IsValid",
"(",
")",
"bool",
"{",
"switch",
"action",
"{",
"case",
"AbortMultipartUploadAction",
",",
"CreateBucketAction",
",",
"DeleteBucketAction",
":",
"fallthrough",
"\n",
"case",
"DeleteBucketPolicyAction",
",",
"DeleteObj... | // IsValid - checks if action is valid or not. | [
"IsValid",
"-",
"checks",
"if",
"action",
"is",
"valid",
"or",
"not",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/action.go#L101-L120 |
125,404 | minio/minio | pkg/policy/action.go | MarshalJSON | func (action Action) MarshalJSON() ([]byte, error) {
if action.IsValid() {
return json.Marshal(string(action))
}
return nil, fmt.Errorf("invalid action '%v'", action)
} | go | func (action Action) MarshalJSON() ([]byte, error) {
if action.IsValid() {
return json.Marshal(string(action))
}
return nil, fmt.Errorf("invalid action '%v'", action)
} | [
"func",
"(",
"action",
"Action",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"action",
".",
"IsValid",
"(",
")",
"{",
"return",
"json",
".",
"Marshal",
"(",
"string",
"(",
"action",
")",
")",
"\n",
"}",
"\n\... | // MarshalJSON - encodes Action to JSON data. | [
"MarshalJSON",
"-",
"encodes",
"Action",
"to",
"JSON",
"data",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/action.go#L123-L129 |
125,405 | minio/minio | pkg/policy/action.go | UnmarshalJSON | func (action *Action) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return err
}
a := Action(s)
if !a.IsValid() {
return fmt.Errorf("invalid action '%v'", s)
}
*action = a
return nil
} | go | func (action *Action) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return err
}
a := Action(s)
if !a.IsValid() {
return fmt.Errorf("invalid action '%v'", s)
}
*action = a
return nil
} | [
"func",
"(",
"action",
"*",
"Action",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"s",
"string",
"\n\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"s",
")",
";",
"err",
"!=",
"nil",
"{"... | // UnmarshalJSON - decodes JSON data to Action. | [
"UnmarshalJSON",
"-",
"decodes",
"JSON",
"data",
"to",
"Action",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/action.go#L132-L147 |
125,406 | minio/minio | cmd/api-errors.go | toAPIError | func toAPIError(ctx context.Context, err error) APIError {
if err == nil {
return noError
}
var apiErr = errorCodes.ToAPIErr(toAPIErrorCode(ctx, err))
if apiErr.Code == "InternalError" {
// If we see an internal error try to interpret
// any underlying errors if possible depending on
// their internal erro... | go | func toAPIError(ctx context.Context, err error) APIError {
if err == nil {
return noError
}
var apiErr = errorCodes.ToAPIErr(toAPIErrorCode(ctx, err))
if apiErr.Code == "InternalError" {
// If we see an internal error try to interpret
// any underlying errors if possible depending on
// their internal erro... | [
"func",
"toAPIError",
"(",
"ctx",
"context",
".",
"Context",
",",
"err",
"error",
")",
"APIError",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"noError",
"\n",
"}",
"\n\n",
"var",
"apiErr",
"=",
"errorCodes",
".",
"ToAPIErr",
"(",
"toAPIErrorCode",
"("... | // toAPIError - Converts embedded errors. Convenience
// function written to handle all cases where we have known types of
// errors returned by underlying layers. | [
"toAPIError",
"-",
"Converts",
"embedded",
"errors",
".",
"Convenience",
"function",
"written",
"to",
"handle",
"all",
"cases",
"where",
"we",
"have",
"known",
"types",
"of",
"errors",
"returned",
"by",
"underlying",
"layers",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/api-errors.go#L1681-L1728 |
125,407 | minio/minio | cmd/api-errors.go | getAPIError | func getAPIError(code APIErrorCode) APIError {
if apiErr, ok := errorCodes[code]; ok {
return apiErr
}
return errorCodes.ToAPIErr(ErrInternalError)
} | go | func getAPIError(code APIErrorCode) APIError {
if apiErr, ok := errorCodes[code]; ok {
return apiErr
}
return errorCodes.ToAPIErr(ErrInternalError)
} | [
"func",
"getAPIError",
"(",
"code",
"APIErrorCode",
")",
"APIError",
"{",
"if",
"apiErr",
",",
"ok",
":=",
"errorCodes",
"[",
"code",
"]",
";",
"ok",
"{",
"return",
"apiErr",
"\n",
"}",
"\n",
"return",
"errorCodes",
".",
"ToAPIErr",
"(",
"ErrInternalError"... | // getAPIError provides API Error for input API error code. | [
"getAPIError",
"provides",
"API",
"Error",
"for",
"input",
"API",
"error",
"code",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/api-errors.go#L1731-L1736 |
125,408 | minio/minio | cmd/api-errors.go | getAPIErrorResponse | func getAPIErrorResponse(ctx context.Context, err APIError, resource, requestID, hostID string) APIErrorResponse {
reqInfo := logger.GetReqInfo(ctx)
return APIErrorResponse{
Code: err.Code,
Message: err.Description,
BucketName: reqInfo.BucketName,
Key: reqInfo.ObjectName,
Resource: resourc... | go | func getAPIErrorResponse(ctx context.Context, err APIError, resource, requestID, hostID string) APIErrorResponse {
reqInfo := logger.GetReqInfo(ctx)
return APIErrorResponse{
Code: err.Code,
Message: err.Description,
BucketName: reqInfo.BucketName,
Key: reqInfo.ObjectName,
Resource: resourc... | [
"func",
"getAPIErrorResponse",
"(",
"ctx",
"context",
".",
"Context",
",",
"err",
"APIError",
",",
"resource",
",",
"requestID",
",",
"hostID",
"string",
")",
"APIErrorResponse",
"{",
"reqInfo",
":=",
"logger",
".",
"GetReqInfo",
"(",
"ctx",
")",
"\n",
"retu... | // getErrorResponse gets in standard error and resource value and
// provides a encodable populated response values | [
"getErrorResponse",
"gets",
"in",
"standard",
"error",
"and",
"resource",
"value",
"and",
"provides",
"a",
"encodable",
"populated",
"response",
"values"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/api-errors.go#L1740-L1751 |
125,409 | minio/minio | cmd/net.go | mustGetLocalIP4 | func mustGetLocalIP4() (ipList set.StringSet) {
ipList = set.NewStringSet()
addrs, err := net.InterfaceAddrs()
logger.FatalIf(err, "Unable to get IP addresses of this host")
for _, addr := range addrs {
var ip net.IP
switch v := addr.(type) {
case *net.IPNet:
ip = v.IP
case *net.IPAddr:
ip = v.IP
}... | go | func mustGetLocalIP4() (ipList set.StringSet) {
ipList = set.NewStringSet()
addrs, err := net.InterfaceAddrs()
logger.FatalIf(err, "Unable to get IP addresses of this host")
for _, addr := range addrs {
var ip net.IP
switch v := addr.(type) {
case *net.IPNet:
ip = v.IP
case *net.IPAddr:
ip = v.IP
}... | [
"func",
"mustGetLocalIP4",
"(",
")",
"(",
"ipList",
"set",
".",
"StringSet",
")",
"{",
"ipList",
"=",
"set",
".",
"NewStringSet",
"(",
")",
"\n",
"addrs",
",",
"err",
":=",
"net",
".",
"InterfaceAddrs",
"(",
")",
"\n",
"logger",
".",
"FatalIf",
"(",
... | // mustGetLocalIP4 returns IPv4 addresses of localhost. It panics on error. | [
"mustGetLocalIP4",
"returns",
"IPv4",
"addresses",
"of",
"localhost",
".",
"It",
"panics",
"on",
"error",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/net.go#L52-L72 |
125,410 | minio/minio | cmd/net.go | getHostIP | func getHostIP(host string) (ipList set.StringSet, err error) {
var ips []net.IP
if ips, err = net.LookupIP(host); err != nil {
return ipList, err
}
ipList = set.NewStringSet()
for _, ip := range ips {
ipList.Add(ip.String())
}
return ipList, err
} | go | func getHostIP(host string) (ipList set.StringSet, err error) {
var ips []net.IP
if ips, err = net.LookupIP(host); err != nil {
return ipList, err
}
ipList = set.NewStringSet()
for _, ip := range ips {
ipList.Add(ip.String())
}
return ipList, err
} | [
"func",
"getHostIP",
"(",
"host",
"string",
")",
"(",
"ipList",
"set",
".",
"StringSet",
",",
"err",
"error",
")",
"{",
"var",
"ips",
"[",
"]",
"net",
".",
"IP",
"\n\n",
"if",
"ips",
",",
"err",
"=",
"net",
".",
"LookupIP",
"(",
"host",
")",
";",... | // getHostIP returns IP address of given host. | [
"getHostIP",
"returns",
"IP",
"address",
"of",
"given",
"host",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/net.go#L98-L111 |
125,411 | minio/minio | cmd/net.go | isHostIP | func isHostIP(ipAddress string) bool {
host, _, err := net.SplitHostPort(ipAddress)
if err != nil {
host = ipAddress
}
// Strip off IPv6 zone information.
if i := strings.Index(host, "%"); i > -1 {
host = host[:i]
}
return net.ParseIP(host) != nil
} | go | func isHostIP(ipAddress string) bool {
host, _, err := net.SplitHostPort(ipAddress)
if err != nil {
host = ipAddress
}
// Strip off IPv6 zone information.
if i := strings.Index(host, "%"); i > -1 {
host = host[:i]
}
return net.ParseIP(host) != nil
} | [
"func",
"isHostIP",
"(",
"ipAddress",
"string",
")",
"bool",
"{",
"host",
",",
"_",
",",
"err",
":=",
"net",
".",
"SplitHostPort",
"(",
"ipAddress",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"host",
"=",
"ipAddress",
"\n",
"}",
"\n",
"// Strip off IPv6... | // isHostIP - helper for validating if the provided arg is an ip address. | [
"isHostIP",
"-",
"helper",
"for",
"validating",
"if",
"the",
"provided",
"arg",
"is",
"an",
"ip",
"address",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/net.go#L181-L191 |
125,412 | minio/minio | cmd/net.go | isLocalHost | func isLocalHost(host string) (bool, error) {
hostIPs, err := getHostIP(host)
if err != nil {
return false, err
}
// If intersection of two IP sets is not empty, then the host is localhost.
isLocalv4 := !localIP4.Intersection(hostIPs).IsEmpty()
isLocalv6 := !localIP6.Intersection(hostIPs).IsEmpty()
return isL... | go | func isLocalHost(host string) (bool, error) {
hostIPs, err := getHostIP(host)
if err != nil {
return false, err
}
// If intersection of two IP sets is not empty, then the host is localhost.
isLocalv4 := !localIP4.Intersection(hostIPs).IsEmpty()
isLocalv6 := !localIP6.Intersection(hostIPs).IsEmpty()
return isL... | [
"func",
"isLocalHost",
"(",
"host",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"hostIPs",
",",
"err",
":=",
"getHostIP",
"(",
"host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"// If intersec... | // isLocalHost - checks if the given parameter
// correspond to one of the local IP of the
// current machine | [
"isLocalHost",
"-",
"checks",
"if",
"the",
"given",
"parameter",
"correspond",
"to",
"one",
"of",
"the",
"local",
"IP",
"of",
"the",
"current",
"machine"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/net.go#L288-L298 |
125,413 | minio/minio | cmd/net.go | CheckLocalServerAddr | func CheckLocalServerAddr(serverAddr string) error {
host, port, err := net.SplitHostPort(serverAddr)
if err != nil {
return uiErrInvalidAddressFlag(err)
}
// Strip off IPv6 zone information.
if i := strings.Index(host, "%"); i > -1 {
host = host[:i]
}
// Check whether port is a valid port number.
p, err ... | go | func CheckLocalServerAddr(serverAddr string) error {
host, port, err := net.SplitHostPort(serverAddr)
if err != nil {
return uiErrInvalidAddressFlag(err)
}
// Strip off IPv6 zone information.
if i := strings.Index(host, "%"); i > -1 {
host = host[:i]
}
// Check whether port is a valid port number.
p, err ... | [
"func",
"CheckLocalServerAddr",
"(",
"serverAddr",
"string",
")",
"error",
"{",
"host",
",",
"port",
",",
"err",
":=",
"net",
".",
"SplitHostPort",
"(",
"serverAddr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"uiErrInvalidAddressFlag",
"(",
"err",
... | // CheckLocalServerAddr - checks if serverAddr is valid and local host. | [
"CheckLocalServerAddr",
"-",
"checks",
"if",
"serverAddr",
"is",
"valid",
"and",
"local",
"host",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/net.go#L348-L381 |
125,414 | minio/minio | cmd/routers.go | registerDistXLRouters | func registerDistXLRouters(router *mux.Router, endpoints EndpointList) {
// Register storage rpc router only if its a distributed setup.
registerStorageRESTHandlers(router, endpoints)
// Register peer REST router only if its a distributed setup.
registerPeerRESTHandlers(router)
// Register distributed namespace ... | go | func registerDistXLRouters(router *mux.Router, endpoints EndpointList) {
// Register storage rpc router only if its a distributed setup.
registerStorageRESTHandlers(router, endpoints)
// Register peer REST router only if its a distributed setup.
registerPeerRESTHandlers(router)
// Register distributed namespace ... | [
"func",
"registerDistXLRouters",
"(",
"router",
"*",
"mux",
".",
"Router",
",",
"endpoints",
"EndpointList",
")",
"{",
"// Register storage rpc router only if its a distributed setup.",
"registerStorageRESTHandlers",
"(",
"router",
",",
"endpoints",
")",
"\n\n",
"// Registe... | // Composed function registering routers for only distributed XL setup. | [
"Composed",
"function",
"registering",
"routers",
"for",
"only",
"distributed",
"XL",
"setup",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/routers.go#L37-L47 |
125,415 | minio/minio | cmd/routers.go | configureServerHandler | func configureServerHandler(endpoints EndpointList) (http.Handler, error) {
// Initialize router. `SkipClean(true)` stops gorilla/mux from
// normalizing URL path minio/minio#3256
router := mux.NewRouter().SkipClean(true)
// Initialize distributed NS lock.
if globalIsDistXL {
registerDistXLRouters(router, endpo... | go | func configureServerHandler(endpoints EndpointList) (http.Handler, error) {
// Initialize router. `SkipClean(true)` stops gorilla/mux from
// normalizing URL path minio/minio#3256
router := mux.NewRouter().SkipClean(true)
// Initialize distributed NS lock.
if globalIsDistXL {
registerDistXLRouters(router, endpo... | [
"func",
"configureServerHandler",
"(",
"endpoints",
"EndpointList",
")",
"(",
"http",
".",
"Handler",
",",
"error",
")",
"{",
"// Initialize router. `SkipClean(true)` stops gorilla/mux from",
"// normalizing URL path minio/minio#3256",
"router",
":=",
"mux",
".",
"NewRouter",... | // configureServer handler returns final handler for the http server. | [
"configureServer",
"handler",
"returns",
"final",
"handler",
"for",
"the",
"http",
"server",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/routers.go#L93-L127 |
125,416 | minio/minio | pkg/policy/condition/ipaddressfunc.go | newIPAddressFunc | func newIPAddressFunc(key Key, values ValueSet) (Function, error) {
IPNets, err := valuesToIPNets(ipAddress, values)
if err != nil {
return nil, err
}
return NewIPAddressFunc(key, IPNets...)
} | go | func newIPAddressFunc(key Key, values ValueSet) (Function, error) {
IPNets, err := valuesToIPNets(ipAddress, values)
if err != nil {
return nil, err
}
return NewIPAddressFunc(key, IPNets...)
} | [
"func",
"newIPAddressFunc",
"(",
"key",
"Key",
",",
"values",
"ValueSet",
")",
"(",
"Function",
",",
"error",
")",
"{",
"IPNets",
",",
"err",
":=",
"valuesToIPNets",
"(",
"ipAddress",
",",
"values",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"... | // newIPAddressFunc - returns new IP address function. | [
"newIPAddressFunc",
"-",
"returns",
"new",
"IP",
"address",
"function",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/condition/ipaddressfunc.go#L151-L158 |
125,417 | minio/minio | pkg/policy/condition/ipaddressfunc.go | NewIPAddressFunc | func NewIPAddressFunc(key Key, IPNets ...*net.IPNet) (Function, error) {
if key != AWSSourceIP {
return nil, fmt.Errorf("only %v key is allowed for %v condition", AWSSourceIP, ipAddress)
}
return &ipAddressFunc{key, IPNets}, nil
} | go | func NewIPAddressFunc(key Key, IPNets ...*net.IPNet) (Function, error) {
if key != AWSSourceIP {
return nil, fmt.Errorf("only %v key is allowed for %v condition", AWSSourceIP, ipAddress)
}
return &ipAddressFunc{key, IPNets}, nil
} | [
"func",
"NewIPAddressFunc",
"(",
"key",
"Key",
",",
"IPNets",
"...",
"*",
"net",
".",
"IPNet",
")",
"(",
"Function",
",",
"error",
")",
"{",
"if",
"key",
"!=",
"AWSSourceIP",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"A... | // NewIPAddressFunc - returns new IP address function. | [
"NewIPAddressFunc",
"-",
"returns",
"new",
"IP",
"address",
"function",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/condition/ipaddressfunc.go#L161-L167 |
125,418 | minio/minio | pkg/policy/condition/ipaddressfunc.go | newNotIPAddressFunc | func newNotIPAddressFunc(key Key, values ValueSet) (Function, error) {
IPNets, err := valuesToIPNets(notIPAddress, values)
if err != nil {
return nil, err
}
return NewNotIPAddressFunc(key, IPNets...)
} | go | func newNotIPAddressFunc(key Key, values ValueSet) (Function, error) {
IPNets, err := valuesToIPNets(notIPAddress, values)
if err != nil {
return nil, err
}
return NewNotIPAddressFunc(key, IPNets...)
} | [
"func",
"newNotIPAddressFunc",
"(",
"key",
"Key",
",",
"values",
"ValueSet",
")",
"(",
"Function",
",",
"error",
")",
"{",
"IPNets",
",",
"err",
":=",
"valuesToIPNets",
"(",
"notIPAddress",
",",
"values",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return... | // newNotIPAddressFunc - returns new Not IP address function. | [
"newNotIPAddressFunc",
"-",
"returns",
"new",
"Not",
"IP",
"address",
"function",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/condition/ipaddressfunc.go#L170-L177 |
125,419 | minio/minio | pkg/policy/condition/ipaddressfunc.go | NewNotIPAddressFunc | func NewNotIPAddressFunc(key Key, IPNets ...*net.IPNet) (Function, error) {
if key != AWSSourceIP {
return nil, fmt.Errorf("only %v key is allowed for %v condition", AWSSourceIP, notIPAddress)
}
return ¬IPAddressFunc{ipAddressFunc{key, IPNets}}, nil
} | go | func NewNotIPAddressFunc(key Key, IPNets ...*net.IPNet) (Function, error) {
if key != AWSSourceIP {
return nil, fmt.Errorf("only %v key is allowed for %v condition", AWSSourceIP, notIPAddress)
}
return ¬IPAddressFunc{ipAddressFunc{key, IPNets}}, nil
} | [
"func",
"NewNotIPAddressFunc",
"(",
"key",
"Key",
",",
"IPNets",
"...",
"*",
"net",
".",
"IPNet",
")",
"(",
"Function",
",",
"error",
")",
"{",
"if",
"key",
"!=",
"AWSSourceIP",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
... | // NewNotIPAddressFunc - returns new Not IP address function. | [
"NewNotIPAddressFunc",
"-",
"returns",
"new",
"Not",
"IP",
"address",
"function",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/condition/ipaddressfunc.go#L180-L186 |
125,420 | minio/minio | cmd/main.go | Main | func Main(args []string) {
// Set the minio app name.
appName := filepath.Base(args[0])
// Run the app - exit on error.
if err := newApp(appName).Run(args); err != nil {
os.Exit(1)
}
} | go | func Main(args []string) {
// Set the minio app name.
appName := filepath.Base(args[0])
// Run the app - exit on error.
if err := newApp(appName).Run(args); err != nil {
os.Exit(1)
}
} | [
"func",
"Main",
"(",
"args",
"[",
"]",
"string",
")",
"{",
"// Set the minio app name.",
"appName",
":=",
"filepath",
".",
"Base",
"(",
"args",
"[",
"0",
"]",
")",
"\n\n",
"// Run the app - exit on error.",
"if",
"err",
":=",
"newApp",
"(",
"appName",
")",
... | // Main main for minio server. | [
"Main",
"main",
"for",
"minio",
"server",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/main.go#L153-L161 |
125,421 | minio/minio | cmd/xl-v1-metadata.go | MarshalJSON | func (c ChecksumInfo) MarshalJSON() ([]byte, error) {
info := checksumInfoJSON{
Name: c.Name,
Algorithm: c.Algorithm.String(),
Hash: hex.EncodeToString(c.Hash),
}
return json.Marshal(info)
} | go | func (c ChecksumInfo) MarshalJSON() ([]byte, error) {
info := checksumInfoJSON{
Name: c.Name,
Algorithm: c.Algorithm.String(),
Hash: hex.EncodeToString(c.Hash),
}
return json.Marshal(info)
} | [
"func",
"(",
"c",
"ChecksumInfo",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"info",
":=",
"checksumInfoJSON",
"{",
"Name",
":",
"c",
".",
"Name",
",",
"Algorithm",
":",
"c",
".",
"Algorithm",
".",
"String",
"(",
"... | // MarshalJSON marshals the ChecksumInfo struct | [
"MarshalJSON",
"marshals",
"the",
"ChecksumInfo",
"struct"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L67-L74 |
125,422 | minio/minio | cmd/xl-v1-metadata.go | AddChecksumInfo | func (e *ErasureInfo) AddChecksumInfo(ckSumInfo ChecksumInfo) {
for i, sum := range e.Checksums {
if sum.Name == ckSumInfo.Name {
e.Checksums[i] = ckSumInfo
return
}
}
e.Checksums = append(e.Checksums, ckSumInfo)
} | go | func (e *ErasureInfo) AddChecksumInfo(ckSumInfo ChecksumInfo) {
for i, sum := range e.Checksums {
if sum.Name == ckSumInfo.Name {
e.Checksums[i] = ckSumInfo
return
}
}
e.Checksums = append(e.Checksums, ckSumInfo)
} | [
"func",
"(",
"e",
"*",
"ErasureInfo",
")",
"AddChecksumInfo",
"(",
"ckSumInfo",
"ChecksumInfo",
")",
"{",
"for",
"i",
",",
"sum",
":=",
"range",
"e",
".",
"Checksums",
"{",
"if",
"sum",
".",
"Name",
"==",
"ckSumInfo",
".",
"Name",
"{",
"e",
".",
"Che... | // AddChecksumInfo adds a checksum of a part. | [
"AddChecksumInfo",
"adds",
"a",
"checksum",
"of",
"a",
"part",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L117-L125 |
125,423 | minio/minio | cmd/xl-v1-metadata.go | GetChecksumInfo | func (e ErasureInfo) GetChecksumInfo(partName string) (ckSum ChecksumInfo) {
// Return the checksum.
for _, sum := range e.Checksums {
if sum.Name == partName {
return sum
}
}
return ChecksumInfo{}
} | go | func (e ErasureInfo) GetChecksumInfo(partName string) (ckSum ChecksumInfo) {
// Return the checksum.
for _, sum := range e.Checksums {
if sum.Name == partName {
return sum
}
}
return ChecksumInfo{}
} | [
"func",
"(",
"e",
"ErasureInfo",
")",
"GetChecksumInfo",
"(",
"partName",
"string",
")",
"(",
"ckSum",
"ChecksumInfo",
")",
"{",
"// Return the checksum.",
"for",
"_",
",",
"sum",
":=",
"range",
"e",
".",
"Checksums",
"{",
"if",
"sum",
".",
"Name",
"==",
... | // GetChecksumInfo - get checksum of a part. | [
"GetChecksumInfo",
"-",
"get",
"checksum",
"of",
"a",
"part",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L128-L136 |
125,424 | minio/minio | cmd/xl-v1-metadata.go | newXLMetaV1 | func newXLMetaV1(object string, dataBlocks, parityBlocks int) (xlMeta xlMetaV1) {
xlMeta = xlMetaV1{}
xlMeta.Version = xlMetaVersion
xlMeta.Format = xlMetaFormat
xlMeta.Minio.Release = ReleaseTag
xlMeta.Erasure = ErasureInfo{
Algorithm: erasureAlgorithmKlauspost,
DataBlocks: dataBlocks,
ParityBlocks: pa... | go | func newXLMetaV1(object string, dataBlocks, parityBlocks int) (xlMeta xlMetaV1) {
xlMeta = xlMetaV1{}
xlMeta.Version = xlMetaVersion
xlMeta.Format = xlMetaFormat
xlMeta.Minio.Release = ReleaseTag
xlMeta.Erasure = ErasureInfo{
Algorithm: erasureAlgorithmKlauspost,
DataBlocks: dataBlocks,
ParityBlocks: pa... | [
"func",
"newXLMetaV1",
"(",
"object",
"string",
",",
"dataBlocks",
",",
"parityBlocks",
"int",
")",
"(",
"xlMeta",
"xlMetaV1",
")",
"{",
"xlMeta",
"=",
"xlMetaV1",
"{",
"}",
"\n",
"xlMeta",
".",
"Version",
"=",
"xlMetaVersion",
"\n",
"xlMeta",
".",
"Format... | // newXLMetaV1 - initializes new xlMetaV1, adds version, allocates a fresh erasure info. | [
"newXLMetaV1",
"-",
"initializes",
"new",
"xlMetaV1",
"adds",
"version",
"allocates",
"a",
"fresh",
"erasure",
"info",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L176-L189 |
125,425 | minio/minio | cmd/xl-v1-metadata.go | newXLMetaFromXLMeta | func newXLMetaFromXLMeta(meta xlMetaV1) xlMetaV1 {
xlMeta := meta
xlMeta.Erasure.Checksums = nil
xlMeta.Parts = nil
return xlMeta
} | go | func newXLMetaFromXLMeta(meta xlMetaV1) xlMetaV1 {
xlMeta := meta
xlMeta.Erasure.Checksums = nil
xlMeta.Parts = nil
return xlMeta
} | [
"func",
"newXLMetaFromXLMeta",
"(",
"meta",
"xlMetaV1",
")",
"xlMetaV1",
"{",
"xlMeta",
":=",
"meta",
"\n",
"xlMeta",
".",
"Erasure",
".",
"Checksums",
"=",
"nil",
"\n",
"xlMeta",
".",
"Parts",
"=",
"nil",
"\n",
"return",
"xlMeta",
"\n",
"}"
] | // Return a new xlMetaV1 initialized using the given xlMetaV1. Used in healing to make sure that we do not copy
// over any part's checksum info which will differ for different disks. | [
"Return",
"a",
"new",
"xlMetaV1",
"initialized",
"using",
"the",
"given",
"xlMetaV1",
".",
"Used",
"in",
"healing",
"to",
"make",
"sure",
"that",
"we",
"do",
"not",
"copy",
"over",
"any",
"part",
"s",
"checksum",
"info",
"which",
"will",
"differ",
"for",
... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L193-L198 |
125,426 | minio/minio | cmd/xl-v1-metadata.go | IsValid | func (m xlMetaV1) IsValid() bool {
return isXLMetaFormatValid(m.Version, m.Format) &&
isXLMetaErasureInfoValid(m.Erasure.DataBlocks, m.Erasure.ParityBlocks)
} | go | func (m xlMetaV1) IsValid() bool {
return isXLMetaFormatValid(m.Version, m.Format) &&
isXLMetaErasureInfoValid(m.Erasure.DataBlocks, m.Erasure.ParityBlocks)
} | [
"func",
"(",
"m",
"xlMetaV1",
")",
"IsValid",
"(",
")",
"bool",
"{",
"return",
"isXLMetaFormatValid",
"(",
"m",
".",
"Version",
",",
"m",
".",
"Format",
")",
"&&",
"isXLMetaErasureInfoValid",
"(",
"m",
".",
"Erasure",
".",
"DataBlocks",
",",
"m",
".",
... | // IsValid - tells if the format is sane by validating the version
// string, format and erasure info fields. | [
"IsValid",
"-",
"tells",
"if",
"the",
"format",
"is",
"sane",
"by",
"validating",
"the",
"version",
"string",
"format",
"and",
"erasure",
"info",
"fields",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L202-L205 |
125,427 | minio/minio | cmd/xl-v1-metadata.go | isXLMetaFormatValid | func isXLMetaFormatValid(version, format string) bool {
return ((version == xlMetaVersion || version == xlMetaVersion100) &&
format == xlMetaFormat)
} | go | func isXLMetaFormatValid(version, format string) bool {
return ((version == xlMetaVersion || version == xlMetaVersion100) &&
format == xlMetaFormat)
} | [
"func",
"isXLMetaFormatValid",
"(",
"version",
",",
"format",
"string",
")",
"bool",
"{",
"return",
"(",
"(",
"version",
"==",
"xlMetaVersion",
"||",
"version",
"==",
"xlMetaVersion100",
")",
"&&",
"format",
"==",
"xlMetaFormat",
")",
"\n",
"}"
] | // Verifies if the backend format metadata is sane by validating
// the version string and format style. | [
"Verifies",
"if",
"the",
"backend",
"format",
"metadata",
"is",
"sane",
"by",
"validating",
"the",
"version",
"string",
"and",
"format",
"style",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L209-L212 |
125,428 | minio/minio | cmd/xl-v1-metadata.go | objectPartIndex | func objectPartIndex(parts []ObjectPartInfo, partNumber int) int {
for i, part := range parts {
if partNumber == part.Number {
return i
}
}
return -1
} | go | func objectPartIndex(parts []ObjectPartInfo, partNumber int) int {
for i, part := range parts {
if partNumber == part.Number {
return i
}
}
return -1
} | [
"func",
"objectPartIndex",
"(",
"parts",
"[",
"]",
"ObjectPartInfo",
",",
"partNumber",
"int",
")",
"int",
"{",
"for",
"i",
",",
"part",
":=",
"range",
"parts",
"{",
"if",
"partNumber",
"==",
"part",
".",
"Number",
"{",
"return",
"i",
"\n",
"}",
"\n",
... | // objectPartIndex - returns the index of matching object part number. | [
"objectPartIndex",
"-",
"returns",
"the",
"index",
"of",
"matching",
"object",
"part",
"number",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L266-L273 |
125,429 | minio/minio | cmd/xl-v1-metadata.go | AddObjectPart | func (m *xlMetaV1) AddObjectPart(partNumber int, partName string, partETag string, partSize int64, actualSize int64) {
partInfo := ObjectPartInfo{
Number: partNumber,
Name: partName,
ETag: partETag,
Size: partSize,
ActualSize: actualSize,
}
// Update part info if it already exists.
... | go | func (m *xlMetaV1) AddObjectPart(partNumber int, partName string, partETag string, partSize int64, actualSize int64) {
partInfo := ObjectPartInfo{
Number: partNumber,
Name: partName,
ETag: partETag,
Size: partSize,
ActualSize: actualSize,
}
// Update part info if it already exists.
... | [
"func",
"(",
"m",
"*",
"xlMetaV1",
")",
"AddObjectPart",
"(",
"partNumber",
"int",
",",
"partName",
"string",
",",
"partETag",
"string",
",",
"partSize",
"int64",
",",
"actualSize",
"int64",
")",
"{",
"partInfo",
":=",
"ObjectPartInfo",
"{",
"Number",
":",
... | // AddObjectPart - add a new object part in order. | [
"AddObjectPart",
"-",
"add",
"a",
"new",
"object",
"part",
"in",
"order",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L276-L298 |
125,430 | minio/minio | cmd/xl-v1-metadata.go | ObjectToPartOffset | func (m xlMetaV1) ObjectToPartOffset(ctx context.Context, offset int64) (partIndex int, partOffset int64, err error) {
if offset == 0 {
// Special case - if offset is 0, then partIndex and partOffset are always 0.
return 0, 0, nil
}
partOffset = offset
// Seek until object offset maps to a particular part offse... | go | func (m xlMetaV1) ObjectToPartOffset(ctx context.Context, offset int64) (partIndex int, partOffset int64, err error) {
if offset == 0 {
// Special case - if offset is 0, then partIndex and partOffset are always 0.
return 0, 0, nil
}
partOffset = offset
// Seek until object offset maps to a particular part offse... | [
"func",
"(",
"m",
"xlMetaV1",
")",
"ObjectToPartOffset",
"(",
"ctx",
"context",
".",
"Context",
",",
"offset",
"int64",
")",
"(",
"partIndex",
"int",
",",
"partOffset",
"int64",
",",
"err",
"error",
")",
"{",
"if",
"offset",
"==",
"0",
"{",
"// Special c... | // ObjectToPartOffset - translate offset of an object to offset of its individual part. | [
"ObjectToPartOffset",
"-",
"translate",
"offset",
"of",
"an",
"object",
"to",
"offset",
"of",
"its",
"individual",
"part",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L301-L320 |
125,431 | minio/minio | cmd/xl-v1-metadata.go | pickValidXLMeta | func pickValidXLMeta(ctx context.Context, metaArr []xlMetaV1, modTime time.Time, quorum int) (xmv xlMetaV1, e error) {
return getXLMetaInQuorum(ctx, metaArr, modTime, quorum)
} | go | func pickValidXLMeta(ctx context.Context, metaArr []xlMetaV1, modTime time.Time, quorum int) (xmv xlMetaV1, e error) {
return getXLMetaInQuorum(ctx, metaArr, modTime, quorum)
} | [
"func",
"pickValidXLMeta",
"(",
"ctx",
"context",
".",
"Context",
",",
"metaArr",
"[",
"]",
"xlMetaV1",
",",
"modTime",
"time",
".",
"Time",
",",
"quorum",
"int",
")",
"(",
"xmv",
"xlMetaV1",
",",
"e",
"error",
")",
"{",
"return",
"getXLMetaInQuorum",
"(... | // pickValidXLMeta - picks one valid xlMeta content and returns from a
// slice of xlmeta content. | [
"pickValidXLMeta",
"-",
"picks",
"one",
"valid",
"xlMeta",
"content",
"and",
"returns",
"from",
"a",
"slice",
"of",
"xlmeta",
"content",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L366-L368 |
125,432 | minio/minio | cmd/xl-v1-metadata.go | readXLMetaParts | func (xl xlObjects) readXLMetaParts(ctx context.Context, bucket, object string) (xlMetaParts []ObjectPartInfo, xlMeta map[string]string, err error) {
var ignoredErrs []error
for _, disk := range xl.getLoadBalancedDisks() {
if disk == nil {
ignoredErrs = append(ignoredErrs, errDiskNotFound)
continue
}
xlMe... | go | func (xl xlObjects) readXLMetaParts(ctx context.Context, bucket, object string) (xlMetaParts []ObjectPartInfo, xlMeta map[string]string, err error) {
var ignoredErrs []error
for _, disk := range xl.getLoadBalancedDisks() {
if disk == nil {
ignoredErrs = append(ignoredErrs, errDiskNotFound)
continue
}
xlMe... | [
"func",
"(",
"xl",
"xlObjects",
")",
"readXLMetaParts",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucket",
",",
"object",
"string",
")",
"(",
"xlMetaParts",
"[",
"]",
"ObjectPartInfo",
",",
"xlMeta",
"map",
"[",
"string",
"]",
"string",
",",
"err",
"e... | // readXLMetaParts - returns the XL Metadata Parts from xl.json of one of the disks picked at random. | [
"readXLMetaParts",
"-",
"returns",
"the",
"XL",
"Metadata",
"Parts",
"from",
"xl",
".",
"json",
"of",
"one",
"of",
"the",
"disks",
"picked",
"at",
"random",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L374-L398 |
125,433 | minio/minio | cmd/xl-v1-metadata.go | writeXLMetadata | func writeXLMetadata(ctx context.Context, disk StorageAPI, bucket, prefix string, xlMeta xlMetaV1) error {
jsonFile := path.Join(prefix, xlMetaJSONFile)
// Marshal json.
metadataBytes, err := json.Marshal(&xlMeta)
if err != nil {
logger.LogIf(ctx, err)
return err
}
// Persist marshaled data.
err = disk.Wri... | go | func writeXLMetadata(ctx context.Context, disk StorageAPI, bucket, prefix string, xlMeta xlMetaV1) error {
jsonFile := path.Join(prefix, xlMetaJSONFile)
// Marshal json.
metadataBytes, err := json.Marshal(&xlMeta)
if err != nil {
logger.LogIf(ctx, err)
return err
}
// Persist marshaled data.
err = disk.Wri... | [
"func",
"writeXLMetadata",
"(",
"ctx",
"context",
".",
"Context",
",",
"disk",
"StorageAPI",
",",
"bucket",
",",
"prefix",
"string",
",",
"xlMeta",
"xlMetaV1",
")",
"error",
"{",
"jsonFile",
":=",
"path",
".",
"Join",
"(",
"prefix",
",",
"xlMetaJSONFile",
... | // writeXLMetadata - writes `xl.json` to a single disk. | [
"writeXLMetadata",
"-",
"writes",
"xl",
".",
"json",
"to",
"a",
"single",
"disk",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L429-L443 |
125,434 | minio/minio | cmd/xl-v1-metadata.go | renameXLMetadata | func renameXLMetadata(ctx context.Context, disks []StorageAPI, srcBucket, srcEntry, dstBucket, dstEntry string, quorum int) ([]StorageAPI, error) {
isDir := false
srcXLJSON := path.Join(srcEntry, xlMetaJSONFile)
dstXLJSON := path.Join(dstEntry, xlMetaJSONFile)
return rename(ctx, disks, srcBucket, srcXLJSON, dstBuck... | go | func renameXLMetadata(ctx context.Context, disks []StorageAPI, srcBucket, srcEntry, dstBucket, dstEntry string, quorum int) ([]StorageAPI, error) {
isDir := false
srcXLJSON := path.Join(srcEntry, xlMetaJSONFile)
dstXLJSON := path.Join(dstEntry, xlMetaJSONFile)
return rename(ctx, disks, srcBucket, srcXLJSON, dstBuck... | [
"func",
"renameXLMetadata",
"(",
"ctx",
"context",
".",
"Context",
",",
"disks",
"[",
"]",
"StorageAPI",
",",
"srcBucket",
",",
"srcEntry",
",",
"dstBucket",
",",
"dstEntry",
"string",
",",
"quorum",
"int",
")",
"(",
"[",
"]",
"StorageAPI",
",",
"error",
... | // Rename `xl.json` content to destination location for each disk in order. | [
"Rename",
"xl",
".",
"json",
"content",
"to",
"destination",
"location",
"for",
"each",
"disk",
"in",
"order",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L446-L451 |
125,435 | minio/minio | cmd/xl-v1-metadata.go | writeUniqueXLMetadata | func writeUniqueXLMetadata(ctx context.Context, disks []StorageAPI, bucket, prefix string, xlMetas []xlMetaV1, quorum int) ([]StorageAPI, error) {
var wg = &sync.WaitGroup{}
var mErrs = make([]error, len(disks))
// Start writing `xl.json` to all disks in parallel.
for index, disk := range disks {
if disk == nil ... | go | func writeUniqueXLMetadata(ctx context.Context, disks []StorageAPI, bucket, prefix string, xlMetas []xlMetaV1, quorum int) ([]StorageAPI, error) {
var wg = &sync.WaitGroup{}
var mErrs = make([]error, len(disks))
// Start writing `xl.json` to all disks in parallel.
for index, disk := range disks {
if disk == nil ... | [
"func",
"writeUniqueXLMetadata",
"(",
"ctx",
"context",
".",
"Context",
",",
"disks",
"[",
"]",
"StorageAPI",
",",
"bucket",
",",
"prefix",
"string",
",",
"xlMetas",
"[",
"]",
"xlMetaV1",
",",
"quorum",
"int",
")",
"(",
"[",
"]",
"StorageAPI",
",",
"erro... | // writeUniqueXLMetadata - writes unique `xl.json` content for each disk in order. | [
"writeUniqueXLMetadata",
"-",
"writes",
"unique",
"xl",
".",
"json",
"content",
"for",
"each",
"disk",
"in",
"order",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-metadata.go#L454-L485 |
125,436 | minio/minio | pkg/iam/policy/opa.go | NewOpa | func NewOpa(args OpaArgs) *Opa {
// No opa args.
if args.URL == nil && args.AuthToken == "" {
return nil
}
return &Opa{
args: args,
client: &http.Client{Transport: args.Transport},
}
} | go | func NewOpa(args OpaArgs) *Opa {
// No opa args.
if args.URL == nil && args.AuthToken == "" {
return nil
}
return &Opa{
args: args,
client: &http.Client{Transport: args.Transport},
}
} | [
"func",
"NewOpa",
"(",
"args",
"OpaArgs",
")",
"*",
"Opa",
"{",
"// No opa args.",
"if",
"args",
".",
"URL",
"==",
"nil",
"&&",
"args",
".",
"AuthToken",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"Opa",
"{",
"args",
":... | // NewOpa - initializes opa policy engine connector. | [
"NewOpa",
"-",
"initializes",
"opa",
"policy",
"engine",
"connector",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/iam/policy/opa.go#L82-L91 |
125,437 | minio/minio | pkg/iam/policy/opa.go | IsAllowed | func (o *Opa) IsAllowed(args Args) bool {
if o == nil {
return false
}
// OPA input
body := make(map[string]interface{})
body["input"] = args
inputBytes, err := json.Marshal(body)
if err != nil {
return false
}
req, err := http.NewRequest("POST", o.args.URL.String(), bytes.NewReader(inputBytes))
if err... | go | func (o *Opa) IsAllowed(args Args) bool {
if o == nil {
return false
}
// OPA input
body := make(map[string]interface{})
body["input"] = args
inputBytes, err := json.Marshal(body)
if err != nil {
return false
}
req, err := http.NewRequest("POST", o.args.URL.String(), bytes.NewReader(inputBytes))
if err... | [
"func",
"(",
"o",
"*",
"Opa",
")",
"IsAllowed",
"(",
"args",
"Args",
")",
"bool",
"{",
"if",
"o",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// OPA input",
"body",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
... | // IsAllowed - checks given policy args is allowed to continue the REST API. | [
"IsAllowed",
"-",
"checks",
"given",
"policy",
"args",
"is",
"allowed",
"to",
"continue",
"the",
"REST",
"API",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/iam/policy/opa.go#L94-L136 |
125,438 | minio/minio | pkg/ioutil/append-file_nix.go | AppendFile | func AppendFile(dst string, src string) error {
appendFile, err := os.OpenFile(dst, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
if err != nil {
return err
}
defer appendFile.Close()
srcFile, err := os.Open(src)
if err != nil {
return err
}
defer srcFile.Close()
// Allocate staging buffer.
var buf = make([... | go | func AppendFile(dst string, src string) error {
appendFile, err := os.OpenFile(dst, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
if err != nil {
return err
}
defer appendFile.Close()
srcFile, err := os.Open(src)
if err != nil {
return err
}
defer srcFile.Close()
// Allocate staging buffer.
var buf = make([... | [
"func",
"AppendFile",
"(",
"dst",
"string",
",",
"src",
"string",
")",
"error",
"{",
"appendFile",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"dst",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_APPEND",
"|",
"os",
".",
"O_CREATE",
",",
"0644",
... | // AppendFile - appends the file "src" to the file "dst" | [
"AppendFile",
"-",
"appends",
"the",
"file",
"src",
"to",
"the",
"file",
"dst"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/ioutil/append-file_nix.go#L27-L43 |
125,439 | minio/minio | pkg/madmin/heal-commands.go | GetMissingCounts | func (hri *HealResultItem) GetMissingCounts() (b, a int) {
if hri == nil {
return
}
for _, v := range hri.Before.Drives {
if v.State == DriveStateMissing {
b++
}
}
for _, v := range hri.After.Drives {
if v.State == DriveStateMissing {
a++
}
}
return
} | go | func (hri *HealResultItem) GetMissingCounts() (b, a int) {
if hri == nil {
return
}
for _, v := range hri.Before.Drives {
if v.State == DriveStateMissing {
b++
}
}
for _, v := range hri.After.Drives {
if v.State == DriveStateMissing {
a++
}
}
return
} | [
"func",
"(",
"hri",
"*",
"HealResultItem",
")",
"GetMissingCounts",
"(",
")",
"(",
"b",
",",
"a",
"int",
")",
"{",
"if",
"hri",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"hri",
".",
"Before",
".",
"Drives",... | // GetMissingCounts - returns the number of missing disks before
// and after heal | [
"GetMissingCounts",
"-",
"returns",
"the",
"number",
"of",
"missing",
"disks",
"before",
"and",
"after",
"heal"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/madmin/heal-commands.go#L120-L135 |
125,440 | minio/minio | pkg/madmin/heal-commands.go | GetOfflineCounts | func (hri *HealResultItem) GetOfflineCounts() (b, a int) {
if hri == nil {
return
}
for _, v := range hri.Before.Drives {
if v.State == DriveStateOffline {
b++
}
}
for _, v := range hri.After.Drives {
if v.State == DriveStateOffline {
a++
}
}
return
} | go | func (hri *HealResultItem) GetOfflineCounts() (b, a int) {
if hri == nil {
return
}
for _, v := range hri.Before.Drives {
if v.State == DriveStateOffline {
b++
}
}
for _, v := range hri.After.Drives {
if v.State == DriveStateOffline {
a++
}
}
return
} | [
"func",
"(",
"hri",
"*",
"HealResultItem",
")",
"GetOfflineCounts",
"(",
")",
"(",
"b",
",",
"a",
"int",
")",
"{",
"if",
"hri",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"hri",
".",
"Before",
".",
"Drives",... | // GetOfflineCounts - returns the number of offline disks before
// and after heal | [
"GetOfflineCounts",
"-",
"returns",
"the",
"number",
"of",
"offline",
"disks",
"before",
"and",
"after",
"heal"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/madmin/heal-commands.go#L139-L154 |
125,441 | minio/minio | pkg/madmin/heal-commands.go | GetCorruptedCounts | func (hri *HealResultItem) GetCorruptedCounts() (b, a int) {
if hri == nil {
return
}
for _, v := range hri.Before.Drives {
if v.State == DriveStateCorrupt {
b++
}
}
for _, v := range hri.After.Drives {
if v.State == DriveStateCorrupt {
a++
}
}
return
} | go | func (hri *HealResultItem) GetCorruptedCounts() (b, a int) {
if hri == nil {
return
}
for _, v := range hri.Before.Drives {
if v.State == DriveStateCorrupt {
b++
}
}
for _, v := range hri.After.Drives {
if v.State == DriveStateCorrupt {
a++
}
}
return
} | [
"func",
"(",
"hri",
"*",
"HealResultItem",
")",
"GetCorruptedCounts",
"(",
")",
"(",
"b",
",",
"a",
"int",
")",
"{",
"if",
"hri",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"hri",
".",
"Before",
".",
"Drives... | // GetCorruptedCounts - returns the number of corrupted disks before
// and after heal | [
"GetCorruptedCounts",
"-",
"returns",
"the",
"number",
"of",
"corrupted",
"disks",
"before",
"and",
"after",
"heal"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/madmin/heal-commands.go#L158-L173 |
125,442 | minio/minio | pkg/madmin/heal-commands.go | GetOnlineCounts | func (hri *HealResultItem) GetOnlineCounts() (b, a int) {
if hri == nil {
return
}
for _, v := range hri.Before.Drives {
if v.State == DriveStateOk {
b++
}
}
for _, v := range hri.After.Drives {
if v.State == DriveStateOk {
a++
}
}
return
} | go | func (hri *HealResultItem) GetOnlineCounts() (b, a int) {
if hri == nil {
return
}
for _, v := range hri.Before.Drives {
if v.State == DriveStateOk {
b++
}
}
for _, v := range hri.After.Drives {
if v.State == DriveStateOk {
a++
}
}
return
} | [
"func",
"(",
"hri",
"*",
"HealResultItem",
")",
"GetOnlineCounts",
"(",
")",
"(",
"b",
",",
"a",
"int",
")",
"{",
"if",
"hri",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"hri",
".",
"Before",
".",
"Drives",
... | // GetOnlineCounts - returns the number of online disks before
// and after heal | [
"GetOnlineCounts",
"-",
"returns",
"the",
"number",
"of",
"online",
"disks",
"before",
"and",
"after",
"heal"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/madmin/heal-commands.go#L177-L192 |
125,443 | minio/minio | pkg/madmin/heal-commands.go | Heal | func (adm *AdminClient) Heal(bucket, prefix string, healOpts HealOpts,
clientToken string, forceStart, forceStop bool) (
healStart HealStartSuccess, healTaskStatus HealTaskStatus, err error) {
if forceStart && forceStop {
return healStart, healTaskStatus, ErrInvalidArgument("forceStart and forceStop set to true i... | go | func (adm *AdminClient) Heal(bucket, prefix string, healOpts HealOpts,
clientToken string, forceStart, forceStop bool) (
healStart HealStartSuccess, healTaskStatus HealTaskStatus, err error) {
if forceStart && forceStop {
return healStart, healTaskStatus, ErrInvalidArgument("forceStart and forceStop set to true i... | [
"func",
"(",
"adm",
"*",
"AdminClient",
")",
"Heal",
"(",
"bucket",
",",
"prefix",
"string",
",",
"healOpts",
"HealOpts",
",",
"clientToken",
"string",
",",
"forceStart",
",",
"forceStop",
"bool",
")",
"(",
"healStart",
"HealStartSuccess",
",",
"healTaskStatus... | // Heal - API endpoint to start heal and to fetch status
// forceStart and forceStop are mutually exclusive, you can either
// set one of them to 'true'. If both are set 'forceStart' will be
// honored. | [
"Heal",
"-",
"API",
"endpoint",
"to",
"start",
"heal",
"and",
"to",
"fetch",
"status",
"forceStart",
"and",
"forceStop",
"are",
"mutually",
"exclusive",
"you",
"can",
"either",
"set",
"one",
"of",
"them",
"to",
"true",
".",
"If",
"both",
"are",
"set",
"f... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/madmin/heal-commands.go#L198-L271 |
125,444 | minio/minio | pkg/policy/condition/func.go | Evaluate | func (functions Functions) Evaluate(values map[string][]string) bool {
for _, f := range functions {
if !f.evaluate(values) {
return false
}
}
return true
} | go | func (functions Functions) Evaluate(values map[string][]string) bool {
for _, f := range functions {
if !f.evaluate(values) {
return false
}
}
return true
} | [
"func",
"(",
"functions",
"Functions",
")",
"Evaluate",
"(",
"values",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"f",
":=",
"range",
"functions",
"{",
"if",
"!",
"f",
".",
"evaluate",
"(",
"values",
")",
"{",... | // Evaluate - evaluates all functions with given values map. Each function is evaluated
// sequencely and next function is called only if current function succeeds. | [
"Evaluate",
"-",
"evaluates",
"all",
"functions",
"with",
"given",
"values",
"map",
".",
"Each",
"function",
"is",
"evaluated",
"sequencely",
"and",
"next",
"function",
"is",
"called",
"only",
"if",
"current",
"function",
"succeeds",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/condition/func.go#L48-L56 |
125,445 | minio/minio | pkg/policy/condition/func.go | Keys | func (functions Functions) Keys() KeySet {
keySet := NewKeySet()
for _, f := range functions {
keySet.Add(f.key())
}
return keySet
} | go | func (functions Functions) Keys() KeySet {
keySet := NewKeySet()
for _, f := range functions {
keySet.Add(f.key())
}
return keySet
} | [
"func",
"(",
"functions",
"Functions",
")",
"Keys",
"(",
")",
"KeySet",
"{",
"keySet",
":=",
"NewKeySet",
"(",
")",
"\n\n",
"for",
"_",
",",
"f",
":=",
"range",
"functions",
"{",
"keySet",
".",
"Add",
"(",
"f",
".",
"key",
"(",
")",
")",
"\n",
"}... | // Keys - returns list of keys used in all functions. | [
"Keys",
"-",
"returns",
"list",
"of",
"keys",
"used",
"in",
"all",
"functions",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/condition/func.go#L59-L67 |
125,446 | minio/minio | pkg/policy/condition/func.go | MarshalJSON | func (functions Functions) MarshalJSON() ([]byte, error) {
nm := make(map[name]map[Key]ValueSet)
for _, f := range functions {
if _, ok := nm[f.name()]; ok {
for k, v := range f.toMap() {
nm[f.name()][k] = v
}
} else {
nm[f.name()] = f.toMap()
}
}
return json.Marshal(nm)
} | go | func (functions Functions) MarshalJSON() ([]byte, error) {
nm := make(map[name]map[Key]ValueSet)
for _, f := range functions {
if _, ok := nm[f.name()]; ok {
for k, v := range f.toMap() {
nm[f.name()][k] = v
}
} else {
nm[f.name()] = f.toMap()
}
}
return json.Marshal(nm)
} | [
"func",
"(",
"functions",
"Functions",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"nm",
":=",
"make",
"(",
"map",
"[",
"name",
"]",
"map",
"[",
"Key",
"]",
"ValueSet",
")",
"\n\n",
"for",
"_",
",",
"f",
":=",
"... | // MarshalJSON - encodes Functions to JSON data. | [
"MarshalJSON",
"-",
"encodes",
"Functions",
"to",
"JSON",
"data",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/condition/func.go#L70-L84 |
125,447 | minio/minio | pkg/policy/condition/func.go | UnmarshalJSON | func (functions *Functions) UnmarshalJSON(data []byte) error {
// As string kind, int kind then json.Unmarshaler is checked at
// https://github.com/golang/go/blob/master/src/encoding/json/decode.go#L618
// UnmarshalJSON() is not called for types extending string
// see https://play.golang.org/p/HrSsKksHvrS, better... | go | func (functions *Functions) UnmarshalJSON(data []byte) error {
// As string kind, int kind then json.Unmarshaler is checked at
// https://github.com/golang/go/blob/master/src/encoding/json/decode.go#L618
// UnmarshalJSON() is not called for types extending string
// see https://play.golang.org/p/HrSsKksHvrS, better... | [
"func",
"(",
"functions",
"*",
"Functions",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"// As string kind, int kind then json.Unmarshaler is checked at",
"// https://github.com/golang/go/blob/master/src/encoding/json/decode.go#L618",
"// UnmarshalJSON()... | // UnmarshalJSON - decodes JSON data to Functions. | [
"UnmarshalJSON",
"-",
"decodes",
"JSON",
"data",
"to",
"Functions",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/condition/func.go#L113-L160 |
125,448 | minio/minio | cmd/retry.go | Seed | func (r *lockedRandSource) Seed(seed int64) {
r.lk.Lock()
r.src.Seed(seed)
r.lk.Unlock()
} | go | func (r *lockedRandSource) Seed(seed int64) {
r.lk.Lock()
r.src.Seed(seed)
r.lk.Unlock()
} | [
"func",
"(",
"r",
"*",
"lockedRandSource",
")",
"Seed",
"(",
"seed",
"int64",
")",
"{",
"r",
".",
"lk",
".",
"Lock",
"(",
")",
"\n",
"r",
".",
"src",
".",
"Seed",
"(",
"seed",
")",
"\n",
"r",
".",
"lk",
".",
"Unlock",
"(",
")",
"\n",
"}"
] | // Seed uses the provided seed value to initialize the generator to a
// deterministic state. | [
"Seed",
"uses",
"the",
"provided",
"seed",
"value",
"to",
"initialize",
"the",
"generator",
"to",
"a",
"deterministic",
"state",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/retry.go#L42-L46 |
125,449 | minio/minio | cmd/retry.go | newRetryTimerWithJitter | func newRetryTimerWithJitter(unit time.Duration, cap time.Duration, jitter float64, doneCh chan struct{}) <-chan int {
attemptCh := make(chan int)
// normalize jitter to the range [0, 1.0]
if jitter < NoJitter {
jitter = NoJitter
}
if jitter > MaxJitter {
jitter = MaxJitter
}
// computes the exponential ba... | go | func newRetryTimerWithJitter(unit time.Duration, cap time.Duration, jitter float64, doneCh chan struct{}) <-chan int {
attemptCh := make(chan int)
// normalize jitter to the range [0, 1.0]
if jitter < NoJitter {
jitter = NoJitter
}
if jitter > MaxJitter {
jitter = MaxJitter
}
// computes the exponential ba... | [
"func",
"newRetryTimerWithJitter",
"(",
"unit",
"time",
".",
"Duration",
",",
"cap",
"time",
".",
"Duration",
",",
"jitter",
"float64",
",",
"doneCh",
"chan",
"struct",
"{",
"}",
")",
"<-",
"chan",
"int",
"{",
"attemptCh",
":=",
"make",
"(",
"chan",
"int... | // newRetryTimerJitter creates a timer with exponentially increasing delays
// until the maximum retry attempts are reached. - this function is a fully
// configurable version, meant for only advanced use cases. For the most part
// one should use newRetryTimerSimple and newRetryTimer. | [
"newRetryTimerJitter",
"creates",
"a",
"timer",
"with",
"exponentially",
"increasing",
"delays",
"until",
"the",
"maximum",
"retry",
"attempts",
"are",
"reached",
".",
"-",
"this",
"function",
"is",
"a",
"fully",
"configurable",
"version",
"meant",
"for",
"only",
... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/retry.go#L64-L122 |
125,450 | minio/minio | pkg/s3select/sql/stringfuncs.go | matcher | func matcher(text, pat string, leadingPercent bool) (res string, match bool) {
if !leadingPercent {
res = strings.TrimPrefix(text, pat)
if len(text) == len(res) {
return "", false
}
} else {
parts := strings.SplitN(text, pat, 2)
if len(parts) == 1 {
return "", false
}
res = parts[1]
}
return res... | go | func matcher(text, pat string, leadingPercent bool) (res string, match bool) {
if !leadingPercent {
res = strings.TrimPrefix(text, pat)
if len(text) == len(res) {
return "", false
}
} else {
parts := strings.SplitN(text, pat, 2)
if len(parts) == 1 {
return "", false
}
res = parts[1]
}
return res... | [
"func",
"matcher",
"(",
"text",
",",
"pat",
"string",
",",
"leadingPercent",
"bool",
")",
"(",
"res",
"string",
",",
"match",
"bool",
")",
"{",
"if",
"!",
"leadingPercent",
"{",
"res",
"=",
"strings",
".",
"TrimPrefix",
"(",
"text",
",",
"pat",
")",
... | // matcher - Finds `pat` in `text`, and returns the part remainder of
// `text`, after the match. If leadingPercent is false, `pat` must be
// the prefix of `text`, otherwise it must be a substring. | [
"matcher",
"-",
"Finds",
"pat",
"in",
"text",
"and",
"returns",
"the",
"part",
"remainder",
"of",
"text",
"after",
"the",
"match",
".",
"If",
"leadingPercent",
"is",
"false",
"pat",
"must",
"be",
"the",
"prefix",
"of",
"text",
"otherwise",
"it",
"must",
... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/stringfuncs.go#L120-L134 |
125,451 | minio/minio | cmd/xl-v1-bucket.go | undoMakeBucket | func undoMakeBucket(storageDisks []StorageAPI, bucket string) {
// Initialize sync waitgroup.
var wg = &sync.WaitGroup{}
// Undo previous make bucket entry on all underlying storage disks.
for index, disk := range storageDisks {
if disk == nil {
continue
}
wg.Add(1)
// Delete a bucket inside a go-routine... | go | func undoMakeBucket(storageDisks []StorageAPI, bucket string) {
// Initialize sync waitgroup.
var wg = &sync.WaitGroup{}
// Undo previous make bucket entry on all underlying storage disks.
for index, disk := range storageDisks {
if disk == nil {
continue
}
wg.Add(1)
// Delete a bucket inside a go-routine... | [
"func",
"undoMakeBucket",
"(",
"storageDisks",
"[",
"]",
"StorageAPI",
",",
"bucket",
"string",
")",
"{",
"// Initialize sync waitgroup.",
"var",
"wg",
"=",
"&",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"// Undo previous make bucket entry on all underlying storage disk... | // undo make bucket operation upon quorum failure. | [
"undo",
"make",
"bucket",
"operation",
"upon",
"quorum",
"failure",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-bucket.go#L103-L121 |
125,452 | minio/minio | cmd/xl-v1-bucket.go | getBucketInfo | func (xl xlObjects) getBucketInfo(ctx context.Context, bucketName string) (bucketInfo BucketInfo, err error) {
var bucketErrs []error
for _, disk := range xl.getLoadBalancedDisks() {
if disk == nil {
bucketErrs = append(bucketErrs, errDiskNotFound)
continue
}
volInfo, serr := disk.StatVol(bucketName)
if... | go | func (xl xlObjects) getBucketInfo(ctx context.Context, bucketName string) (bucketInfo BucketInfo, err error) {
var bucketErrs []error
for _, disk := range xl.getLoadBalancedDisks() {
if disk == nil {
bucketErrs = append(bucketErrs, errDiskNotFound)
continue
}
volInfo, serr := disk.StatVol(bucketName)
if... | [
"func",
"(",
"xl",
"xlObjects",
")",
"getBucketInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucketName",
"string",
")",
"(",
"bucketInfo",
"BucketInfo",
",",
"err",
"error",
")",
"{",
"var",
"bucketErrs",
"[",
"]",
"error",
"\n",
"for",
"_",
",",
... | // getBucketInfo - returns the BucketInfo from one of the load balanced disks. | [
"getBucketInfo",
"-",
"returns",
"the",
"BucketInfo",
"from",
"one",
"of",
"the",
"load",
"balanced",
"disks",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-bucket.go#L124-L150 |
125,453 | minio/minio | cmd/xl-v1-bucket.go | GetBucketInfo | func (xl xlObjects) GetBucketInfo(ctx context.Context, bucket string) (bi BucketInfo, e error) {
bucketLock := xl.nsMutex.NewNSLock(bucket, "")
if e := bucketLock.GetRLock(globalObjectTimeout); e != nil {
return bi, e
}
defer bucketLock.RUnlock()
bucketInfo, err := xl.getBucketInfo(ctx, bucket)
if err != nil {
... | go | func (xl xlObjects) GetBucketInfo(ctx context.Context, bucket string) (bi BucketInfo, e error) {
bucketLock := xl.nsMutex.NewNSLock(bucket, "")
if e := bucketLock.GetRLock(globalObjectTimeout); e != nil {
return bi, e
}
defer bucketLock.RUnlock()
bucketInfo, err := xl.getBucketInfo(ctx, bucket)
if err != nil {
... | [
"func",
"(",
"xl",
"xlObjects",
")",
"GetBucketInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucket",
"string",
")",
"(",
"bi",
"BucketInfo",
",",
"e",
"error",
")",
"{",
"bucketLock",
":=",
"xl",
".",
"nsMutex",
".",
"NewNSLock",
"(",
"bucket",
... | // GetBucketInfo - returns BucketInfo for a bucket. | [
"GetBucketInfo",
"-",
"returns",
"BucketInfo",
"for",
"a",
"bucket",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-bucket.go#L153-L164 |
125,454 | minio/minio | cmd/xl-v1-bucket.go | listBuckets | func (xl xlObjects) listBuckets(ctx context.Context) (bucketsInfo []BucketInfo, err error) {
for _, disk := range xl.getLoadBalancedDisks() {
if disk == nil {
continue
}
var volsInfo []VolInfo
volsInfo, err = disk.ListVols()
if err == nil {
// NOTE: The assumption here is that volumes across all disks ... | go | func (xl xlObjects) listBuckets(ctx context.Context) (bucketsInfo []BucketInfo, err error) {
for _, disk := range xl.getLoadBalancedDisks() {
if disk == nil {
continue
}
var volsInfo []VolInfo
volsInfo, err = disk.ListVols()
if err == nil {
// NOTE: The assumption here is that volumes across all disks ... | [
"func",
"(",
"xl",
"xlObjects",
")",
"listBuckets",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"bucketsInfo",
"[",
"]",
"BucketInfo",
",",
"err",
"error",
")",
"{",
"for",
"_",
",",
"disk",
":=",
"range",
"xl",
".",
"getLoadBalancedDisks",
"(",
"... | // listBuckets - returns list of all buckets from a disk picked at random. | [
"listBuckets",
"-",
"returns",
"list",
"of",
"all",
"buckets",
"from",
"a",
"disk",
"picked",
"at",
"random",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-bucket.go#L167-L201 |
125,455 | minio/minio | cmd/xl-v1-bucket.go | ListBuckets | func (xl xlObjects) ListBuckets(ctx context.Context) ([]BucketInfo, error) {
bucketInfos, err := xl.listBuckets(ctx)
if err != nil {
return nil, toObjectErr(err)
}
// Sort by bucket name before returning.
sort.Sort(byBucketName(bucketInfos))
return bucketInfos, nil
} | go | func (xl xlObjects) ListBuckets(ctx context.Context) ([]BucketInfo, error) {
bucketInfos, err := xl.listBuckets(ctx)
if err != nil {
return nil, toObjectErr(err)
}
// Sort by bucket name before returning.
sort.Sort(byBucketName(bucketInfos))
return bucketInfos, nil
} | [
"func",
"(",
"xl",
"xlObjects",
")",
"ListBuckets",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"BucketInfo",
",",
"error",
")",
"{",
"bucketInfos",
",",
"err",
":=",
"xl",
".",
"listBuckets",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
... | // ListBuckets - lists all the buckets, sorted by its name. | [
"ListBuckets",
"-",
"lists",
"all",
"the",
"buckets",
"sorted",
"by",
"its",
"name",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-bucket.go#L204-L212 |
125,456 | minio/minio | cmd/xl-v1-bucket.go | deleteDanglingBucket | func deleteDanglingBucket(ctx context.Context, storageDisks []StorageAPI, dErrs []error, bucket string) {
for index, err := range dErrs {
if err == errVolumeNotEmpty {
// Attempt to delete bucket again.
if derr := storageDisks[index].DeleteVol(bucket); derr == errVolumeNotEmpty {
_ = cleanupDir(ctx, storag... | go | func deleteDanglingBucket(ctx context.Context, storageDisks []StorageAPI, dErrs []error, bucket string) {
for index, err := range dErrs {
if err == errVolumeNotEmpty {
// Attempt to delete bucket again.
if derr := storageDisks[index].DeleteVol(bucket); derr == errVolumeNotEmpty {
_ = cleanupDir(ctx, storag... | [
"func",
"deleteDanglingBucket",
"(",
"ctx",
"context",
".",
"Context",
",",
"storageDisks",
"[",
"]",
"StorageAPI",
",",
"dErrs",
"[",
"]",
"error",
",",
"bucket",
"string",
")",
"{",
"for",
"index",
",",
"err",
":=",
"range",
"dErrs",
"{",
"if",
"err",
... | // Dangling buckets should be handled appropriately, in this following situation
// we actually have quorum error to be `nil` but we have some disks where
// the bucket delete returned `errVolumeNotEmpty` but this is not correct
// can only happen if there are dangling objects in a bucket. Under such
// a situation we ... | [
"Dangling",
"buckets",
"should",
"be",
"handled",
"appropriately",
"in",
"this",
"following",
"situation",
"we",
"actually",
"have",
"quorum",
"error",
"to",
"be",
"nil",
"but",
"we",
"have",
"some",
"disks",
"where",
"the",
"bucket",
"delete",
"returned",
"er... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-bucket.go#L222-L236 |
125,457 | minio/minio | cmd/xl-v1-bucket.go | DeleteBucket | func (xl xlObjects) DeleteBucket(ctx context.Context, bucket string) error {
bucketLock := xl.nsMutex.NewNSLock(bucket, "")
if err := bucketLock.GetLock(globalObjectTimeout); err != nil {
return err
}
defer bucketLock.Unlock()
// Collect if all disks report volume not found.
var wg = &sync.WaitGroup{}
var dEr... | go | func (xl xlObjects) DeleteBucket(ctx context.Context, bucket string) error {
bucketLock := xl.nsMutex.NewNSLock(bucket, "")
if err := bucketLock.GetLock(globalObjectTimeout); err != nil {
return err
}
defer bucketLock.Unlock()
// Collect if all disks report volume not found.
var wg = &sync.WaitGroup{}
var dEr... | [
"func",
"(",
"xl",
"xlObjects",
")",
"DeleteBucket",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucket",
"string",
")",
"error",
"{",
"bucketLock",
":=",
"xl",
".",
"nsMutex",
".",
"NewNSLock",
"(",
"bucket",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
... | // DeleteBucket - deletes a bucket. | [
"DeleteBucket",
"-",
"deletes",
"a",
"bucket",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/xl-v1-bucket.go#L239-L294 |
125,458 | minio/minio | cmd/config-common.go | watchConfigEtcd | func watchConfigEtcd(objAPI ObjectLayer, configFile string, loadCfgFn func(ObjectLayer) error) {
for {
watchCh := globalEtcdClient.Watch(context.Background(), iamConfigPrefix)
select {
case <-GlobalServiceDoneCh:
return
case watchResp, ok := <-watchCh:
if !ok {
time.Sleep(1 * time.Second)
continu... | go | func watchConfigEtcd(objAPI ObjectLayer, configFile string, loadCfgFn func(ObjectLayer) error) {
for {
watchCh := globalEtcdClient.Watch(context.Background(), iamConfigPrefix)
select {
case <-GlobalServiceDoneCh:
return
case watchResp, ok := <-watchCh:
if !ok {
time.Sleep(1 * time.Second)
continu... | [
"func",
"watchConfigEtcd",
"(",
"objAPI",
"ObjectLayer",
",",
"configFile",
"string",
",",
"loadCfgFn",
"func",
"(",
"ObjectLayer",
")",
"error",
")",
"{",
"for",
"{",
"watchCh",
":=",
"globalEtcdClient",
".",
"Watch",
"(",
"context",
".",
"Background",
"(",
... | // watchConfigEtcd - watches for changes on `configFile` on etcd and loads them. | [
"watchConfigEtcd",
"-",
"watches",
"for",
"changes",
"on",
"configFile",
"on",
"etcd",
"and",
"loads",
"them",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/config-common.go#L108-L132 |
125,459 | minio/minio | cmd/os-reliable.go | removeAll | func removeAll(dirPath string) (err error) {
if dirPath == "" {
return errInvalidArgument
}
if err = checkPathLength(dirPath); err != nil {
return err
}
if err = reliableRemoveAll(dirPath); err != nil {
switch {
case isSysErrNotDir(err):
// File path cannot be verified since one of
// the parents i... | go | func removeAll(dirPath string) (err error) {
if dirPath == "" {
return errInvalidArgument
}
if err = checkPathLength(dirPath); err != nil {
return err
}
if err = reliableRemoveAll(dirPath); err != nil {
switch {
case isSysErrNotDir(err):
// File path cannot be verified since one of
// the parents i... | [
"func",
"removeAll",
"(",
"dirPath",
"string",
")",
"(",
"err",
"error",
")",
"{",
"if",
"dirPath",
"==",
"\"",
"\"",
"{",
"return",
"errInvalidArgument",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"checkPathLength",
"(",
"dirPath",
")",
";",
"err",
"!=",
"n... | // Wrapper functions to os.RemoveAll, which calls reliableRemoveAll
// this is to ensure that if there is a racy parent directory
// create in between we can simply retry the operation. | [
"Wrapper",
"functions",
"to",
"os",
".",
"RemoveAll",
"which",
"calls",
"reliableRemoveAll",
"this",
"is",
"to",
"ensure",
"that",
"if",
"there",
"is",
"a",
"racy",
"parent",
"directory",
"create",
"in",
"between",
"we",
"can",
"simply",
"retry",
"the",
"ope... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/os-reliable.go#L28-L52 |
125,460 | minio/minio | cmd/os-reliable.go | mkdirAll | func mkdirAll(dirPath string, mode os.FileMode) (err error) {
if dirPath == "" {
return errInvalidArgument
}
if err = checkPathLength(dirPath); err != nil {
return err
}
if err = reliableMkdirAll(dirPath, mode); err != nil {
// File path cannot be verified since one of the parents is a file.
if isSysErrN... | go | func mkdirAll(dirPath string, mode os.FileMode) (err error) {
if dirPath == "" {
return errInvalidArgument
}
if err = checkPathLength(dirPath); err != nil {
return err
}
if err = reliableMkdirAll(dirPath, mode); err != nil {
// File path cannot be verified since one of the parents is a file.
if isSysErrN... | [
"func",
"mkdirAll",
"(",
"dirPath",
"string",
",",
"mode",
"os",
".",
"FileMode",
")",
"(",
"err",
"error",
")",
"{",
"if",
"dirPath",
"==",
"\"",
"\"",
"{",
"return",
"errInvalidArgument",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"checkPathLength",
"(",
"... | // Wrapper functions to os.MkdirAll, which calls reliableMkdirAll
// this is to ensure that if there is a racy parent directory
// delete in between we can simply retry the operation. | [
"Wrapper",
"functions",
"to",
"os",
".",
"MkdirAll",
"which",
"calls",
"reliableMkdirAll",
"this",
"is",
"to",
"ensure",
"that",
"if",
"there",
"is",
"a",
"racy",
"parent",
"directory",
"delete",
"in",
"between",
"we",
"can",
"simply",
"retry",
"the",
"opera... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/os-reliable.go#L75-L96 |
125,461 | minio/minio | cmd/os-reliable.go | renameAll | func renameAll(srcFilePath, dstFilePath string) (err error) {
if srcFilePath == "" || dstFilePath == "" {
return errInvalidArgument
}
if err = checkPathLength(srcFilePath); err != nil {
return err
}
if err = checkPathLength(dstFilePath); err != nil {
return err
}
if err = reliableRename(srcFilePath, dstF... | go | func renameAll(srcFilePath, dstFilePath string) (err error) {
if srcFilePath == "" || dstFilePath == "" {
return errInvalidArgument
}
if err = checkPathLength(srcFilePath); err != nil {
return err
}
if err = checkPathLength(dstFilePath); err != nil {
return err
}
if err = reliableRename(srcFilePath, dstF... | [
"func",
"renameAll",
"(",
"srcFilePath",
",",
"dstFilePath",
"string",
")",
"(",
"err",
"error",
")",
"{",
"if",
"srcFilePath",
"==",
"\"",
"\"",
"||",
"dstFilePath",
"==",
"\"",
"\"",
"{",
"return",
"errInvalidArgument",
"\n",
"}",
"\n\n",
"if",
"err",
... | // Wrapper function to os.Rename, which calls reliableMkdirAll
// and reliableRenameAll. This is to ensure that if there is a
// racy parent directory delete in between we can simply retry
// the operation. | [
"Wrapper",
"function",
"to",
"os",
".",
"Rename",
"which",
"calls",
"reliableMkdirAll",
"and",
"reliableRenameAll",
".",
"This",
"is",
"to",
"ensure",
"that",
"if",
"there",
"is",
"a",
"racy",
"parent",
"directory",
"delete",
"in",
"between",
"we",
"can",
"s... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/os-reliable.go#L120-L154 |
125,462 | minio/minio | cmd/bitrot.go | New | func (a BitrotAlgorithm) New() hash.Hash {
switch a {
case SHA256:
return sha256.New()
case BLAKE2b512:
b2, _ := blake2b.New512(nil) // New512 never returns an error if the key is nil
return b2
case HighwayHash256:
hh, _ := highwayhash.New(magicHighwayHash256Key) // New will never return error since key is ... | go | func (a BitrotAlgorithm) New() hash.Hash {
switch a {
case SHA256:
return sha256.New()
case BLAKE2b512:
b2, _ := blake2b.New512(nil) // New512 never returns an error if the key is nil
return b2
case HighwayHash256:
hh, _ := highwayhash.New(magicHighwayHash256Key) // New will never return error since key is ... | [
"func",
"(",
"a",
"BitrotAlgorithm",
")",
"New",
"(",
")",
"hash",
".",
"Hash",
"{",
"switch",
"a",
"{",
"case",
"SHA256",
":",
"return",
"sha256",
".",
"New",
"(",
")",
"\n",
"case",
"BLAKE2b512",
":",
"b2",
",",
"_",
":=",
"blake2b",
".",
"New512... | // New returns a new hash.Hash calculating the given bitrot algorithm. | [
"New",
"returns",
"a",
"new",
"hash",
".",
"Hash",
"calculating",
"the",
"given",
"bitrot",
"algorithm",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/bitrot.go#L61-L78 |
125,463 | minio/minio | cmd/bitrot.go | String | func (a BitrotAlgorithm) String() string {
name, ok := bitrotAlgorithms[a]
if !ok {
logger.CriticalIf(context.Background(), errors.New("Unsupported bitrot algorithm"))
}
return name
} | go | func (a BitrotAlgorithm) String() string {
name, ok := bitrotAlgorithms[a]
if !ok {
logger.CriticalIf(context.Background(), errors.New("Unsupported bitrot algorithm"))
}
return name
} | [
"func",
"(",
"a",
"BitrotAlgorithm",
")",
"String",
"(",
")",
"string",
"{",
"name",
",",
"ok",
":=",
"bitrotAlgorithms",
"[",
"a",
"]",
"\n",
"if",
"!",
"ok",
"{",
"logger",
".",
"CriticalIf",
"(",
"context",
".",
"Background",
"(",
")",
",",
"error... | // String returns the string identifier for a given bitrot algorithm.
// If the algorithm is not supported String panics. | [
"String",
"returns",
"the",
"string",
"identifier",
"for",
"a",
"given",
"bitrot",
"algorithm",
".",
"If",
"the",
"algorithm",
"is",
"not",
"supported",
"String",
"panics",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/bitrot.go#L88-L94 |
125,464 | minio/minio | cmd/bitrot.go | BitrotAlgorithmFromString | func BitrotAlgorithmFromString(s string) (a BitrotAlgorithm) {
for alg, name := range bitrotAlgorithms {
if name == s {
return alg
}
}
return
} | go | func BitrotAlgorithmFromString(s string) (a BitrotAlgorithm) {
for alg, name := range bitrotAlgorithms {
if name == s {
return alg
}
}
return
} | [
"func",
"BitrotAlgorithmFromString",
"(",
"s",
"string",
")",
"(",
"a",
"BitrotAlgorithm",
")",
"{",
"for",
"alg",
",",
"name",
":=",
"range",
"bitrotAlgorithms",
"{",
"if",
"name",
"==",
"s",
"{",
"return",
"alg",
"\n",
"}",
"\n",
"}",
"\n",
"return",
... | // BitrotAlgorithmFromString returns a bitrot algorithm from the given string representation.
// It returns 0 if the string representation does not match any supported algorithm.
// The zero value of a bitrot algorithm is never supported. | [
"BitrotAlgorithmFromString",
"returns",
"a",
"bitrot",
"algorithm",
"from",
"the",
"given",
"string",
"representation",
".",
"It",
"returns",
"0",
"if",
"the",
"string",
"representation",
"does",
"not",
"match",
"any",
"supported",
"algorithm",
".",
"The",
"zero",... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/bitrot.go#L110-L117 |
125,465 | minio/minio | cmd/bitrot.go | closeBitrotReaders | func closeBitrotReaders(rs []io.ReaderAt) {
for _, r := range rs {
if br, ok := r.(io.Closer); ok {
br.Close()
}
}
} | go | func closeBitrotReaders(rs []io.ReaderAt) {
for _, r := range rs {
if br, ok := r.(io.Closer); ok {
br.Close()
}
}
} | [
"func",
"closeBitrotReaders",
"(",
"rs",
"[",
"]",
"io",
".",
"ReaderAt",
")",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"rs",
"{",
"if",
"br",
",",
"ok",
":=",
"r",
".",
"(",
"io",
".",
"Closer",
")",
";",
"ok",
"{",
"br",
".",
"Close",
"(",... | // Close all the readers. | [
"Close",
"all",
"the",
"readers",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/bitrot.go#L134-L140 |
125,466 | minio/minio | cmd/bitrot.go | closeBitrotWriters | func closeBitrotWriters(ws []io.Writer) {
for _, w := range ws {
if bw, ok := w.(io.Closer); ok {
bw.Close()
}
}
} | go | func closeBitrotWriters(ws []io.Writer) {
for _, w := range ws {
if bw, ok := w.(io.Closer); ok {
bw.Close()
}
}
} | [
"func",
"closeBitrotWriters",
"(",
"ws",
"[",
"]",
"io",
".",
"Writer",
")",
"{",
"for",
"_",
",",
"w",
":=",
"range",
"ws",
"{",
"if",
"bw",
",",
"ok",
":=",
"w",
".",
"(",
"io",
".",
"Closer",
")",
";",
"ok",
"{",
"bw",
".",
"Close",
"(",
... | // Close all the writers. | [
"Close",
"all",
"the",
"writers",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/bitrot.go#L143-L149 |
125,467 | minio/minio | cmd/bitrot.go | bitrotWriterSum | func bitrotWriterSum(w io.Writer) []byte {
if bw, ok := w.(*wholeBitrotWriter); ok {
return bw.Sum(nil)
}
return nil
} | go | func bitrotWriterSum(w io.Writer) []byte {
if bw, ok := w.(*wholeBitrotWriter); ok {
return bw.Sum(nil)
}
return nil
} | [
"func",
"bitrotWriterSum",
"(",
"w",
"io",
".",
"Writer",
")",
"[",
"]",
"byte",
"{",
"if",
"bw",
",",
"ok",
":=",
"w",
".",
"(",
"*",
"wholeBitrotWriter",
")",
";",
"ok",
"{",
"return",
"bw",
".",
"Sum",
"(",
"nil",
")",
"\n",
"}",
"\n",
"retu... | // Returns hash sum for whole-bitrot, nil for streaming-bitrot. | [
"Returns",
"hash",
"sum",
"for",
"whole",
"-",
"bitrot",
"nil",
"for",
"streaming",
"-",
"bitrot",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/bitrot.go#L152-L157 |
125,468 | minio/minio | cmd/bitrot.go | bitrotCheckFile | func bitrotCheckFile(disk StorageAPI, volume string, filePath string, tillOffset int64, algo BitrotAlgorithm, sum []byte, shardSize int64) (err error) {
if algo != HighwayHash256S {
buf := []byte{}
// For whole-file bitrot we don't need to read the entire file as the bitrot verify happens on the server side even i... | go | func bitrotCheckFile(disk StorageAPI, volume string, filePath string, tillOffset int64, algo BitrotAlgorithm, sum []byte, shardSize int64) (err error) {
if algo != HighwayHash256S {
buf := []byte{}
// For whole-file bitrot we don't need to read the entire file as the bitrot verify happens on the server side even i... | [
"func",
"bitrotCheckFile",
"(",
"disk",
"StorageAPI",
",",
"volume",
"string",
",",
"filePath",
"string",
",",
"tillOffset",
"int64",
",",
"algo",
"BitrotAlgorithm",
",",
"sum",
"[",
"]",
"byte",
",",
"shardSize",
"int64",
")",
"(",
"err",
"error",
")",
"{... | // Verify if a file has bitrot error. | [
"Verify",
"if",
"a",
"file",
"has",
"bitrot",
"error",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/bitrot.go#L160-L187 |
125,469 | minio/minio | pkg/quick/encoding.go | saveFileConfig | func saveFileConfig(filename string, v interface{}) error {
// Fetch filename's extension
ext := filepath.Ext(filename)
// Marshal data
dataBytes, err := toMarshaller(ext)(v)
if err != nil {
return err
}
if runtime.GOOS == "windows" {
dataBytes = []byte(strings.Replace(string(dataBytes), "\n", "\r\n", -1))
... | go | func saveFileConfig(filename string, v interface{}) error {
// Fetch filename's extension
ext := filepath.Ext(filename)
// Marshal data
dataBytes, err := toMarshaller(ext)(v)
if err != nil {
return err
}
if runtime.GOOS == "windows" {
dataBytes = []byte(strings.Replace(string(dataBytes), "\n", "\r\n", -1))
... | [
"func",
"saveFileConfig",
"(",
"filename",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"// Fetch filename's extension",
"ext",
":=",
"filepath",
".",
"Ext",
"(",
"filename",
")",
"\n",
"// Marshal data",
"dataBytes",
",",
"err",
":=",
"toMars... | // saveFileConfig marshals with the right encoding format
// according to the filename extension, if no extension is
// provided, json will be selected. | [
"saveFileConfig",
"marshals",
"with",
"the",
"right",
"encoding",
"format",
"according",
"to",
"the",
"filename",
"extension",
"if",
"no",
"extension",
"is",
"provided",
"json",
"will",
"be",
"selected",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/quick/encoding.go#L112-L126 |
125,470 | minio/minio | pkg/quick/encoding.go | loadFileConfig | func loadFileConfig(filename string, v interface{}) error {
if _, err := os.Stat(filename); err != nil {
return err
}
fileData, err := ioutil.ReadFile(filename)
if err != nil {
return err
}
if runtime.GOOS == "windows" {
fileData = []byte(strings.Replace(string(fileData), "\r\n", "\n", -1))
}
if err = ch... | go | func loadFileConfig(filename string, v interface{}) error {
if _, err := os.Stat(filename); err != nil {
return err
}
fileData, err := ioutil.ReadFile(filename)
if err != nil {
return err
}
if runtime.GOOS == "windows" {
fileData = []byte(strings.Replace(string(fileData), "\r\n", "\n", -1))
}
if err = ch... | [
"func",
"loadFileConfig",
"(",
"filename",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"filename",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"fileData... | // loadFileConfig unmarshals the file's content with the right
// decoder format according to the filename extension. If no
// extension is provided, json will be selected by default. | [
"loadFileConfig",
"unmarshals",
"the",
"file",
"s",
"content",
"with",
"the",
"right",
"decoder",
"format",
"according",
"to",
"the",
"filename",
"extension",
".",
"If",
"no",
"extension",
"is",
"provided",
"json",
"will",
"be",
"selected",
"by",
"default",
".... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/quick/encoding.go#L181-L199 |
125,471 | minio/minio | cmd/crypto/metadata.go | IsMultiPart | func IsMultiPart(metadata map[string]string) bool {
if _, ok := metadata[SSEMultipart]; ok {
return true
}
return false
} | go | func IsMultiPart(metadata map[string]string) bool {
if _, ok := metadata[SSEMultipart]; ok {
return true
}
return false
} | [
"func",
"IsMultiPart",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
")",
"bool",
"{",
"if",
"_",
",",
"ok",
":=",
"metadata",
"[",
"SSEMultipart",
"]",
";",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // IsMultiPart returns true if the object metadata indicates
// that it was uploaded using some form of server-side-encryption
// and the S3 multipart API. | [
"IsMultiPart",
"returns",
"true",
"if",
"the",
"object",
"metadata",
"indicates",
"that",
"it",
"was",
"uploaded",
"using",
"some",
"form",
"of",
"server",
"-",
"side",
"-",
"encryption",
"and",
"the",
"S3",
"multipart",
"API",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L28-L33 |
125,472 | minio/minio | cmd/crypto/metadata.go | RemoveSSEHeaders | func RemoveSSEHeaders(metadata map[string]string) {
delete(metadata, SSEHeader)
delete(metadata, SSECKeyMD5)
delete(metadata, SSECAlgorithm)
} | go | func RemoveSSEHeaders(metadata map[string]string) {
delete(metadata, SSEHeader)
delete(metadata, SSECKeyMD5)
delete(metadata, SSECAlgorithm)
} | [
"func",
"RemoveSSEHeaders",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
")",
"{",
"delete",
"(",
"metadata",
",",
"SSEHeader",
")",
"\n",
"delete",
"(",
"metadata",
",",
"SSECKeyMD5",
")",
"\n",
"delete",
"(",
"metadata",
",",
"SSECAlgorithm",
")... | // RemoveSSEHeaders removes all crypto-specific SSE
// header entries from the metadata map. | [
"RemoveSSEHeaders",
"removes",
"all",
"crypto",
"-",
"specific",
"SSE",
"header",
"entries",
"from",
"the",
"metadata",
"map",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L45-L49 |
125,473 | minio/minio | cmd/crypto/metadata.go | RemoveInternalEntries | func RemoveInternalEntries(metadata map[string]string) {
delete(metadata, SSEMultipart)
delete(metadata, SSEIV)
delete(metadata, SSESealAlgorithm)
delete(metadata, SSECSealedKey)
delete(metadata, S3SealedKey)
delete(metadata, S3KMSKeyID)
delete(metadata, S3KMSSealedKey)
} | go | func RemoveInternalEntries(metadata map[string]string) {
delete(metadata, SSEMultipart)
delete(metadata, SSEIV)
delete(metadata, SSESealAlgorithm)
delete(metadata, SSECSealedKey)
delete(metadata, S3SealedKey)
delete(metadata, S3KMSKeyID)
delete(metadata, S3KMSSealedKey)
} | [
"func",
"RemoveInternalEntries",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
")",
"{",
"delete",
"(",
"metadata",
",",
"SSEMultipart",
")",
"\n",
"delete",
"(",
"metadata",
",",
"SSEIV",
")",
"\n",
"delete",
"(",
"metadata",
",",
"SSESealAlgorithm"... | // RemoveInternalEntries removes all crypto-specific internal
// metadata entries from the metadata map. | [
"RemoveInternalEntries",
"removes",
"all",
"crypto",
"-",
"specific",
"internal",
"metadata",
"entries",
"from",
"the",
"metadata",
"map",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L53-L61 |
125,474 | minio/minio | cmd/crypto/metadata.go | IsEncrypted | func IsEncrypted(metadata map[string]string) bool {
if _, ok := metadata[SSEIV]; ok {
return true
}
if _, ok := metadata[SSESealAlgorithm]; ok {
return true
}
if IsMultiPart(metadata) {
return true
}
if S3.IsEncrypted(metadata) {
return true
}
if SSEC.IsEncrypted(metadata) {
return true
}
return fa... | go | func IsEncrypted(metadata map[string]string) bool {
if _, ok := metadata[SSEIV]; ok {
return true
}
if _, ok := metadata[SSESealAlgorithm]; ok {
return true
}
if IsMultiPart(metadata) {
return true
}
if S3.IsEncrypted(metadata) {
return true
}
if SSEC.IsEncrypted(metadata) {
return true
}
return fa... | [
"func",
"IsEncrypted",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
")",
"bool",
"{",
"if",
"_",
",",
"ok",
":=",
"metadata",
"[",
"SSEIV",
"]",
";",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"metadata",
"... | // IsEncrypted returns true if the object metadata indicates
// that it was uploaded using some form of server-side-encryption.
//
// IsEncrypted only checks whether the metadata contains at least
// one entry indicating SSE-C or SSE-S3. | [
"IsEncrypted",
"returns",
"true",
"if",
"the",
"object",
"metadata",
"indicates",
"that",
"it",
"was",
"uploaded",
"using",
"some",
"form",
"of",
"server",
"-",
"side",
"-",
"encryption",
".",
"IsEncrypted",
"only",
"checks",
"whether",
"the",
"metadata",
"con... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L68-L85 |
125,475 | minio/minio | cmd/crypto/metadata.go | IsEncrypted | func (s3) IsEncrypted(metadata map[string]string) bool {
if _, ok := metadata[S3SealedKey]; ok {
return true
}
if _, ok := metadata[S3KMSKeyID]; ok {
return true
}
if _, ok := metadata[S3KMSSealedKey]; ok {
return true
}
return false
} | go | func (s3) IsEncrypted(metadata map[string]string) bool {
if _, ok := metadata[S3SealedKey]; ok {
return true
}
if _, ok := metadata[S3KMSKeyID]; ok {
return true
}
if _, ok := metadata[S3KMSSealedKey]; ok {
return true
}
return false
} | [
"func",
"(",
"s3",
")",
"IsEncrypted",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
")",
"bool",
"{",
"if",
"_",
",",
"ok",
":=",
"metadata",
"[",
"S3SealedKey",
"]",
";",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok... | // IsEncrypted returns true if the object metadata indicates
// that the object was uploaded using SSE-S3. | [
"IsEncrypted",
"returns",
"true",
"if",
"the",
"object",
"metadata",
"indicates",
"that",
"the",
"object",
"was",
"uploaded",
"using",
"SSE",
"-",
"S3",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L89-L100 |
125,476 | minio/minio | cmd/crypto/metadata.go | IsEncrypted | func (ssec) IsEncrypted(metadata map[string]string) bool {
if _, ok := metadata[SSECSealedKey]; ok {
return true
}
return false
} | go | func (ssec) IsEncrypted(metadata map[string]string) bool {
if _, ok := metadata[SSECSealedKey]; ok {
return true
}
return false
} | [
"func",
"(",
"ssec",
")",
"IsEncrypted",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
")",
"bool",
"{",
"if",
"_",
",",
"ok",
":=",
"metadata",
"[",
"SSECSealedKey",
"]",
";",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
... | // IsEncrypted returns true if the object metadata indicates
// that the object was uploaded using SSE-C. | [
"IsEncrypted",
"returns",
"true",
"if",
"the",
"object",
"metadata",
"indicates",
"that",
"the",
"object",
"was",
"uploaded",
"using",
"SSE",
"-",
"C",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L104-L109 |
125,477 | minio/minio | cmd/crypto/metadata.go | CreateMultipartMetadata | func CreateMultipartMetadata(metadata map[string]string) map[string]string {
if metadata == nil {
metadata = map[string]string{}
}
metadata[SSEMultipart] = ""
return metadata
} | go | func CreateMultipartMetadata(metadata map[string]string) map[string]string {
if metadata == nil {
metadata = map[string]string{}
}
metadata[SSEMultipart] = ""
return metadata
} | [
"func",
"CreateMultipartMetadata",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"if",
"metadata",
"==",
"nil",
"{",
"metadata",
"=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",... | // CreateMultipartMetadata adds the multipart flag entry to metadata
// and returns modifed metadata. It allocates a new metadata map if
// metadata is nil. | [
"CreateMultipartMetadata",
"adds",
"the",
"multipart",
"flag",
"entry",
"to",
"metadata",
"and",
"returns",
"modifed",
"metadata",
".",
"It",
"allocates",
"a",
"new",
"metadata",
"map",
"if",
"metadata",
"is",
"nil",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L114-L120 |
125,478 | minio/minio | cmd/crypto/metadata.go | CreateMetadata | func (s3) CreateMetadata(metadata map[string]string, keyID string, kmsKey []byte, sealedKey SealedKey) map[string]string {
if sealedKey.Algorithm != SealAlgorithm {
logger.CriticalIf(context.Background(), fmt.Errorf("The seal algorithm '%s' is invalid for SSE-S3", sealedKey.Algorithm))
}
if metadata == nil {
me... | go | func (s3) CreateMetadata(metadata map[string]string, keyID string, kmsKey []byte, sealedKey SealedKey) map[string]string {
if sealedKey.Algorithm != SealAlgorithm {
logger.CriticalIf(context.Background(), fmt.Errorf("The seal algorithm '%s' is invalid for SSE-S3", sealedKey.Algorithm))
}
if metadata == nil {
me... | [
"func",
"(",
"s3",
")",
"CreateMetadata",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
",",
"keyID",
"string",
",",
"kmsKey",
"[",
"]",
"byte",
",",
"sealedKey",
"SealedKey",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"if",
"sealedKey",
".... | // CreateMetadata encodes the keyID, the sealed kms data key and the sealed key
// into the metadata and returns the modified metadata. It allocates a new
// metadata map if metadata is nil. | [
"CreateMetadata",
"encodes",
"the",
"keyID",
"the",
"sealed",
"kms",
"data",
"key",
"and",
"the",
"sealed",
"key",
"into",
"the",
"metadata",
"and",
"returns",
"the",
"modified",
"metadata",
".",
"It",
"allocates",
"a",
"new",
"metadata",
"map",
"if",
"metad... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L125-L139 |
125,479 | minio/minio | cmd/crypto/metadata.go | ParseMetadata | func (s3) ParseMetadata(metadata map[string]string) (keyID string, kmsKey []byte, sealedKey SealedKey, err error) {
// Extract all required values from object metadata
b64IV, ok := metadata[SSEIV]
if !ok {
return keyID, kmsKey, sealedKey, errMissingInternalIV
}
algorithm, ok := metadata[SSESealAlgorithm]
if !ok... | go | func (s3) ParseMetadata(metadata map[string]string) (keyID string, kmsKey []byte, sealedKey SealedKey, err error) {
// Extract all required values from object metadata
b64IV, ok := metadata[SSEIV]
if !ok {
return keyID, kmsKey, sealedKey, errMissingInternalIV
}
algorithm, ok := metadata[SSESealAlgorithm]
if !ok... | [
"func",
"(",
"s3",
")",
"ParseMetadata",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"keyID",
"string",
",",
"kmsKey",
"[",
"]",
"byte",
",",
"sealedKey",
"SealedKey",
",",
"err",
"error",
")",
"{",
"// Extract all required values from ob... | // ParseMetadata extracts all SSE-S3 related values from the object metadata
// and checks whether they are well-formed. It returns the KMS key-ID, the
// sealed KMS key and the sealed object key on success. | [
"ParseMetadata",
"extracts",
"all",
"SSE",
"-",
"S3",
"related",
"values",
"from",
"the",
"object",
"metadata",
"and",
"checks",
"whether",
"they",
"are",
"well",
"-",
"formed",
".",
"It",
"returns",
"the",
"KMS",
"key",
"-",
"ID",
"the",
"sealed",
"KMS",
... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L144-L188 |
125,480 | minio/minio | cmd/crypto/metadata.go | CreateMetadata | func (ssec) CreateMetadata(metadata map[string]string, sealedKey SealedKey) map[string]string {
if sealedKey.Algorithm != SealAlgorithm {
logger.CriticalIf(context.Background(), fmt.Errorf("The seal algorithm '%s' is invalid for SSE-C", sealedKey.Algorithm))
}
if metadata == nil {
metadata = map[string]string{}... | go | func (ssec) CreateMetadata(metadata map[string]string, sealedKey SealedKey) map[string]string {
if sealedKey.Algorithm != SealAlgorithm {
logger.CriticalIf(context.Background(), fmt.Errorf("The seal algorithm '%s' is invalid for SSE-C", sealedKey.Algorithm))
}
if metadata == nil {
metadata = map[string]string{}... | [
"func",
"(",
"ssec",
")",
"CreateMetadata",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
",",
"sealedKey",
"SealedKey",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"if",
"sealedKey",
".",
"Algorithm",
"!=",
"SealAlgorithm",
"{",
"logger",
".",
... | // CreateMetadata encodes the sealed key into the metadata and returns the modified metadata.
// It allocates a new metadata map if metadata is nil. | [
"CreateMetadata",
"encodes",
"the",
"sealed",
"key",
"into",
"the",
"metadata",
"and",
"returns",
"the",
"modified",
"metadata",
".",
"It",
"allocates",
"a",
"new",
"metadata",
"map",
"if",
"metadata",
"is",
"nil",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L192-L204 |
125,481 | minio/minio | cmd/crypto/metadata.go | ParseMetadata | func (ssec) ParseMetadata(metadata map[string]string) (sealedKey SealedKey, err error) {
// Extract all required values from object metadata
b64IV, ok := metadata[SSEIV]
if !ok {
return sealedKey, errMissingInternalIV
}
algorithm, ok := metadata[SSESealAlgorithm]
if !ok {
return sealedKey, errMissingInternalS... | go | func (ssec) ParseMetadata(metadata map[string]string) (sealedKey SealedKey, err error) {
// Extract all required values from object metadata
b64IV, ok := metadata[SSEIV]
if !ok {
return sealedKey, errMissingInternalIV
}
algorithm, ok := metadata[SSESealAlgorithm]
if !ok {
return sealedKey, errMissingInternalS... | [
"func",
"(",
"ssec",
")",
"ParseMetadata",
"(",
"metadata",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"sealedKey",
"SealedKey",
",",
"err",
"error",
")",
"{",
"// Extract all required values from object metadata",
"b64IV",
",",
"ok",
":=",
"metadata",
"[",
... | // ParseMetadata extracts all SSE-C related values from the object metadata
// and checks whether they are well-formed. It returns the sealed object key
// on success. | [
"ParseMetadata",
"extracts",
"all",
"SSE",
"-",
"C",
"related",
"values",
"from",
"the",
"object",
"metadata",
"and",
"checks",
"whether",
"they",
"are",
"well",
"-",
"formed",
".",
"It",
"returns",
"the",
"sealed",
"object",
"key",
"on",
"success",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/crypto/metadata.go#L209-L241 |
125,482 | minio/minio | cmd/fallocate_linux.go | Fallocate | func Fallocate(fd int, offset int64, len int64) error {
// No need to attempt fallocate for 0 length.
if len == 0 {
return nil
}
// Don't extend size of file even if offset + len is
// greater than file size from <bits/fcntl-linux.h>.
fallocFLKeepSize := uint32(1)
return syscall.Fallocate(fd, fallocFLKeepSize,... | go | func Fallocate(fd int, offset int64, len int64) error {
// No need to attempt fallocate for 0 length.
if len == 0 {
return nil
}
// Don't extend size of file even if offset + len is
// greater than file size from <bits/fcntl-linux.h>.
fallocFLKeepSize := uint32(1)
return syscall.Fallocate(fd, fallocFLKeepSize,... | [
"func",
"Fallocate",
"(",
"fd",
"int",
",",
"offset",
"int64",
",",
"len",
"int64",
")",
"error",
"{",
"// No need to attempt fallocate for 0 length.",
"if",
"len",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"// Don't extend size of file even if offset + len ... | // Fallocate uses the linux Fallocate syscall, which helps us to be
// sure that subsequent writes on a file just created will not fail,
// in addition, file allocation will be contigous on the disk | [
"Fallocate",
"uses",
"the",
"linux",
"Fallocate",
"syscall",
"which",
"helps",
"us",
"to",
"be",
"sure",
"that",
"subsequent",
"writes",
"on",
"a",
"file",
"just",
"created",
"will",
"not",
"fail",
"in",
"addition",
"file",
"allocation",
"will",
"be",
"conti... | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/fallocate_linux.go#L26-L35 |
125,483 | minio/minio | cmd/dummy-handlers.go | GetBucketWebsiteHandler | func (api objectAPIHandlers) GetBucketWebsiteHandler(w http.ResponseWriter, r *http.Request) {
writeSuccessResponseHeadersOnly(w)
w.(http.Flusher).Flush()
} | go | func (api objectAPIHandlers) GetBucketWebsiteHandler(w http.ResponseWriter, r *http.Request) {
writeSuccessResponseHeadersOnly(w)
w.(http.Flusher).Flush()
} | [
"func",
"(",
"api",
"objectAPIHandlers",
")",
"GetBucketWebsiteHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"writeSuccessResponseHeadersOnly",
"(",
"w",
")",
"\n",
"w",
".",
"(",
"http",
".",
"Flusher",
... | // GetBucketWebsite - GET bucket website, a dummy api | [
"GetBucketWebsite",
"-",
"GET",
"bucket",
"website",
"a",
"dummy",
"api"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/dummy-handlers.go#L46-L49 |
125,484 | minio/minio | cmd/dummy-handlers.go | GetBucketCorsHandler | func (api objectAPIHandlers) GetBucketCorsHandler(w http.ResponseWriter, r *http.Request) {
ctx := newContext(r, w, "GetBucketCorsHandler")
type corsRule struct {
AllowedHeaders []string `xml:"AllowedHeaders"`
AllowedMethods []allowedMethod `xml:"AllowedMethod"`
AllowedOrigins []string `xml:"Allo... | go | func (api objectAPIHandlers) GetBucketCorsHandler(w http.ResponseWriter, r *http.Request) {
ctx := newContext(r, w, "GetBucketCorsHandler")
type corsRule struct {
AllowedHeaders []string `xml:"AllowedHeaders"`
AllowedMethods []allowedMethod `xml:"AllowedMethod"`
AllowedOrigins []string `xml:"Allo... | [
"func",
"(",
"api",
"objectAPIHandlers",
")",
"GetBucketCorsHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"newContext",
"(",
"r",
",",
"w",
",",
"\"",
"\"",
")",
"\n\n",
"type",
"corsRu... | // GetBucketCorsHandler - GET bucket cors, a dummy api | [
"GetBucketCorsHandler",
"-",
"GET",
"bucket",
"cors",
"a",
"dummy",
"api"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/dummy-handlers.go#L111-L157 |
125,485 | minio/minio | cmd/dummy-handlers.go | GetBucketTaggingHandler | func (api objectAPIHandlers) GetBucketTaggingHandler(w http.ResponseWriter, r *http.Request) {
ctx := newContext(r, w, "GetBucketTagging")
vars := mux.Vars(r)
bucket := vars["bucket"]
objAPI := api.ObjectAPI()
if objAPI == nil {
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL, gu... | go | func (api objectAPIHandlers) GetBucketTaggingHandler(w http.ResponseWriter, r *http.Request) {
ctx := newContext(r, w, "GetBucketTagging")
vars := mux.Vars(r)
bucket := vars["bucket"]
objAPI := api.ObjectAPI()
if objAPI == nil {
writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrServerNotInitialized), r.URL, gu... | [
"func",
"(",
"api",
"objectAPIHandlers",
")",
"GetBucketTaggingHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"newContext",
"(",
"r",
",",
"w",
",",
"\"",
"\"",
")",
"\n\n",
"vars",
":="... | // GetBucketTaggingHandler - GET bucket tagging, a dummy api | [
"GetBucketTaggingHandler",
"-",
"GET",
"bucket",
"tagging",
"a",
"dummy",
"api"
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/dummy-handlers.go#L160-L195 |
125,486 | minio/minio | cmd/gateway/oss/gateway-oss.go | ossGatewayMain | func ossGatewayMain(ctx *cli.Context) {
if ctx.Args().First() == "help" {
cli.ShowCommandHelpAndExit(ctx, ossBackend, 1)
}
// Validate gateway arguments.
host := ctx.Args().First()
logger.FatalIf(minio.ValidateGatewayArguments(ctx.GlobalString("address"), host), "Invalid argument")
minio.StartGateway(ctx, &OS... | go | func ossGatewayMain(ctx *cli.Context) {
if ctx.Args().First() == "help" {
cli.ShowCommandHelpAndExit(ctx, ossBackend, 1)
}
// Validate gateway arguments.
host := ctx.Args().First()
logger.FatalIf(minio.ValidateGatewayArguments(ctx.GlobalString("address"), host), "Invalid argument")
minio.StartGateway(ctx, &OS... | [
"func",
"ossGatewayMain",
"(",
"ctx",
"*",
"cli",
".",
"Context",
")",
"{",
"if",
"ctx",
".",
"Args",
"(",
")",
".",
"First",
"(",
")",
"==",
"\"",
"\"",
"{",
"cli",
".",
"ShowCommandHelpAndExit",
"(",
"ctx",
",",
"ossBackend",
",",
"1",
")",
"\n",... | // Handler for 'minio gateway oss' command line. | [
"Handler",
"for",
"minio",
"gateway",
"oss",
"command",
"line",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L111-L121 |
125,487 | minio/minio | cmd/gateway/oss/gateway-oss.go | NewGatewayLayer | func (g *OSS) NewGatewayLayer(creds auth.Credentials) (minio.ObjectLayer, error) {
var err error
// Regions and endpoints
// https://www.alibabacloud.com/help/doc-detail/31837.htm
if g.host == "" {
g.host = "https://oss.aliyuncs.com"
}
// Initialize oss client object.
client, err := oss.New(g.host, creds.Acc... | go | func (g *OSS) NewGatewayLayer(creds auth.Credentials) (minio.ObjectLayer, error) {
var err error
// Regions and endpoints
// https://www.alibabacloud.com/help/doc-detail/31837.htm
if g.host == "" {
g.host = "https://oss.aliyuncs.com"
}
// Initialize oss client object.
client, err := oss.New(g.host, creds.Acc... | [
"func",
"(",
"g",
"*",
"OSS",
")",
"NewGatewayLayer",
"(",
"creds",
"auth",
".",
"Credentials",
")",
"(",
"minio",
".",
"ObjectLayer",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n\n",
"// Regions and endpoints",
"// https://www.alibabacloud.com/help/doc-deta... | // NewGatewayLayer implements Gateway interface and returns OSS ObjectLayer. | [
"NewGatewayLayer",
"implements",
"Gateway",
"interface",
"and",
"returns",
"OSS",
"ObjectLayer",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L134-L152 |
125,488 | minio/minio | cmd/gateway/oss/gateway-oss.go | ossHeaderToS3Meta | func ossHeaderToS3Meta(header http.Header) map[string]string {
// Decoding technique for each key is used here is as follows
// Each '_' is converted to '-'
// Each '__' is converted to '_'
// With this basic assumption here are some of the expected
// translations for these keys.
// i: 'x_s3cmd__attrs' -> o: 'x-... | go | func ossHeaderToS3Meta(header http.Header) map[string]string {
// Decoding technique for each key is used here is as follows
// Each '_' is converted to '-'
// Each '__' is converted to '_'
// With this basic assumption here are some of the expected
// translations for these keys.
// i: 'x_s3cmd__attrs' -> o: 'x-... | [
"func",
"ossHeaderToS3Meta",
"(",
"header",
"http",
".",
"Header",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"// Decoding technique for each key is used here is as follows",
"// Each '_' is converted to '-'",
"// Each '__' is converted to '_'",
"// With this basic assumption h... | // ossMetaToS3Meta converts OSS metadata to S3 metadata.
// It is the reverse of appendS3MetaToOSSOptions. | [
"ossMetaToS3Meta",
"converts",
"OSS",
"metadata",
"to",
"S3",
"metadata",
".",
"It",
"is",
"the",
"reverse",
"of",
"appendS3MetaToOSSOptions",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L227-L269 |
125,489 | minio/minio | cmd/gateway/oss/gateway-oss.go | ossToObjectError | func ossToObjectError(err error, params ...string) error {
if err == nil {
return nil
}
bucket := ""
object := ""
uploadID := ""
switch len(params) {
case 3:
uploadID = params[2]
fallthrough
case 2:
object = params[1]
fallthrough
case 1:
bucket = params[0]
}
ossErr, ok := err.(oss.ServiceError)... | go | func ossToObjectError(err error, params ...string) error {
if err == nil {
return nil
}
bucket := ""
object := ""
uploadID := ""
switch len(params) {
case 3:
uploadID = params[2]
fallthrough
case 2:
object = params[1]
fallthrough
case 1:
bucket = params[0]
}
ossErr, ok := err.(oss.ServiceError)... | [
"func",
"ossToObjectError",
"(",
"err",
"error",
",",
"params",
"...",
"string",
")",
"error",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"bucket",
":=",
"\"",
"\"",
"\n",
"object",
":=",
"\"",
"\"",
"\n",
"uploadID",
":=... | // ossToObjectError converts OSS errors to minio object layer errors. | [
"ossToObjectError",
"converts",
"OSS",
"errors",
"to",
"minio",
"object",
"layer",
"errors",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L272-L328 |
125,490 | minio/minio | cmd/gateway/oss/gateway-oss.go | ossIsValidBucketName | func ossIsValidBucketName(bucket string) bool {
// dot is not allowed in bucket name
if strings.Contains(bucket, ".") {
return false
}
if s3utils.CheckValidBucketNameStrict(bucket) != nil {
return false
}
return true
} | go | func ossIsValidBucketName(bucket string) bool {
// dot is not allowed in bucket name
if strings.Contains(bucket, ".") {
return false
}
if s3utils.CheckValidBucketNameStrict(bucket) != nil {
return false
}
return true
} | [
"func",
"ossIsValidBucketName",
"(",
"bucket",
"string",
")",
"bool",
"{",
"// dot is not allowed in bucket name",
"if",
"strings",
".",
"Contains",
"(",
"bucket",
",",
"\"",
"\"",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"s3utils",
".",
"CheckValid... | // ossIsValidBucketName verifies whether a bucket name is valid. | [
"ossIsValidBucketName",
"verifies",
"whether",
"a",
"bucket",
"name",
"is",
"valid",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L348-L357 |
125,491 | minio/minio | cmd/gateway/oss/gateway-oss.go | MakeBucketWithLocation | func (l *ossObjects) MakeBucketWithLocation(ctx context.Context, bucket, location string) error {
if !ossIsValidBucketName(bucket) {
logger.LogIf(ctx, minio.BucketNameInvalid{Bucket: bucket})
return minio.BucketNameInvalid{Bucket: bucket}
}
err := l.Client.CreateBucket(bucket)
logger.LogIf(ctx, err)
return os... | go | func (l *ossObjects) MakeBucketWithLocation(ctx context.Context, bucket, location string) error {
if !ossIsValidBucketName(bucket) {
logger.LogIf(ctx, minio.BucketNameInvalid{Bucket: bucket})
return minio.BucketNameInvalid{Bucket: bucket}
}
err := l.Client.CreateBucket(bucket)
logger.LogIf(ctx, err)
return os... | [
"func",
"(",
"l",
"*",
"ossObjects",
")",
"MakeBucketWithLocation",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucket",
",",
"location",
"string",
")",
"error",
"{",
"if",
"!",
"ossIsValidBucketName",
"(",
"bucket",
")",
"{",
"logger",
".",
"LogIf",
"(",... | // MakeBucketWithLocation creates a new container on OSS backend. | [
"MakeBucketWithLocation",
"creates",
"a",
"new",
"container",
"on",
"OSS",
"backend",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L360-L369 |
125,492 | minio/minio | cmd/gateway/oss/gateway-oss.go | ossGeBucketInfo | func ossGeBucketInfo(ctx context.Context, client *oss.Client, bucket string) (bi minio.BucketInfo, err error) {
bgir, err := client.GetBucketInfo(bucket)
if err != nil {
logger.LogIf(ctx, err)
return bi, ossToObjectError(err, bucket)
}
return minio.BucketInfo{
Name: bgir.BucketInfo.Name,
Created: bgir.B... | go | func ossGeBucketInfo(ctx context.Context, client *oss.Client, bucket string) (bi minio.BucketInfo, err error) {
bgir, err := client.GetBucketInfo(bucket)
if err != nil {
logger.LogIf(ctx, err)
return bi, ossToObjectError(err, bucket)
}
return minio.BucketInfo{
Name: bgir.BucketInfo.Name,
Created: bgir.B... | [
"func",
"ossGeBucketInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"oss",
".",
"Client",
",",
"bucket",
"string",
")",
"(",
"bi",
"minio",
".",
"BucketInfo",
",",
"err",
"error",
")",
"{",
"bgir",
",",
"err",
":=",
"client",
".",
"... | // ossGeBucketInfo gets bucket metadata. | [
"ossGeBucketInfo",
"gets",
"bucket",
"metadata",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L372-L383 |
125,493 | minio/minio | cmd/gateway/oss/gateway-oss.go | GetBucketInfo | func (l *ossObjects) GetBucketInfo(ctx context.Context, bucket string) (bi minio.BucketInfo, err error) {
return ossGeBucketInfo(ctx, l.Client, bucket)
} | go | func (l *ossObjects) GetBucketInfo(ctx context.Context, bucket string) (bi minio.BucketInfo, err error) {
return ossGeBucketInfo(ctx, l.Client, bucket)
} | [
"func",
"(",
"l",
"*",
"ossObjects",
")",
"GetBucketInfo",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucket",
"string",
")",
"(",
"bi",
"minio",
".",
"BucketInfo",
",",
"err",
"error",
")",
"{",
"return",
"ossGeBucketInfo",
"(",
"ctx",
",",
"l",
"."... | // GetBucketInfo gets bucket metadata. | [
"GetBucketInfo",
"gets",
"bucket",
"metadata",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L386-L388 |
125,494 | minio/minio | cmd/gateway/oss/gateway-oss.go | ListBuckets | func (l *ossObjects) ListBuckets(ctx context.Context) (buckets []minio.BucketInfo, err error) {
marker := oss.Marker("")
for {
lbr, err := l.Client.ListBuckets(marker)
if err != nil {
logger.LogIf(ctx, err)
return nil, ossToObjectError(err)
}
for _, bi := range lbr.Buckets {
buckets = append(buckets... | go | func (l *ossObjects) ListBuckets(ctx context.Context) (buckets []minio.BucketInfo, err error) {
marker := oss.Marker("")
for {
lbr, err := l.Client.ListBuckets(marker)
if err != nil {
logger.LogIf(ctx, err)
return nil, ossToObjectError(err)
}
for _, bi := range lbr.Buckets {
buckets = append(buckets... | [
"func",
"(",
"l",
"*",
"ossObjects",
")",
"ListBuckets",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"buckets",
"[",
"]",
"minio",
".",
"BucketInfo",
",",
"err",
"error",
")",
"{",
"marker",
":=",
"oss",
".",
"Marker",
"(",
"\"",
"\"",
")",
"\... | // ListBuckets lists all OSS buckets. | [
"ListBuckets",
"lists",
"all",
"OSS",
"buckets",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L391-L414 |
125,495 | minio/minio | cmd/gateway/oss/gateway-oss.go | DeleteBucket | func (l *ossObjects) DeleteBucket(ctx context.Context, bucket string) error {
err := l.Client.DeleteBucket(bucket)
if err != nil {
logger.LogIf(ctx, err)
return ossToObjectError(err, bucket)
}
return nil
} | go | func (l *ossObjects) DeleteBucket(ctx context.Context, bucket string) error {
err := l.Client.DeleteBucket(bucket)
if err != nil {
logger.LogIf(ctx, err)
return ossToObjectError(err, bucket)
}
return nil
} | [
"func",
"(",
"l",
"*",
"ossObjects",
")",
"DeleteBucket",
"(",
"ctx",
"context",
".",
"Context",
",",
"bucket",
"string",
")",
"error",
"{",
"err",
":=",
"l",
".",
"Client",
".",
"DeleteBucket",
"(",
"bucket",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{"... | // DeleteBucket deletes a bucket on OSS. | [
"DeleteBucket",
"deletes",
"a",
"bucket",
"on",
"OSS",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L417-L424 |
125,496 | minio/minio | cmd/gateway/oss/gateway-oss.go | fromOSSClientObjectProperties | func fromOSSClientObjectProperties(bucket string, o oss.ObjectProperties) minio.ObjectInfo {
// NOTE(timonwong): No Content-Type and user defined metadata.
// https://www.alibabacloud.com/help/doc-detail/31965.htm
return minio.ObjectInfo{
Bucket: bucket,
Name: o.Key,
ModTime: o.LastModified,
Size: o.... | go | func fromOSSClientObjectProperties(bucket string, o oss.ObjectProperties) minio.ObjectInfo {
// NOTE(timonwong): No Content-Type and user defined metadata.
// https://www.alibabacloud.com/help/doc-detail/31965.htm
return minio.ObjectInfo{
Bucket: bucket,
Name: o.Key,
ModTime: o.LastModified,
Size: o.... | [
"func",
"fromOSSClientObjectProperties",
"(",
"bucket",
"string",
",",
"o",
"oss",
".",
"ObjectProperties",
")",
"minio",
".",
"ObjectInfo",
"{",
"// NOTE(timonwong): No Content-Type and user defined metadata.",
"// https://www.alibabacloud.com/help/doc-detail/31965.htm",
"return",... | // fromOSSClientObjectProperties converts oss ObjectProperties to ObjectInfo. | [
"fromOSSClientObjectProperties",
"converts",
"oss",
"ObjectProperties",
"to",
"ObjectInfo",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L427-L438 |
125,497 | minio/minio | cmd/gateway/oss/gateway-oss.go | fromOSSClientListObjectsResult | func fromOSSClientListObjectsResult(bucket string, lor oss.ListObjectsResult) minio.ListObjectsInfo {
objects := make([]minio.ObjectInfo, len(lor.Objects))
for i, oi := range lor.Objects {
objects[i] = fromOSSClientObjectProperties(bucket, oi)
}
prefixes := make([]string, len(lor.CommonPrefixes))
copy(prefixes,... | go | func fromOSSClientListObjectsResult(bucket string, lor oss.ListObjectsResult) minio.ListObjectsInfo {
objects := make([]minio.ObjectInfo, len(lor.Objects))
for i, oi := range lor.Objects {
objects[i] = fromOSSClientObjectProperties(bucket, oi)
}
prefixes := make([]string, len(lor.CommonPrefixes))
copy(prefixes,... | [
"func",
"fromOSSClientListObjectsResult",
"(",
"bucket",
"string",
",",
"lor",
"oss",
".",
"ListObjectsResult",
")",
"minio",
".",
"ListObjectsInfo",
"{",
"objects",
":=",
"make",
"(",
"[",
"]",
"minio",
".",
"ObjectInfo",
",",
"len",
"(",
"lor",
".",
"Objec... | // fromOSSClientListObjectsResult converts oss ListBucketResult to ListObjectsInfo. | [
"fromOSSClientListObjectsResult",
"converts",
"oss",
"ListBucketResult",
"to",
"ListObjectsInfo",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L441-L456 |
125,498 | minio/minio | cmd/gateway/oss/gateway-oss.go | ossListObjects | func ossListObjects(ctx context.Context, client *oss.Client, bucket, prefix, marker, delimiter string, maxKeys int) (loi minio.ListObjectsInfo, err error) {
buck, err := client.Bucket(bucket)
if err != nil {
logger.LogIf(ctx, err)
return loi, ossToObjectError(err, bucket)
}
// maxKeys should default to 1000 or... | go | func ossListObjects(ctx context.Context, client *oss.Client, bucket, prefix, marker, delimiter string, maxKeys int) (loi minio.ListObjectsInfo, err error) {
buck, err := client.Bucket(bucket)
if err != nil {
logger.LogIf(ctx, err)
return loi, ossToObjectError(err, bucket)
}
// maxKeys should default to 1000 or... | [
"func",
"ossListObjects",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"oss",
".",
"Client",
",",
"bucket",
",",
"prefix",
",",
"marker",
",",
"delimiter",
"string",
",",
"maxKeys",
"int",
")",
"(",
"loi",
"minio",
".",
"ListObjectsInfo",
"... | // ossListObjects lists all blobs in OSS bucket filtered by prefix. | [
"ossListObjects",
"lists",
"all",
"blobs",
"in",
"OSS",
"bucket",
"filtered",
"by",
"prefix",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L459-L478 |
125,499 | minio/minio | cmd/gateway/oss/gateway-oss.go | ossListObjectsV2 | func ossListObjectsV2(ctx context.Context, client *oss.Client, bucket, prefix, continuationToken, delimiter string, maxKeys int,
fetchOwner bool, startAfter string) (loi minio.ListObjectsV2Info, err error) {
// fetchOwner is not supported and unused.
marker := continuationToken
if marker == "" {
marker = startAft... | go | func ossListObjectsV2(ctx context.Context, client *oss.Client, bucket, prefix, continuationToken, delimiter string, maxKeys int,
fetchOwner bool, startAfter string) (loi minio.ListObjectsV2Info, err error) {
// fetchOwner is not supported and unused.
marker := continuationToken
if marker == "" {
marker = startAft... | [
"func",
"ossListObjectsV2",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"oss",
".",
"Client",
",",
"bucket",
",",
"prefix",
",",
"continuationToken",
",",
"delimiter",
"string",
",",
"maxKeys",
"int",
",",
"fetchOwner",
"bool",
",",
"startAfte... | // ossListObjectsV2 lists all blobs in OSS bucket filtered by prefix. | [
"ossListObjectsV2",
"lists",
"all",
"blobs",
"in",
"OSS",
"bucket",
"filtered",
"by",
"prefix",
"."
] | 4b858b562a0887e10bfd0414dc87e68f1af31c3a | https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/gateway/oss/gateway-oss.go#L481-L501 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.