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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,800 | ory/dockertest | docker/client.go | NewVersionedClient | func NewVersionedClient(endpoint string, apiVersionString string) (*Client, error) {
u, err := parseEndpoint(endpoint, false)
if err != nil {
return nil, err
}
var requestedAPIVersion APIVersion
if strings.Contains(apiVersionString, ".") {
requestedAPIVersion, err = NewAPIVersion(apiVersionString)
if err != ... | go | func NewVersionedClient(endpoint string, apiVersionString string) (*Client, error) {
u, err := parseEndpoint(endpoint, false)
if err != nil {
return nil, err
}
var requestedAPIVersion APIVersion
if strings.Contains(apiVersionString, ".") {
requestedAPIVersion, err = NewAPIVersion(apiVersionString)
if err != ... | [
"func",
"NewVersionedClient",
"(",
"endpoint",
"string",
",",
"apiVersionString",
"string",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"u",
",",
"err",
":=",
"parseEndpoint",
"(",
"endpoint",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // NewVersionedClient returns a Client instance ready for communication with
// the given server endpoint, using a specific remote API version. | [
"NewVersionedClient",
"returns",
"a",
"Client",
"instance",
"ready",
"for",
"communication",
"with",
"the",
"given",
"server",
"endpoint",
"using",
"a",
"specific",
"remote",
"API",
"version",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/client.go#L200-L222 |
27,801 | ory/dockertest | docker/client.go | NewVersionedTLSClient | func NewVersionedTLSClient(endpoint string, cert, key, ca, apiVersionString string) (*Client, error) {
var certPEMBlock []byte
var keyPEMBlock []byte
var caPEMCert []byte
if _, err := os.Stat(cert); !os.IsNotExist(err) {
certPEMBlock, err = ioutil.ReadFile(cert)
if err != nil {
return nil, err
}
}
if _, ... | go | func NewVersionedTLSClient(endpoint string, cert, key, ca, apiVersionString string) (*Client, error) {
var certPEMBlock []byte
var keyPEMBlock []byte
var caPEMCert []byte
if _, err := os.Stat(cert); !os.IsNotExist(err) {
certPEMBlock, err = ioutil.ReadFile(cert)
if err != nil {
return nil, err
}
}
if _, ... | [
"func",
"NewVersionedTLSClient",
"(",
"endpoint",
"string",
",",
"cert",
",",
"key",
",",
"ca",
",",
"apiVersionString",
"string",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"var",
"certPEMBlock",
"[",
"]",
"byte",
"\n",
"var",
"keyPEMBlock",
"[",
... | // NewVersionedTLSClient returns a Client instance ready for TLS communications with the givens
// server endpoint, key and certificates, using a specific remote API version. | [
"NewVersionedTLSClient",
"returns",
"a",
"Client",
"instance",
"ready",
"for",
"TLS",
"communications",
"with",
"the",
"givens",
"server",
"endpoint",
"key",
"and",
"certificates",
"using",
"a",
"specific",
"remote",
"API",
"version",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/client.go#L239-L262 |
27,802 | ory/dockertest | docker/client.go | SetTimeout | func (c *Client) SetTimeout(t time.Duration) {
if c.HTTPClient != nil {
c.HTTPClient.Timeout = t
}
} | go | func (c *Client) SetTimeout(t time.Duration) {
if c.HTTPClient != nil {
c.HTTPClient.Timeout = t
}
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetTimeout",
"(",
"t",
"time",
".",
"Duration",
")",
"{",
"if",
"c",
".",
"HTTPClient",
"!=",
"nil",
"{",
"c",
".",
"HTTPClient",
".",
"Timeout",
"=",
"t",
"\n",
"}",
"\n",
"}"
] | // SetTimeout takes a timeout and applies it to the HTTPClient. It should not
// be called concurrently with any other Client methods. | [
"SetTimeout",
"takes",
"a",
"timeout",
"and",
"applies",
"it",
"to",
"the",
"HTTPClient",
".",
"It",
"should",
"not",
"be",
"called",
"concurrently",
"with",
"any",
"other",
"Client",
"methods",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/client.go#L355-L359 |
27,803 | ory/dockertest | docker/client.go | chooseError | func chooseError(ctx context.Context, err error) error {
select {
case <-ctx.Done():
return ctx.Err()
default:
return err
}
} | go | func chooseError(ctx context.Context, err error) error {
select {
case <-ctx.Done():
return ctx.Err()
default:
return err
}
} | [
"func",
"chooseError",
"(",
"ctx",
"context",
".",
"Context",
",",
"err",
"error",
")",
"error",
"{",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"ctx",
".",
"Err",
"(",
")",
"\n",
"default",
":",
"return",
"err",
"\n"... | // if error in context, return that instead of generic http error | [
"if",
"error",
"in",
"context",
"return",
"that",
"instead",
"of",
"generic",
"http",
"error"
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/client.go#L511-L518 |
27,804 | ory/dockertest | docker/client.go | getFakeNativeURL | func (c *Client) getFakeNativeURL(path string) string {
u := *c.endpointURL // Copy.
// Override URL so that net/http will not complain.
u.Scheme = "http"
u.Host = "unix.sock" // Doesn't matter what this is - it's not used.
u.Path = ""
urlStr := strings.TrimRight(u.String(), "/")
if c.requestedAPIVersion != nil... | go | func (c *Client) getFakeNativeURL(path string) string {
u := *c.endpointURL // Copy.
// Override URL so that net/http will not complain.
u.Scheme = "http"
u.Host = "unix.sock" // Doesn't matter what this is - it's not used.
u.Path = ""
urlStr := strings.TrimRight(u.String(), "/")
if c.requestedAPIVersion != nil... | [
"func",
"(",
"c",
"*",
"Client",
")",
"getFakeNativeURL",
"(",
"path",
"string",
")",
"string",
"{",
"u",
":=",
"*",
"c",
".",
"endpointURL",
"// Copy.",
"\n\n",
"// Override URL so that net/http will not complain.",
"u",
".",
"Scheme",
"=",
"\"",
"\"",
"\n",
... | // getFakeNativeURL returns the URL needed to make an HTTP request over a UNIX
// domain socket to the given path. | [
"getFakeNativeURL",
"returns",
"the",
"URL",
"needed",
"to",
"make",
"an",
"HTTP",
"request",
"over",
"a",
"UNIX",
"domain",
"socket",
"to",
"the",
"given",
"path",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/client.go#L860-L872 |
27,805 | ory/dockertest | docker/client.go | defaultTransport | func defaultTransport() *http.Transport {
transport := defaultPooledTransport()
transport.DisableKeepAlives = true
transport.MaxIdleConnsPerHost = -1
return transport
} | go | func defaultTransport() *http.Transport {
transport := defaultPooledTransport()
transport.DisableKeepAlives = true
transport.MaxIdleConnsPerHost = -1
return transport
} | [
"func",
"defaultTransport",
"(",
")",
"*",
"http",
".",
"Transport",
"{",
"transport",
":=",
"defaultPooledTransport",
"(",
")",
"\n",
"transport",
".",
"DisableKeepAlives",
"=",
"true",
"\n",
"transport",
".",
"MaxIdleConnsPerHost",
"=",
"-",
"1",
"\n",
"retu... | // defaultTransport returns a new http.Transport with similar default values to
// http.DefaultTransport, but with idle connections and keepalives disabled. | [
"defaultTransport",
"returns",
"a",
"new",
"http",
".",
"Transport",
"with",
"similar",
"default",
"values",
"to",
"http",
".",
"DefaultTransport",
"but",
"with",
"idle",
"connections",
"and",
"keepalives",
"disabled",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/client.go#L1058-L1063 |
27,806 | ory/dockertest | docker/env.go | Get | func (env *Env) Get(key string) (value string) {
return env.Map()[key]
} | go | func (env *Env) Get(key string) (value string) {
return env.Map()[key]
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"Get",
"(",
"key",
"string",
")",
"(",
"value",
"string",
")",
"{",
"return",
"env",
".",
"Map",
"(",
")",
"[",
"key",
"]",
"\n",
"}"
] | // Get returns the string value of the given key. | [
"Get",
"returns",
"the",
"string",
"value",
"of",
"the",
"given",
"key",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/env.go#L19-L21 |
27,807 | ory/dockertest | docker/env.go | Exists | func (env *Env) Exists(key string) bool {
_, exists := env.Map()[key]
return exists
} | go | func (env *Env) Exists(key string) bool {
_, exists := env.Map()[key]
return exists
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"Exists",
"(",
"key",
"string",
")",
"bool",
"{",
"_",
",",
"exists",
":=",
"env",
".",
"Map",
"(",
")",
"[",
"key",
"]",
"\n",
"return",
"exists",
"\n",
"}"
] | // Exists checks whether the given key is defined in the internal Env
// representation. | [
"Exists",
"checks",
"whether",
"the",
"given",
"key",
"is",
"defined",
"in",
"the",
"internal",
"Env",
"representation",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/env.go#L25-L28 |
27,808 | ory/dockertest | docker/env.go | GetBool | func (env *Env) GetBool(key string) (value bool) {
s := strings.ToLower(strings.Trim(env.Get(key), " \t"))
if s == "" || s == "0" || s == "no" || s == "false" || s == "none" {
return false
}
return true
} | go | func (env *Env) GetBool(key string) (value bool) {
s := strings.ToLower(strings.Trim(env.Get(key), " \t"))
if s == "" || s == "0" || s == "no" || s == "false" || s == "none" {
return false
}
return true
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"GetBool",
"(",
"key",
"string",
")",
"(",
"value",
"bool",
")",
"{",
"s",
":=",
"strings",
".",
"ToLower",
"(",
"strings",
".",
"Trim",
"(",
"env",
".",
"Get",
"(",
"key",
")",
",",
"\"",
"\\t",
"\"",
")",
... | // GetBool returns a boolean representation of the given key. The key is false
// whenever its value if 0, no, false, none or an empty string. Any other value
// will be interpreted as true. | [
"GetBool",
"returns",
"a",
"boolean",
"representation",
"of",
"the",
"given",
"key",
".",
"The",
"key",
"is",
"false",
"whenever",
"its",
"value",
"if",
"0",
"no",
"false",
"none",
"or",
"an",
"empty",
"string",
".",
"Any",
"other",
"value",
"will",
"be"... | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/env.go#L33-L39 |
27,809 | ory/dockertest | docker/env.go | SetBool | func (env *Env) SetBool(key string, value bool) {
if value {
env.Set(key, "1")
} else {
env.Set(key, "0")
}
} | go | func (env *Env) SetBool(key string, value bool) {
if value {
env.Set(key, "1")
} else {
env.Set(key, "0")
}
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"SetBool",
"(",
"key",
"string",
",",
"value",
"bool",
")",
"{",
"if",
"value",
"{",
"env",
".",
"Set",
"(",
"key",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"env",
".",
"Set",
"(",
"key",
",",
"\"",
... | // SetBool defines a boolean value to the given key. | [
"SetBool",
"defines",
"a",
"boolean",
"value",
"to",
"the",
"given",
"key",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/env.go#L42-L48 |
27,810 | ory/dockertest | docker/env.go | GetInt | func (env *Env) GetInt(key string) int {
return int(env.GetInt64(key))
} | go | func (env *Env) GetInt(key string) int {
return int(env.GetInt64(key))
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"GetInt",
"(",
"key",
"string",
")",
"int",
"{",
"return",
"int",
"(",
"env",
".",
"GetInt64",
"(",
"key",
")",
")",
"\n",
"}"
] | // GetInt returns the value of the provided key, converted to int.
//
// It the value cannot be represented as an integer, it returns -1. | [
"GetInt",
"returns",
"the",
"value",
"of",
"the",
"provided",
"key",
"converted",
"to",
"int",
".",
"It",
"the",
"value",
"cannot",
"be",
"represented",
"as",
"an",
"integer",
"it",
"returns",
"-",
"1",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/env.go#L53-L55 |
27,811 | ory/dockertest | docker/env.go | SetInt | func (env *Env) SetInt(key string, value int) {
env.Set(key, strconv.Itoa(value))
} | go | func (env *Env) SetInt(key string, value int) {
env.Set(key, strconv.Itoa(value))
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"SetInt",
"(",
"key",
"string",
",",
"value",
"int",
")",
"{",
"env",
".",
"Set",
"(",
"key",
",",
"strconv",
".",
"Itoa",
"(",
"value",
")",
")",
"\n",
"}"
] | // SetInt defines an integer value to the given key. | [
"SetInt",
"defines",
"an",
"integer",
"value",
"to",
"the",
"given",
"key",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/env.go#L58-L60 |
27,812 | ory/dockertest | docker/env.go | GetInt64 | func (env *Env) GetInt64(key string) int64 {
s := strings.Trim(env.Get(key), " \t")
val, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return -1
}
return val
} | go | func (env *Env) GetInt64(key string) int64 {
s := strings.Trim(env.Get(key), " \t")
val, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return -1
}
return val
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"GetInt64",
"(",
"key",
"string",
")",
"int64",
"{",
"s",
":=",
"strings",
".",
"Trim",
"(",
"env",
".",
"Get",
"(",
"key",
")",
",",
"\"",
"\\t",
"\"",
")",
"\n",
"val",
",",
"err",
":=",
"strconv",
".",
... | // GetInt64 returns the value of the provided key, converted to int64.
//
// It the value cannot be represented as an integer, it returns -1. | [
"GetInt64",
"returns",
"the",
"value",
"of",
"the",
"provided",
"key",
"converted",
"to",
"int64",
".",
"It",
"the",
"value",
"cannot",
"be",
"represented",
"as",
"an",
"integer",
"it",
"returns",
"-",
"1",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/env.go#L65-L72 |
27,813 | ory/dockertest | docker/env.go | GetList | func (env *Env) GetList(key string) []string {
sval := env.Get(key)
if sval == "" {
return nil
}
var l []string
if err := json.Unmarshal([]byte(sval), &l); err != nil {
l = append(l, sval)
}
return l
} | go | func (env *Env) GetList(key string) []string {
sval := env.Get(key)
if sval == "" {
return nil
}
var l []string
if err := json.Unmarshal([]byte(sval), &l); err != nil {
l = append(l, sval)
}
return l
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"GetList",
"(",
"key",
"string",
")",
"[",
"]",
"string",
"{",
"sval",
":=",
"env",
".",
"Get",
"(",
"key",
")",
"\n",
"if",
"sval",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"var",
"l",
"["... | // GetList returns a list of strings matching the provided key. It handles the
// list as a JSON representation of a list of strings.
//
// If the given key matches to a single string, it will return a list
// containing only the value that matches the key. | [
"GetList",
"returns",
"a",
"list",
"of",
"strings",
"matching",
"the",
"provided",
"key",
".",
"It",
"handles",
"the",
"list",
"as",
"a",
"JSON",
"representation",
"of",
"a",
"list",
"of",
"strings",
".",
"If",
"the",
"given",
"key",
"matches",
"to",
"a"... | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/env.go#L106-L116 |
27,814 | ory/dockertest | docker/env.go | SetList | func (env *Env) SetList(key string, value []string) error {
return env.SetJSON(key, value)
} | go | func (env *Env) SetList(key string, value []string) error {
return env.SetJSON(key, value)
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"SetList",
"(",
"key",
"string",
",",
"value",
"[",
"]",
"string",
")",
"error",
"{",
"return",
"env",
".",
"SetJSON",
"(",
"key",
",",
"value",
")",
"\n",
"}"
] | // SetList stores the given list in the provided key, after serializing it to
// JSON format. | [
"SetList",
"stores",
"the",
"given",
"list",
"in",
"the",
"provided",
"key",
"after",
"serializing",
"it",
"to",
"JSON",
"format",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/env.go#L120-L122 |
27,815 | ory/dockertest | docker/env.go | Set | func (env *Env) Set(key, value string) {
*env = append(*env, key+"="+value)
} | go | func (env *Env) Set(key, value string) {
*env = append(*env, key+"="+value)
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"Set",
"(",
"key",
",",
"value",
"string",
")",
"{",
"*",
"env",
"=",
"append",
"(",
"*",
"env",
",",
"key",
"+",
"\"",
"\"",
"+",
"value",
")",
"\n",
"}"
] | // Set defines the value of a key to the given string. | [
"Set",
"defines",
"the",
"value",
"of",
"a",
"key",
"to",
"the",
"given",
"string",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/env.go#L125-L127 |
27,816 | ory/dockertest | docker/client_windows.go | initializeNativeClient | func (c *Client) initializeNativeClient(trFunc func() *http.Transport) {
if c.endpointURL.Scheme != namedPipeProtocol {
return
}
namedPipePath := c.endpointURL.Path
dialFunc := func(network, addr string) (net.Conn, error) {
timeout := namedPipeConnectTimeout
return winio.DialPipe(namedPipePath, &timeout)
}
... | go | func (c *Client) initializeNativeClient(trFunc func() *http.Transport) {
if c.endpointURL.Scheme != namedPipeProtocol {
return
}
namedPipePath := c.endpointURL.Path
dialFunc := func(network, addr string) (net.Conn, error) {
timeout := namedPipeConnectTimeout
return winio.DialPipe(namedPipePath, &timeout)
}
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"initializeNativeClient",
"(",
"trFunc",
"func",
"(",
")",
"*",
"http",
".",
"Transport",
")",
"{",
"if",
"c",
".",
"endpointURL",
".",
"Scheme",
"!=",
"namedPipeProtocol",
"{",
"return",
"\n",
"}",
"\n",
"namedPipeP... | // initializeNativeClient initializes the native Named Pipe client for Windows | [
"initializeNativeClient",
"initializes",
"the",
"native",
"Named",
"Pipe",
"client",
"for",
"Windows"
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/client_windows.go#L29-L45 |
27,817 | ory/dockertest | docker/auth.go | NewAuthConfigurationsFromFile | func NewAuthConfigurationsFromFile(path string) (*AuthConfigurations, error) {
r, err := os.Open(path)
if err != nil {
return nil, err
}
return NewAuthConfigurations(r)
} | go | func NewAuthConfigurationsFromFile(path string) (*AuthConfigurations, error) {
r, err := os.Open(path)
if err != nil {
return nil, err
}
return NewAuthConfigurations(r)
} | [
"func",
"NewAuthConfigurationsFromFile",
"(",
"path",
"string",
")",
"(",
"*",
"AuthConfigurations",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
... | // NewAuthConfigurationsFromFile returns AuthConfigurations from a path containing JSON
// in the same format as the .dockercfg file. | [
"NewAuthConfigurationsFromFile",
"returns",
"AuthConfigurations",
"from",
"a",
"path",
"containing",
"JSON",
"in",
"the",
"same",
"format",
"as",
"the",
".",
"dockercfg",
"file",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/auth.go#L51-L57 |
27,818 | ory/dockertest | docker/auth.go | authConfigs | func authConfigs(confs map[string]dockerConfig) (*AuthConfigurations, error) {
c := &AuthConfigurations{
Configs: make(map[string]AuthConfiguration),
}
for reg, conf := range confs {
if conf.Auth == "" {
continue
}
data, err := base64.StdEncoding.DecodeString(conf.Auth)
if err != nil {
return nil, er... | go | func authConfigs(confs map[string]dockerConfig) (*AuthConfigurations, error) {
c := &AuthConfigurations{
Configs: make(map[string]AuthConfiguration),
}
for reg, conf := range confs {
if conf.Auth == "" {
continue
}
data, err := base64.StdEncoding.DecodeString(conf.Auth)
if err != nil {
return nil, er... | [
"func",
"authConfigs",
"(",
"confs",
"map",
"[",
"string",
"]",
"dockerConfig",
")",
"(",
"*",
"AuthConfigurations",
",",
"error",
")",
"{",
"c",
":=",
"&",
"AuthConfigurations",
"{",
"Configs",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"AuthConfigurati... | // authConfigs converts a dockerConfigs map to a AuthConfigurations object. | [
"authConfigs",
"converts",
"a",
"dockerConfigs",
"map",
"to",
"a",
"AuthConfigurations",
"object",
"."
] | 56b367fe94ad17019ab80b91fe686218e65ce9fa | https://github.com/ory/dockertest/blob/56b367fe94ad17019ab80b91fe686218e65ce9fa/docker/auth.go#L127-L151 |
27,819 | hyperhq/hyperd | server/server_unix.go | newServer | func (s *Server) newServer(proto, addr string) ([]*HTTPServer, error) {
var (
err error
ls []net.Listener
)
switch proto {
case "fd":
ls, err = listenFD(addr, s.cfg.TLSConfig)
if err != nil {
return nil, err
}
case "tcp":
l, err := s.initTCPSocket(addr)
if err != nil {
return nil, err
}
ls... | go | func (s *Server) newServer(proto, addr string) ([]*HTTPServer, error) {
var (
err error
ls []net.Listener
)
switch proto {
case "fd":
ls, err = listenFD(addr, s.cfg.TLSConfig)
if err != nil {
return nil, err
}
case "tcp":
l, err := s.initTCPSocket(addr)
if err != nil {
return nil, err
}
ls... | [
"func",
"(",
"s",
"*",
"Server",
")",
"newServer",
"(",
"proto",
",",
"addr",
"string",
")",
"(",
"[",
"]",
"*",
"HTTPServer",
",",
"error",
")",
"{",
"var",
"(",
"err",
"error",
"\n",
"ls",
"[",
"]",
"net",
".",
"Listener",
"\n",
")",
"\n",
"s... | // newServer sets up the required HTTPServers and does protocol specific checking.
// newServer does not set any muxers, you should set it later to Handler field | [
"newServer",
"sets",
"up",
"the",
"required",
"HTTPServers",
"and",
"does",
"protocol",
"specific",
"checking",
".",
"newServer",
"does",
"not",
"set",
"any",
"muxers",
"you",
"should",
"set",
"it",
"later",
"to",
"Handler",
"field"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/server_unix.go#L20-L56 |
27,820 | hyperhq/hyperd | daemon/pod/servicediscovery.go | add | func (s *Services) add(newServs []*apitypes.UserService) error {
var err error
// check if adding service conflict with existing ones
exist := make(map[serviceKey]bool, s.size())
for _, srv := range s.spec {
exist[serviceKey{srv.ServiceIP, srv.ServicePort, srv.Protocol}] = true
}
for _, srv := range newServs {
... | go | func (s *Services) add(newServs []*apitypes.UserService) error {
var err error
// check if adding service conflict with existing ones
exist := make(map[serviceKey]bool, s.size())
for _, srv := range s.spec {
exist[serviceKey{srv.ServiceIP, srv.ServicePort, srv.Protocol}] = true
}
for _, srv := range newServs {
... | [
"func",
"(",
"s",
"*",
"Services",
")",
"add",
"(",
"newServs",
"[",
"]",
"*",
"apitypes",
".",
"UserService",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"// check if adding service conflict with existing ones",
"exist",
":=",
"make",
"(",
"map",
"[",
"... | // add will only add services in list that don't exist, else failed | [
"add",
"will",
"only",
"add",
"services",
"in",
"list",
"that",
"don",
"t",
"exist",
"else",
"failed"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/pod/servicediscovery.go#L88-L113 |
27,821 | hyperhq/hyperd | daemon/pod/servicediscovery.go | update | func (s *Services) update(srvs []*apitypes.UserService) error {
var err error
// check if update service list conflicts
tbd := make(map[serviceKey]bool, len(srvs))
for _, srv := range srvs {
key := serviceKey{srv.ServiceIP, srv.ServicePort, srv.Protocol}
if tbd[key] {
err = fmt.Errorf("given service list con... | go | func (s *Services) update(srvs []*apitypes.UserService) error {
var err error
// check if update service list conflicts
tbd := make(map[serviceKey]bool, len(srvs))
for _, srv := range srvs {
key := serviceKey{srv.ServiceIP, srv.ServicePort, srv.Protocol}
if tbd[key] {
err = fmt.Errorf("given service list con... | [
"func",
"(",
"s",
"*",
"Services",
")",
"update",
"(",
"srvs",
"[",
"]",
"*",
"apitypes",
".",
"UserService",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"// check if update service list conflicts",
"tbd",
":=",
"make",
"(",
"map",
"[",
"serviceKey",
"... | // update removes services in list that already exist, and add with new ones
// or just add new ones if they are not exist already | [
"update",
"removes",
"services",
"in",
"list",
"that",
"already",
"exist",
"and",
"add",
"with",
"new",
"ones",
"or",
"just",
"add",
"new",
"ones",
"if",
"they",
"are",
"not",
"exist",
"already"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/pod/servicediscovery.go#L144-L166 |
27,822 | hyperhq/hyperd | daemon/server.go | CmdListPortMappings | func (daemon *Daemon) CmdListPortMappings(podId string) (*engine.Env, error) {
p, ok := daemon.PodList.Get(podId)
if !ok {
return nil, errors.ErrPodNotFound.WithArgs(podId)
}
pms := p.ListPortMappings()
v := &engine.Env{}
v.SetJson("portMappings", pms)
return v, nil
} | go | func (daemon *Daemon) CmdListPortMappings(podId string) (*engine.Env, error) {
p, ok := daemon.PodList.Get(podId)
if !ok {
return nil, errors.ErrPodNotFound.WithArgs(podId)
}
pms := p.ListPortMappings()
v := &engine.Env{}
v.SetJson("portMappings", pms)
return v, nil
} | [
"func",
"(",
"daemon",
"*",
"Daemon",
")",
"CmdListPortMappings",
"(",
"podId",
"string",
")",
"(",
"*",
"engine",
".",
"Env",
",",
"error",
")",
"{",
"p",
",",
"ok",
":=",
"daemon",
".",
"PodList",
".",
"Get",
"(",
"podId",
")",
"\n",
"if",
"!",
... | // pod level port mappings API | [
"pod",
"level",
"port",
"mappings",
"API"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/server.go#L306-L317 |
27,823 | hyperhq/hyperd | serverrpc/exec.go | ExecSignal | func (s *ServerRPC) ExecSignal(ctx context.Context, req *types.ExecSignalRequest) (*types.ExecSignalResponse, error) {
err := s.daemon.KillExec(req.ContainerID, req.ExecID, req.Signal)
if err != nil {
return nil, err
}
return &types.ExecSignalResponse{}, nil
} | go | func (s *ServerRPC) ExecSignal(ctx context.Context, req *types.ExecSignalRequest) (*types.ExecSignalResponse, error) {
err := s.daemon.KillExec(req.ContainerID, req.ExecID, req.Signal)
if err != nil {
return nil, err
}
return &types.ExecSignalResponse{}, nil
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"ExecSignal",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"types",
".",
"ExecSignalRequest",
")",
"(",
"*",
"types",
".",
"ExecSignalResponse",
",",
"error",
")",
"{",
"err",
":=",
"s",
".",
"daemon"... | // ExecSignal sends a singal to specified exec of specified container | [
"ExecSignal",
"sends",
"a",
"singal",
"to",
"specified",
"exec",
"of",
"specified",
"container"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/exec.go#L104-L111 |
27,824 | hyperhq/hyperd | client/build.go | ValidateContextDirectory | func ValidateContextDirectory(srcPath string, excludes []string) error {
contextRoot := filepath.Join(srcPath, ".")
return filepath.Walk(contextRoot, func(filePath string, f os.FileInfo, err error) error {
// skip this directory/file if it's not in the path, it won't get added to the context
if relFilePath, err ... | go | func ValidateContextDirectory(srcPath string, excludes []string) error {
contextRoot := filepath.Join(srcPath, ".")
return filepath.Walk(contextRoot, func(filePath string, f os.FileInfo, err error) error {
// skip this directory/file if it's not in the path, it won't get added to the context
if relFilePath, err ... | [
"func",
"ValidateContextDirectory",
"(",
"srcPath",
"string",
",",
"excludes",
"[",
"]",
"string",
")",
"error",
"{",
"contextRoot",
":=",
"filepath",
".",
"Join",
"(",
"srcPath",
",",
"\"",
"\"",
")",
"\n\n",
"return",
"filepath",
".",
"Walk",
"(",
"conte... | // validateContextDirectory checks if all the contents of the directory
// can be read and returns an error if some files can't be read
// symlinks which point to non-existing files don't trigger an error | [
"validateContextDirectory",
"checks",
"if",
"all",
"the",
"contents",
"of",
"the",
"directory",
"can",
"be",
"read",
"and",
"returns",
"an",
"error",
"if",
"some",
"files",
"can",
"t",
"be",
"read",
"symlinks",
"which",
"point",
"to",
"non",
"-",
"existing",... | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/client/build.go#L177-L218 |
27,825 | hyperhq/hyperd | server/server.go | InitRouters | func (s *Server) InitRouters(d *daemon.Daemon) {
s.addRouter(container.NewRouter(d))
s.addRouter(pod.NewRouter(d))
s.addRouter(service.NewRouter(d))
s.addRouter(local.NewRouter(d))
s.addRouter(system.NewRouter(d))
s.addRouter(build.NewRouter(d))
} | go | func (s *Server) InitRouters(d *daemon.Daemon) {
s.addRouter(container.NewRouter(d))
s.addRouter(pod.NewRouter(d))
s.addRouter(service.NewRouter(d))
s.addRouter(local.NewRouter(d))
s.addRouter(system.NewRouter(d))
s.addRouter(build.NewRouter(d))
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"InitRouters",
"(",
"d",
"*",
"daemon",
".",
"Daemon",
")",
"{",
"s",
".",
"addRouter",
"(",
"container",
".",
"NewRouter",
"(",
"d",
")",
")",
"\n",
"s",
".",
"addRouter",
"(",
"pod",
".",
"NewRouter",
"(",
... | // InitRouters initializes a list of routers for the server. | [
"InitRouters",
"initializes",
"a",
"list",
"of",
"routers",
"for",
"the",
"server",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/server.go#L177-L184 |
27,826 | hyperhq/hyperd | server/server.go | addRouter | func (s *Server) addRouter(r router.Router) {
s.routers = append(s.routers, r)
} | go | func (s *Server) addRouter(r router.Router) {
s.routers = append(s.routers, r)
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"addRouter",
"(",
"r",
"router",
".",
"Router",
")",
"{",
"s",
".",
"routers",
"=",
"append",
"(",
"s",
".",
"routers",
",",
"r",
")",
"\n",
"}"
] | // addRouter adds a new router to the server. | [
"addRouter",
"adds",
"a",
"new",
"router",
"to",
"the",
"server",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/server.go#L187-L189 |
27,827 | hyperhq/hyperd | server/server.go | createMux | func (s *Server) createMux() *mux.Router {
m := mux.NewRouter()
if utils.IsDebugEnabled() {
profilerSetup(m, "/debug/")
}
glog.V(3).Infof("Registering routers")
for _, apiRouter := range s.routers {
for _, r := range apiRouter.Routes() {
f := s.makeHTTPHandler(r.Handler())
glog.V(3).Infof("Registering ... | go | func (s *Server) createMux() *mux.Router {
m := mux.NewRouter()
if utils.IsDebugEnabled() {
profilerSetup(m, "/debug/")
}
glog.V(3).Infof("Registering routers")
for _, apiRouter := range s.routers {
for _, r := range apiRouter.Routes() {
f := s.makeHTTPHandler(r.Handler())
glog.V(3).Infof("Registering ... | [
"func",
"(",
"s",
"*",
"Server",
")",
"createMux",
"(",
")",
"*",
"mux",
".",
"Router",
"{",
"m",
":=",
"mux",
".",
"NewRouter",
"(",
")",
"\n",
"if",
"utils",
".",
"IsDebugEnabled",
"(",
")",
"{",
"profilerSetup",
"(",
"m",
",",
"\"",
"\"",
")",... | // createMux initializes the main router the server uses.
// we keep enableCors just for legacy usage, need to be removed in the future | [
"createMux",
"initializes",
"the",
"main",
"router",
"the",
"server",
"uses",
".",
"we",
"keep",
"enableCors",
"just",
"for",
"legacy",
"usage",
"need",
"to",
"be",
"removed",
"in",
"the",
"future"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/server.go#L193-L211 |
27,828 | hyperhq/hyperd | server/server.go | Wait | func (s *Server) Wait(waitChan chan error) {
if err := s.serveAPI(); err != nil {
glog.Errorf("ServeAPI error: %v", err)
waitChan <- err
return
}
waitChan <- nil
} | go | func (s *Server) Wait(waitChan chan error) {
if err := s.serveAPI(); err != nil {
glog.Errorf("ServeAPI error: %v", err)
waitChan <- err
return
}
waitChan <- nil
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"Wait",
"(",
"waitChan",
"chan",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"serveAPI",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"waitChan"... | // Wait blocks the server goroutine until it exits.
// It sends an error message if there is any error during
// the API execution. | [
"Wait",
"blocks",
"the",
"server",
"goroutine",
"until",
"it",
"exits",
".",
"It",
"sends",
"an",
"error",
"message",
"if",
"there",
"is",
"any",
"error",
"during",
"the",
"API",
"execution",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/server.go#L216-L223 |
27,829 | hyperhq/hyperd | daemon/pod/etchosts.go | prepareHosts | func prepareHosts(podID string) (string, error) {
var err error
hostsDir, hostsPath := HostsPath(podID)
if err = os.MkdirAll(hostsDir, 0755); err != nil {
return "", err
}
if _, err = os.Stat(hostsPath); err != nil && os.IsNotExist(err) {
// mount tmpfs on hostsDir
if err := syscall.Mount(podID+"-hosts", ... | go | func prepareHosts(podID string) (string, error) {
var err error
hostsDir, hostsPath := HostsPath(podID)
if err = os.MkdirAll(hostsDir, 0755); err != nil {
return "", err
}
if _, err = os.Stat(hostsPath); err != nil && os.IsNotExist(err) {
// mount tmpfs on hostsDir
if err := syscall.Mount(podID+"-hosts", ... | [
"func",
"prepareHosts",
"(",
"podID",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n\n",
"hostsDir",
",",
"hostsPath",
":=",
"HostsPath",
"(",
"podID",
")",
"\n\n",
"if",
"err",
"=",
"os",
".",
"MkdirAll",
"(",
"hostsD... | // prepareHosts creates hosts file for given pod | [
"prepareHosts",
"creates",
"hosts",
"file",
"for",
"given",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/pod/etchosts.go#L68-L91 |
27,830 | hyperhq/hyperd | networking/portmapping/host_portmapping_linux.go | NewPortRange | func NewPortRange(r string) (*PortRange, error) {
segs := strings.SplitN(r, "-", 2)
b, err := strconv.ParseUint(segs[0], 10, 16)
if err != nil {
return nil, err
}
e := b
if len(segs) > 1 {
e, err = strconv.ParseUint(segs[1], 10, 16)
if err != nil {
return nil, err
}
}
return &PortRange{
Begin: int(... | go | func NewPortRange(r string) (*PortRange, error) {
segs := strings.SplitN(r, "-", 2)
b, err := strconv.ParseUint(segs[0], 10, 16)
if err != nil {
return nil, err
}
e := b
if len(segs) > 1 {
e, err = strconv.ParseUint(segs[1], 10, 16)
if err != nil {
return nil, err
}
}
return &PortRange{
Begin: int(... | [
"func",
"NewPortRange",
"(",
"r",
"string",
")",
"(",
"*",
"PortRange",
",",
"error",
")",
"{",
"segs",
":=",
"strings",
".",
"SplitN",
"(",
"r",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"b",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"segs... | // NewPortRange generate a port range from string r. the r should be a decimal number or
// in format begin-end, where begin and end are both decimal number. And the port range should
// be 0-65535, i.e. 16-bit unsigned int
// It returns PortRange pointer for valid input, otherwise return error | [
"NewPortRange",
"generate",
"a",
"port",
"range",
"from",
"string",
"r",
".",
"the",
"r",
"should",
"be",
"a",
"decimal",
"number",
"or",
"in",
"format",
"begin",
"-",
"end",
"where",
"begin",
"and",
"end",
"are",
"both",
"decimal",
"number",
".",
"And",... | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/networking/portmapping/host_portmapping_linux.go#L33-L50 |
27,831 | hyperhq/hyperd | networking/portmapping/setup_linux.go | Setup | func Setup(bIface, addr string, disable bool) error {
var err error
disableIptables = disable
bridgeIface = bIface
if disableIptables {
hlog.Log(hlog.DEBUG, "Iptables is disabled")
return nil
}
hlog.Log(hlog.TRACE, "setting up iptables")
err = setupIPTables(addr)
if err != nil {
hlog.Log(hlog.ERROR, "f... | go | func Setup(bIface, addr string, disable bool) error {
var err error
disableIptables = disable
bridgeIface = bIface
if disableIptables {
hlog.Log(hlog.DEBUG, "Iptables is disabled")
return nil
}
hlog.Log(hlog.TRACE, "setting up iptables")
err = setupIPTables(addr)
if err != nil {
hlog.Log(hlog.ERROR, "f... | [
"func",
"Setup",
"(",
"bIface",
",",
"addr",
"string",
",",
"disable",
"bool",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"disableIptables",
"=",
"disable",
"\n",
"bridgeIface",
"=",
"bIface",
"\n\n",
"if",
"disableIptables",
"{",
"hlog",
".",
"Log"... | //setup environment for iptables and IP forwarding | [
"setup",
"environment",
"for",
"iptables",
"and",
"IP",
"forwarding"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/networking/portmapping/setup_linux.go#L18-L37 |
27,832 | hyperhq/hyperd | networking/portmapping/iptables/iptables_linux.go | OperatePortMap | func OperatePortMap(action Action, chain string, rule []string) error {
if output, err := Raw(append([]string{
"-t", string(Nat), string(action), chain}, rule...)...); err != nil {
return fmt.Errorf("Unable to setup network port map: %s", err)
} else if len(output) != 0 {
return &ChainError{Chain: chain, Output... | go | func OperatePortMap(action Action, chain string, rule []string) error {
if output, err := Raw(append([]string{
"-t", string(Nat), string(action), chain}, rule...)...); err != nil {
return fmt.Errorf("Unable to setup network port map: %s", err)
} else if len(output) != 0 {
return &ChainError{Chain: chain, Output... | [
"func",
"OperatePortMap",
"(",
"action",
"Action",
",",
"chain",
"string",
",",
"rule",
"[",
"]",
"string",
")",
"error",
"{",
"if",
"output",
",",
"err",
":=",
"Raw",
"(",
"append",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"string",
"(",
"Na... | // Check if a dnat rule exists | [
"Check",
"if",
"a",
"dnat",
"rule",
"exists"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/networking/portmapping/iptables/iptables_linux.go#L62-L71 |
27,833 | hyperhq/hyperd | networking/portmapping/iptables/iptables_linux.go | Exists | func Exists(table Table, chain string, rule ...string) bool {
if string(table) == "" {
table = Filter
}
// iptables -C, --check option was added in v.1.4.11
// http://ftp.netfilter.org/pub/iptables/changes-iptables-1.4.11.txt
// try -C
// if exit status is 0 then return true, the rule exists
if _, err := Raw... | go | func Exists(table Table, chain string, rule ...string) bool {
if string(table) == "" {
table = Filter
}
// iptables -C, --check option was added in v.1.4.11
// http://ftp.netfilter.org/pub/iptables/changes-iptables-1.4.11.txt
// try -C
// if exit status is 0 then return true, the rule exists
if _, err := Raw... | [
"func",
"Exists",
"(",
"table",
"Table",
",",
"chain",
"string",
",",
"rule",
"...",
"string",
")",
"bool",
"{",
"if",
"string",
"(",
"table",
")",
"==",
"\"",
"\"",
"{",
"table",
"=",
"Filter",
"\n",
"}",
"\n\n",
"// iptables -C, --check option was added ... | // Check if a rule exists | [
"Check",
"if",
"a",
"rule",
"exists"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/networking/portmapping/iptables/iptables_linux.go#L142-L170 |
27,834 | hyperhq/hyperd | networking/portmapping/iptables/iptables_linux.go | Raw | func Raw(args ...string) ([]byte, error) {
if err := initCheck(); err != nil {
return nil, err
}
if supportsXlock {
args = append([]string{"--wait"}, args...)
}
hlog.Log(hlog.TRACE, "%s, %v", iptablesPath, args)
output, err := exec.Command(iptablesPath, args...).CombinedOutput()
if err != nil {
return ni... | go | func Raw(args ...string) ([]byte, error) {
if err := initCheck(); err != nil {
return nil, err
}
if supportsXlock {
args = append([]string{"--wait"}, args...)
}
hlog.Log(hlog.TRACE, "%s, %v", iptablesPath, args)
output, err := exec.Command(iptablesPath, args...).CombinedOutput()
if err != nil {
return ni... | [
"func",
"Raw",
"(",
"args",
"...",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"err",
":=",
"initCheck",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"supportsXlock",
"{",
"... | // Call 'iptables' system command, passing supplied arguments | [
"Call",
"iptables",
"system",
"command",
"passing",
"supplied",
"arguments"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/networking/portmapping/iptables/iptables_linux.go#L173-L194 |
27,835 | hyperhq/hyperd | daemon/daemondb/daemondb.go | LagecyGetPod | func (d *DaemonDB) LagecyGetPod(id string) ([]byte, error) {
return d.Get(keyPod(id))
} | go | func (d *DaemonDB) LagecyGetPod(id string) ([]byte, error) {
return d.Get(keyPod(id))
} | [
"func",
"(",
"d",
"*",
"DaemonDB",
")",
"LagecyGetPod",
"(",
"id",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"d",
".",
"Get",
"(",
"keyPod",
"(",
"id",
")",
")",
"\n",
"}"
] | // Pods podId and args | [
"Pods",
"podId",
"and",
"args"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/daemondb/daemondb.go#L43-L45 |
27,836 | hyperhq/hyperd | engine/env.go | Get | func (env *Env) Get(key string) (value string) {
// not using Map() because of the extra allocations https://github.com/docker/docker/pull/7488#issuecomment-51638315
for _, kv := range *env {
if strings.Index(kv, "=") == -1 {
continue
}
parts := strings.SplitN(kv, "=", 2)
if parts[0] != key {
continue
... | go | func (env *Env) Get(key string) (value string) {
// not using Map() because of the extra allocations https://github.com/docker/docker/pull/7488#issuecomment-51638315
for _, kv := range *env {
if strings.Index(kv, "=") == -1 {
continue
}
parts := strings.SplitN(kv, "=", 2)
if parts[0] != key {
continue
... | [
"func",
"(",
"env",
"*",
"Env",
")",
"Get",
"(",
"key",
"string",
")",
"(",
"value",
"string",
")",
"{",
"// not using Map() because of the extra allocations https://github.com/docker/docker/pull/7488#issuecomment-51638315",
"for",
"_",
",",
"kv",
":=",
"range",
"*",
... | // Get returns the last value associated with the given key. If there are no
// values associated with the key, Get returns the empty string. | [
"Get",
"returns",
"the",
"last",
"value",
"associated",
"with",
"the",
"given",
"key",
".",
"If",
"there",
"are",
"no",
"values",
"associated",
"with",
"the",
"key",
"Get",
"returns",
"the",
"empty",
"string",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/env.go#L18-L35 |
27,837 | hyperhq/hyperd | engine/env.go | Decode | func (env *Env) Decode(src io.Reader) error {
m := make(map[string]interface{})
d := json.NewDecoder(src)
// We need this or we'll lose data when we decode int64 in json
d.UseNumber()
if err := d.Decode(&m); err != nil {
return err
}
for k, v := range m {
env.SetAuto(k, v)
}
return nil
} | go | func (env *Env) Decode(src io.Reader) error {
m := make(map[string]interface{})
d := json.NewDecoder(src)
// We need this or we'll lose data when we decode int64 in json
d.UseNumber()
if err := d.Decode(&m); err != nil {
return err
}
for k, v := range m {
env.SetAuto(k, v)
}
return nil
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"Decode",
"(",
"src",
"io",
".",
"Reader",
")",
"error",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"d",
":=",
"json",
".",
"NewDecoder",
"(",
"src",
")",
"\n",... | // DecodeEnv decodes `src` as a json dictionary, and adds
// each decoded key-value pair to the environment.
//
// If `src` cannot be decoded as a json dictionary, an error
// is returned. | [
"DecodeEnv",
"decodes",
"src",
"as",
"a",
"json",
"dictionary",
"and",
"adds",
"each",
"decoded",
"key",
"-",
"value",
"pair",
"to",
"the",
"environment",
".",
"If",
"src",
"cannot",
"be",
"decoded",
"as",
"a",
"json",
"dictionary",
"an",
"error",
"is",
... | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/env.go#L189-L201 |
27,838 | hyperhq/hyperd | engine/env.go | MultiMap | func (env *Env) MultiMap() map[string][]string {
m := make(map[string][]string)
for _, kv := range *env {
parts := strings.SplitN(kv, "=", 2)
m[parts[0]] = append(m[parts[0]], parts[1])
}
return m
} | go | func (env *Env) MultiMap() map[string][]string {
m := make(map[string][]string)
for _, kv := range *env {
parts := strings.SplitN(kv, "=", 2)
m[parts[0]] = append(m[parts[0]], parts[1])
}
return m
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"MultiMap",
"(",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"kv",
":=",
"range",
"*",
"env",... | // MultiMap returns a representation of env as a
// map of string arrays, keyed by string.
// This is the same structure as http headers for example,
// which allow each key to have multiple values. | [
"MultiMap",
"returns",
"a",
"representation",
"of",
"env",
"as",
"a",
"map",
"of",
"string",
"arrays",
"keyed",
"by",
"string",
".",
"This",
"is",
"the",
"same",
"structure",
"as",
"http",
"headers",
"for",
"example",
"which",
"allow",
"each",
"key",
"to",... | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/env.go#L294-L301 |
27,839 | hyperhq/hyperd | engine/env.go | InitMultiMap | func (env *Env) InitMultiMap(m map[string][]string) {
(*env) = make([]string, 0, len(m))
for k, vals := range m {
for _, v := range vals {
env.Set(k, v)
}
}
} | go | func (env *Env) InitMultiMap(m map[string][]string) {
(*env) = make([]string, 0, len(m))
for k, vals := range m {
for _, v := range vals {
env.Set(k, v)
}
}
} | [
"func",
"(",
"env",
"*",
"Env",
")",
"InitMultiMap",
"(",
"m",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"{",
"(",
"*",
"env",
")",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"m",
")",
")",
"\n",
"for",
"k",
... | // InitMultiMap removes all values in env, then initializes
// new values from the contents of m. | [
"InitMultiMap",
"removes",
"all",
"values",
"in",
"env",
"then",
"initializes",
"new",
"values",
"from",
"the",
"contents",
"of",
"m",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/env.go#L305-L312 |
27,840 | hyperhq/hyperd | lib/goconfig/conf.go | SetValue | func (c *ConfigFile) SetValue(section, key, value string) bool {
// Blank section name represents DEFAULT section.
if len(section) == 0 {
section = DEFAULT_SECTION
}
if len(key) == 0 {
return false
}
if c.BlockMode {
c.lock.Lock()
defer c.lock.Unlock()
}
// Check if section exists.
if _, ok := c.data... | go | func (c *ConfigFile) SetValue(section, key, value string) bool {
// Blank section name represents DEFAULT section.
if len(section) == 0 {
section = DEFAULT_SECTION
}
if len(key) == 0 {
return false
}
if c.BlockMode {
c.lock.Lock()
defer c.lock.Unlock()
}
// Check if section exists.
if _, ok := c.data... | [
"func",
"(",
"c",
"*",
"ConfigFile",
")",
"SetValue",
"(",
"section",
",",
"key",
",",
"value",
"string",
")",
"bool",
"{",
"// Blank section name represents DEFAULT section.",
"if",
"len",
"(",
"section",
")",
"==",
"0",
"{",
"section",
"=",
"DEFAULT_SECTION"... | // SetValue adds a new section-key-value to the configuration.
// It returns true if the key and value were inserted,
// or returns false if the value was overwritten.
// If the section does not exist in advance, it will be created. | [
"SetValue",
"adds",
"a",
"new",
"section",
"-",
"key",
"-",
"value",
"to",
"the",
"configuration",
".",
"It",
"returns",
"true",
"if",
"the",
"key",
"and",
"value",
"were",
"inserted",
"or",
"returns",
"false",
"if",
"the",
"value",
"was",
"overwritten",
... | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/lib/goconfig/conf.go#L85-L115 |
27,841 | hyperhq/hyperd | daemon/pod/streams.go | NewStreamConfig | func NewStreamConfig() *StreamConfig {
return &StreamConfig{
stderr: new(broadcaster.Unbuffered),
stdout: new(broadcaster.Unbuffered),
}
} | go | func NewStreamConfig() *StreamConfig {
return &StreamConfig{
stderr: new(broadcaster.Unbuffered),
stdout: new(broadcaster.Unbuffered),
}
} | [
"func",
"NewStreamConfig",
"(",
")",
"*",
"StreamConfig",
"{",
"return",
"&",
"StreamConfig",
"{",
"stderr",
":",
"new",
"(",
"broadcaster",
".",
"Unbuffered",
")",
",",
"stdout",
":",
"new",
"(",
"broadcaster",
".",
"Unbuffered",
")",
",",
"}",
"\n",
"}... | // NewStreamConfig creates a stream config and initializes
// the standard err and standard out to new unbuffered broadcasters. | [
"NewStreamConfig",
"creates",
"a",
"stream",
"config",
"and",
"initializes",
"the",
"standard",
"err",
"and",
"standard",
"out",
"to",
"new",
"unbuffered",
"broadcasters",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/pod/streams.go#L39-L44 |
27,842 | hyperhq/hyperd | daemon/pod/streams.go | StdoutPipe | func (streamConfig *StreamConfig) StdoutPipe() io.ReadCloser {
bytesPipe := ioutils.NewBytesPipe(nil)
streamConfig.stdout.Add(bytesPipe)
return bytesPipe
} | go | func (streamConfig *StreamConfig) StdoutPipe() io.ReadCloser {
bytesPipe := ioutils.NewBytesPipe(nil)
streamConfig.stdout.Add(bytesPipe)
return bytesPipe
} | [
"func",
"(",
"streamConfig",
"*",
"StreamConfig",
")",
"StdoutPipe",
"(",
")",
"io",
".",
"ReadCloser",
"{",
"bytesPipe",
":=",
"ioutils",
".",
"NewBytesPipe",
"(",
"nil",
")",
"\n",
"streamConfig",
".",
"stdout",
".",
"Add",
"(",
"bytesPipe",
")",
"\n",
... | // StdoutPipe creates a new io.ReadCloser with an empty bytes pipe.
// It adds this new out pipe to the Stdout broadcaster. | [
"StdoutPipe",
"creates",
"a",
"new",
"io",
".",
"ReadCloser",
"with",
"an",
"empty",
"bytes",
"pipe",
".",
"It",
"adds",
"this",
"new",
"out",
"pipe",
"to",
"the",
"Stdout",
"broadcaster",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/pod/streams.go#L68-L72 |
27,843 | hyperhq/hyperd | daemon/pod/streams.go | StderrPipe | func (streamConfig *StreamConfig) StderrPipe() io.ReadCloser {
bytesPipe := ioutils.NewBytesPipe(nil)
streamConfig.stderr.Add(bytesPipe)
return bytesPipe
} | go | func (streamConfig *StreamConfig) StderrPipe() io.ReadCloser {
bytesPipe := ioutils.NewBytesPipe(nil)
streamConfig.stderr.Add(bytesPipe)
return bytesPipe
} | [
"func",
"(",
"streamConfig",
"*",
"StreamConfig",
")",
"StderrPipe",
"(",
")",
"io",
".",
"ReadCloser",
"{",
"bytesPipe",
":=",
"ioutils",
".",
"NewBytesPipe",
"(",
"nil",
")",
"\n",
"streamConfig",
".",
"stderr",
".",
"Add",
"(",
"bytesPipe",
")",
"\n",
... | // StderrPipe creates a new io.ReadCloser with an empty bytes pipe.
// It adds this new err pipe to the Stderr broadcaster. | [
"StderrPipe",
"creates",
"a",
"new",
"io",
".",
"ReadCloser",
"with",
"an",
"empty",
"bytes",
"pipe",
".",
"It",
"adds",
"this",
"new",
"err",
"pipe",
"to",
"the",
"Stderr",
"broadcaster",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/pod/streams.go#L76-L80 |
27,844 | hyperhq/hyperd | daemon/daemonbuilder/pod.go | ContainerAttach | func (d Docker) ContainerAttach(cId string, stdin io.ReadCloser, stdout, stderr io.Writer, stream bool) error {
<-d.hyper.Ready
err := d.Daemon.Attach(stdin, ioutils.NopWriteCloser(stdout), cId)
if err != nil {
return err
}
code, err := d.Daemon.ExitCode(cId, "")
if err != nil {
return err
}
if code == 0... | go | func (d Docker) ContainerAttach(cId string, stdin io.ReadCloser, stdout, stderr io.Writer, stream bool) error {
<-d.hyper.Ready
err := d.Daemon.Attach(stdin, ioutils.NopWriteCloser(stdout), cId)
if err != nil {
return err
}
code, err := d.Daemon.ExitCode(cId, "")
if err != nil {
return err
}
if code == 0... | [
"func",
"(",
"d",
"Docker",
")",
"ContainerAttach",
"(",
"cId",
"string",
",",
"stdin",
"io",
".",
"ReadCloser",
",",
"stdout",
",",
"stderr",
"io",
".",
"Writer",
",",
"stream",
"bool",
")",
"error",
"{",
"<-",
"d",
".",
"hyper",
".",
"Ready",
"\n\n... | // ContainerAttach attaches streams to the container cID. If stream is true, it streams the output. | [
"ContainerAttach",
"attaches",
"streams",
"to",
"the",
"container",
"cID",
".",
"If",
"stream",
"is",
"true",
"it",
"streams",
"the",
"output",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/daemonbuilder/pod.go#L26-L47 |
27,845 | hyperhq/hyperd | daemon/daemonbuilder/pod.go | ContainerCreate | func (d Docker) ContainerCreate(params types.ContainerCreateConfig) (types.ContainerCreateResponse, error) {
var spec *apitypes.UserPod
var err error
if params.Config == nil {
return types.ContainerCreateResponse{}, derr.ErrorCodeEmptyConfig
}
podId := fmt.Sprintf("buildpod-%s", utils.RandStr(10, "alpha"))
//... | go | func (d Docker) ContainerCreate(params types.ContainerCreateConfig) (types.ContainerCreateResponse, error) {
var spec *apitypes.UserPod
var err error
if params.Config == nil {
return types.ContainerCreateResponse{}, derr.ErrorCodeEmptyConfig
}
podId := fmt.Sprintf("buildpod-%s", utils.RandStr(10, "alpha"))
//... | [
"func",
"(",
"d",
"Docker",
")",
"ContainerCreate",
"(",
"params",
"types",
".",
"ContainerCreateConfig",
")",
"(",
"types",
".",
"ContainerCreateResponse",
",",
"error",
")",
"{",
"var",
"spec",
"*",
"apitypes",
".",
"UserPod",
"\n",
"var",
"err",
"error",
... | // Override the Docker ContainerCreate interface, create pod to run command | [
"Override",
"the",
"Docker",
"ContainerCreate",
"interface",
"create",
"pod",
"to",
"run",
"command"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/daemonbuilder/pod.go#L210-L250 |
27,846 | hyperhq/hyperd | server/server_windows.go | newServer | func (s *Server) newServer(proto, addr string) ([]*HTTPServer, error) {
var (
ls []net.Listener
)
switch proto {
case "tcp":
l, err := s.initTCPSocket(addr)
if err != nil {
return nil, err
}
ls = append(ls, l)
default:
return nil, errors.New("Invalid protocol format. Windows only supports tcp.")
}... | go | func (s *Server) newServer(proto, addr string) ([]*HTTPServer, error) {
var (
ls []net.Listener
)
switch proto {
case "tcp":
l, err := s.initTCPSocket(addr)
if err != nil {
return nil, err
}
ls = append(ls, l)
default:
return nil, errors.New("Invalid protocol format. Windows only supports tcp.")
}... | [
"func",
"(",
"s",
"*",
"Server",
")",
"newServer",
"(",
"proto",
",",
"addr",
"string",
")",
"(",
"[",
"]",
"*",
"HTTPServer",
",",
"error",
")",
"{",
"var",
"(",
"ls",
"[",
"]",
"net",
".",
"Listener",
"\n",
")",
"\n",
"switch",
"proto",
"{",
... | // NewServer sets up the required Server and does protocol specific checking. | [
"NewServer",
"sets",
"up",
"the",
"required",
"Server",
"and",
"does",
"protocol",
"specific",
"checking",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/server_windows.go#L12-L39 |
27,847 | hyperhq/hyperd | server/router/local/local.go | NewRoute | func NewRoute(method, path string, handler httputils.APIFunc) dkrouter.Route {
return localRoute{method, path, handler}
} | go | func NewRoute(method, path string, handler httputils.APIFunc) dkrouter.Route {
return localRoute{method, path, handler}
} | [
"func",
"NewRoute",
"(",
"method",
",",
"path",
"string",
",",
"handler",
"httputils",
".",
"APIFunc",
")",
"dkrouter",
".",
"Route",
"{",
"return",
"localRoute",
"{",
"method",
",",
"path",
",",
"handler",
"}",
"\n",
"}"
] | // NewRoute initializes a new local router for the reouter | [
"NewRoute",
"initializes",
"a",
"new",
"local",
"router",
"for",
"the",
"reouter"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/router/local/local.go#L39-L41 |
27,848 | hyperhq/hyperd | server/router/local/local.go | NewRouter | func NewRouter(daemon *daemon.Daemon) dkrouter.Router {
r := &router{
daemon: daemon,
}
r.initRoutes()
return r
} | go | func NewRouter(daemon *daemon.Daemon) dkrouter.Router {
r := &router{
daemon: daemon,
}
r.initRoutes()
return r
} | [
"func",
"NewRouter",
"(",
"daemon",
"*",
"daemon",
".",
"Daemon",
")",
"dkrouter",
".",
"Router",
"{",
"r",
":=",
"&",
"router",
"{",
"daemon",
":",
"daemon",
",",
"}",
"\n",
"r",
".",
"initRoutes",
"(",
")",
"\n",
"return",
"r",
"\n",
"}"
] | // NewRouter initializes a local router with a new daemon. | [
"NewRouter",
"initializes",
"a",
"local",
"router",
"with",
"a",
"new",
"daemon",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/router/local/local.go#L74-L80 |
27,849 | hyperhq/hyperd | server/router/local/local.go | initRoutes | func (r *router) initRoutes() {
r.routes = []dkrouter.Route{
// OPTIONS
// GET
// /images/json in docker
NewGetRoute("/images/get", r.getImagesJSON),
// /images/get in docker
NewGetRoute("/images/save", r.getImagesSave),
// POST
NewPostRoute("/image/create", r.postImagesCreate),
NewPostRoute("/image/... | go | func (r *router) initRoutes() {
r.routes = []dkrouter.Route{
// OPTIONS
// GET
// /images/json in docker
NewGetRoute("/images/get", r.getImagesJSON),
// /images/get in docker
NewGetRoute("/images/save", r.getImagesSave),
// POST
NewPostRoute("/image/create", r.postImagesCreate),
NewPostRoute("/image/... | [
"func",
"(",
"r",
"*",
"router",
")",
"initRoutes",
"(",
")",
"{",
"r",
".",
"routes",
"=",
"[",
"]",
"dkrouter",
".",
"Route",
"{",
"// OPTIONS",
"// GET",
"// /images/json in docker",
"NewGetRoute",
"(",
"\"",
"\"",
",",
"r",
".",
"getImagesJSON",
")",... | // initRoutes initializes the routes in this router | [
"initRoutes",
"initializes",
"the",
"routes",
"in",
"this",
"router"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/router/local/local.go#L88-L103 |
27,850 | hyperhq/hyperd | daemon/pod/container.go | initStreams | func (c *Container) initStreams() error {
if c.streams != nil {
return nil
}
if !c.p.IsAlive() {
c.Log(ERROR, "can not init stream to a non-existing sandbox")
return errors.ErrPodNotAlive.WithArgs(c.p.Id())
}
c.Log(TRACE, "init io streams")
c.streams = NewStreamConfig()
c.streams.NewInputPipes()
tty := &h... | go | func (c *Container) initStreams() error {
if c.streams != nil {
return nil
}
if !c.p.IsAlive() {
c.Log(ERROR, "can not init stream to a non-existing sandbox")
return errors.ErrPodNotAlive.WithArgs(c.p.Id())
}
c.Log(TRACE, "init io streams")
c.streams = NewStreamConfig()
c.streams.NewInputPipes()
tty := &h... | [
"func",
"(",
"c",
"*",
"Container",
")",
"initStreams",
"(",
")",
"error",
"{",
"if",
"c",
".",
"streams",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"!",
"c",
".",
"p",
".",
"IsAlive",
"(",
")",
"{",
"c",
".",
"Log",
"(",
"ERR... | // This method should be called when initialzing container or put into resource lock. | [
"This",
"method",
"should",
"be",
"called",
"when",
"initialzing",
"container",
"or",
"put",
"into",
"resource",
"lock",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/pod/container.go#L945-L966 |
27,851 | hyperhq/hyperd | daemon/pod/container.go | Create | func (cs *ContainerStatus) Create() error {
cs.Lock()
defer cs.Unlock()
if cs.State != S_CONTAINER_NONE {
err := fmt.Errorf("only NONE container could be create, current: %d", cs.State)
return err
}
cs.State = S_CONTAINER_CREATING
cs.stateChanged.Broadcast()
return nil
} | go | func (cs *ContainerStatus) Create() error {
cs.Lock()
defer cs.Unlock()
if cs.State != S_CONTAINER_NONE {
err := fmt.Errorf("only NONE container could be create, current: %d", cs.State)
return err
}
cs.State = S_CONTAINER_CREATING
cs.stateChanged.Broadcast()
return nil
} | [
"func",
"(",
"cs",
"*",
"ContainerStatus",
")",
"Create",
"(",
")",
"error",
"{",
"cs",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cs",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"cs",
".",
"State",
"!=",
"S_CONTAINER_NONE",
"{",
"err",
":=",
"fmt",
".",
... | // container status transition | [
"container",
"status",
"transition"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/daemon/pod/container.go#L1196-L1209 |
27,852 | hyperhq/hyperd | storage/devicemapper/dm.go | DMCleanup | func DMCleanup(dm *DeviceMapper) error {
var parms string
// Delete the thin pool for test
parms = fmt.Sprintf("dmsetup remove \"/dev/mapper/%s\"", dm.PoolName)
if res, err := exec.Command("/bin/sh", "-c", parms).CombinedOutput(); err != nil {
glog.Error(string(res))
return fmt.Errorf(string(res))
}
// Delete... | go | func DMCleanup(dm *DeviceMapper) error {
var parms string
// Delete the thin pool for test
parms = fmt.Sprintf("dmsetup remove \"/dev/mapper/%s\"", dm.PoolName)
if res, err := exec.Command("/bin/sh", "-c", parms).CombinedOutput(); err != nil {
glog.Error(string(res))
return fmt.Errorf(string(res))
}
// Delete... | [
"func",
"DMCleanup",
"(",
"dm",
"*",
"DeviceMapper",
")",
"error",
"{",
"var",
"parms",
"string",
"\n",
"// Delete the thin pool for test",
"parms",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"dm",
".",
"PoolName",
")",
"\n",
"if",
... | // Delete the pool which is created in 'Init' function | [
"Delete",
"the",
"pool",
"which",
"is",
"created",
"in",
"Init",
"function"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/storage/devicemapper/dm.go#L295-L315 |
27,853 | hyperhq/hyperd | server/httputils/httputils.go | ParseMultipartForm | func ParseMultipartForm(r *http.Request) error {
if err := r.ParseMultipartForm(4096); err != nil && !strings.HasPrefix(err.Error(), "mime:") {
return err
}
return nil
} | go | func ParseMultipartForm(r *http.Request) error {
if err := r.ParseMultipartForm(4096); err != nil && !strings.HasPrefix(err.Error(), "mime:") {
return err
}
return nil
} | [
"func",
"ParseMultipartForm",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"if",
"err",
":=",
"r",
".",
"ParseMultipartForm",
"(",
"4096",
")",
";",
"err",
"!=",
"nil",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"err",
".",
"Error",
"(... | // ParseMultipartForm ensure the request form is parsed, even with invalid content types. | [
"ParseMultipartForm",
"ensure",
"the",
"request",
"form",
"is",
"parsed",
"even",
"with",
"invalid",
"content",
"types",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/httputils/httputils.go#L81-L86 |
27,854 | hyperhq/hyperd | server/httputils/httputils.go | WriteError | func WriteError(w http.ResponseWriter, err error) {
if err == nil || w == nil {
glog.Errorf("unexpected HTTP error handling, error %v, writer %v", err, w)
return
}
statusCode := http.StatusInternalServerError
errMsg := err.Error()
// Based on the type of error we get we need to process things
// slightly di... | go | func WriteError(w http.ResponseWriter, err error) {
if err == nil || w == nil {
glog.Errorf("unexpected HTTP error handling, error %v, writer %v", err, w)
return
}
statusCode := http.StatusInternalServerError
errMsg := err.Error()
// Based on the type of error we get we need to process things
// slightly di... | [
"func",
"WriteError",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"err",
"error",
")",
"{",
"if",
"err",
"==",
"nil",
"||",
"w",
"==",
"nil",
"{",
"glog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
",",
"w",
")",
"\n",
"return",
"\n",
"}",
"... | // WriteError decodes a specific docker error and sends it in the response. | [
"WriteError",
"decodes",
"a",
"specific",
"docker",
"error",
"and",
"sends",
"it",
"in",
"the",
"response",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/server/httputils/httputils.go#L89-L158 |
27,855 | hyperhq/hyperd | image/tarexport/tarexport.go | NewTarExporter | func NewTarExporter(is image.Store, ls layer.Store, rs reference.Store) hyperimage.Exporter {
return &tarexporter{
is: is,
ls: ls,
rs: rs,
}
} | go | func NewTarExporter(is image.Store, ls layer.Store, rs reference.Store) hyperimage.Exporter {
return &tarexporter{
is: is,
ls: ls,
rs: rs,
}
} | [
"func",
"NewTarExporter",
"(",
"is",
"image",
".",
"Store",
",",
"ls",
"layer",
".",
"Store",
",",
"rs",
"reference",
".",
"Store",
")",
"hyperimage",
".",
"Exporter",
"{",
"return",
"&",
"tarexporter",
"{",
"is",
":",
"is",
",",
"ls",
":",
"ls",
","... | // NewTarExporter returns new ImageExporter for tar packages | [
"NewTarExporter",
"returns",
"new",
"ImageExporter",
"for",
"tar",
"packages"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/image/tarexport/tarexport.go#L31-L37 |
27,856 | hyperhq/hyperd | storage/graphdriver/rawblock/driver.go | Init | func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
backingFs := "<unknown>"
blockFs := "xfs" // TODO: make it configurable
cow := true
supported := "supported"
fsMagic, err := graphdriver.GetFSMagic(home)
if err != nil {
return nil, err
}
if fsName, ok :=... | go | func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
backingFs := "<unknown>"
blockFs := "xfs" // TODO: make it configurable
cow := true
supported := "supported"
fsMagic, err := graphdriver.GetFSMagic(home)
if err != nil {
return nil, err
}
if fsName, ok :=... | [
"func",
"Init",
"(",
"home",
"string",
",",
"options",
"[",
"]",
"string",
",",
"uidMaps",
",",
"gidMaps",
"[",
"]",
"idtools",
".",
"IDMap",
")",
"(",
"graphdriver",
".",
"Driver",
",",
"error",
")",
"{",
"backingFs",
":=",
"\"",
"\"",
"\n",
"blockF... | // Init returns a new Raw Block driver.
// This sets the home directory for the driver and returns NaiveDiffDriver. | [
"Init",
"returns",
"a",
"new",
"Raw",
"Block",
"driver",
".",
"This",
"sets",
"the",
"home",
"directory",
"for",
"the",
"driver",
"and",
"returns",
"NaiveDiffDriver",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/storage/graphdriver/rawblock/driver.go#L58-L124 |
27,857 | hyperhq/hyperd | storage/graphdriver/rawblock/driver.go | Status | func (d *Driver) Status() [][2]string {
return [][2]string{
{"Backing Filesystem", d.backingFs},
{"Support Copy-On-Write", fmt.Sprintf("%v", d.cow)},
{"Block Filesystem", d.blockFs},
{"Block Size", fmt.Sprintf("%s", units.HumanSize(float64(d.blockSize)))},
}
} | go | func (d *Driver) Status() [][2]string {
return [][2]string{
{"Backing Filesystem", d.backingFs},
{"Support Copy-On-Write", fmt.Sprintf("%v", d.cow)},
{"Block Filesystem", d.blockFs},
{"Block Size", fmt.Sprintf("%s", units.HumanSize(float64(d.blockSize)))},
}
} | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Status",
"(",
")",
"[",
"]",
"[",
"2",
"]",
"string",
"{",
"return",
"[",
"]",
"[",
"2",
"]",
"string",
"{",
"{",
"\"",
"\"",
",",
"d",
".",
"backingFs",
"}",
",",
"{",
"\"",
"\"",
",",
"fmt",
".",
"... | // Status is used for implementing the graphdriver.ProtoDriver interface. | [
"Status",
"is",
"used",
"for",
"implementing",
"the",
"graphdriver",
".",
"ProtoDriver",
"interface",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/storage/graphdriver/rawblock/driver.go#L131-L138 |
27,858 | hyperhq/hyperd | storage/graphdriver/rawblock/driver.go | Create | func (d *Driver) Create(id, parent, mountLabel string) error {
if err := idtools.MkdirAllAs(filepath.Dir(d.block(id)), 0700, d.uid, d.gid); err != nil {
return err
}
if parent == "" {
return CreateBlock(d.block(id), d.blockFs, mountLabel, d.blockSize)
}
if out, err := exec.Command("cp", "-a", "--reflink=auto",... | go | func (d *Driver) Create(id, parent, mountLabel string) error {
if err := idtools.MkdirAllAs(filepath.Dir(d.block(id)), 0700, d.uid, d.gid); err != nil {
return err
}
if parent == "" {
return CreateBlock(d.block(id), d.blockFs, mountLabel, d.blockSize)
}
if out, err := exec.Command("cp", "-a", "--reflink=auto",... | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Create",
"(",
"id",
",",
"parent",
",",
"mountLabel",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"idtools",
".",
"MkdirAllAs",
"(",
"filepath",
".",
"Dir",
"(",
"d",
".",
"block",
"(",
"id",
")",
")",
"... | // Create prepares the filesystem for the rawblock driver and copies the block from the parent. | [
"Create",
"prepares",
"the",
"filesystem",
"for",
"the",
"rawblock",
"driver",
"and",
"copies",
"the",
"block",
"from",
"the",
"parent",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/storage/graphdriver/rawblock/driver.go#L151-L162 |
27,859 | hyperhq/hyperd | storage/graphdriver/rawblock/driver.go | Exists | func (d *Driver) Exists(id string) bool {
_, err := os.Stat(d.block(id))
return err == nil
} | go | func (d *Driver) Exists(id string) bool {
_, err := os.Stat(d.block(id))
return err == nil
} | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Exists",
"(",
"id",
"string",
")",
"bool",
"{",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"d",
".",
"block",
"(",
"id",
")",
")",
"\n",
"return",
"err",
"==",
"nil",
"\n",
"}"
] | // Exists checks to see if the directory exists for the given id. | [
"Exists",
"checks",
"to",
"see",
"if",
"the",
"directory",
"exists",
"for",
"the",
"given",
"id",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/storage/graphdriver/rawblock/driver.go#L210-L213 |
27,860 | hyperhq/hyperd | engine/streams.go | Tail | func Tail(buffer *bytes.Buffer, n int) string {
if n <= 0 {
return ""
}
s := strings.TrimRightFunc(buffer.String(), unicode.IsSpace)
i := len(s) - 1
for ; i >= 0 && n > 0; i-- {
if s[i] == '\n' {
n--
if n == 0 {
break
}
}
}
// when i == -1, return the whole string which is s[0:]
return s[i+1:... | go | func Tail(buffer *bytes.Buffer, n int) string {
if n <= 0 {
return ""
}
s := strings.TrimRightFunc(buffer.String(), unicode.IsSpace)
i := len(s) - 1
for ; i >= 0 && n > 0; i-- {
if s[i] == '\n' {
n--
if n == 0 {
break
}
}
}
// when i == -1, return the whole string which is s[0:]
return s[i+1:... | [
"func",
"Tail",
"(",
"buffer",
"*",
"bytes",
".",
"Buffer",
",",
"n",
"int",
")",
"string",
"{",
"if",
"n",
"<=",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"s",
":=",
"strings",
".",
"TrimRightFunc",
"(",
"buffer",
".",
"String",
"(",
")",... | // Tail returns the n last lines of a buffer
// stripped out of trailing white spaces, if any.
//
// if n <= 0, returns an empty string | [
"Tail",
"returns",
"the",
"n",
"last",
"lines",
"of",
"a",
"buffer",
"stripped",
"out",
"of",
"trailing",
"white",
"spaces",
"if",
"any",
".",
"if",
"n",
"<",
"=",
"0",
"returns",
"an",
"empty",
"string"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/streams.go#L24-L40 |
27,861 | hyperhq/hyperd | engine/streams.go | Used | func (o *Output) Used() bool {
o.Lock()
defer o.Unlock()
return o.used
} | go | func (o *Output) Used() bool {
o.Lock()
defer o.Unlock()
return o.used
} | [
"func",
"(",
"o",
"*",
"Output",
")",
"Used",
"(",
")",
"bool",
"{",
"o",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"Unlock",
"(",
")",
"\n",
"return",
"o",
".",
"used",
"\n",
"}"
] | // Return true if something was written on this output | [
"Return",
"true",
"if",
"something",
"was",
"written",
"on",
"this",
"output"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/streams.go#L49-L53 |
27,862 | hyperhq/hyperd | engine/streams.go | Add | func (o *Output) Add(dst io.Writer) {
o.Lock()
defer o.Unlock()
o.dests = append(o.dests, dst)
} | go | func (o *Output) Add(dst io.Writer) {
o.Lock()
defer o.Unlock()
o.dests = append(o.dests, dst)
} | [
"func",
"(",
"o",
"*",
"Output",
")",
"Add",
"(",
"dst",
"io",
".",
"Writer",
")",
"{",
"o",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"Unlock",
"(",
")",
"\n",
"o",
".",
"dests",
"=",
"append",
"(",
"o",
".",
"dests",
",",
"dst",
")"... | // Add attaches a new destination to the Output. Any data subsequently written
// to the output will be written to the new destination in addition to all the others.
// This method is thread-safe. | [
"Add",
"attaches",
"a",
"new",
"destination",
"to",
"the",
"Output",
".",
"Any",
"data",
"subsequently",
"written",
"to",
"the",
"output",
"will",
"be",
"written",
"to",
"the",
"new",
"destination",
"in",
"addition",
"to",
"all",
"the",
"others",
".",
"Thi... | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/streams.go#L58-L62 |
27,863 | hyperhq/hyperd | engine/streams.go | Set | func (o *Output) Set(dst io.Writer) {
o.Close()
o.Lock()
defer o.Unlock()
o.dests = []io.Writer{dst}
} | go | func (o *Output) Set(dst io.Writer) {
o.Close()
o.Lock()
defer o.Unlock()
o.dests = []io.Writer{dst}
} | [
"func",
"(",
"o",
"*",
"Output",
")",
"Set",
"(",
"dst",
"io",
".",
"Writer",
")",
"{",
"o",
".",
"Close",
"(",
")",
"\n",
"o",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"Unlock",
"(",
")",
"\n",
"o",
".",
"dests",
"=",
"[",
"]",
"i... | // Set closes and remove existing destination and then attaches a new destination to
// the Output. Any data subsequently written to the output will be written to the new
// destination in addition to all the others. This method is thread-safe. | [
"Set",
"closes",
"and",
"remove",
"existing",
"destination",
"and",
"then",
"attaches",
"a",
"new",
"destination",
"to",
"the",
"Output",
".",
"Any",
"data",
"subsequently",
"written",
"to",
"the",
"output",
"will",
"be",
"written",
"to",
"the",
"new",
"dest... | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/streams.go#L67-L72 |
27,864 | hyperhq/hyperd | engine/streams.go | Write | func (o *Output) Write(p []byte) (n int, err error) {
o.Lock()
defer o.Unlock()
o.used = true
var firstErr error
for _, dst := range o.dests {
_, err := dst.Write(p)
if err != nil && firstErr == nil {
firstErr = err
}
}
return len(p), firstErr
} | go | func (o *Output) Write(p []byte) (n int, err error) {
o.Lock()
defer o.Unlock()
o.used = true
var firstErr error
for _, dst := range o.dests {
_, err := dst.Write(p)
if err != nil && firstErr == nil {
firstErr = err
}
}
return len(p), firstErr
} | [
"func",
"(",
"o",
"*",
"Output",
")",
"Write",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"o",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"Unlock",
"(",
")",
"\n",
"o",
".",
"used",
"=",
"true",
... | // Write writes the same data to all registered destinations.
// This method is thread-safe. | [
"Write",
"writes",
"the",
"same",
"data",
"to",
"all",
"registered",
"destinations",
".",
"This",
"method",
"is",
"thread",
"-",
"safe",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/streams.go#L86-L98 |
27,865 | hyperhq/hyperd | engine/streams.go | Close | func (o *Output) Close() error {
o.Lock()
defer o.Unlock()
var firstErr error
for _, dst := range o.dests {
if closer, ok := dst.(io.Closer); ok {
err := closer.Close()
if err != nil && firstErr == nil {
firstErr = err
}
}
}
o.tasks.Wait()
o.dests = nil
return firstErr
} | go | func (o *Output) Close() error {
o.Lock()
defer o.Unlock()
var firstErr error
for _, dst := range o.dests {
if closer, ok := dst.(io.Closer); ok {
err := closer.Close()
if err != nil && firstErr == nil {
firstErr = err
}
}
}
o.tasks.Wait()
o.dests = nil
return firstErr
} | [
"func",
"(",
"o",
"*",
"Output",
")",
"Close",
"(",
")",
"error",
"{",
"o",
".",
"Lock",
"(",
")",
"\n",
"defer",
"o",
".",
"Unlock",
"(",
")",
"\n",
"var",
"firstErr",
"error",
"\n",
"for",
"_",
",",
"dst",
":=",
"range",
"o",
".",
"dests",
... | // Close unregisters all destinations and waits for all background
// AddTail and AddString tasks to complete.
// The Close method of each destination is called if it exists. | [
"Close",
"unregisters",
"all",
"destinations",
"and",
"waits",
"for",
"all",
"background",
"AddTail",
"and",
"AddString",
"tasks",
"to",
"complete",
".",
"The",
"Close",
"method",
"of",
"each",
"destination",
"is",
"called",
"if",
"it",
"exists",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/streams.go#L103-L118 |
27,866 | hyperhq/hyperd | engine/streams.go | Read | func (i *Input) Read(p []byte) (n int, err error) {
i.Mutex.Lock()
defer i.Mutex.Unlock()
if i.src == nil {
return 0, io.EOF
}
return i.src.Read(p)
} | go | func (i *Input) Read(p []byte) (n int, err error) {
i.Mutex.Lock()
defer i.Mutex.Unlock()
if i.src == nil {
return 0, io.EOF
}
return i.src.Read(p)
} | [
"func",
"(",
"i",
"*",
"Input",
")",
"Read",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"i",
".",
"Mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"i",
".",
"Mutex",
".",
"Unlock",
"(",
")",
"\n",
"if",
... | // Read reads from the input in a thread-safe way. | [
"Read",
"reads",
"from",
"the",
"input",
"in",
"a",
"thread",
"-",
"safe",
"way",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/streams.go#L132-L139 |
27,867 | hyperhq/hyperd | engine/streams.go | Close | func (i *Input) Close() error {
if i.src != nil {
if closer, ok := i.src.(io.Closer); ok {
return closer.Close()
}
}
return nil
} | go | func (i *Input) Close() error {
if i.src != nil {
if closer, ok := i.src.(io.Closer); ok {
return closer.Close()
}
}
return nil
} | [
"func",
"(",
"i",
"*",
"Input",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"i",
".",
"src",
"!=",
"nil",
"{",
"if",
"closer",
",",
"ok",
":=",
"i",
".",
"src",
".",
"(",
"io",
".",
"Closer",
")",
";",
"ok",
"{",
"return",
"closer",
".",
"C... | // Closes the src
// Not thread safe on purpose | [
"Closes",
"the",
"src",
"Not",
"thread",
"safe",
"on",
"purpose"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/streams.go#L143-L150 |
27,868 | hyperhq/hyperd | engine/streams.go | Add | func (i *Input) Add(src io.Reader) error {
i.Mutex.Lock()
defer i.Mutex.Unlock()
if i.src != nil {
return fmt.Errorf("Maximum number of sources reached: 1")
}
i.src = src
return nil
} | go | func (i *Input) Add(src io.Reader) error {
i.Mutex.Lock()
defer i.Mutex.Unlock()
if i.src != nil {
return fmt.Errorf("Maximum number of sources reached: 1")
}
i.src = src
return nil
} | [
"func",
"(",
"i",
"*",
"Input",
")",
"Add",
"(",
"src",
"io",
".",
"Reader",
")",
"error",
"{",
"i",
".",
"Mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"i",
".",
"Mutex",
".",
"Unlock",
"(",
")",
"\n",
"if",
"i",
".",
"src",
"!=",
"nil",
"... | // Add attaches a new source to the input.
// Add can only be called once per input. Subsequent calls will
// return an error. | [
"Add",
"attaches",
"a",
"new",
"source",
"to",
"the",
"input",
".",
"Add",
"can",
"only",
"be",
"called",
"once",
"per",
"input",
".",
"Subsequent",
"calls",
"will",
"return",
"an",
"error",
"."
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/streams.go#L155-L163 |
27,869 | hyperhq/hyperd | engine/streams.go | AddEnv | func (o *Output) AddEnv() (dst *Env, err error) {
src, err := o.AddPipe()
if err != nil {
return nil, err
}
dst = &Env{}
o.tasks.Add(1)
go func() {
defer o.tasks.Done()
decoder := NewDecoder(src)
for {
env, err := decoder.Decode()
if err != nil {
return
}
*dst = *env
}
}()
return dst, ... | go | func (o *Output) AddEnv() (dst *Env, err error) {
src, err := o.AddPipe()
if err != nil {
return nil, err
}
dst = &Env{}
o.tasks.Add(1)
go func() {
defer o.tasks.Done()
decoder := NewDecoder(src)
for {
env, err := decoder.Decode()
if err != nil {
return
}
*dst = *env
}
}()
return dst, ... | [
"func",
"(",
"o",
"*",
"Output",
")",
"AddEnv",
"(",
")",
"(",
"dst",
"*",
"Env",
",",
"err",
"error",
")",
"{",
"src",
",",
"err",
":=",
"o",
".",
"AddPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
... | // AddEnv starts a new goroutine which will decode all subsequent data
// as a stream of json-encoded objects, and point `dst` to the last
// decoded object.
// The result `env` can be queried using the type-neutral Env interface.
// It is not safe to query `env` until the Output is closed. | [
"AddEnv",
"starts",
"a",
"new",
"goroutine",
"which",
"will",
"decode",
"all",
"subsequent",
"data",
"as",
"a",
"stream",
"of",
"json",
"-",
"encoded",
"objects",
"and",
"point",
"dst",
"to",
"the",
"last",
"decoded",
"object",
".",
"The",
"result",
"env",... | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/engine/streams.go#L170-L189 |
27,870 | hyperhq/hyperd | serverrpc/server.go | NewServerRPC | func NewServerRPC(d *daemon.Daemon) *ServerRPC {
s := &ServerRPC{
server: grpc.NewServer(grpc.UnaryInterceptor(unaryLoger), grpc.StreamInterceptor(streamLoger)),
daemon: d,
}
s.registerServer()
return s
} | go | func NewServerRPC(d *daemon.Daemon) *ServerRPC {
s := &ServerRPC{
server: grpc.NewServer(grpc.UnaryInterceptor(unaryLoger), grpc.StreamInterceptor(streamLoger)),
daemon: d,
}
s.registerServer()
return s
} | [
"func",
"NewServerRPC",
"(",
"d",
"*",
"daemon",
".",
"Daemon",
")",
"*",
"ServerRPC",
"{",
"s",
":=",
"&",
"ServerRPC",
"{",
"server",
":",
"grpc",
".",
"NewServer",
"(",
"grpc",
".",
"UnaryInterceptor",
"(",
"unaryLoger",
")",
",",
"grpc",
".",
"Stre... | // NewServerRPC creates a new ServerRPC | [
"NewServerRPC",
"creates",
"a",
"new",
"ServerRPC"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/server.go#L59-L66 |
27,871 | hyperhq/hyperd | serverrpc/server.go | Serve | func (s *ServerRPC) Serve(addr string) error {
s.Log(hlog.DEBUG, "start server at %s", addr)
l, err := net.Listen("tcp", addr)
if err != nil {
s.Log(hlog.ERROR, "Failed to listen %s: %v", addr, err)
return err
}
return s.server.Serve(l)
} | go | func (s *ServerRPC) Serve(addr string) error {
s.Log(hlog.DEBUG, "start server at %s", addr)
l, err := net.Listen("tcp", addr)
if err != nil {
s.Log(hlog.ERROR, "Failed to listen %s: %v", addr, err)
return err
}
return s.server.Serve(l)
} | [
"func",
"(",
"s",
"*",
"ServerRPC",
")",
"Serve",
"(",
"addr",
"string",
")",
"error",
"{",
"s",
".",
"Log",
"(",
"hlog",
".",
"DEBUG",
",",
"\"",
"\"",
",",
"addr",
")",
"\n",
"l",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
","... | // Serve serves gRPC request by goroutines | [
"Serve",
"serves",
"gRPC",
"request",
"by",
"goroutines"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/serverrpc/server.go#L84-L93 |
27,872 | hyperhq/hyperd | integration/client.go | GetPodInfo | func (c *HyperClient) GetPodInfo(podID string) (*types.PodInfo, error) {
request := types.PodInfoRequest{
PodID: podID,
}
pod, err := c.client.PodInfo(c.ctx, &request)
if err != nil {
return nil, err
}
return pod.PodInfo, nil
} | go | func (c *HyperClient) GetPodInfo(podID string) (*types.PodInfo, error) {
request := types.PodInfoRequest{
PodID: podID,
}
pod, err := c.client.PodInfo(c.ctx, &request)
if err != nil {
return nil, err
}
return pod.PodInfo, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"GetPodInfo",
"(",
"podID",
"string",
")",
"(",
"*",
"types",
".",
"PodInfo",
",",
"error",
")",
"{",
"request",
":=",
"types",
".",
"PodInfoRequest",
"{",
"PodID",
":",
"podID",
",",
"}",
"\n",
"pod",
",",
... | // GetPodInfo gets pod info by podID | [
"GetPodInfo",
"gets",
"pod",
"info",
"by",
"podID"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L37-L47 |
27,873 | hyperhq/hyperd | integration/client.go | GetPodList | func (c *HyperClient) GetPodList() ([]*types.PodListResult, error) {
request := types.PodListRequest{}
podList, err := c.client.PodList(
c.ctx,
&request,
)
if err != nil {
return nil, err
}
return podList.PodList, nil
} | go | func (c *HyperClient) GetPodList() ([]*types.PodListResult, error) {
request := types.PodListRequest{}
podList, err := c.client.PodList(
c.ctx,
&request,
)
if err != nil {
return nil, err
}
return podList.PodList, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"GetPodList",
"(",
")",
"(",
"[",
"]",
"*",
"types",
".",
"PodListResult",
",",
"error",
")",
"{",
"request",
":=",
"types",
".",
"PodListRequest",
"{",
"}",
"\n",
"podList",
",",
"err",
":=",
"c",
".",
"c... | // GetPodList get a list of Pods | [
"GetPodList",
"get",
"a",
"list",
"of",
"Pods"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L50-L61 |
27,874 | hyperhq/hyperd | integration/client.go | GetVMList | func (c *HyperClient) GetVMList() ([]*types.VMListResult, error) {
req := types.VMListRequest{}
vmList, err := c.client.VMList(
c.ctx,
&req,
)
if err != nil {
return nil, err
}
return vmList.VmList, nil
} | go | func (c *HyperClient) GetVMList() ([]*types.VMListResult, error) {
req := types.VMListRequest{}
vmList, err := c.client.VMList(
c.ctx,
&req,
)
if err != nil {
return nil, err
}
return vmList.VmList, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"GetVMList",
"(",
")",
"(",
"[",
"]",
"*",
"types",
".",
"VMListResult",
",",
"error",
")",
"{",
"req",
":=",
"types",
".",
"VMListRequest",
"{",
"}",
"\n",
"vmList",
",",
"err",
":=",
"c",
".",
"client",
... | // GetVMList gets a list of VMs | [
"GetVMList",
"gets",
"a",
"list",
"of",
"VMs"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L64-L75 |
27,875 | hyperhq/hyperd | integration/client.go | GetContainerList | func (c *HyperClient) GetContainerList() ([]*types.ContainerListResult, error) {
req := types.ContainerListRequest{}
containerList, err := c.client.ContainerList(
c.ctx,
&req,
)
if err != nil {
return nil, err
}
return containerList.ContainerList, nil
} | go | func (c *HyperClient) GetContainerList() ([]*types.ContainerListResult, error) {
req := types.ContainerListRequest{}
containerList, err := c.client.ContainerList(
c.ctx,
&req,
)
if err != nil {
return nil, err
}
return containerList.ContainerList, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"GetContainerList",
"(",
")",
"(",
"[",
"]",
"*",
"types",
".",
"ContainerListResult",
",",
"error",
")",
"{",
"req",
":=",
"types",
".",
"ContainerListRequest",
"{",
"}",
"\n",
"containerList",
",",
"err",
":="... | // GetContainerList gets a list of containers | [
"GetContainerList",
"gets",
"a",
"list",
"of",
"containers"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L78-L89 |
27,876 | hyperhq/hyperd | integration/client.go | GetContainerInfo | func (c *HyperClient) GetContainerInfo(container string) (*types.ContainerInfo, error) {
req := types.ContainerInfoRequest{
Container: container,
}
cinfo, err := c.client.ContainerInfo(
c.ctx,
&req,
)
if err != nil {
return nil, err
}
return cinfo.ContainerInfo, nil
} | go | func (c *HyperClient) GetContainerInfo(container string) (*types.ContainerInfo, error) {
req := types.ContainerInfoRequest{
Container: container,
}
cinfo, err := c.client.ContainerInfo(
c.ctx,
&req,
)
if err != nil {
return nil, err
}
return cinfo.ContainerInfo, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"GetContainerInfo",
"(",
"container",
"string",
")",
"(",
"*",
"types",
".",
"ContainerInfo",
",",
"error",
")",
"{",
"req",
":=",
"types",
".",
"ContainerInfoRequest",
"{",
"Container",
":",
"container",
",",
"}"... | // GetContainerInfo gets container info by container name or id | [
"GetContainerInfo",
"gets",
"container",
"info",
"by",
"container",
"name",
"or",
"id"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L92-L105 |
27,877 | hyperhq/hyperd | integration/client.go | GetContainerLogs | func (c *HyperClient) GetContainerLogs(container string) ([]byte, error) {
req := types.ContainerLogsRequest{
Container: container,
Follow: false,
Timestamps: false,
Tail: "",
Since: "",
Stdout: true,
Stderr: true,
}
stream, err := c.client.ContainerLogs(
c.ctx,
&req,
)
if... | go | func (c *HyperClient) GetContainerLogs(container string) ([]byte, error) {
req := types.ContainerLogsRequest{
Container: container,
Follow: false,
Timestamps: false,
Tail: "",
Since: "",
Stdout: true,
Stderr: true,
}
stream, err := c.client.ContainerLogs(
c.ctx,
&req,
)
if... | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"GetContainerLogs",
"(",
"container",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"req",
":=",
"types",
".",
"ContainerLogsRequest",
"{",
"Container",
":",
"container",
",",
"Follow",
":",
"fal... | // GetContainerLogs gets container log by container name or id | [
"GetContainerLogs",
"gets",
"container",
"log",
"by",
"container",
"name",
"or",
"id"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L108-L142 |
27,878 | hyperhq/hyperd | integration/client.go | PostAttach | func (c *HyperClient) PostAttach(id string, tty bool) error {
stream, err := c.client.Attach(c.ctx)
if err != nil {
return err
}
extractor := NewExtractor(tty)
req := types.AttachMessage{
ContainerID: id,
}
if err := stream.Send(&req); err != nil {
return err
}
cmd := types.AttachMessage{
Data: []by... | go | func (c *HyperClient) PostAttach(id string, tty bool) error {
stream, err := c.client.Attach(c.ctx)
if err != nil {
return err
}
extractor := NewExtractor(tty)
req := types.AttachMessage{
ContainerID: id,
}
if err := stream.Send(&req); err != nil {
return err
}
cmd := types.AttachMessage{
Data: []by... | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"PostAttach",
"(",
"id",
"string",
",",
"tty",
"bool",
")",
"error",
"{",
"stream",
",",
"err",
":=",
"c",
".",
"client",
".",
"Attach",
"(",
"c",
".",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // PostAttach attach to a container or pod by id | [
"PostAttach",
"attach",
"to",
"a",
"container",
"or",
"pod",
"by",
"id"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L242-L279 |
27,879 | hyperhq/hyperd | integration/client.go | GetImageList | func (c *HyperClient) GetImageList() ([]*types.ImageInfo, error) {
req := types.ImageListRequest{}
imageList, err := c.client.ImageList(
c.ctx,
&req,
)
if err != nil {
return nil, err
}
return imageList.ImageList, nil
} | go | func (c *HyperClient) GetImageList() ([]*types.ImageInfo, error) {
req := types.ImageListRequest{}
imageList, err := c.client.ImageList(
c.ctx,
&req,
)
if err != nil {
return nil, err
}
return imageList.ImageList, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"GetImageList",
"(",
")",
"(",
"[",
"]",
"*",
"types",
".",
"ImageInfo",
",",
"error",
")",
"{",
"req",
":=",
"types",
".",
"ImageListRequest",
"{",
"}",
"\n",
"imageList",
",",
"err",
":=",
"c",
".",
"cli... | // GetImageList gets a list of images | [
"GetImageList",
"gets",
"a",
"list",
"of",
"images"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L282-L293 |
27,880 | hyperhq/hyperd | integration/client.go | CreatePod | func (c *HyperClient) CreatePod(spec *types.UserPod) (string, error) {
req := types.PodCreateRequest{
PodSpec: spec,
}
resp, err := c.client.PodCreate(
c.ctx,
&req,
)
if err != nil {
return "", err
}
return resp.PodID, nil
} | go | func (c *HyperClient) CreatePod(spec *types.UserPod) (string, error) {
req := types.PodCreateRequest{
PodSpec: spec,
}
resp, err := c.client.PodCreate(
c.ctx,
&req,
)
if err != nil {
return "", err
}
return resp.PodID, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"CreatePod",
"(",
"spec",
"*",
"types",
".",
"UserPod",
")",
"(",
"string",
",",
"error",
")",
"{",
"req",
":=",
"types",
".",
"PodCreateRequest",
"{",
"PodSpec",
":",
"spec",
",",
"}",
"\n",
"resp",
",",
... | // CreatePod creates a pod | [
"CreatePod",
"creates",
"a",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L296-L309 |
27,881 | hyperhq/hyperd | integration/client.go | CreateContainer | func (c *HyperClient) CreateContainer(podID string, spec *types.UserContainer) (string, error) {
req := types.ContainerCreateRequest{
PodID: podID,
ContainerSpec: spec,
}
resp, err := c.client.ContainerCreate(c.ctx, &req)
if err != nil {
return "", err
}
return resp.ContainerID, nil
} | go | func (c *HyperClient) CreateContainer(podID string, spec *types.UserContainer) (string, error) {
req := types.ContainerCreateRequest{
PodID: podID,
ContainerSpec: spec,
}
resp, err := c.client.ContainerCreate(c.ctx, &req)
if err != nil {
return "", err
}
return resp.ContainerID, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"CreateContainer",
"(",
"podID",
"string",
",",
"spec",
"*",
"types",
".",
"UserContainer",
")",
"(",
"string",
",",
"error",
")",
"{",
"req",
":=",
"types",
".",
"ContainerCreateRequest",
"{",
"PodID",
":",
"po... | // CreateContainer creates a container | [
"CreateContainer",
"creates",
"a",
"container"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L312-L323 |
27,882 | hyperhq/hyperd | integration/client.go | RenameContainer | func (c *HyperClient) RenameContainer(oldName string, newName string) error {
req := types.ContainerRenameRequest{
OldContainerName: oldName,
NewContainerName: newName,
}
_, err := c.client.ContainerRename(c.ctx, &req)
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) RenameContainer(oldName string, newName string) error {
req := types.ContainerRenameRequest{
OldContainerName: oldName,
NewContainerName: newName,
}
_, err := c.client.ContainerRename(c.ctx, &req)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"RenameContainer",
"(",
"oldName",
"string",
",",
"newName",
"string",
")",
"error",
"{",
"req",
":=",
"types",
".",
"ContainerRenameRequest",
"{",
"OldContainerName",
":",
"oldName",
",",
"NewContainerName",
":",
"ne... | // RenameContainer renames a container | [
"RenameContainer",
"renames",
"a",
"container"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L326-L338 |
27,883 | hyperhq/hyperd | integration/client.go | RemovePod | func (c *HyperClient) RemovePod(podID string) error {
_, err := c.client.PodRemove(
c.ctx,
&types.PodRemoveRequest{PodID: podID},
)
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) RemovePod(podID string) error {
_, err := c.client.PodRemove(
c.ctx,
&types.PodRemoveRequest{PodID: podID},
)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"RemovePod",
"(",
"podID",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"client",
".",
"PodRemove",
"(",
"c",
".",
"ctx",
",",
"&",
"types",
".",
"PodRemoveRequest",
"{",
"PodID",
":",
"po... | // RemovePod removes a pod by podID | [
"RemovePod",
"removes",
"a",
"pod",
"by",
"podID"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L341-L352 |
27,884 | hyperhq/hyperd | integration/client.go | ContainerExecSignal | func (c *HyperClient) ContainerExecSignal(container, execID string, sig int64) error {
req := types.ExecSignalRequest{
ContainerID: container,
ExecID: execID,
Signal: sig,
}
_, err := c.client.ExecSignal(c.ctx, &req)
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) ContainerExecSignal(container, execID string, sig int64) error {
req := types.ExecSignalRequest{
ContainerID: container,
ExecID: execID,
Signal: sig,
}
_, err := c.client.ExecSignal(c.ctx, &req)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"ContainerExecSignal",
"(",
"container",
",",
"execID",
"string",
",",
"sig",
"int64",
")",
"error",
"{",
"req",
":=",
"types",
".",
"ExecSignalRequest",
"{",
"ContainerID",
":",
"container",
",",
"ExecID",
":",
"... | // ContainerExecSignal sends signal to specified exec of specified container | [
"ContainerExecSignal",
"sends",
"signal",
"to",
"specified",
"exec",
"of",
"specified",
"container"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L355-L367 |
27,885 | hyperhq/hyperd | integration/client.go | ContainerExecCreate | func (c *HyperClient) ContainerExecCreate(container string, command []string, tty bool) (string, error) {
req := types.ExecCreateRequest{
ContainerID: container,
Command: command,
Tty: tty,
}
resp, err := c.client.ExecCreate(c.ctx, &req)
if err != nil {
return "", err
}
return resp.ExecID, ni... | go | func (c *HyperClient) ContainerExecCreate(container string, command []string, tty bool) (string, error) {
req := types.ExecCreateRequest{
ContainerID: container,
Command: command,
Tty: tty,
}
resp, err := c.client.ExecCreate(c.ctx, &req)
if err != nil {
return "", err
}
return resp.ExecID, ni... | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"ContainerExecCreate",
"(",
"container",
"string",
",",
"command",
"[",
"]",
"string",
",",
"tty",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"req",
":=",
"types",
".",
"ExecCreateRequest",
"{",
"Contai... | // ContainerExecCreate creates exec in a container | [
"ContainerExecCreate",
"creates",
"exec",
"in",
"a",
"container"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L370-L382 |
27,886 | hyperhq/hyperd | integration/client.go | ContainerExecStart | func (c *HyperClient) ContainerExecStart(containerId, execId string, stdin io.ReadCloser, stdout, stderr io.Writer, tty bool) error {
request := types.ExecStartRequest{
ContainerID: containerId,
ExecID: execId,
}
stream, err := c.client.ExecStart(context.Background())
if err != nil {
return err
}
if er... | go | func (c *HyperClient) ContainerExecStart(containerId, execId string, stdin io.ReadCloser, stdout, stderr io.Writer, tty bool) error {
request := types.ExecStartRequest{
ContainerID: containerId,
ExecID: execId,
}
stream, err := c.client.ExecStart(context.Background())
if err != nil {
return err
}
if er... | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"ContainerExecStart",
"(",
"containerId",
",",
"execId",
"string",
",",
"stdin",
"io",
".",
"ReadCloser",
",",
"stdout",
",",
"stderr",
"io",
".",
"Writer",
",",
"tty",
"bool",
")",
"error",
"{",
"request",
":="... | // ContainerExecStart starts exec in a container with input stream in and output stream out | [
"ContainerExecStart",
"starts",
"exec",
"in",
"a",
"container",
"with",
"input",
"stream",
"in",
"and",
"output",
"stream",
"out"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L385-L466 |
27,887 | hyperhq/hyperd | integration/client.go | StartPod | func (c *HyperClient) StartPod(podID string) error {
req := &types.PodStartRequest{
PodID: podID,
}
_, err := c.client.PodStart(c.ctx, req)
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) StartPod(podID string) error {
req := &types.PodStartRequest{
PodID: podID,
}
_, err := c.client.PodStart(c.ctx, req)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"StartPod",
"(",
"podID",
"string",
")",
"error",
"{",
"req",
":=",
"&",
"types",
".",
"PodStartRequest",
"{",
"PodID",
":",
"podID",
",",
"}",
"\n\n",
"_",
",",
"err",
":=",
"c",
".",
"client",
".",
"PodS... | // StartPod starts a pod by podID | [
"StartPod",
"starts",
"a",
"pod",
"by",
"podID"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L469-L480 |
27,888 | hyperhq/hyperd | integration/client.go | StopPod | func (c *HyperClient) StopPod(podID string) (int, string, error) {
resp, err := c.client.PodStop(c.ctx, &types.PodStopRequest{
PodID: podID,
})
if err != nil {
return -1, "", err
}
return int(resp.Code), resp.Cause, nil
} | go | func (c *HyperClient) StopPod(podID string) (int, string, error) {
resp, err := c.client.PodStop(c.ctx, &types.PodStopRequest{
PodID: podID,
})
if err != nil {
return -1, "", err
}
return int(resp.Code), resp.Cause, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"StopPod",
"(",
"podID",
"string",
")",
"(",
"int",
",",
"string",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"c",
".",
"client",
".",
"PodStop",
"(",
"c",
".",
"ctx",
",",
"&",
"types",
".",
"P... | // StopPod stops a pod | [
"StopPod",
"stops",
"a",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L483-L492 |
27,889 | hyperhq/hyperd | integration/client.go | PausePod | func (c *HyperClient) PausePod(podID string) error {
_, err := c.client.PodPause(c.ctx, &types.PodPauseRequest{
PodID: podID,
})
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) PausePod(podID string) error {
_, err := c.client.PodPause(c.ctx, &types.PodPauseRequest{
PodID: podID,
})
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"PausePod",
"(",
"podID",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"client",
".",
"PodPause",
"(",
"c",
".",
"ctx",
",",
"&",
"types",
".",
"PodPauseRequest",
"{",
"PodID",
":",
"podID... | // PausePod pauses a pod | [
"PausePod",
"pauses",
"a",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L495-L504 |
27,890 | hyperhq/hyperd | integration/client.go | UnpausePod | func (c *HyperClient) UnpausePod(podID string) error {
_, err := c.client.PodUnpause(c.ctx, &types.PodUnpauseRequest{
PodID: podID,
})
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) UnpausePod(podID string) error {
_, err := c.client.PodUnpause(c.ctx, &types.PodUnpauseRequest{
PodID: podID,
})
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"UnpausePod",
"(",
"podID",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"client",
".",
"PodUnpause",
"(",
"c",
".",
"ctx",
",",
"&",
"types",
".",
"PodUnpauseRequest",
"{",
"PodID",
":",
... | // UnpausePod unpauses a pod | [
"UnpausePod",
"unpauses",
"a",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L507-L516 |
27,891 | hyperhq/hyperd | integration/client.go | PodSignal | func (c *HyperClient) PodSignal(podID string, signal int64) error {
_, err := c.client.PodSignal(c.ctx, &types.PodSignalRequest{
PodID: podID,
Signal: signal,
})
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) PodSignal(podID string, signal int64) error {
_, err := c.client.PodSignal(c.ctx, &types.PodSignalRequest{
PodID: podID,
Signal: signal,
})
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"PodSignal",
"(",
"podID",
"string",
",",
"signal",
"int64",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"client",
".",
"PodSignal",
"(",
"c",
".",
"ctx",
",",
"&",
"types",
".",
"PodSignalRequest",
... | // PodSignal sends a signal to all containers of specified pod | [
"PodSignal",
"sends",
"a",
"signal",
"to",
"all",
"containers",
"of",
"specified",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L519-L529 |
27,892 | hyperhq/hyperd | integration/client.go | DeleteService | func (c *HyperClient) DeleteService(podID string, services []*types.UserService) error {
_, err := c.client.ServiceDelete(
c.ctx,
&types.ServiceDelRequest{PodID: podID, Services: services},
)
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) DeleteService(podID string, services []*types.UserService) error {
_, err := c.client.ServiceDelete(
c.ctx,
&types.ServiceDelRequest{PodID: podID, Services: services},
)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"DeleteService",
"(",
"podID",
"string",
",",
"services",
"[",
"]",
"*",
"types",
".",
"UserService",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"client",
".",
"ServiceDelete",
"(",
"c",
".",
"ctx",... | // DeleteService deletes user service by podID and service content | [
"DeleteService",
"deletes",
"user",
"service",
"by",
"podID",
"and",
"service",
"content"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L620-L630 |
27,893 | hyperhq/hyperd | integration/client.go | ListService | func (c *HyperClient) ListService(podID string) ([]*types.UserService, error) {
resp, err := c.client.ServiceList(
c.ctx,
&types.ServiceListRequest{PodID: podID},
)
if err != nil {
return nil, err
}
return resp.Services, nil
} | go | func (c *HyperClient) ListService(podID string) ([]*types.UserService, error) {
resp, err := c.client.ServiceList(
c.ctx,
&types.ServiceListRequest{PodID: podID},
)
if err != nil {
return nil, err
}
return resp.Services, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"ListService",
"(",
"podID",
"string",
")",
"(",
"[",
"]",
"*",
"types",
".",
"UserService",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"c",
".",
"client",
".",
"ServiceList",
"(",
"c",
".",
"ctx",
... | // ListService lists user services by podID | [
"ListService",
"lists",
"user",
"services",
"by",
"podID"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L633-L644 |
27,894 | hyperhq/hyperd | integration/client.go | GetPodStats | func (c *HyperClient) GetPodStats(podID string) (*types.PodStats, error) {
statsResponse, err := c.client.PodStats(
c.ctx,
&types.PodStatsRequest{PodID: podID},
)
if err != nil {
return nil, err
}
return statsResponse.PodStats, nil
} | go | func (c *HyperClient) GetPodStats(podID string) (*types.PodStats, error) {
statsResponse, err := c.client.PodStats(
c.ctx,
&types.PodStatsRequest{PodID: podID},
)
if err != nil {
return nil, err
}
return statsResponse.PodStats, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"GetPodStats",
"(",
"podID",
"string",
")",
"(",
"*",
"types",
".",
"PodStats",
",",
"error",
")",
"{",
"statsResponse",
",",
"err",
":=",
"c",
".",
"client",
".",
"PodStats",
"(",
"c",
".",
"ctx",
",",
"&... | // GetPodStats get stats of Pod by podID | [
"GetPodStats",
"get",
"stats",
"of",
"Pod",
"by",
"podID"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L647-L658 |
27,895 | hyperhq/hyperd | integration/client.go | AddService | func (c *HyperClient) AddService(podID string, services []*types.UserService) error {
_, err := c.client.ServiceAdd(
c.ctx,
&types.ServiceAddRequest{PodID: podID, Services: services},
)
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) AddService(podID string, services []*types.UserService) error {
_, err := c.client.ServiceAdd(
c.ctx,
&types.ServiceAddRequest{PodID: podID, Services: services},
)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"AddService",
"(",
"podID",
"string",
",",
"services",
"[",
"]",
"*",
"types",
".",
"UserService",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"client",
".",
"ServiceAdd",
"(",
"c",
".",
"ctx",
","... | // AddService adds user service by podID and service content | [
"AddService",
"adds",
"user",
"service",
"by",
"podID",
"and",
"service",
"content"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L661-L672 |
27,896 | hyperhq/hyperd | integration/client.go | UpdateService | func (c *HyperClient) UpdateService(podID string, services []*types.UserService) error {
_, err := c.client.ServiceUpdate(
c.ctx,
&types.ServiceUpdateRequest{PodID: podID, Services: services},
)
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) UpdateService(podID string, services []*types.UserService) error {
_, err := c.client.ServiceUpdate(
c.ctx,
&types.ServiceUpdateRequest{PodID: podID, Services: services},
)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"UpdateService",
"(",
"podID",
"string",
",",
"services",
"[",
"]",
"*",
"types",
".",
"UserService",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"client",
".",
"ServiceUpdate",
"(",
"c",
".",
"ctx",... | // UpdateService updates user service by podID and service content | [
"UpdateService",
"updates",
"user",
"service",
"by",
"podID",
"and",
"service",
"content"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L675-L685 |
27,897 | hyperhq/hyperd | integration/client.go | SetPodLabels | func (c *HyperClient) SetPodLabels(podID string, override bool, labels map[string]string) error {
_, err := c.client.SetPodLabels(
c.ctx,
&types.PodLabelsRequest{PodID: podID, Override: override, Labels: labels},
)
if err != nil {
return err
}
return nil
} | go | func (c *HyperClient) SetPodLabels(podID string, override bool, labels map[string]string) error {
_, err := c.client.SetPodLabels(
c.ctx,
&types.PodLabelsRequest{PodID: podID, Override: override, Labels: labels},
)
if err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"SetPodLabels",
"(",
"podID",
"string",
",",
"override",
"bool",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"client",
".",
"SetPodLabels",
"(",
"c... | // SetPodLabels sets labels to Pod by podID | [
"SetPodLabels",
"sets",
"labels",
"to",
"Pod",
"by",
"podID"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L688-L699 |
27,898 | hyperhq/hyperd | integration/client.go | Info | func (c *HyperClient) Info() (*types.InfoResponse, error) {
info, err := c.client.Info(
c.ctx,
&types.InfoRequest{},
)
if err != nil {
return nil, err
}
return info, nil
} | go | func (c *HyperClient) Info() (*types.InfoResponse, error) {
info, err := c.client.Info(
c.ctx,
&types.InfoRequest{},
)
if err != nil {
return nil, err
}
return info, nil
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"Info",
"(",
")",
"(",
"*",
"types",
".",
"InfoResponse",
",",
"error",
")",
"{",
"info",
",",
"err",
":=",
"c",
".",
"client",
".",
"Info",
"(",
"c",
".",
"ctx",
",",
"&",
"types",
".",
"InfoRequest",
... | // Info gets system info of hyperd | [
"Info",
"gets",
"system",
"info",
"of",
"hyperd"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L702-L713 |
27,899 | hyperhq/hyperd | integration/client.go | ContainerSignal | func (c *HyperClient) ContainerSignal(podID, containerID string, signal int64) error {
_, err := c.client.ContainerSignal(c.ctx, &types.ContainerSignalRequest{
PodID: podID,
ContainerID: containerID,
Signal: signal,
})
return err
} | go | func (c *HyperClient) ContainerSignal(podID, containerID string, signal int64) error {
_, err := c.client.ContainerSignal(c.ctx, &types.ContainerSignalRequest{
PodID: podID,
ContainerID: containerID,
Signal: signal,
})
return err
} | [
"func",
"(",
"c",
"*",
"HyperClient",
")",
"ContainerSignal",
"(",
"podID",
",",
"containerID",
"string",
",",
"signal",
"int64",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"client",
".",
"ContainerSignal",
"(",
"c",
".",
"ctx",
",",
"&",
"t... | // ContainerSignal sends a signal to specified container of specified pod | [
"ContainerSignal",
"sends",
"a",
"signal",
"to",
"specified",
"container",
"of",
"specified",
"pod"
] | 8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956 | https://github.com/hyperhq/hyperd/blob/8a7e67dc33bbccdfc92b5e2a908bbdb1c5d9b956/integration/client.go#L730-L738 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.