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,000
mholt/caddy
caddyfile/dispenser.go
Err
func (d *Dispenser) Err(msg string) error { msg = fmt.Sprintf("%s:%d - Error during parsing: %s", d.File(), d.Line(), msg) return errors.New(msg) }
go
func (d *Dispenser) Err(msg string) error { msg = fmt.Sprintf("%s:%d - Error during parsing: %s", d.File(), d.Line(), msg) return errors.New(msg) }
[ "func", "(", "d", "*", "Dispenser", ")", "Err", "(", "msg", "string", ")", "error", "{", "msg", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "d", ".", "File", "(", ")", ",", "d", ".", "Line", "(", ")", ",", "msg", ")", "\n", "return", ...
// Err generates a custom parse-time error with a message of msg.
[ "Err", "generates", "a", "custom", "parse", "-", "time", "error", "with", "a", "message", "of", "msg", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyfile/dispenser.go#L228-L231
125,001
mholt/caddy
caddyfile/dispenser.go
Errf
func (d *Dispenser) Errf(format string, args ...interface{}) error { return d.Err(fmt.Sprintf(format, args...)) }
go
func (d *Dispenser) Errf(format string, args ...interface{}) error { return d.Err(fmt.Sprintf(format, args...)) }
[ "func", "(", "d", "*", "Dispenser", ")", "Errf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "error", "{", "return", "d", ".", "Err", "(", "fmt", ".", "Sprintf", "(", "format", ",", "args", "...", ")", ")", "\n", "}" ...
// Errf is like Err, but for formatted error messages
[ "Errf", "is", "like", "Err", "but", "for", "formatted", "error", "messages" ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyfile/dispenser.go#L234-L236
125,002
mholt/caddy
caddyfile/dispenser.go
numLineBreaks
func (d *Dispenser) numLineBreaks(tknIdx int) int { if tknIdx < 0 || tknIdx >= len(d.tokens) { return 0 } return strings.Count(d.tokens[tknIdx].Text, "\n") }
go
func (d *Dispenser) numLineBreaks(tknIdx int) int { if tknIdx < 0 || tknIdx >= len(d.tokens) { return 0 } return strings.Count(d.tokens[tknIdx].Text, "\n") }
[ "func", "(", "d", "*", "Dispenser", ")", "numLineBreaks", "(", "tknIdx", "int", ")", "int", "{", "if", "tknIdx", "<", "0", "||", "tknIdx", ">=", "len", "(", "d", ".", "tokens", ")", "{", "return", "0", "\n", "}", "\n", "return", "strings", ".", "...
// numLineBreaks counts how many line breaks are in the token // value given by the token index tknIdx. It returns 0 if the // token does not exist or there are no line breaks.
[ "numLineBreaks", "counts", "how", "many", "line", "breaks", "are", "in", "the", "token", "value", "given", "by", "the", "token", "index", "tknIdx", ".", "It", "returns", "0", "if", "the", "token", "does", "not", "exist", "or", "there", "are", "no", "line...
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyfile/dispenser.go#L241-L246
125,003
mholt/caddy
caddyhttp/fastcgi/setup.go
setup
func setup(c *caddy.Controller) error { cfg := httpserver.GetConfig(c) rules, err := fastcgiParse(c) if err != nil { return err } cfg.AddMiddleware(func(next httpserver.Handler) httpserver.Handler { return Handler{ Next: next, Rules: rules, Root: cfg.Root, FileSys:...
go
func setup(c *caddy.Controller) error { cfg := httpserver.GetConfig(c) rules, err := fastcgiParse(c) if err != nil { return err } cfg.AddMiddleware(func(next httpserver.Handler) httpserver.Handler { return Handler{ Next: next, Rules: rules, Root: cfg.Root, FileSys:...
[ "func", "setup", "(", "c", "*", "caddy", ".", "Controller", ")", "error", "{", "cfg", ":=", "httpserver", ".", "GetConfig", "(", "c", ")", "\n\n", "rules", ",", "err", ":=", "fastcgiParse", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// setup configures a new FastCGI middleware instance.
[ "setup", "configures", "a", "new", "FastCGI", "middleware", "instance", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/fastcgi/setup.go#L40-L62
125,004
mholt/caddy
caddyhttp/fastcgi/setup.go
fastcgiPreset
func fastcgiPreset(name string, rule *Rule) error { switch name { case "php": rule.Ext = ".php" rule.SplitPath = ".php" rule.IndexFiles = []string{"index.php"} default: return errors.New(name + " is not a valid preset name") } return nil }
go
func fastcgiPreset(name string, rule *Rule) error { switch name { case "php": rule.Ext = ".php" rule.SplitPath = ".php" rule.IndexFiles = []string{"index.php"} default: return errors.New(name + " is not a valid preset name") } return nil }
[ "func", "fastcgiPreset", "(", "name", "string", ",", "rule", "*", "Rule", ")", "error", "{", "switch", "name", "{", "case", "\"", "\"", ":", "rule", ".", "Ext", "=", "\"", "\"", "\n", "rule", ".", "SplitPath", "=", "\"", "\"", "\n", "rule", ".", ...
// fastcgiPreset configures rule according to name. It returns an error if // name is not a recognized preset name.
[ "fastcgiPreset", "configures", "rule", "according", "to", "name", ".", "It", "returns", "an", "error", "if", "name", "is", "not", "a", "recognized", "preset", "name", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/fastcgi/setup.go#L210-L220
125,005
mholt/caddy
caddyhttp/pprof/setup.go
setup
func setup(c *caddy.Controller) error { found := false for c.Next() { if found { return c.Err("pprof can only be specified once") } if len(c.RemainingArgs()) != 0 { return c.ArgErr() } if c.NextBlock() { return c.ArgErr() } found = true } httpserver.GetConfig(c).AddMiddleware(func(next http...
go
func setup(c *caddy.Controller) error { found := false for c.Next() { if found { return c.Err("pprof can only be specified once") } if len(c.RemainingArgs()) != 0 { return c.ArgErr() } if c.NextBlock() { return c.ArgErr() } found = true } httpserver.GetConfig(c).AddMiddleware(func(next http...
[ "func", "setup", "(", "c", "*", "caddy", ".", "Controller", ")", "error", "{", "found", ":=", "false", "\n\n", "for", "c", ".", "Next", "(", ")", "{", "if", "found", "{", "return", "c", ".", "Err", "(", "\"", "\"", ")", "\n", "}", "\n", "if", ...
// setup returns a new instance of a pprof handler. It accepts no arguments or options.
[ "setup", "returns", "a", "new", "instance", "of", "a", "pprof", "handler", ".", "It", "accepts", "no", "arguments", "or", "options", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/pprof/setup.go#L30-L51
125,006
mholt/caddy
caddyhttp/header/setup.go
setup
func setup(c *caddy.Controller) error { rules, err := headersParse(c) if err != nil { return err } httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler { return Headers{Next: next, Rules: rules} }) return nil }
go
func setup(c *caddy.Controller) error { rules, err := headersParse(c) if err != nil { return err } httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler { return Headers{Next: next, Rules: rules} }) return nil }
[ "func", "setup", "(", "c", "*", "caddy", ".", "Controller", ")", "error", "{", "rules", ",", "err", ":=", "headersParse", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "httpserver", ".", "GetConfig", "(", "...
// setup configures a new Headers middleware instance.
[ "setup", "configures", "a", "new", "Headers", "middleware", "instance", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/header/setup.go#L32-L43
125,007
mholt/caddy
caddyhttp/gzip/responsefilter.go
ShouldCompress
func (l LengthFilter) ShouldCompress(w http.ResponseWriter) bool { contentLength := w.Header().Get("Content-Length") length, err := strconv.ParseInt(contentLength, 10, 64) if err != nil || length == 0 { return false } return l != 0 && int64(l) <= length }
go
func (l LengthFilter) ShouldCompress(w http.ResponseWriter) bool { contentLength := w.Header().Get("Content-Length") length, err := strconv.ParseInt(contentLength, 10, 64) if err != nil || length == 0 { return false } return l != 0 && int64(l) <= length }
[ "func", "(", "l", "LengthFilter", ")", "ShouldCompress", "(", "w", "http", ".", "ResponseWriter", ")", "bool", "{", "contentLength", ":=", "w", ".", "Header", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "length", ",", "err", ":=", "strconv", "....
// ShouldCompress returns if content length is greater than or // equals to minimum length.
[ "ShouldCompress", "returns", "if", "content", "length", "is", "greater", "than", "or", "equals", "to", "minimum", "length", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/gzip/responsefilter.go#L33-L40
125,008
mholt/caddy
caddyhttp/gzip/responsefilter.go
NewResponseFilterWriter
func NewResponseFilterWriter(filters []ResponseFilter, gz *gzipResponseWriter) *ResponseFilterWriter { return &ResponseFilterWriter{filters: filters, gzipResponseWriter: gz} }
go
func NewResponseFilterWriter(filters []ResponseFilter, gz *gzipResponseWriter) *ResponseFilterWriter { return &ResponseFilterWriter{filters: filters, gzipResponseWriter: gz} }
[ "func", "NewResponseFilterWriter", "(", "filters", "[", "]", "ResponseFilter", ",", "gz", "*", "gzipResponseWriter", ")", "*", "ResponseFilterWriter", "{", "return", "&", "ResponseFilterWriter", "{", "filters", ":", "filters", ",", "gzipResponseWriter", ":", "gz", ...
// NewResponseFilterWriter creates and initializes a new ResponseFilterWriter.
[ "NewResponseFilterWriter", "creates", "and", "initializes", "a", "new", "ResponseFilterWriter", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/gzip/responsefilter.go#L67-L69
125,009
mholt/caddy
caddyhttp/gzip/responsefilter.go
WriteHeader
func (r *ResponseFilterWriter) WriteHeader(code int) { // Determine if compression should be used or not. r.shouldCompress = true for _, filter := range r.filters { if !filter.ShouldCompress(r) { r.shouldCompress = false break } } if r.shouldCompress { // replace discard writer with ResponseWriter i...
go
func (r *ResponseFilterWriter) WriteHeader(code int) { // Determine if compression should be used or not. r.shouldCompress = true for _, filter := range r.filters { if !filter.ShouldCompress(r) { r.shouldCompress = false break } } if r.shouldCompress { // replace discard writer with ResponseWriter i...
[ "func", "(", "r", "*", "ResponseFilterWriter", ")", "WriteHeader", "(", "code", "int", ")", "{", "// Determine if compression should be used or not.", "r", ".", "shouldCompress", "=", "true", "\n", "for", "_", ",", "filter", ":=", "range", "r", ".", "filters", ...
// WriteHeader wraps underlying WriteHeader method and // compresses if filters are satisfied.
[ "WriteHeader", "wraps", "underlying", "WriteHeader", "method", "and", "compresses", "if", "filters", "are", "satisfied", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/gzip/responsefilter.go#L73-L95
125,010
mholt/caddy
caddyhttp/gzip/responsefilter.go
Write
func (r *ResponseFilterWriter) Write(b []byte) (int, error) { if !r.statusCodeWritten { r.WriteHeader(http.StatusOK) } if r.shouldCompress { return r.gzipResponseWriter.Write(b) } return r.ResponseWriter.Write(b) }
go
func (r *ResponseFilterWriter) Write(b []byte) (int, error) { if !r.statusCodeWritten { r.WriteHeader(http.StatusOK) } if r.shouldCompress { return r.gzipResponseWriter.Write(b) } return r.ResponseWriter.Write(b) }
[ "func", "(", "r", "*", "ResponseFilterWriter", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "if", "!", "r", ".", "statusCodeWritten", "{", "r", ".", "WriteHeader", "(", "http", ".", "StatusOK", ")", "\n", "}", ...
// Write wraps underlying Write method and compresses if filters // are satisfied
[ "Write", "wraps", "underlying", "Write", "method", "and", "compresses", "if", "filters", "are", "satisfied" ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/gzip/responsefilter.go#L99-L107
125,011
mholt/caddy
caddyhttp/httpserver/condition.go
SetupIfMatcher
func SetupIfMatcher(controller *caddy.Controller) (RequestMatcher, error) { var c = controller.Dispenser // copy the dispenser var matcher IfMatcher for c.NextBlock() { switch c.Val() { case "if": args1 := c.RemainingArgs() if len(args1) != 3 { return matcher, c.ArgErr() } ifc, err := newIfCond(a...
go
func SetupIfMatcher(controller *caddy.Controller) (RequestMatcher, error) { var c = controller.Dispenser // copy the dispenser var matcher IfMatcher for c.NextBlock() { switch c.Val() { case "if": args1 := c.RemainingArgs() if len(args1) != 3 { return matcher, c.ArgErr() } ifc, err := newIfCond(a...
[ "func", "SetupIfMatcher", "(", "controller", "*", "caddy", ".", "Controller", ")", "(", "RequestMatcher", ",", "error", ")", "{", "var", "c", "=", "controller", ".", "Dispenser", "// copy the dispenser", "\n", "var", "matcher", "IfMatcher", "\n", "for", "c", ...
// SetupIfMatcher parses `if` or `if_op` in the current dispenser block. // It returns a RequestMatcher and an error if any.
[ "SetupIfMatcher", "parses", "if", "or", "if_op", "in", "the", "current", "dispenser", "block", ".", "It", "returns", "a", "RequestMatcher", "and", "an", "error", "if", "any", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/condition.go#L28-L59
125,012
mholt/caddy
caddyhttp/httpserver/condition.go
matchFunc
func (i ifCond) matchFunc(a, b string) bool { return i.rex.MatchString(a) }
go
func (i ifCond) matchFunc(a, b string) bool { return i.rex.MatchString(a) }
[ "func", "(", "i", "ifCond", ")", "matchFunc", "(", "a", ",", "b", "string", ")", "bool", "{", "return", "i", ".", "rex", ".", "MatchString", "(", "a", ")", "\n", "}" ]
// matchFunc is condition for Match operator.
[ "matchFunc", "is", "condition", "for", "Match", "operator", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/condition.go#L133-L135
125,013
mholt/caddy
caddyhttp/httpserver/condition.go
Match
func (m IfMatcher) Match(r *http.Request) bool { if m.isOr { return m.Or(r) } return m.And(r) }
go
func (m IfMatcher) Match(r *http.Request) bool { if m.isOr { return m.Or(r) } return m.And(r) }
[ "func", "(", "m", "IfMatcher", ")", "Match", "(", "r", "*", "http", ".", "Request", ")", "bool", "{", "if", "m", ".", "isOr", "{", "return", "m", ".", "Or", "(", "r", ")", "\n", "}", "\n", "return", "m", ".", "And", "(", "r", ")", "\n", "}"...
// Match satisfies RequestMatcher interface. // It returns true if the conditions in m are true.
[ "Match", "satisfies", "RequestMatcher", "interface", ".", "It", "returns", "true", "if", "the", "conditions", "in", "m", "are", "true", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/condition.go#L166-L171
125,014
mholt/caddy
caddyhttp/httpserver/condition.go
And
func (m IfMatcher) And(r *http.Request) bool { for _, i := range m.ifs { if !i.True(r) { return false } } return true }
go
func (m IfMatcher) And(r *http.Request) bool { for _, i := range m.ifs { if !i.True(r) { return false } } return true }
[ "func", "(", "m", "IfMatcher", ")", "And", "(", "r", "*", "http", ".", "Request", ")", "bool", "{", "for", "_", ",", "i", ":=", "range", "m", ".", "ifs", "{", "if", "!", "i", ".", "True", "(", "r", ")", "{", "return", "false", "\n", "}", "\...
// And returns true if all conditions in m are true.
[ "And", "returns", "true", "if", "all", "conditions", "in", "m", "are", "true", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/condition.go#L174-L181
125,015
mholt/caddy
caddyhttp/httpserver/condition.go
IfMatcherKeyword
func IfMatcherKeyword(c *caddy.Controller) bool { if c.Val() == "if" || c.Val() == "if_op" { // clear remaining args c.RemainingArgs() return true } return false }
go
func IfMatcherKeyword(c *caddy.Controller) bool { if c.Val() == "if" || c.Val() == "if_op" { // clear remaining args c.RemainingArgs() return true } return false }
[ "func", "IfMatcherKeyword", "(", "c", "*", "caddy", ".", "Controller", ")", "bool", "{", "if", "c", ".", "Val", "(", ")", "==", "\"", "\"", "||", "c", ".", "Val", "(", ")", "==", "\"", "\"", "{", "// clear remaining args", "c", ".", "RemainingArgs", ...
// IfMatcherKeyword checks if the next value in the dispenser is a keyword for 'if' config block. // If true, remaining arguments in the dispenser are cleared to keep the dispenser valid for use.
[ "IfMatcherKeyword", "checks", "if", "the", "next", "value", "in", "the", "dispenser", "is", "a", "keyword", "for", "if", "config", "block", ".", "If", "true", "remaining", "arguments", "in", "the", "dispenser", "are", "cleared", "to", "keep", "the", "dispens...
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/condition.go#L195-L202
125,016
mholt/caddy
caddyhttp/httpserver/siteconfig.go
AddMiddleware
func (s *SiteConfig) AddMiddleware(m Middleware) { s.middleware = append(s.middleware, m) }
go
func (s *SiteConfig) AddMiddleware(m Middleware) { s.middleware = append(s.middleware, m) }
[ "func", "(", "s", "*", "SiteConfig", ")", "AddMiddleware", "(", "m", "Middleware", ")", "{", "s", ".", "middleware", "=", "append", "(", "s", ".", "middleware", ",", "m", ")", "\n", "}" ]
// AddMiddleware adds a middleware to a site's middleware stack.
[ "AddMiddleware", "adds", "a", "middleware", "to", "a", "site", "s", "middleware", "stack", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/siteconfig.go#L119-L121
125,017
mholt/caddy
caddyhttp/httpserver/siteconfig.go
AddListenerMiddleware
func (s *SiteConfig) AddListenerMiddleware(l ListenerMiddleware) { s.listenerMiddleware = append(s.listenerMiddleware, l) }
go
func (s *SiteConfig) AddListenerMiddleware(l ListenerMiddleware) { s.listenerMiddleware = append(s.listenerMiddleware, l) }
[ "func", "(", "s", "*", "SiteConfig", ")", "AddListenerMiddleware", "(", "l", "ListenerMiddleware", ")", "{", "s", ".", "listenerMiddleware", "=", "append", "(", "s", ".", "listenerMiddleware", ",", "l", ")", "\n", "}" ]
// AddListenerMiddleware adds a listener middleware to a site's listenerMiddleware stack.
[ "AddListenerMiddleware", "adds", "a", "listener", "middleware", "to", "a", "site", "s", "listenerMiddleware", "stack", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/siteconfig.go#L124-L126
125,018
mholt/caddy
caddyhttp/httpserver/vhosttrie.go
matchPath
func (t *vhostTrie) matchPath(remainingPath string) *vhostTrie { var longestMatch *vhostTrie for len(remainingPath) > 0 { ch := string(remainingPath[0]) next, ok := t.edges[ch] if !ok { break } if next.site != nil { longestMatch = next } t = next remainingPath = remainingPath[1:] } return long...
go
func (t *vhostTrie) matchPath(remainingPath string) *vhostTrie { var longestMatch *vhostTrie for len(remainingPath) > 0 { ch := string(remainingPath[0]) next, ok := t.edges[ch] if !ok { break } if next.site != nil { longestMatch = next } t = next remainingPath = remainingPath[1:] } return long...
[ "func", "(", "t", "*", "vhostTrie", ")", "matchPath", "(", "remainingPath", "string", ")", "*", "vhostTrie", "{", "var", "longestMatch", "*", "vhostTrie", "\n", "for", "len", "(", "remainingPath", ")", ">", "0", "{", "ch", ":=", "string", "(", "remaining...
// matchPath traverses t until it finds the longest key matching // remainingPath, and returns its node.
[ "matchPath", "traverses", "t", "until", "it", "finds", "the", "longest", "key", "matching", "remainingPath", "and", "returns", "its", "node", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/vhosttrie.go#L124-L139
125,019
mholt/caddy
caddyhttp/httpserver/vhosttrie.go
splitHostPath
func (t *vhostTrie) splitHostPath(key string) (host, path string) { parts := strings.SplitN(key, "/", 2) host, path = strings.ToLower(parts[0]), "/" if len(parts) > 1 { path += parts[1] } // strip out the port (if present) from the host, since // each port has its own socket, and each socket has its // own lis...
go
func (t *vhostTrie) splitHostPath(key string) (host, path string) { parts := strings.SplitN(key, "/", 2) host, path = strings.ToLower(parts[0]), "/" if len(parts) > 1 { path += parts[1] } // strip out the port (if present) from the host, since // each port has its own socket, and each socket has its // own lis...
[ "func", "(", "t", "*", "vhostTrie", ")", "splitHostPath", "(", "key", "string", ")", "(", "host", ",", "path", "string", ")", "{", "parts", ":=", "strings", ".", "SplitN", "(", "key", ",", "\"", "\"", ",", "2", ")", "\n", "host", ",", "path", "="...
// splitHostPath separates host from path in key.
[ "splitHostPath", "separates", "host", "from", "path", "in", "key", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/vhosttrie.go#L142-L159
125,020
mholt/caddy
caddyhttp/httpserver/vhosttrie.go
String
func (t *vhostTrie) String() string { var s string for host, edge := range t.edges { s += edge.str(host) } return s }
go
func (t *vhostTrie) String() string { var s string for host, edge := range t.edges { s += edge.str(host) } return s }
[ "func", "(", "t", "*", "vhostTrie", ")", "String", "(", ")", "string", "{", "var", "s", "string", "\n", "for", "host", ",", "edge", ":=", "range", "t", ".", "edges", "{", "s", "+=", "edge", ".", "str", "(", "host", ")", "\n", "}", "\n", "return...
// String returns a list of all the entries in t; assumes that // t is a root node.
[ "String", "returns", "a", "list", "of", "all", "the", "entries", "in", "t", ";", "assumes", "that", "t", "is", "a", "root", "node", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/vhosttrie.go#L163-L169
125,021
mholt/caddy
caddyhttp/errors/setup.go
setup
func setup(c *caddy.Controller) error { handler, err := errorsParse(c) if err != nil { return err } handler.Log.Attach(c) httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler { handler.Next = next return handler }) return nil }
go
func setup(c *caddy.Controller) error { handler, err := errorsParse(c) if err != nil { return err } handler.Log.Attach(c) httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler { handler.Next = next return handler }) return nil }
[ "func", "setup", "(", "c", "*", "caddy", ".", "Controller", ")", "error", "{", "handler", ",", "err", ":=", "errorsParse", "(", "c", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "handler", ".", "Log", ".", "Attach...
// setup configures a new errors middleware instance.
[ "setup", "configures", "a", "new", "errors", "middleware", "instance", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/errors/setup.go#L28-L43
125,022
mholt/caddy
caddyhttp/httpserver/logger.go
Println
func (l Logger) Println(args ...interface{}) { l.fileMu.RLock() l.Logger.Println(args...) l.fileMu.RUnlock() }
go
func (l Logger) Println(args ...interface{}) { l.fileMu.RLock() l.Logger.Println(args...) l.fileMu.RUnlock() }
[ "func", "(", "l", "Logger", ")", "Println", "(", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "fileMu", ".", "RLock", "(", ")", "\n", "l", ".", "Logger", ".", "Println", "(", "args", "...", ")", "\n", "l", ".", "fileMu", ".", "RUnl...
// Println wraps underlying logger with mutex
[ "Println", "wraps", "underlying", "logger", "with", "mutex" ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/logger.go#L59-L63
125,023
mholt/caddy
caddyhttp/httpserver/logger.go
Printf
func (l Logger) Printf(format string, args ...interface{}) { l.fileMu.RLock() l.Logger.Printf(format, args...) l.fileMu.RUnlock() }
go
func (l Logger) Printf(format string, args ...interface{}) { l.fileMu.RLock() l.Logger.Printf(format, args...) l.fileMu.RUnlock() }
[ "func", "(", "l", "Logger", ")", "Printf", "(", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "fileMu", ".", "RLock", "(", ")", "\n", "l", ".", "Logger", ".", "Printf", "(", "format", ",", "args", "...", ")", ...
// Printf wraps underlying logger with mutex
[ "Printf", "wraps", "underlying", "logger", "with", "mutex" ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/logger.go#L66-L70
125,024
mholt/caddy
caddyhttp/httpserver/logger.go
Attach
func (l *Logger) Attach(controller *caddy.Controller) { if controller != nil { // Opens file or connect to local/remote syslog controller.OnStartup(l.Start) // Closes file or disconnects from local/remote syslog controller.OnShutdown(l.Close) } }
go
func (l *Logger) Attach(controller *caddy.Controller) { if controller != nil { // Opens file or connect to local/remote syslog controller.OnStartup(l.Start) // Closes file or disconnects from local/remote syslog controller.OnShutdown(l.Close) } }
[ "func", "(", "l", "*", "Logger", ")", "Attach", "(", "controller", "*", "caddy", ".", "Controller", ")", "{", "if", "controller", "!=", "nil", "{", "// Opens file or connect to local/remote syslog", "controller", ".", "OnStartup", "(", "l", ".", "Start", ")", ...
// Attach binds logger Start and Close functions to // controller's OnStartup and OnShutdown hooks.
[ "Attach", "binds", "logger", "Start", "and", "Close", "functions", "to", "controller", "s", "OnStartup", "and", "OnShutdown", "hooks", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/logger.go#L101-L109
125,025
mholt/caddy
caddyhttp/rewrite/rewrite.go
NewSimpleRule
func NewSimpleRule(from, to string, negate bool) (*SimpleRule, error) { r, err := regexp.Compile(from) if err != nil { return nil, err } return &SimpleRule{ Regexp: r, To: to, Negate: negate, }, nil }
go
func NewSimpleRule(from, to string, negate bool) (*SimpleRule, error) { r, err := regexp.Compile(from) if err != nil { return nil, err } return &SimpleRule{ Regexp: r, To: to, Negate: negate, }, nil }
[ "func", "NewSimpleRule", "(", "from", ",", "to", "string", ",", "negate", "bool", ")", "(", "*", "SimpleRule", ",", "error", ")", "{", "r", ",", "err", ":=", "regexp", ".", "Compile", "(", "from", ")", "\n", "if", "err", "!=", "nil", "{", "return",...
// NewSimpleRule creates a new Simple Rule
[ "NewSimpleRule", "creates", "a", "new", "Simple", "Rule" ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/rewrite/rewrite.go#L72-L82
125,026
mholt/caddy
caddyhttp/rewrite/rewrite.go
Match
func (s *SimpleRule) Match(r *http.Request) bool { matches := regexpMatches(s.Regexp, "/", r.URL.Path) if s.Negate { return len(matches) == 0 } return len(matches) > 0 }
go
func (s *SimpleRule) Match(r *http.Request) bool { matches := regexpMatches(s.Regexp, "/", r.URL.Path) if s.Negate { return len(matches) == 0 } return len(matches) > 0 }
[ "func", "(", "s", "*", "SimpleRule", ")", "Match", "(", "r", "*", "http", ".", "Request", ")", "bool", "{", "matches", ":=", "regexpMatches", "(", "s", ".", "Regexp", ",", "\"", "\"", ",", "r", ".", "URL", ".", "Path", ")", "\n", "if", "s", "."...
// Match satisfies httpserver.Config
[ "Match", "satisfies", "httpserver", ".", "Config" ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/rewrite/rewrite.go#L88-L94
125,027
mholt/caddy
caddyhttp/rewrite/rewrite.go
matchExt
func (r ComplexRule) matchExt(rPath string) bool { f := filepath.Base(rPath) ext := path.Ext(f) if ext == "" { ext = "/" } mustUse := false for _, v := range r.Exts { use := true if v[0] == '!' { use = false v = v[1:] } if use { mustUse = true } if ext == v { return use } } retur...
go
func (r ComplexRule) matchExt(rPath string) bool { f := filepath.Base(rPath) ext := path.Ext(f) if ext == "" { ext = "/" } mustUse := false for _, v := range r.Exts { use := true if v[0] == '!' { use = false v = v[1:] } if use { mustUse = true } if ext == v { return use } } retur...
[ "func", "(", "r", "ComplexRule", ")", "matchExt", "(", "rPath", "string", ")", "bool", "{", "f", ":=", "filepath", ".", "Base", "(", "rPath", ")", "\n", "ext", ":=", "path", ".", "Ext", "(", "f", ")", "\n", "if", "ext", "==", "\"", "\"", "{", "...
// matchExt matches rPath against registered file extensions. // Returns true if a match is found and false otherwise.
[ "matchExt", "matches", "rPath", "against", "registered", "file", "extensions", ".", "Returns", "true", "if", "a", "match", "is", "found", "and", "false", "otherwise", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/rewrite/rewrite.go#L222-L247
125,028
mholt/caddy
caddyhttp/gzip/setup.go
setup
func setup(c *caddy.Controller) error { configs, err := gzipParse(c) if err != nil { return err } httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler { return Gzip{Next: next, Configs: configs} }) return nil }
go
func setup(c *caddy.Controller) error { configs, err := gzipParse(c) if err != nil { return err } httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler { return Gzip{Next: next, Configs: configs} }) return nil }
[ "func", "setup", "(", "c", "*", "caddy", ".", "Controller", ")", "error", "{", "configs", ",", "err", ":=", "gzipParse", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "httpserver", ".", "GetConfig", "(", "c...
// setup configures a new gzip middleware instance.
[ "setup", "configures", "a", "new", "gzip", "middleware", "instance", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/gzip/setup.go#L30-L41
125,029
mholt/caddy
caddyhttp/status/setup.go
setup
func setup(c *caddy.Controller) error { rules, err := statusParse(c) if err != nil { return err } cfg := httpserver.GetConfig(c) mid := func(next httpserver.Handler) httpserver.Handler { return Status{Rules: rules, Next: next} } cfg.AddMiddleware(mid) return nil }
go
func setup(c *caddy.Controller) error { rules, err := statusParse(c) if err != nil { return err } cfg := httpserver.GetConfig(c) mid := func(next httpserver.Handler) httpserver.Handler { return Status{Rules: rules, Next: next} } cfg.AddMiddleware(mid) return nil }
[ "func", "setup", "(", "c", "*", "caddy", ".", "Controller", ")", "error", "{", "rules", ",", "err", ":=", "statusParse", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "cfg", ":=", "httpserver", ".", "GetCon...
// setup configures new Status middleware instance.
[ "setup", "configures", "new", "Status", "middleware", "instance", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/status/setup.go#L33-L46
125,030
mholt/caddy
caddyhttp/status/setup.go
statusParse
func statusParse(c *caddy.Controller) ([]httpserver.HandlerConfig, error) { var rules []httpserver.HandlerConfig for c.Next() { hadBlock := false args := c.RemainingArgs() switch len(args) { case 1: status, err := strconv.Atoi(args[0]) if err != nil { return rules, c.Errf("Expecting a numeric stat...
go
func statusParse(c *caddy.Controller) ([]httpserver.HandlerConfig, error) { var rules []httpserver.HandlerConfig for c.Next() { hadBlock := false args := c.RemainingArgs() switch len(args) { case 1: status, err := strconv.Atoi(args[0]) if err != nil { return rules, c.Errf("Expecting a numeric stat...
[ "func", "statusParse", "(", "c", "*", "caddy", ".", "Controller", ")", "(", "[", "]", "httpserver", ".", "HandlerConfig", ",", "error", ")", "{", "var", "rules", "[", "]", "httpserver", ".", "HandlerConfig", "\n\n", "for", "c", ".", "Next", "(", ")", ...
// statusParse parses status directive
[ "statusParse", "parses", "status", "directive" ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/status/setup.go#L49-L107
125,031
mholt/caddy
caddyhttp/header/header.go
delHeader
func (rww *responseWriterWrapper) delHeader(key string) { // remove the existing one if any rww.Header().Del(key) // register a future deletion rww.ops = append(rww.ops, func(h http.Header) { h.Del(key) }) }
go
func (rww *responseWriterWrapper) delHeader(key string) { // remove the existing one if any rww.Header().Del(key) // register a future deletion rww.ops = append(rww.ops, func(h http.Header) { h.Del(key) }) }
[ "func", "(", "rww", "*", "responseWriterWrapper", ")", "delHeader", "(", "key", "string", ")", "{", "// remove the existing one if any", "rww", ".", "Header", "(", ")", ".", "Del", "(", "key", ")", "\n\n", "// register a future deletion", "rww", ".", "ops", "=...
// delHeader deletes the existing header according to the key // Also it will delete that header added later.
[ "delHeader", "deletes", "the", "existing", "header", "according", "to", "the", "key", "Also", "it", "will", "delete", "that", "header", "added", "later", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/header/header.go#L113-L121
125,032
mholt/caddy
caddyhttp/httpserver/responsewriterwrapper.go
Push
func (rww *ResponseWriterWrapper) Push(target string, opts *http.PushOptions) error { if pusher, hasPusher := rww.ResponseWriter.(http.Pusher); hasPusher { return pusher.Push(target, opts) } return NonPusherError{Underlying: rww.ResponseWriter} }
go
func (rww *ResponseWriterWrapper) Push(target string, opts *http.PushOptions) error { if pusher, hasPusher := rww.ResponseWriter.(http.Pusher); hasPusher { return pusher.Push(target, opts) } return NonPusherError{Underlying: rww.ResponseWriter} }
[ "func", "(", "rww", "*", "ResponseWriterWrapper", ")", "Push", "(", "target", "string", ",", "opts", "*", "http", ".", "PushOptions", ")", "error", "{", "if", "pusher", ",", "hasPusher", ":=", "rww", ".", "ResponseWriter", ".", "(", "http", ".", "Pusher"...
// Push implements http.Pusher. // It just inherits the underlying ResponseWriter's Push method. // It panics if the underlying ResponseWriter is not a Pusher.
[ "Push", "implements", "http", ".", "Pusher", ".", "It", "just", "inherits", "the", "underlying", "ResponseWriter", "s", "Push", "method", ".", "It", "panics", "if", "the", "underlying", "ResponseWriter", "is", "not", "a", "Pusher", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/httpserver/responsewriterwrapper.go#L61-L67
125,033
mholt/caddy
controller.go
OnFirstStartup
func (c *Controller) OnFirstStartup(fn func() error) { c.instance.OnFirstStartup = append(c.instance.OnFirstStartup, fn) }
go
func (c *Controller) OnFirstStartup(fn func() error) { c.instance.OnFirstStartup = append(c.instance.OnFirstStartup, fn) }
[ "func", "(", "c", "*", "Controller", ")", "OnFirstStartup", "(", "fn", "func", "(", ")", "error", ")", "{", "c", ".", "instance", ".", "OnFirstStartup", "=", "append", "(", "c", ".", "instance", ".", "OnFirstStartup", ",", "fn", ")", "\n", "}" ]
// OnFirstStartup adds fn to the list of callback functions to execute // when the server is about to be started NOT as part of a restart.
[ "OnFirstStartup", "adds", "fn", "to", "the", "list", "of", "callback", "functions", "to", "execute", "when", "the", "server", "is", "about", "to", "be", "started", "NOT", "as", "part", "of", "a", "restart", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/controller.go#L73-L75
125,034
mholt/caddy
controller.go
OnRestartFailed
func (c *Controller) OnRestartFailed(fn func() error) { c.instance.OnRestartFailed = append(c.instance.OnRestartFailed, fn) }
go
func (c *Controller) OnRestartFailed(fn func() error) { c.instance.OnRestartFailed = append(c.instance.OnRestartFailed, fn) }
[ "func", "(", "c", "*", "Controller", ")", "OnRestartFailed", "(", "fn", "func", "(", ")", "error", ")", "{", "c", ".", "instance", ".", "OnRestartFailed", "=", "append", "(", "c", ".", "instance", ".", "OnRestartFailed", ",", "fn", ")", "\n", "}" ]
// OnRestartFailed adds fn to the list of callback functions to execute // if the server failed to restart.
[ "OnRestartFailed", "adds", "fn", "to", "the", "list", "of", "callback", "functions", "to", "execute", "if", "the", "server", "failed", "to", "restart", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/controller.go#L91-L93
125,035
mholt/caddy
controller.go
Get
func (c *Controller) Get(key interface{}) interface{} { c.instance.StorageMu.RLock() defer c.instance.StorageMu.RUnlock() return c.instance.Storage[key] }
go
func (c *Controller) Get(key interface{}) interface{} { c.instance.StorageMu.RLock() defer c.instance.StorageMu.RUnlock() return c.instance.Storage[key] }
[ "func", "(", "c", "*", "Controller", ")", "Get", "(", "key", "interface", "{", "}", ")", "interface", "{", "}", "{", "c", ".", "instance", ".", "StorageMu", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "instance", ".", "StorageMu", ".", "RUnloc...
// Get safely gets a value from the Instance's storage.
[ "Get", "safely", "gets", "a", "value", "from", "the", "Instance", "s", "storage", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/controller.go#L113-L117
125,036
mholt/caddy
controller.go
Set
func (c *Controller) Set(key, val interface{}) { c.instance.StorageMu.Lock() c.instance.Storage[key] = val c.instance.StorageMu.Unlock() }
go
func (c *Controller) Set(key, val interface{}) { c.instance.StorageMu.Lock() c.instance.Storage[key] = val c.instance.StorageMu.Unlock() }
[ "func", "(", "c", "*", "Controller", ")", "Set", "(", "key", ",", "val", "interface", "{", "}", ")", "{", "c", ".", "instance", ".", "StorageMu", ".", "Lock", "(", ")", "\n", "c", ".", "instance", ".", "Storage", "[", "key", "]", "=", "val", "\...
// Set safely sets a value on the Instance's storage.
[ "Set", "safely", "sets", "a", "value", "on", "the", "Instance", "s", "storage", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/controller.go#L120-L124
125,037
mholt/caddy
caddyhttp/fastcgi/fcgiclient.go
DialWithDialerContext
func DialWithDialerContext(ctx context.Context, network, address string, dialer net.Dialer) (fcgi *FCGIClient, err error) { var conn net.Conn conn, err = dialer.DialContext(ctx, network, address) if err != nil { return } fcgi = &FCGIClient{ rwc: conn, keepAlive: false, reqID: 1, } return }
go
func DialWithDialerContext(ctx context.Context, network, address string, dialer net.Dialer) (fcgi *FCGIClient, err error) { var conn net.Conn conn, err = dialer.DialContext(ctx, network, address) if err != nil { return } fcgi = &FCGIClient{ rwc: conn, keepAlive: false, reqID: 1, } return }
[ "func", "DialWithDialerContext", "(", "ctx", "context", ".", "Context", ",", "network", ",", "address", "string", ",", "dialer", "net", ".", "Dialer", ")", "(", "fcgi", "*", "FCGIClient", ",", "err", "error", ")", "{", "var", "conn", "net", ".", "Conn", ...
// DialWithDialerContext connects to the fcgi responder at the specified network address, using custom net.Dialer // and a context. // See func net.Dial for a description of the network and address parameters.
[ "DialWithDialerContext", "connects", "to", "the", "fcgi", "responder", "at", "the", "specified", "network", "address", "using", "custom", "net", ".", "Dialer", "and", "a", "context", ".", "See", "func", "net", ".", "Dial", "for", "a", "description", "of", "t...
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/fastcgi/fcgiclient.go#L190-L204
125,038
mholt/caddy
caddyhttp/fastcgi/fcgiclient.go
DialContext
func DialContext(ctx context.Context, network, address string) (fcgi *FCGIClient, err error) { return DialWithDialerContext(ctx, network, address, net.Dialer{}) }
go
func DialContext(ctx context.Context, network, address string) (fcgi *FCGIClient, err error) { return DialWithDialerContext(ctx, network, address, net.Dialer{}) }
[ "func", "DialContext", "(", "ctx", "context", ".", "Context", ",", "network", ",", "address", "string", ")", "(", "fcgi", "*", "FCGIClient", ",", "err", "error", ")", "{", "return", "DialWithDialerContext", "(", "ctx", ",", "network", ",", "address", ",", ...
// DialContext is like Dial but passes ctx to dialer.Dial.
[ "DialContext", "is", "like", "Dial", "but", "passes", "ctx", "to", "dialer", ".", "Dial", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/fastcgi/fcgiclient.go#L207-L209
125,039
mholt/caddy
caddyhttp/fastcgi/fcgiclient.go
Dial
func Dial(network, address string) (fcgi *FCGIClient, err error) { return DialContext(context.Background(), network, address) }
go
func Dial(network, address string) (fcgi *FCGIClient, err error) { return DialContext(context.Background(), network, address) }
[ "func", "Dial", "(", "network", ",", "address", "string", ")", "(", "fcgi", "*", "FCGIClient", ",", "err", "error", ")", "{", "return", "DialContext", "(", "context", ".", "Background", "(", ")", ",", "network", ",", "address", ")", "\n", "}" ]
// Dial connects to the fcgi responder at the specified network address, using default net.Dialer. // See func net.Dial for a description of the network and address parameters.
[ "Dial", "connects", "to", "the", "fcgi", "responder", "at", "the", "specified", "network", "address", "using", "default", "net", ".", "Dialer", ".", "See", "func", "net", ".", "Dial", "for", "a", "description", "of", "the", "network", "and", "address", "pa...
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/fastcgi/fcgiclient.go#L213-L215
125,040
mholt/caddy
caddyhttp/fastcgi/fcgiclient.go
Post
func (c *FCGIClient) Post(p map[string]string, method string, bodyType string, body io.Reader, l int64) (resp *http.Response, err error) { if p == nil { p = make(map[string]string) } p["REQUEST_METHOD"] = strings.ToUpper(method) if len(p["REQUEST_METHOD"]) == 0 || p["REQUEST_METHOD"] == "GET" { p["REQUEST_MET...
go
func (c *FCGIClient) Post(p map[string]string, method string, bodyType string, body io.Reader, l int64) (resp *http.Response, err error) { if p == nil { p = make(map[string]string) } p["REQUEST_METHOD"] = strings.ToUpper(method) if len(p["REQUEST_METHOD"]) == 0 || p["REQUEST_METHOD"] == "GET" { p["REQUEST_MET...
[ "func", "(", "c", "*", "FCGIClient", ")", "Post", "(", "p", "map", "[", "string", "]", "string", ",", "method", "string", ",", "bodyType", "string", ",", "body", "io", ".", "Reader", ",", "l", "int64", ")", "(", "resp", "*", "http", ".", "Response"...
// Post issues a POST request to the fcgi responder. with request body // in the format that bodyType specified
[ "Post", "issues", "a", "POST", "request", "to", "the", "fcgi", "responder", ".", "with", "request", "body", "in", "the", "format", "that", "bodyType", "specified" ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddyhttp/fastcgi/fcgiclient.go#L489-L508
125,041
mholt/caddy
caddytls/config.go
NewConfig
func NewConfig(inst *caddy.Instance) (*Config, error) { inst.StorageMu.RLock() certCache, ok := inst.Storage[CertCacheInstStorageKey].(*certmagic.Cache) inst.StorageMu.RUnlock() if !ok || certCache == nil { // set up the clustering plugin, if there is one (and there should always // be one since this tls plugin...
go
func NewConfig(inst *caddy.Instance) (*Config, error) { inst.StorageMu.RLock() certCache, ok := inst.Storage[CertCacheInstStorageKey].(*certmagic.Cache) inst.StorageMu.RUnlock() if !ok || certCache == nil { // set up the clustering plugin, if there is one (and there should always // be one since this tls plugin...
[ "func", "NewConfig", "(", "inst", "*", "caddy", ".", "Instance", ")", "(", "*", "Config", ",", "error", ")", "{", "inst", ".", "StorageMu", ".", "RLock", "(", ")", "\n", "certCache", ",", "ok", ":=", "inst", ".", "Storage", "[", "CertCacheInstStorageKe...
// NewConfig returns a new Config with a pointer to the instance's // certificate cache. You will usually need to set other fields on // the returned Config for successful practical use.
[ "NewConfig", "returns", "a", "new", "Config", "with", "a", "pointer", "to", "the", "instance", "s", "certificate", "cache", ".", "You", "will", "usually", "need", "to", "set", "other", "fields", "on", "the", "returned", "Config", "for", "successful", "practi...
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddytls/config.go#L101-L164
125,042
mholt/caddy
caddytls/config.go
GetSupportedProtocolName
func GetSupportedProtocolName(protocol uint16) (string, error) { for k, v := range SupportedProtocols { if v == protocol { return k, nil } } return "", fmt.Errorf("name: unsupported protocol") }
go
func GetSupportedProtocolName(protocol uint16) (string, error) { for k, v := range SupportedProtocols { if v == protocol { return k, nil } } return "", fmt.Errorf("name: unsupported protocol") }
[ "func", "GetSupportedProtocolName", "(", "protocol", "uint16", ")", "(", "string", ",", "error", ")", "{", "for", "k", ",", "v", ":=", "range", "SupportedProtocols", "{", "if", "v", "==", "protocol", "{", "return", "k", ",", "nil", "\n", "}", "\n", "}"...
// GetSupportedProtocolName returns the protocol name
[ "GetSupportedProtocolName", "returns", "the", "protocol", "name" ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddytls/config.go#L463-L471
125,043
mholt/caddy
caddytls/config.go
GetSupportedCipherName
func GetSupportedCipherName(cipher uint16) (string, error) { for k, v := range SupportedCiphersMap { if v == cipher { return k, nil } } return "", fmt.Errorf("name: unsupported cipher") }
go
func GetSupportedCipherName(cipher uint16) (string, error) { for k, v := range SupportedCiphersMap { if v == cipher { return k, nil } } return "", fmt.Errorf("name: unsupported cipher") }
[ "func", "GetSupportedCipherName", "(", "cipher", "uint16", ")", "(", "string", ",", "error", ")", "{", "for", "k", ",", "v", ":=", "range", "SupportedCiphersMap", "{", "if", "v", "==", "cipher", "{", "return", "k", ",", "nil", "\n", "}", "\n", "}", "...
// GetSupportedCipherName returns the cipher name
[ "GetSupportedCipherName", "returns", "the", "cipher", "name" ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddytls/config.go#L501-L509
125,044
mholt/caddy
caddy.go
Stop
func (i *Instance) Stop() error { // stop the servers for _, s := range i.servers { if gs, ok := s.server.(GracefulServer); ok { if err := gs.Stop(); err != nil { log.Printf("[ERROR] Stopping %s: %v", gs.Address(), err) } } } // splice i out of instance list, causing it to be garbage-collected insta...
go
func (i *Instance) Stop() error { // stop the servers for _, s := range i.servers { if gs, ok := s.server.(GracefulServer); ok { if err := gs.Stop(); err != nil { log.Printf("[ERROR] Stopping %s: %v", gs.Address(), err) } } } // splice i out of instance list, causing it to be garbage-collected insta...
[ "func", "(", "i", "*", "Instance", ")", "Stop", "(", ")", "error", "{", "// stop the servers", "for", "_", ",", "s", ":=", "range", "i", ".", "servers", "{", "if", "gs", ",", "ok", ":=", "s", ".", "server", ".", "(", "GracefulServer", ")", ";", "...
// Stop stops all servers contained in i. It does NOT // execute shutdown callbacks.
[ "Stop", "stops", "all", "servers", "contained", "in", "i", ".", "It", "does", "NOT", "execute", "shutdown", "callbacks", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddy.go#L137-L158
125,045
mholt/caddy
caddy.go
SaveServer
func (i *Instance) SaveServer(s Server, ln net.Listener) { i.servers = append(i.servers, ServerListener{server: s, listener: ln}) }
go
func (i *Instance) SaveServer(s Server, ln net.Listener) { i.servers = append(i.servers, ServerListener{server: s, listener: ln}) }
[ "func", "(", "i", "*", "Instance", ")", "SaveServer", "(", "s", "Server", ",", "ln", "net", ".", "Listener", ")", "{", "i", ".", "servers", "=", "append", "(", "i", ".", "servers", ",", "ServerListener", "{", "server", ":", "s", ",", "listener", ":...
// SaveServer adds s and its associated listener ln to the // internally-kept list of servers that is running. For // saved servers, graceful restarts will be provided.
[ "SaveServer", "adds", "s", "and", "its", "associated", "listener", "ln", "to", "the", "internally", "-", "kept", "list", "of", "servers", "that", "is", "running", ".", "For", "saved", "servers", "graceful", "restarts", "will", "be", "provided", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddy.go#L275-L277
125,046
mholt/caddy
caddy.go
CaddyfileFromPipe
func CaddyfileFromPipe(f *os.File, serverType string) (Input, error) { fi, err := f.Stat() if err == nil && fi.Mode()&os.ModeCharDevice == 0 { // Note that a non-nil error is not a problem. Windows // will not create a stdin if there is no pipe, which // produces an error when calling Stat(). But Unix will //...
go
func CaddyfileFromPipe(f *os.File, serverType string) (Input, error) { fi, err := f.Stat() if err == nil && fi.Mode()&os.ModeCharDevice == 0 { // Note that a non-nil error is not a problem. Windows // will not create a stdin if there is no pipe, which // produces an error when calling Stat(). But Unix will //...
[ "func", "CaddyfileFromPipe", "(", "f", "*", "os", ".", "File", ",", "serverType", "string", ")", "(", "Input", ",", "error", ")", "{", "fi", ",", "err", ":=", "f", ".", "Stat", "(", ")", "\n", "if", "err", "==", "nil", "&&", "fi", ".", "Mode", ...
// CaddyfileFromPipe loads the Caddyfile input from f if f is // not interactive input. f is assumed to be a pipe or stream, // such as os.Stdin. If f is not a pipe, no error is returned // but the Input value will be nil. An error is only returned // if there was an error reading the pipe, even if the length // of wha...
[ "CaddyfileFromPipe", "loads", "the", "Caddyfile", "input", "from", "f", "if", "f", "is", "not", "interactive", "input", ".", "f", "is", "assumed", "to", "be", "a", "pipe", "or", "stream", "such", "as", "os", ".", "Stdin", ".", "If", "f", "is", "not", ...
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddy.go#L438-L461
125,047
mholt/caddy
caddy.go
Stop
func Stop() error { // This awkward for loop is to avoid a deadlock since // inst.Stop() also acquires the instancesMu lock. for { instancesMu.Lock() if len(instances) == 0 { instancesMu.Unlock() break } inst := instances[0] instancesMu.Unlock() if err := inst.Stop(); err != nil { log.Printf("[E...
go
func Stop() error { // This awkward for loop is to avoid a deadlock since // inst.Stop() also acquires the instancesMu lock. for { instancesMu.Lock() if len(instances) == 0 { instancesMu.Unlock() break } inst := instances[0] instancesMu.Unlock() if err := inst.Stop(); err != nil { log.Printf("[E...
[ "func", "Stop", "(", ")", "error", "{", "// This awkward for loop is to avoid a deadlock since", "// inst.Stop() also acquires the instancesMu lock.", "for", "{", "instancesMu", ".", "Lock", "(", ")", "\n", "if", "len", "(", "instances", ")", "==", "0", "{", "instance...
// Stop stops ALL servers. It blocks until they are all stopped. // It does NOT execute shutdown callbacks, and it deletes all // instances after stopping is completed. Do not re-use any // references to old instances after calling Stop.
[ "Stop", "stops", "ALL", "servers", ".", "It", "blocks", "until", "they", "are", "all", "stopped", ".", "It", "does", "NOT", "execute", "shutdown", "callbacks", "and", "it", "deletes", "all", "instances", "after", "stopping", "is", "completed", ".", "Do", "...
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddy.go#L874-L890
125,048
mholt/caddy
caddy.go
writePidFile
func writePidFile() error { if PidFile == "" { return nil } pid := []byte(strconv.Itoa(os.Getpid()) + "\n") return ioutil.WriteFile(PidFile, pid, 0644) }
go
func writePidFile() error { if PidFile == "" { return nil } pid := []byte(strconv.Itoa(os.Getpid()) + "\n") return ioutil.WriteFile(PidFile, pid, 0644) }
[ "func", "writePidFile", "(", ")", "error", "{", "if", "PidFile", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n", "pid", ":=", "[", "]", "byte", "(", "strconv", ".", "Itoa", "(", "os", ".", "Getpid", "(", ")", ")", "+", "\"", "\\n", "\"...
// writePidFile writes the process ID to the file at PidFile. // It does nothing if PidFile is not set.
[ "writePidFile", "writes", "the", "process", "ID", "to", "the", "file", "at", "PidFile", ".", "It", "does", "nothing", "if", "PidFile", "is", "not", "set", "." ]
a2ed91bc45c8b3faa1577ed4c18334d38a581ca7
https://github.com/mholt/caddy/blob/a2ed91bc45c8b3faa1577ed4c18334d38a581ca7/caddy.go#L997-L1003
125,049
minio/minio
cmd/logger/target/console/console.go
Send
func (c *Target) Send(e interface{}) error { entry, ok := e.(log.Entry) if !ok { return fmt.Errorf("Uexpected log entry structure %#v", e) } if logger.IsJSON() { logJSON, err := json.Marshal(&entry) if err != nil { return err } fmt.Println(string(logJSON)) return nil } traceLength := len(entry.Tra...
go
func (c *Target) Send(e interface{}) error { entry, ok := e.(log.Entry) if !ok { return fmt.Errorf("Uexpected log entry structure %#v", e) } if logger.IsJSON() { logJSON, err := json.Marshal(&entry) if err != nil { return err } fmt.Println(string(logJSON)) return nil } traceLength := len(entry.Tra...
[ "func", "(", "c", "*", "Target", ")", "Send", "(", "e", "interface", "{", "}", ")", "error", "{", "entry", ",", "ok", ":=", "e", ".", "(", "log", ".", "Entry", ")", "\n", "if", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ...
// Send log message 'e' to console
[ "Send", "log", "message", "e", "to", "console" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/logger/target/console/console.go#L34-L103
125,050
minio/minio
cmd/common-main.go
loadLoggers
func loadLoggers() { auditEndpoint, ok := os.LookupEnv("MINIO_AUDIT_LOGGER_HTTP_ENDPOINT") if ok { // Enable audit HTTP logging through ENV. logger.AddAuditTarget(http.New(auditEndpoint, NewCustomHTTPTransport())) } loggerEndpoint, ok := os.LookupEnv("MINIO_LOGGER_HTTP_ENDPOINT") if ok { // Enable HTTP logg...
go
func loadLoggers() { auditEndpoint, ok := os.LookupEnv("MINIO_AUDIT_LOGGER_HTTP_ENDPOINT") if ok { // Enable audit HTTP logging through ENV. logger.AddAuditTarget(http.New(auditEndpoint, NewCustomHTTPTransport())) } loggerEndpoint, ok := os.LookupEnv("MINIO_LOGGER_HTTP_ENDPOINT") if ok { // Enable HTTP logg...
[ "func", "loadLoggers", "(", ")", "{", "auditEndpoint", ",", "ok", ":=", "os", ".", "LookupEnv", "(", "\"", "\"", ")", "\n", "if", "ok", "{", "// Enable audit HTTP logging through ENV.", "logger", ".", "AddAuditTarget", "(", "http", ".", "New", "(", "auditEnd...
// Load logger targets based on user's configuration
[ "Load", "logger", "targets", "based", "on", "user", "s", "configuration" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/common-main.go#L54-L79
125,051
minio/minio
cmd/common-main.go
parseCompressIncludes
func parseCompressIncludes(includes []string) ([]string, error) { for _, e := range includes { if len(e) == 0 { return nil, uiErrInvalidCompressionIncludesValue(nil).Msg("extension/mime-type (%s) cannot be empty", e) } } return includes, nil }
go
func parseCompressIncludes(includes []string) ([]string, error) { for _, e := range includes { if len(e) == 0 { return nil, uiErrInvalidCompressionIncludesValue(nil).Msg("extension/mime-type (%s) cannot be empty", e) } } return includes, nil }
[ "func", "parseCompressIncludes", "(", "includes", "[", "]", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "for", "_", ",", "e", ":=", "range", "includes", "{", "if", "len", "(", "e", ")", "==", "0", "{", "return", "nil", ",", "u...
// Parses the given compression exclude list `extensions` or `content-types`.
[ "Parses", "the", "given", "compression", "exclude", "list", "extensions", "or", "content", "-", "types", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/common-main.go#L167-L174
125,052
minio/minio
cmd/lock-rest-server.go
LockHandler
func (l *lockRESTServer) LockHandler(w http.ResponseWriter, r *http.Request) { if !l.IsValid(w, r) { l.writeErrorResponse(w, errors.New("Invalid request")) return } ctx := newContext(r, w, "Lock") var lockArgs dsync.LockArgs if r.ContentLength < 0 { l.writeErrorResponse(w, errInvalidArgument) return } ...
go
func (l *lockRESTServer) LockHandler(w http.ResponseWriter, r *http.Request) { if !l.IsValid(w, r) { l.writeErrorResponse(w, errors.New("Invalid request")) return } ctx := newContext(r, w, "Lock") var lockArgs dsync.LockArgs if r.ContentLength < 0 { l.writeErrorResponse(w, errInvalidArgument) return } ...
[ "func", "(", "l", "*", "lockRESTServer", ")", "LockHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "if", "!", "l", ".", "IsValid", "(", "w", ",", "r", ")", "{", "l", ".", "writeErrorResponse", "("...
// LockHandler - Acquires a lock.
[ "LockHandler", "-", "Acquires", "a", "lock", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/lock-rest-server.go#L64-L92
125,053
minio/minio
cmd/lock-rest-server.go
ExpiredHandler
func (l *lockRESTServer) ExpiredHandler(w http.ResponseWriter, r *http.Request) { if !l.IsValid(w, r) { l.writeErrorResponse(w, errors.New("Invalid request")) return } ctx := newContext(r, w, "Expired") var lockArgs dsync.LockArgs if r.ContentLength < 0 { l.writeErrorResponse(w, errInvalidArgument) retur...
go
func (l *lockRESTServer) ExpiredHandler(w http.ResponseWriter, r *http.Request) { if !l.IsValid(w, r) { l.writeErrorResponse(w, errors.New("Invalid request")) return } ctx := newContext(r, w, "Expired") var lockArgs dsync.LockArgs if r.ContentLength < 0 { l.writeErrorResponse(w, errInvalidArgument) retur...
[ "func", "(", "l", "*", "lockRESTServer", ")", "ExpiredHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "if", "!", "l", ".", "IsValid", "(", "w", ",", "r", ")", "{", "l", ".", "writeErrorResponse", ...
// ExpiredHandler - query expired lock status.
[ "ExpiredHandler", "-", "query", "expired", "lock", "status", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/lock-rest-server.go#L217-L254
125,054
minio/minio
cmd/lock-rest-server.go
startLockMaintenance
func startLockMaintenance(lkSrv *lockRESTServer) { // Initialize a new ticker with a minute between each ticks. ticker := time.NewTicker(lockMaintenanceInterval) // Stop the timer upon service closure and cleanup the go-routine. defer ticker.Stop() // Start with random sleep time, so as to avoid "synchronous chec...
go
func startLockMaintenance(lkSrv *lockRESTServer) { // Initialize a new ticker with a minute between each ticks. ticker := time.NewTicker(lockMaintenanceInterval) // Stop the timer upon service closure and cleanup the go-routine. defer ticker.Stop() // Start with random sleep time, so as to avoid "synchronous chec...
[ "func", "startLockMaintenance", "(", "lkSrv", "*", "lockRESTServer", ")", "{", "// Initialize a new ticker with a minute between each ticks.", "ticker", ":=", "time", ".", "NewTicker", "(", "lockMaintenanceInterval", ")", "\n", "// Stop the timer upon service closure and cleanup ...
// Start lock maintenance from all lock servers.
[ "Start", "lock", "maintenance", "from", "all", "lock", "servers", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/lock-rest-server.go#L304-L321
125,055
minio/minio
cmd/lock-rest-server.go
registerLockRESTHandlers
func registerLockRESTHandlers(router *mux.Router) { subrouter := router.PathPrefix(lockRESTPath).Subrouter() subrouter.Methods(http.MethodPost).Path("/" + lockRESTMethodLock).HandlerFunc(httpTraceHdrs(globalLockServer.LockHandler)) subrouter.Methods(http.MethodPost).Path("/" + lockRESTMethodRLock).HandlerFunc(httpTr...
go
func registerLockRESTHandlers(router *mux.Router) { subrouter := router.PathPrefix(lockRESTPath).Subrouter() subrouter.Methods(http.MethodPost).Path("/" + lockRESTMethodLock).HandlerFunc(httpTraceHdrs(globalLockServer.LockHandler)) subrouter.Methods(http.MethodPost).Path("/" + lockRESTMethodRLock).HandlerFunc(httpTr...
[ "func", "registerLockRESTHandlers", "(", "router", "*", "mux", ".", "Router", ")", "{", "subrouter", ":=", "router", ".", "PathPrefix", "(", "lockRESTPath", ")", ".", "Subrouter", "(", ")", "\n", "subrouter", ".", "Methods", "(", "http", ".", "MethodPost", ...
// registerLockRESTHandlers - register lock rest router.
[ "registerLockRESTHandlers", "-", "register", "lock", "rest", "router", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/lock-rest-server.go#L324-L336
125,056
minio/minio
cmd/endpoint-ellipses.go
getDivisibleSize
func getDivisibleSize(totalSizes []uint64) (result uint64) { gcd := func(x, y uint64) uint64 { for y != 0 { x, y = y, x%y } return x } result = totalSizes[0] for i := 1; i < len(totalSizes); i++ { result = gcd(result, totalSizes[i]) } return result }
go
func getDivisibleSize(totalSizes []uint64) (result uint64) { gcd := func(x, y uint64) uint64 { for y != 0 { x, y = y, x%y } return x } result = totalSizes[0] for i := 1; i < len(totalSizes); i++ { result = gcd(result, totalSizes[i]) } return result }
[ "func", "getDivisibleSize", "(", "totalSizes", "[", "]", "uint64", ")", "(", "result", "uint64", ")", "{", "gcd", ":=", "func", "(", "x", ",", "y", "uint64", ")", "uint64", "{", "for", "y", "!=", "0", "{", "x", ",", "y", "=", "y", ",", "x", "%"...
// getDivisibleSize - returns a greatest common divisor of // all the ellipses sizes.
[ "getDivisibleSize", "-", "returns", "a", "greatest", "common", "divisor", "of", "all", "the", "ellipses", "sizes", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/endpoint-ellipses.go#L51-L63
125,057
minio/minio
cmd/endpoint-ellipses.go
getEndpoints
func (s endpointSet) getEndpoints() (endpoints []string) { if len(s.endpoints) != 0 { return s.endpoints } for _, argPattern := range s.argPatterns { for _, lbls := range argPattern.Expand() { endpoints = append(endpoints, strings.Join(lbls, "")) } } s.endpoints = endpoints return endpoints }
go
func (s endpointSet) getEndpoints() (endpoints []string) { if len(s.endpoints) != 0 { return s.endpoints } for _, argPattern := range s.argPatterns { for _, lbls := range argPattern.Expand() { endpoints = append(endpoints, strings.Join(lbls, "")) } } s.endpoints = endpoints return endpoints }
[ "func", "(", "s", "endpointSet", ")", "getEndpoints", "(", ")", "(", "endpoints", "[", "]", "string", ")", "{", "if", "len", "(", "s", ".", "endpoints", ")", "!=", "0", "{", "return", "s", ".", "endpoints", "\n", "}", "\n", "for", "_", ",", "argP...
// Returns all the expanded endpoints, each argument is expanded separately.
[ "Returns", "all", "the", "expanded", "endpoints", "each", "argument", "is", "expanded", "separately", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/endpoint-ellipses.go#L151-L162
125,058
minio/minio
cmd/endpoint-ellipses.go
Get
func (s endpointSet) Get() (sets [][]string) { var k = uint64(0) endpoints := s.getEndpoints() for i := range s.setIndexes { for j := range s.setIndexes[i] { sets = append(sets, endpoints[k:s.setIndexes[i][j]+k]) k = s.setIndexes[i][j] + k } } return sets }
go
func (s endpointSet) Get() (sets [][]string) { var k = uint64(0) endpoints := s.getEndpoints() for i := range s.setIndexes { for j := range s.setIndexes[i] { sets = append(sets, endpoints[k:s.setIndexes[i][j]+k]) k = s.setIndexes[i][j] + k } } return sets }
[ "func", "(", "s", "endpointSet", ")", "Get", "(", ")", "(", "sets", "[", "]", "[", "]", "string", ")", "{", "var", "k", "=", "uint64", "(", "0", ")", "\n", "endpoints", ":=", "s", ".", "getEndpoints", "(", ")", "\n", "for", "i", ":=", "range", ...
// Get returns the sets representation of the endpoints // this function also intelligently decides on what will // be the right set size etc.
[ "Get", "returns", "the", "sets", "representation", "of", "the", "endpoints", "this", "function", "also", "intelligently", "decides", "on", "what", "will", "be", "the", "right", "set", "size", "etc", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/endpoint-ellipses.go#L167-L178
125,059
minio/minio
cmd/endpoint-ellipses.go
getTotalSizes
func getTotalSizes(argPatterns []ellipses.ArgPattern) []uint64 { var totalSizes []uint64 for _, argPattern := range argPatterns { var totalSize uint64 = 1 for _, p := range argPattern { totalSize = totalSize * uint64(len(p.Seq)) } totalSizes = append(totalSizes, totalSize) } return totalSizes }
go
func getTotalSizes(argPatterns []ellipses.ArgPattern) []uint64 { var totalSizes []uint64 for _, argPattern := range argPatterns { var totalSize uint64 = 1 for _, p := range argPattern { totalSize = totalSize * uint64(len(p.Seq)) } totalSizes = append(totalSizes, totalSize) } return totalSizes }
[ "func", "getTotalSizes", "(", "argPatterns", "[", "]", "ellipses", ".", "ArgPattern", ")", "[", "]", "uint64", "{", "var", "totalSizes", "[", "]", "uint64", "\n", "for", "_", ",", "argPattern", ":=", "range", "argPatterns", "{", "var", "totalSize", "uint64...
// Return the total size for each argument patterns.
[ "Return", "the", "total", "size", "for", "each", "argument", "patterns", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/endpoint-ellipses.go#L181-L191
125,060
minio/minio
cmd/endpoint-ellipses.go
parseEndpointSet
func parseEndpointSet(args ...string) (ep endpointSet, err error) { var argPatterns = make([]ellipses.ArgPattern, len(args)) for i, arg := range args { patterns, perr := ellipses.FindEllipsesPatterns(arg) if perr != nil { return endpointSet{}, uiErrInvalidErasureEndpoints(nil).Msg(perr.Error()) } argPatter...
go
func parseEndpointSet(args ...string) (ep endpointSet, err error) { var argPatterns = make([]ellipses.ArgPattern, len(args)) for i, arg := range args { patterns, perr := ellipses.FindEllipsesPatterns(arg) if perr != nil { return endpointSet{}, uiErrInvalidErasureEndpoints(nil).Msg(perr.Error()) } argPatter...
[ "func", "parseEndpointSet", "(", "args", "...", "string", ")", "(", "ep", "endpointSet", ",", "err", "error", ")", "{", "var", "argPatterns", "=", "make", "(", "[", "]", "ellipses", ".", "ArgPattern", ",", "len", "(", "args", ")", ")", "\n", "for", "...
// Parses all arguments and returns an endpointSet which is a collection // of endpoints following the ellipses pattern, this is what is used // by the object layer for initializing itself.
[ "Parses", "all", "arguments", "and", "returns", "an", "endpointSet", "which", "is", "a", "collection", "of", "endpoints", "following", "the", "ellipses", "pattern", "this", "is", "what", "is", "used", "by", "the", "object", "layer", "for", "initializing", "its...
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/endpoint-ellipses.go#L196-L214
125,061
minio/minio
cmd/endpoint-ellipses.go
createServerEndpoints
func createServerEndpoints(serverAddr string, args ...string) (string, EndpointList, SetupType, int, int, error) { setArgs, err := getAllSets(args...) if err != nil { return serverAddr, nil, -1, 0, 0, err } var endpoints EndpointList var setupType SetupType serverAddr, endpoints, setupType, err = CreateEndpoin...
go
func createServerEndpoints(serverAddr string, args ...string) (string, EndpointList, SetupType, int, int, error) { setArgs, err := getAllSets(args...) if err != nil { return serverAddr, nil, -1, 0, 0, err } var endpoints EndpointList var setupType SetupType serverAddr, endpoints, setupType, err = CreateEndpoin...
[ "func", "createServerEndpoints", "(", "serverAddr", "string", ",", "args", "...", "string", ")", "(", "string", ",", "EndpointList", ",", "SetupType", ",", "int", ",", "int", ",", "error", ")", "{", "setArgs", ",", "err", ":=", "getAllSets", "(", "args", ...
// CreateServerEndpoints - validates and creates new endpoints from input args, supports // both ellipses and without ellipses transparently.
[ "CreateServerEndpoints", "-", "validates", "and", "creates", "new", "endpoints", "from", "input", "args", "supports", "both", "ellipses", "and", "without", "ellipses", "transparently", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/endpoint-ellipses.go#L268-L282
125,062
minio/minio
cmd/handler-utils.go
parseLocationConstraint
func parseLocationConstraint(r *http.Request) (location string, s3Error APIErrorCode) { // If the request has no body with content-length set to 0, // we do not have to validate location constraint. Bucket will // be created at default region. locationConstraint := createBucketLocationConfiguration{} err := xmlDec...
go
func parseLocationConstraint(r *http.Request) (location string, s3Error APIErrorCode) { // If the request has no body with content-length set to 0, // we do not have to validate location constraint. Bucket will // be created at default region. locationConstraint := createBucketLocationConfiguration{} err := xmlDec...
[ "func", "parseLocationConstraint", "(", "r", "*", "http", ".", "Request", ")", "(", "location", "string", ",", "s3Error", "APIErrorCode", ")", "{", "// If the request has no body with content-length set to 0,", "// we do not have to validate location constraint. Bucket will", "...
// Parses location constraint from the incoming reader.
[ "Parses", "location", "constraint", "from", "the", "incoming", "reader", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L37-L53
125,063
minio/minio
cmd/handler-utils.go
isMetadataDirectiveValid
func isMetadataDirectiveValid(h http.Header) bool { _, ok := h[http.CanonicalHeaderKey("X-Amz-Metadata-Directive")] if ok { // Check atleast set metadata-directive is valid. return (isMetadataCopy(h) || isMetadataReplace(h)) } // By default if x-amz-metadata-directive is not we // treat it as 'COPY' this funct...
go
func isMetadataDirectiveValid(h http.Header) bool { _, ok := h[http.CanonicalHeaderKey("X-Amz-Metadata-Directive")] if ok { // Check atleast set metadata-directive is valid. return (isMetadataCopy(h) || isMetadataReplace(h)) } // By default if x-amz-metadata-directive is not we // treat it as 'COPY' this funct...
[ "func", "isMetadataDirectiveValid", "(", "h", "http", ".", "Header", ")", "bool", "{", "_", ",", "ok", ":=", "h", "[", "http", ".", "CanonicalHeaderKey", "(", "\"", "\"", ")", "]", "\n", "if", "ok", "{", "// Check atleast set metadata-directive is valid.", "...
// isMetadataDirectiveValid - check if metadata-directive is valid.
[ "isMetadataDirectiveValid", "-", "check", "if", "metadata", "-", "directive", "is", "valid", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L74-L83
125,064
minio/minio
cmd/handler-utils.go
path2BucketAndObject
func path2BucketAndObject(path string) (bucket, object string) { // Skip the first element if it is '/', split the rest. path = strings.TrimPrefix(path, "/") pathComponents := strings.SplitN(path, "/", 2) // Save the bucket and object extracted from path. switch len(pathComponents) { case 1: bucket = pathCompo...
go
func path2BucketAndObject(path string) (bucket, object string) { // Skip the first element if it is '/', split the rest. path = strings.TrimPrefix(path, "/") pathComponents := strings.SplitN(path, "/", 2) // Save the bucket and object extracted from path. switch len(pathComponents) { case 1: bucket = pathCompo...
[ "func", "path2BucketAndObject", "(", "path", "string", ")", "(", "bucket", ",", "object", "string", ")", "{", "// Skip the first element if it is '/', split the rest.", "path", "=", "strings", ".", "TrimPrefix", "(", "path", ",", "\"", "\"", ")", "\n", "pathCompon...
// Splits an incoming path into bucket and object components.
[ "Splits", "an", "incoming", "path", "into", "bucket", "and", "object", "components", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L96-L110
125,065
minio/minio
cmd/handler-utils.go
extractMetadata
func extractMetadata(ctx context.Context, r *http.Request) (metadata map[string]string, err error) { query := r.URL.Query() header := r.Header metadata = make(map[string]string) // Extract all query values. err = extractMetadataFromMap(ctx, query, metadata) if err != nil { return nil, err } // Extract all he...
go
func extractMetadata(ctx context.Context, r *http.Request) (metadata map[string]string, err error) { query := r.URL.Query() header := r.Header metadata = make(map[string]string) // Extract all query values. err = extractMetadataFromMap(ctx, query, metadata) if err != nil { return nil, err } // Extract all he...
[ "func", "extractMetadata", "(", "ctx", "context", ".", "Context", ",", "r", "*", "http", ".", "Request", ")", "(", "metadata", "map", "[", "string", "]", "string", ",", "err", "error", ")", "{", "query", ":=", "r", ".", "URL", ".", "Query", "(", ")...
// extractMetadata extracts metadata from HTTP header and HTTP queryString.
[ "extractMetadata", "extracts", "metadata", "from", "HTTP", "header", "and", "HTTP", "queryString", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L121-L144
125,066
minio/minio
cmd/handler-utils.go
extractMetadataFromMap
func extractMetadataFromMap(ctx context.Context, v map[string][]string, m map[string]string) error { if v == nil { logger.LogIf(ctx, errInvalidArgument) return errInvalidArgument } // Save all supported headers. for _, supportedHeader := range supportedHeaders { if value, ok := v[http.CanonicalHeaderKey(suppo...
go
func extractMetadataFromMap(ctx context.Context, v map[string][]string, m map[string]string) error { if v == nil { logger.LogIf(ctx, errInvalidArgument) return errInvalidArgument } // Save all supported headers. for _, supportedHeader := range supportedHeaders { if value, ok := v[http.CanonicalHeaderKey(suppo...
[ "func", "extractMetadataFromMap", "(", "ctx", "context", ".", "Context", ",", "v", "map", "[", "string", "]", "[", "]", "string", ",", "m", "map", "[", "string", "]", "string", ")", "error", "{", "if", "v", "==", "nil", "{", "logger", ".", "LogIf", ...
// extractMetadata extracts metadata from map values.
[ "extractMetadata", "extracts", "metadata", "from", "map", "values", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L147-L173
125,067
minio/minio
cmd/handler-utils.go
getRedirectPostRawQuery
func getRedirectPostRawQuery(objInfo ObjectInfo) string { redirectValues := make(url.Values) redirectValues.Set("bucket", objInfo.Bucket) redirectValues.Set("key", objInfo.Name) redirectValues.Set("etag", "\""+objInfo.ETag+"\"") return redirectValues.Encode() }
go
func getRedirectPostRawQuery(objInfo ObjectInfo) string { redirectValues := make(url.Values) redirectValues.Set("bucket", objInfo.Bucket) redirectValues.Set("key", objInfo.Name) redirectValues.Set("etag", "\""+objInfo.ETag+"\"") return redirectValues.Encode() }
[ "func", "getRedirectPostRawQuery", "(", "objInfo", "ObjectInfo", ")", "string", "{", "redirectValues", ":=", "make", "(", "url", ".", "Values", ")", "\n", "redirectValues", ".", "Set", "(", "\"", "\"", ",", "objInfo", ".", "Bucket", ")", "\n", "redirectValue...
// The Query string for the redirect URL the client is // redirected on successful upload.
[ "The", "Query", "string", "for", "the", "redirect", "URL", "the", "client", "is", "redirected", "on", "successful", "upload", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L177-L183
125,068
minio/minio
cmd/handler-utils.go
getReqAccessCred
func getReqAccessCred(r *http.Request, region string) (cred auth.Credentials) { cred, _, _ = getReqAccessKeyV4(r, region, serviceS3) if cred.AccessKey == "" { cred, _, _ = getReqAccessKeyV2(r) } if cred.AccessKey == "" { claims, owner, _ := webRequestAuthenticate(r) if owner { return globalServerConfig.Get...
go
func getReqAccessCred(r *http.Request, region string) (cred auth.Credentials) { cred, _, _ = getReqAccessKeyV4(r, region, serviceS3) if cred.AccessKey == "" { cred, _, _ = getReqAccessKeyV2(r) } if cred.AccessKey == "" { claims, owner, _ := webRequestAuthenticate(r) if owner { return globalServerConfig.Get...
[ "func", "getReqAccessCred", "(", "r", "*", "http", ".", "Request", ",", "region", "string", ")", "(", "cred", "auth", ".", "Credentials", ")", "{", "cred", ",", "_", ",", "_", "=", "getReqAccessKeyV4", "(", "r", ",", "region", ",", "serviceS3", ")", ...
// Returns access credentials in the request Authorization header.
[ "Returns", "access", "credentials", "in", "the", "request", "Authorization", "header", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L186-L199
125,069
minio/minio
cmd/handler-utils.go
extractReqParams
func extractReqParams(r *http.Request) map[string]string { if r == nil { return nil } region := globalServerConfig.GetRegion() cred := getReqAccessCred(r, region) // Success. return map[string]string{ "region": region, "accessKey": cred.AccessKey, "sourceIPAddress": handlers.GetSourceIP(r...
go
func extractReqParams(r *http.Request) map[string]string { if r == nil { return nil } region := globalServerConfig.GetRegion() cred := getReqAccessCred(r, region) // Success. return map[string]string{ "region": region, "accessKey": cred.AccessKey, "sourceIPAddress": handlers.GetSourceIP(r...
[ "func", "extractReqParams", "(", "r", "*", "http", ".", "Request", ")", "map", "[", "string", "]", "string", "{", "if", "r", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "region", ":=", "globalServerConfig", ".", "GetRegion", "(", ")", "\n", ...
// Extract request params to be sent with event notifiation.
[ "Extract", "request", "params", "to", "be", "sent", "with", "event", "notifiation", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L202-L217
125,070
minio/minio
cmd/handler-utils.go
extractRespElements
func extractRespElements(w http.ResponseWriter) map[string]string { return map[string]string{ "requestId": w.Header().Get(responseRequestIDKey), "content-length": w.Header().Get("Content-Length"), // Add more fields here. } }
go
func extractRespElements(w http.ResponseWriter) map[string]string { return map[string]string{ "requestId": w.Header().Get(responseRequestIDKey), "content-length": w.Header().Get("Content-Length"), // Add more fields here. } }
[ "func", "extractRespElements", "(", "w", "http", ".", "ResponseWriter", ")", "map", "[", "string", "]", "string", "{", "return", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "w", ".", "Header", "(", ")", ".", "Get", "(", "responseRequestI...
// Extract response elements to be sent with event notifiation.
[ "Extract", "response", "elements", "to", "be", "sent", "with", "event", "notifiation", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L220-L227
125,071
minio/minio
cmd/handler-utils.go
validateFormFieldSize
func validateFormFieldSize(ctx context.Context, formValues http.Header) error { // Iterate over form values for k := range formValues { // Check if value's field exceeds S3 limit if int64(len(formValues.Get(k))) > maxFormFieldSize { logger.LogIf(ctx, errSizeUnexpected) return errSizeUnexpected } } // S...
go
func validateFormFieldSize(ctx context.Context, formValues http.Header) error { // Iterate over form values for k := range formValues { // Check if value's field exceeds S3 limit if int64(len(formValues.Get(k))) > maxFormFieldSize { logger.LogIf(ctx, errSizeUnexpected) return errSizeUnexpected } } // S...
[ "func", "validateFormFieldSize", "(", "ctx", "context", ".", "Context", ",", "formValues", "http", ".", "Header", ")", "error", "{", "// Iterate over form values", "for", "k", ":=", "range", "formValues", "{", "// Check if value's field exceeds S3 limit", "if", "int64...
// Validate form field size for s3 specification requirement.
[ "Validate", "form", "field", "size", "for", "s3", "specification", "requirement", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L247-L259
125,072
minio/minio
cmd/handler-utils.go
extractPostPolicyFormValues
func extractPostPolicyFormValues(ctx context.Context, form *multipart.Form) (filePart io.ReadCloser, fileName string, fileSize int64, formValues http.Header, err error) { /// HTML Form values fileName = "" // Canonicalize the form values into http.Header. formValues = make(http.Header) for k, v := range form.Valu...
go
func extractPostPolicyFormValues(ctx context.Context, form *multipart.Form) (filePart io.ReadCloser, fileName string, fileSize int64, formValues http.Header, err error) { /// HTML Form values fileName = "" // Canonicalize the form values into http.Header. formValues = make(http.Header) for k, v := range form.Valu...
[ "func", "extractPostPolicyFormValues", "(", "ctx", "context", ".", "Context", ",", "form", "*", "multipart", ".", "Form", ")", "(", "filePart", "io", ".", "ReadCloser", ",", "fileName", "string", ",", "fileSize", "int64", ",", "formValues", "http", ".", "Hea...
// Extract form fields and file data from a HTTP POST Policy
[ "Extract", "form", "fields", "and", "file", "data", "from", "a", "HTTP", "POST", "Policy" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L262-L325
125,073
minio/minio
cmd/handler-utils.go
httpTraceAll
func httpTraceAll(f http.HandlerFunc) http.HandlerFunc { if globalHTTPTraceFile == nil { return f } return httptracer.TraceReqHandlerFunc(f, globalHTTPTraceFile, true) }
go
func httpTraceAll(f http.HandlerFunc) http.HandlerFunc { if globalHTTPTraceFile == nil { return f } return httptracer.TraceReqHandlerFunc(f, globalHTTPTraceFile, true) }
[ "func", "httpTraceAll", "(", "f", "http", ".", "HandlerFunc", ")", "http", ".", "HandlerFunc", "{", "if", "globalHTTPTraceFile", "==", "nil", "{", "return", "f", "\n", "}", "\n", "return", "httptracer", ".", "TraceReqHandlerFunc", "(", "f", ",", "globalHTTPT...
// Log headers and body.
[ "Log", "headers", "and", "body", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L328-L333
125,074
minio/minio
cmd/handler-utils.go
httpTraceHdrs
func httpTraceHdrs(f http.HandlerFunc) http.HandlerFunc { if globalHTTPTraceFile == nil { return f } return httptracer.TraceReqHandlerFunc(f, globalHTTPTraceFile, false) }
go
func httpTraceHdrs(f http.HandlerFunc) http.HandlerFunc { if globalHTTPTraceFile == nil { return f } return httptracer.TraceReqHandlerFunc(f, globalHTTPTraceFile, false) }
[ "func", "httpTraceHdrs", "(", "f", "http", ".", "HandlerFunc", ")", "http", ".", "HandlerFunc", "{", "if", "globalHTTPTraceFile", "==", "nil", "{", "return", "f", "\n", "}", "\n", "return", "httptracer", ".", "TraceReqHandlerFunc", "(", "f", ",", "globalHTTP...
// Log only the headers.
[ "Log", "only", "the", "headers", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L336-L341
125,075
minio/minio
cmd/handler-utils.go
notFoundHandlerJSON
func notFoundHandlerJSON(w http.ResponseWriter, r *http.Request) { writeErrorResponseJSON(context.Background(), w, errorCodes.ToAPIErr(ErrMethodNotAllowed), r.URL) }
go
func notFoundHandlerJSON(w http.ResponseWriter, r *http.Request) { writeErrorResponseJSON(context.Background(), w, errorCodes.ToAPIErr(ErrMethodNotAllowed), r.URL) }
[ "func", "notFoundHandlerJSON", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "writeErrorResponseJSON", "(", "context", ".", "Background", "(", ")", ",", "w", ",", "errorCodes", ".", "ToAPIErr", "(", "ErrMethodNotAl...
// If none of the http routes match respond with MethodNotAllowed, in JSON
[ "If", "none", "of", "the", "http", "routes", "match", "respond", "with", "MethodNotAllowed", "in", "JSON" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L371-L373
125,076
minio/minio
cmd/handler-utils.go
notFoundHandler
func notFoundHandler(w http.ResponseWriter, r *http.Request) { writeErrorResponse(context.Background(), w, errorCodes.ToAPIErr(ErrMethodNotAllowed), r.URL, guessIsBrowserReq(r)) }
go
func notFoundHandler(w http.ResponseWriter, r *http.Request) { writeErrorResponse(context.Background(), w, errorCodes.ToAPIErr(ErrMethodNotAllowed), r.URL, guessIsBrowserReq(r)) }
[ "func", "notFoundHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "writeErrorResponse", "(", "context", ".", "Background", "(", ")", ",", "w", ",", "errorCodes", ".", "ToAPIErr", "(", "ErrMethodNotAllowed", ...
// If none of the http routes match respond with MethodNotAllowed
[ "If", "none", "of", "the", "http", "routes", "match", "respond", "with", "MethodNotAllowed" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/cmd/handler-utils.go#L376-L378
125,077
minio/minio
pkg/certs/certs.go
New
func New(certFile, keyFile string, loadCert LoadX509KeyPairFunc) (*Certs, error) { certFileIsLink, err := checkSymlink(certFile) if err != nil { return nil, err } keyFileIsLink, err := checkSymlink(keyFile) if err != nil { return nil, err } c := &Certs{ certFile: certFile, keyFile: keyFile, loadCert: ...
go
func New(certFile, keyFile string, loadCert LoadX509KeyPairFunc) (*Certs, error) { certFileIsLink, err := checkSymlink(certFile) if err != nil { return nil, err } keyFileIsLink, err := checkSymlink(keyFile) if err != nil { return nil, err } c := &Certs{ certFile: certFile, keyFile: keyFile, loadCert: ...
[ "func", "New", "(", "certFile", ",", "keyFile", "string", ",", "loadCert", "LoadX509KeyPairFunc", ")", "(", "*", "Certs", ",", "error", ")", "{", "certFileIsLink", ",", "err", ":=", "checkSymlink", "(", "certFile", ")", "\n", "if", "err", "!=", "nil", "{...
// New initializes a new certs monitor.
[ "New", "initializes", "a", "new", "certs", "monitor", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/certs/certs.go#L50-L79
125,078
minio/minio
pkg/certs/certs.go
watchSymlinks
func (c *Certs) watchSymlinks() (err error) { c.Lock() c.cert, err = c.loadCert(c.certFile, c.keyFile) c.Unlock() if err != nil { return err } go func() { for { select { case <-c.e: // Once stopped exits this routine. return case <-time.After(24 * time.Hour): cert, cerr := c.loadCert(c.ce...
go
func (c *Certs) watchSymlinks() (err error) { c.Lock() c.cert, err = c.loadCert(c.certFile, c.keyFile) c.Unlock() if err != nil { return err } go func() { for { select { case <-c.e: // Once stopped exits this routine. return case <-time.After(24 * time.Hour): cert, cerr := c.loadCert(c.ce...
[ "func", "(", "c", "*", "Certs", ")", "watchSymlinks", "(", ")", "(", "err", "error", ")", "{", "c", ".", "Lock", "(", ")", "\n", "c", ".", "cert", ",", "err", "=", "c", ".", "loadCert", "(", "c", ".", "certFile", ",", "c", ".", "keyFile", ")"...
// watchSymlinks reloads symlinked files since fsnotify cannot watch // on symbolic links.
[ "watchSymlinks", "reloads", "symlinked", "files", "since", "fsnotify", "cannot", "watch", "on", "symbolic", "links", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/certs/certs.go#L91-L116
125,079
minio/minio
pkg/certs/certs.go
GetCertificate
func (c *Certs) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error) { c.RLock() defer c.RUnlock() return &c.cert, nil }
go
func (c *Certs) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error) { c.RLock() defer c.RUnlock() return &c.cert, nil }
[ "func", "(", "c", "*", "Certs", ")", "GetCertificate", "(", "hello", "*", "tls", ".", "ClientHelloInfo", ")", "(", "*", "tls", ".", "Certificate", ",", "error", ")", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", ...
// GetCertificate returns the loaded certificate for use by // the TLSConfig fields GetCertificate field in a http.Server.
[ "GetCertificate", "returns", "the", "loaded", "certificate", "for", "use", "by", "the", "TLSConfig", "fields", "GetCertificate", "field", "in", "a", "http", ".", "Server", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/certs/certs.go#L177-L181
125,080
minio/minio
pkg/s3select/parquet/reader.go
NewReader
func NewReader(getReaderFunc func(offset, length int64) (io.ReadCloser, error), args *ReaderArgs) (*Reader, error) { reader, err := parquetgo.NewReader(getReaderFunc, nil) if err != nil { if err != io.EOF { return nil, errParquetParsingError(err) } return nil, err } return &Reader{ args: args, read...
go
func NewReader(getReaderFunc func(offset, length int64) (io.ReadCloser, error), args *ReaderArgs) (*Reader, error) { reader, err := parquetgo.NewReader(getReaderFunc, nil) if err != nil { if err != io.EOF { return nil, errParquetParsingError(err) } return nil, err } return &Reader{ args: args, read...
[ "func", "NewReader", "(", "getReaderFunc", "func", "(", "offset", ",", "length", "int64", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", ",", "args", "*", "ReaderArgs", ")", "(", "*", "Reader", ",", "error", ")", "{", "reader", ",", "err", ":=...
// NewReader - creates new Parquet reader using readerFunc callback.
[ "NewReader", "-", "creates", "new", "Parquet", "reader", "using", "readerFunc", "callback", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/parquet/reader.go#L86-L100
125,081
minio/minio
pkg/policy/condition/boolfunc.go
NewBoolFunc
func NewBoolFunc(key Key, value string) (Function, error) { return &booleanFunc{key, value}, nil }
go
func NewBoolFunc(key Key, value string) (Function, error) { return &booleanFunc{key, value}, nil }
[ "func", "NewBoolFunc", "(", "key", "Key", ",", "value", "string", ")", "(", "Function", ",", "error", ")", "{", "return", "&", "booleanFunc", "{", "key", ",", "value", "}", ",", "nil", "\n", "}" ]
// NewBoolFunc - returns new Bool function.
[ "NewBoolFunc", "-", "returns", "new", "Bool", "function", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/policy/condition/boolfunc.go#L103-L105
125,082
minio/minio
pkg/s3select/sql/value.go
GetTypeString
func (v *Value) GetTypeString() string { switch v.vType { case typeNull: return "NULL" case typeBool: return "BOOL" case typeString: return "STRING" case typeInt: return "INT" case typeFloat: return "FLOAT" case typeTimestamp: return "TIMESTAMP" case typeBytes: return "BYTES" } return "--" }
go
func (v *Value) GetTypeString() string { switch v.vType { case typeNull: return "NULL" case typeBool: return "BOOL" case typeString: return "STRING" case typeInt: return "INT" case typeFloat: return "FLOAT" case typeTimestamp: return "TIMESTAMP" case typeBytes: return "BYTES" } return "--" }
[ "func", "(", "v", "*", "Value", ")", "GetTypeString", "(", ")", "string", "{", "switch", "v", ".", "vType", "{", "case", "typeNull", ":", "return", "\"", "\"", "\n", "case", "typeBool", ":", "return", "\"", "\"", "\n", "case", "typeString", ":", "ret...
// GetTypeString returns a string representation for vType
[ "GetTypeString", "returns", "a", "string", "representation", "for", "vType" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L72-L90
125,083
minio/minio
pkg/s3select/sql/value.go
Repr
func (v *Value) Repr() string { switch v.vType { case typeNull: return ":NULL" case typeBool, typeInt, typeFloat: return fmt.Sprintf("%v:%s", v.value, v.GetTypeString()) case typeTimestamp: return fmt.Sprintf("%s:TIMESTAMP", v.value.(*time.Time)) case typeString: return fmt.Sprintf("\"%s\":%s", v.value.(st...
go
func (v *Value) Repr() string { switch v.vType { case typeNull: return ":NULL" case typeBool, typeInt, typeFloat: return fmt.Sprintf("%v:%s", v.value, v.GetTypeString()) case typeTimestamp: return fmt.Sprintf("%s:TIMESTAMP", v.value.(*time.Time)) case typeString: return fmt.Sprintf("\"%s\":%s", v.value.(st...
[ "func", "(", "v", "*", "Value", ")", "Repr", "(", ")", "string", "{", "switch", "v", ".", "vType", "{", "case", "typeNull", ":", "return", "\"", "\"", "\n", "case", "typeBool", ",", "typeInt", ",", "typeFloat", ":", "return", "fmt", ".", "Sprintf", ...
// Repr returns a string representation of value.
[ "Repr", "returns", "a", "string", "representation", "of", "value", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L93-L108
125,084
minio/minio
pkg/s3select/sql/value.go
FromTimestamp
func FromTimestamp(t time.Time) *Value { return &Value{value: t, vType: typeTimestamp} }
go
func FromTimestamp(t time.Time) *Value { return &Value{value: t, vType: typeTimestamp} }
[ "func", "FromTimestamp", "(", "t", "time", ".", "Time", ")", "*", "Value", "{", "return", "&", "Value", "{", "value", ":", "t", ",", "vType", ":", "typeTimestamp", "}", "\n", "}" ]
// FromTimestamp creates a Value from a timestamp
[ "FromTimestamp", "creates", "a", "Value", "from", "a", "timestamp" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L131-L133
125,085
minio/minio
pkg/s3select/sql/value.go
ToFloat
func (v *Value) ToFloat() (val float64, ok bool) { switch v.vType { case typeFloat: val, ok = v.value.(float64) case typeInt: var i int64 i, ok = v.value.(int64) val = float64(i) default: } return }
go
func (v *Value) ToFloat() (val float64, ok bool) { switch v.vType { case typeFloat: val, ok = v.value.(float64) case typeInt: var i int64 i, ok = v.value.(int64) val = float64(i) default: } return }
[ "func", "(", "v", "*", "Value", ")", "ToFloat", "(", ")", "(", "val", "float64", ",", "ok", "bool", ")", "{", "switch", "v", ".", "vType", "{", "case", "typeFloat", ":", "val", ",", "ok", "=", "v", ".", "value", ".", "(", "float64", ")", "\n", ...
// ToFloat works for int and float values
[ "ToFloat", "works", "for", "int", "and", "float", "values" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L146-L157
125,086
minio/minio
pkg/s3select/sql/value.go
ToInt
func (v *Value) ToInt() (val int64, ok bool) { switch v.vType { case typeInt: val, ok = v.value.(int64) default: } return }
go
func (v *Value) ToInt() (val int64, ok bool) { switch v.vType { case typeInt: val, ok = v.value.(int64) default: } return }
[ "func", "(", "v", "*", "Value", ")", "ToInt", "(", ")", "(", "val", "int64", ",", "ok", "bool", ")", "{", "switch", "v", ".", "vType", "{", "case", "typeInt", ":", "val", ",", "ok", "=", "v", ".", "value", ".", "(", "int64", ")", "\n", "defau...
// ToInt converts value to int.
[ "ToInt", "converts", "value", "to", "int", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L160-L167
125,087
minio/minio
pkg/s3select/sql/value.go
ToString
func (v *Value) ToString() (val string, ok bool) { switch v.vType { case typeString: val, ok = v.value.(string) default: } return }
go
func (v *Value) ToString() (val string, ok bool) { switch v.vType { case typeString: val, ok = v.value.(string) default: } return }
[ "func", "(", "v", "*", "Value", ")", "ToString", "(", ")", "(", "val", "string", ",", "ok", "bool", ")", "{", "switch", "v", ".", "vType", "{", "case", "typeString", ":", "val", ",", "ok", "=", "v", ".", "value", ".", "(", "string", ")", "\n", ...
// ToString converts value to string.
[ "ToString", "converts", "value", "to", "string", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L170-L177
125,088
minio/minio
pkg/s3select/sql/value.go
ToBool
func (v *Value) ToBool() (val bool, ok bool) { switch v.vType { case typeBool: return v.value.(bool), true } return false, false }
go
func (v *Value) ToBool() (val bool, ok bool) { switch v.vType { case typeBool: return v.value.(bool), true } return false, false }
[ "func", "(", "v", "*", "Value", ")", "ToBool", "(", ")", "(", "val", "bool", ",", "ok", "bool", ")", "{", "switch", "v", ".", "vType", "{", "case", "typeBool", ":", "return", "v", ".", "value", ".", "(", "bool", ")", ",", "true", "\n", "}", "...
// ToBool returns the bool value; second return value refers to if the bool // conversion succeeded.
[ "ToBool", "returns", "the", "bool", "value", ";", "second", "return", "value", "refers", "to", "if", "the", "bool", "conversion", "succeeded", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L181-L187
125,089
minio/minio
pkg/s3select/sql/value.go
ToTimestamp
func (v *Value) ToTimestamp() (t time.Time, ok bool) { switch v.vType { case typeTimestamp: return v.value.(time.Time), true } return t, false }
go
func (v *Value) ToTimestamp() (t time.Time, ok bool) { switch v.vType { case typeTimestamp: return v.value.(time.Time), true } return t, false }
[ "func", "(", "v", "*", "Value", ")", "ToTimestamp", "(", ")", "(", "t", "time", ".", "Time", ",", "ok", "bool", ")", "{", "switch", "v", ".", "vType", "{", "case", "typeTimestamp", ":", "return", "v", ".", "value", ".", "(", "time", ".", "Time", ...
// ToTimestamp returns the timestamp value if present.
[ "ToTimestamp", "returns", "the", "timestamp", "value", "if", "present", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L190-L196
125,090
minio/minio
pkg/s3select/sql/value.go
ToBytes
func (v *Value) ToBytes() ([]byte, bool) { switch v.vType { case typeBytes: return v.value.([]byte), true } return nil, false }
go
func (v *Value) ToBytes() ([]byte, bool) { switch v.vType { case typeBytes: return v.value.([]byte), true } return nil, false }
[ "func", "(", "v", "*", "Value", ")", "ToBytes", "(", ")", "(", "[", "]", "byte", ",", "bool", ")", "{", "switch", "v", ".", "vType", "{", "case", "typeBytes", ":", "return", "v", ".", "value", ".", "(", "[", "]", "byte", ")", ",", "true", "\n...
// ToBytes converts Value to byte-slice.
[ "ToBytes", "converts", "Value", "to", "byte", "-", "slice", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L199-L205
125,091
minio/minio
pkg/s3select/sql/value.go
setInt
func (v *Value) setInt(i int64) { v.vType = typeInt v.value = i }
go
func (v *Value) setInt(i int64) { v.vType = typeInt v.value = i }
[ "func", "(", "v", "*", "Value", ")", "setInt", "(", "i", "int64", ")", "{", "v", ".", "vType", "=", "typeInt", "\n", "v", ".", "value", "=", "i", "\n", "}" ]
// setters used internally to mutate values
[ "setters", "used", "internally", "to", "mutate", "values" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L218-L221
125,092
minio/minio
pkg/s3select/sql/value.go
CSVString
func (v *Value) CSVString() string { switch v.vType { case typeNull: return "" case typeBool: return fmt.Sprintf("%v", v.value.(bool)) case typeString: return v.value.(string) case typeInt: return fmt.Sprintf("%v", v.value.(int64)) case typeFloat: return fmt.Sprintf("%v", v.value.(float64)) case typeTi...
go
func (v *Value) CSVString() string { switch v.vType { case typeNull: return "" case typeBool: return fmt.Sprintf("%v", v.value.(bool)) case typeString: return v.value.(string) case typeInt: return fmt.Sprintf("%v", v.value.(int64)) case typeFloat: return fmt.Sprintf("%v", v.value.(float64)) case typeTi...
[ "func", "(", "v", "*", "Value", ")", "CSVString", "(", ")", "string", "{", "switch", "v", ".", "vType", "{", "case", "typeNull", ":", "return", "\"", "\"", "\n", "case", "typeBool", ":", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "v", ...
// CSVString - convert to string for CSV serialization
[ "CSVString", "-", "convert", "to", "string", "for", "CSV", "serialization" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L244-L263
125,093
minio/minio
pkg/s3select/sql/value.go
floatToValue
func floatToValue(f float64) *Value { intPart, fracPart := math.Modf(f) if fracPart == 0 { return FromInt(int64(intPart)) } return FromFloat(f) }
go
func floatToValue(f float64) *Value { intPart, fracPart := math.Modf(f) if fracPart == 0 { return FromInt(int64(intPart)) } return FromFloat(f) }
[ "func", "floatToValue", "(", "f", "float64", ")", "*", "Value", "{", "intPart", ",", "fracPart", ":=", "math", ".", "Modf", "(", "f", ")", "\n", "if", "fracPart", "==", "0", "{", "return", "FromInt", "(", "int64", "(", "intPart", ")", ")", "\n", "}...
// floatToValue converts a float into int representation if needed.
[ "floatToValue", "converts", "a", "float", "into", "int", "representation", "if", "needed", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L266-L272
125,094
minio/minio
pkg/s3select/sql/value.go
negate
func (v *Value) negate() { switch v.vType { case typeFloat: v.value = -(v.value.(float64)) case typeInt: v.value = -(v.value.(int64)) } }
go
func (v *Value) negate() { switch v.vType { case typeFloat: v.value = -(v.value.(float64)) case typeInt: v.value = -(v.value.(int64)) } }
[ "func", "(", "v", "*", "Value", ")", "negate", "(", ")", "{", "switch", "v", ".", "vType", "{", "case", "typeFloat", ":", "v", ".", "value", "=", "-", "(", "v", ".", "value", ".", "(", "float64", ")", ")", "\n", "case", "typeInt", ":", "v", "...
// negate negates a numeric value
[ "negate", "negates", "a", "numeric", "value" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L275-L282
125,095
minio/minio
pkg/s3select/sql/value.go
arithOp
func (v *Value) arithOp(op string, a *Value) error { err := inferTypeForArithOp(v) if err != nil { return err } err = inferTypeForArithOp(a) if err != nil { return err } if !v.isNumeric() || !a.isNumeric() { return errInvalidDataType(errArithMismatchedTypes) } if !isValidArithOperator(op) { return e...
go
func (v *Value) arithOp(op string, a *Value) error { err := inferTypeForArithOp(v) if err != nil { return err } err = inferTypeForArithOp(a) if err != nil { return err } if !v.isNumeric() || !a.isNumeric() { return errInvalidDataType(errArithMismatchedTypes) } if !isValidArithOperator(op) { return e...
[ "func", "(", "v", "*", "Value", ")", "arithOp", "(", "op", "string", ",", "a", "*", "Value", ")", "error", "{", "err", ":=", "inferTypeForArithOp", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "="...
// For arithmetic operations, if both values are numeric then the // operation shall succeed. If the types are unknown automatic type // conversion to a number is attempted.
[ "For", "arithmetic", "operations", "if", "both", "values", "are", "numeric", "then", "the", "operation", "shall", "succeed", ".", "If", "the", "types", "are", "unknown", "automatic", "type", "conversion", "to", "a", "number", "is", "attempted", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L461-L496
125,096
minio/minio
pkg/s3select/sql/value.go
bytesToFloat
func (v *Value) bytesToFloat() (float64, bool) { bytes, _ := v.ToBytes() i, err := strconv.ParseFloat(string(bytes), 64) return i, err == nil }
go
func (v *Value) bytesToFloat() (float64, bool) { bytes, _ := v.ToBytes() i, err := strconv.ParseFloat(string(bytes), 64) return i, err == nil }
[ "func", "(", "v", "*", "Value", ")", "bytesToFloat", "(", ")", "(", "float64", ",", "bool", ")", "{", "bytes", ",", "_", ":=", "v", ".", "ToBytes", "(", ")", "\n", "i", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "string", "(", "bytes", ...
// Converts untyped value into float. The bool return implies success // - it returns false only if there is a conversion failure.
[ "Converts", "untyped", "value", "into", "float", ".", "The", "bool", "return", "implies", "success", "-", "it", "returns", "false", "only", "if", "there", "is", "a", "conversion", "failure", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L529-L533
125,097
minio/minio
pkg/s3select/sql/value.go
bytesToBool
func (v *Value) bytesToBool() (val bool, ok bool) { bytes, _ := v.ToBytes() ok = true switch strings.ToLower(string(bytes)) { case "t", "true": val = true case "f", "false": val = false default: ok = false } return val, ok }
go
func (v *Value) bytesToBool() (val bool, ok bool) { bytes, _ := v.ToBytes() ok = true switch strings.ToLower(string(bytes)) { case "t", "true": val = true case "f", "false": val = false default: ok = false } return val, ok }
[ "func", "(", "v", "*", "Value", ")", "bytesToBool", "(", ")", "(", "val", "bool", ",", "ok", "bool", ")", "{", "bytes", ",", "_", ":=", "v", ".", "ToBytes", "(", ")", "\n", "ok", "=", "true", "\n", "switch", "strings", ".", "ToLower", "(", "str...
// Converts untyped value into bool. The second bool return implies // success - it returns false in case of a conversion failure.
[ "Converts", "untyped", "value", "into", "bool", ".", "The", "second", "bool", "return", "implies", "success", "-", "it", "returns", "false", "in", "case", "of", "a", "conversion", "failure", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L537-L549
125,098
minio/minio
pkg/s3select/sql/value.go
bytesToString
func (v *Value) bytesToString() string { bytes, _ := v.ToBytes() return string(bytes) }
go
func (v *Value) bytesToString() string { bytes, _ := v.ToBytes() return string(bytes) }
[ "func", "(", "v", "*", "Value", ")", "bytesToString", "(", ")", "string", "{", "bytes", ",", "_", ":=", "v", ".", "ToBytes", "(", ")", "\n", "return", "string", "(", "bytes", ")", "\n", "}" ]
// bytesToString - never fails
[ "bytesToString", "-", "never", "fails" ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L552-L555
125,099
minio/minio
pkg/s3select/sql/value.go
inferTypeAsString
func inferTypeAsString(v *Value) { b, ok := v.ToBytes() if !ok { return } v.setString(string(b)) }
go
func inferTypeAsString(v *Value) { b, ok := v.ToBytes() if !ok { return } v.setString(string(b)) }
[ "func", "inferTypeAsString", "(", "v", "*", "Value", ")", "{", "b", ",", "ok", ":=", "v", ".", "ToBytes", "(", ")", "\n", "if", "!", "ok", "{", "return", "\n", "}", "\n\n", "v", ".", "setString", "(", "string", "(", "b", ")", ")", "\n", "}" ]
// inferTypeAsString is used to convert untyped values to string - it // is called when the caller requires a string context to proceed.
[ "inferTypeAsString", "is", "used", "to", "convert", "untyped", "values", "to", "string", "-", "it", "is", "called", "when", "the", "caller", "requires", "a", "string", "context", "to", "proceed", "." ]
4b858b562a0887e10bfd0414dc87e68f1af31c3a
https://github.com/minio/minio/blob/4b858b562a0887e10bfd0414dc87e68f1af31c3a/pkg/s3select/sql/value.go#L633-L640