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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
21,500 | CloudyKit/jet | lex.go | lexRawQuote | func lexRawQuote(l *lexer) stateFn {
Loop:
for {
switch l.next() {
case eof:
return l.errorf("unterminated raw quoted string")
case '`':
break Loop
}
}
l.emit(itemRawString)
return lexInsideAction
} | go | func lexRawQuote(l *lexer) stateFn {
Loop:
for {
switch l.next() {
case eof:
return l.errorf("unterminated raw quoted string")
case '`':
break Loop
}
}
l.emit(itemRawString)
return lexInsideAction
} | [
"func",
"lexRawQuote",
"(",
"l",
"*",
"lexer",
")",
"stateFn",
"{",
"Loop",
":",
"for",
"{",
"switch",
"l",
".",
"next",
"(",
")",
"{",
"case",
"eof",
":",
"return",
"l",
".",
"errorf",
"(",
"\"",
"\"",
")",
"\n",
"case",
"'`'",
":",
"break",
"... | // lexRawQuote scans a raw quoted string. | [
"lexRawQuote",
"scans",
"a",
"raw",
"quoted",
"string",
"."
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/lex.go#L652-L664 |
21,501 | CloudyKit/jet | utils/visitor.go | Walk | func Walk(t *jet.Template, v Visitor) {
v.Visit(VisitorContext{Visitor: v}, t.Root)
} | go | func Walk(t *jet.Template, v Visitor) {
v.Visit(VisitorContext{Visitor: v}, t.Root)
} | [
"func",
"Walk",
"(",
"t",
"*",
"jet",
".",
"Template",
",",
"v",
"Visitor",
")",
"{",
"v",
".",
"Visit",
"(",
"VisitorContext",
"{",
"Visitor",
":",
"v",
"}",
",",
"t",
".",
"Root",
")",
"\n",
"}"
] | // Walk walks the template ast and calls the Visit method on each node of the tree
// if you're not familiar with the Visitor pattern please check the visitor_test.go
// for usage examples | [
"Walk",
"walks",
"the",
"template",
"ast",
"and",
"calls",
"the",
"Visit",
"method",
"on",
"each",
"node",
"of",
"the",
"tree",
"if",
"you",
"re",
"not",
"familiar",
"with",
"the",
"Visitor",
"pattern",
"please",
"check",
"the",
"visitor_test",
".",
"go",
... | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/utils/visitor.go#L12-L14 |
21,502 | CloudyKit/jet | examples/todos/main.go | Render | func (t *tTODO) Render(r *jet.Runtime) {
done := "yes"
if !t.Done {
done = "no"
}
r.Write([]byte(fmt.Sprintf("TODO: %s (done: %s)", t.Text, done)))
} | go | func (t *tTODO) Render(r *jet.Runtime) {
done := "yes"
if !t.Done {
done = "no"
}
r.Write([]byte(fmt.Sprintf("TODO: %s (done: %s)", t.Text, done)))
} | [
"func",
"(",
"t",
"*",
"tTODO",
")",
"Render",
"(",
"r",
"*",
"jet",
".",
"Runtime",
")",
"{",
"done",
":=",
"\"",
"\"",
"\n",
"if",
"!",
"t",
".",
"Done",
"{",
"done",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"r",
".",
"Write",
"(",
"[",
"]",
"... | // Render implements jet.Renderer interface | [
"Render",
"implements",
"jet",
".",
"Renderer",
"interface"
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/examples/todos/main.go#L68-L74 |
21,503 | CloudyKit/jet | parse.go | parseTemplate | func (t *Template) parseTemplate() (next Node) {
t.Root = t.newList(t.peek().pos)
// {{ extends|import stringLiteral }}
for t.peek().typ != itemEOF {
delim := t.next()
if delim.typ == itemText && strings.TrimSpace(delim.val) == "" {
continue //skips empty text nodes
}
if delim.typ == itemLeftDelim {
to... | go | func (t *Template) parseTemplate() (next Node) {
t.Root = t.newList(t.peek().pos)
// {{ extends|import stringLiteral }}
for t.peek().typ != itemEOF {
delim := t.next()
if delim.typ == itemText && strings.TrimSpace(delim.val) == "" {
continue //skips empty text nodes
}
if delim.typ == itemLeftDelim {
to... | [
"func",
"(",
"t",
"*",
"Template",
")",
"parseTemplate",
"(",
")",
"(",
"next",
"Node",
")",
"{",
"t",
".",
"Root",
"=",
"t",
".",
"newList",
"(",
"t",
".",
"peek",
"(",
")",
".",
"pos",
")",
"\n",
"// {{ extends|import stringLiteral }}",
"for",
"t",... | // parse is the top-level parser for a template, essentially the same
// It runs to EOF. | [
"parse",
"is",
"the",
"top",
"-",
"level",
"parser",
"for",
"a",
"template",
"essentially",
"the",
"same",
"It",
"runs",
"to",
"EOF",
"."
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/parse.go#L198-L248 |
21,504 | CloudyKit/jet | node.go | simplifyComplex | func (n *NumberNode) simplifyComplex() {
n.IsFloat = imag(n.Complex128) == 0
if n.IsFloat {
n.Float64 = real(n.Complex128)
n.IsInt = float64(int64(n.Float64)) == n.Float64
if n.IsInt {
n.Int64 = int64(n.Float64)
}
n.IsUint = float64(uint64(n.Float64)) == n.Float64
if n.IsUint {
n.Uint64 = uint64(n.F... | go | func (n *NumberNode) simplifyComplex() {
n.IsFloat = imag(n.Complex128) == 0
if n.IsFloat {
n.Float64 = real(n.Complex128)
n.IsInt = float64(int64(n.Float64)) == n.Float64
if n.IsInt {
n.Int64 = int64(n.Float64)
}
n.IsUint = float64(uint64(n.Float64)) == n.Float64
if n.IsUint {
n.Uint64 = uint64(n.F... | [
"func",
"(",
"n",
"*",
"NumberNode",
")",
"simplifyComplex",
"(",
")",
"{",
"n",
".",
"IsFloat",
"=",
"imag",
"(",
"n",
".",
"Complex128",
")",
"==",
"0",
"\n",
"if",
"n",
".",
"IsFloat",
"{",
"n",
".",
"Float64",
"=",
"real",
"(",
"n",
".",
"C... | // simplifyComplex pulls out any other types that are represented by the complex number.
// These all require that the imaginary part be zero. | [
"simplifyComplex",
"pulls",
"out",
"any",
"other",
"types",
"that",
"are",
"represented",
"by",
"the",
"complex",
"number",
".",
"These",
"all",
"require",
"that",
"the",
"imaginary",
"part",
"be",
"zero",
"."
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/node.go#L310-L323 |
21,505 | CloudyKit/jet | loader.go | Open | func (l *OSFileSystemLoader) Open(name string) (io.ReadCloser, error) {
return os.Open(name)
} | go | func (l *OSFileSystemLoader) Open(name string) (io.ReadCloser, error) {
return os.Open(name)
} | [
"func",
"(",
"l",
"*",
"OSFileSystemLoader",
")",
"Open",
"(",
"name",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"return",
"os",
".",
"Open",
"(",
"name",
")",
"\n",
"}"
] | // Open opens a file from OS file system. | [
"Open",
"opens",
"a",
"file",
"from",
"OS",
"file",
"system",
"."
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/loader.go#L54-L56 |
21,506 | CloudyKit/jet | loader.go | AddPath | func (l *OSFileSystemLoader) AddPath(path string) {
l.dirs = append(l.dirs, path)
} | go | func (l *OSFileSystemLoader) AddPath(path string) {
l.dirs = append(l.dirs, path)
} | [
"func",
"(",
"l",
"*",
"OSFileSystemLoader",
")",
"AddPath",
"(",
"path",
"string",
")",
"{",
"l",
".",
"dirs",
"=",
"append",
"(",
"l",
".",
"dirs",
",",
"path",
")",
"\n",
"}"
] | // AddPath adds the path to the internal list of paths searched when loading templates. | [
"AddPath",
"adds",
"the",
"path",
"to",
"the",
"internal",
"list",
"of",
"paths",
"searched",
"when",
"loading",
"templates",
"."
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/loader.go#L71-L73 |
21,507 | CloudyKit/jet | eval.go | YieldBlock | func (st *Runtime) YieldBlock(name string, context interface{}) {
block, has := st.getBlock(name)
if has == false {
panic(fmt.Errorf("Block %q was not found!!", name))
}
if context != nil {
current := st.context
st.context = reflect.ValueOf(context)
st.executeList(block.List)
st.context = current
}
s... | go | func (st *Runtime) YieldBlock(name string, context interface{}) {
block, has := st.getBlock(name)
if has == false {
panic(fmt.Errorf("Block %q was not found!!", name))
}
if context != nil {
current := st.context
st.context = reflect.ValueOf(context)
st.executeList(block.List)
st.context = current
}
s... | [
"func",
"(",
"st",
"*",
"Runtime",
")",
"YieldBlock",
"(",
"name",
"string",
",",
"context",
"interface",
"{",
"}",
")",
"{",
"block",
",",
"has",
":=",
"st",
".",
"getBlock",
"(",
"name",
")",
"\n\n",
"if",
"has",
"==",
"false",
"{",
"panic",
"(",... | // YieldBlock yields a block in the current context, will panic if the context is not available | [
"YieldBlock",
"yields",
"a",
"block",
"in",
"the",
"current",
"context",
"will",
"panic",
"if",
"the",
"context",
"is",
"not",
"available"
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/eval.go#L106-L121 |
21,508 | CloudyKit/jet | eval.go | YieldTemplate | func (st *Runtime) YieldTemplate(name string, context interface{}) {
t, err := st.set.GetTemplate(name)
if err != nil {
panic(fmt.Errorf("include: template %q was not found", name))
}
st.newScope()
st.blocks = t.processedBlocks
Root := t.Root
if t.extends != nil {
Root = t.extends.Root
}
if context != ... | go | func (st *Runtime) YieldTemplate(name string, context interface{}) {
t, err := st.set.GetTemplate(name)
if err != nil {
panic(fmt.Errorf("include: template %q was not found", name))
}
st.newScope()
st.blocks = t.processedBlocks
Root := t.Root
if t.extends != nil {
Root = t.extends.Root
}
if context != ... | [
"func",
"(",
"st",
"*",
"Runtime",
")",
"YieldTemplate",
"(",
"name",
"string",
",",
"context",
"interface",
"{",
"}",
")",
"{",
"t",
",",
"err",
":=",
"st",
".",
"set",
".",
"GetTemplate",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"... | // YieldTemplate yields a template same as include | [
"YieldTemplate",
"yields",
"a",
"template",
"same",
"as",
"include"
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/eval.go#L133-L158 |
21,509 | CloudyKit/jet | eval.go | Resolve | func (state *Runtime) Resolve(name string) reflect.Value {
if name == "." {
return state.context
}
sc := state.scope
// try to resolve variables in the current scope
vl, ok := sc.variables[name]
// if not found walks parent scopes
for !ok && sc.parent != nil {
sc = sc.parent
vl, ok = sc.variables[name]
... | go | func (state *Runtime) Resolve(name string) reflect.Value {
if name == "." {
return state.context
}
sc := state.scope
// try to resolve variables in the current scope
vl, ok := sc.variables[name]
// if not found walks parent scopes
for !ok && sc.parent != nil {
sc = sc.parent
vl, ok = sc.variables[name]
... | [
"func",
"(",
"state",
"*",
"Runtime",
")",
"Resolve",
"(",
"name",
"string",
")",
"reflect",
".",
"Value",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"state",
".",
"context",
"\n",
"}",
"\n\n",
"sc",
":=",
"state",
".",
"scope",
"\n",
"// ... | // Resolve resolves a value from the execution context | [
"Resolve",
"resolves",
"a",
"value",
"from",
"the",
"execution",
"context"
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/eval.go#L195-L221 |
21,510 | CloudyKit/jet | loaders/httpfs/loader.go | Open | func (l *httpFileSystemLoader) Open(name string) (io.ReadCloser, error) {
if l.fs == nil {
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
}
return l.fs.Open(name)
} | go | func (l *httpFileSystemLoader) Open(name string) (io.ReadCloser, error) {
if l.fs == nil {
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
}
return l.fs.Open(name)
} | [
"func",
"(",
"l",
"*",
"httpFileSystemLoader",
")",
"Open",
"(",
"name",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"if",
"l",
".",
"fs",
"==",
"nil",
"{",
"return",
"nil",
",",
"&",
"os",
".",
"PathError",
"{",
"Op",
":... | // Open opens the file via the internal http.FileSystem. It is the callers duty to close the file. | [
"Open",
"opens",
"the",
"file",
"via",
"the",
"internal",
"http",
".",
"FileSystem",
".",
"It",
"is",
"the",
"callers",
"duty",
"to",
"close",
"the",
"file",
"."
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/loaders/httpfs/loader.go#L21-L26 |
21,511 | CloudyKit/jet | template.go | AddGlobal | func (s *Set) AddGlobal(key string, i interface{}) *Set {
s.gmx.Lock()
if s.globals == nil {
s.globals = make(VarMap)
}
s.globals[key] = reflect.ValueOf(i)
s.gmx.Unlock()
return s
} | go | func (s *Set) AddGlobal(key string, i interface{}) *Set {
s.gmx.Lock()
if s.globals == nil {
s.globals = make(VarMap)
}
s.globals[key] = reflect.ValueOf(i)
s.gmx.Unlock()
return s
} | [
"func",
"(",
"s",
"*",
"Set",
")",
"AddGlobal",
"(",
"key",
"string",
",",
"i",
"interface",
"{",
"}",
")",
"*",
"Set",
"{",
"s",
".",
"gmx",
".",
"Lock",
"(",
")",
"\n",
"if",
"s",
".",
"globals",
"==",
"nil",
"{",
"s",
".",
"globals",
"=",
... | // AddGlobal add or set a global variable into the Set | [
"AddGlobal",
"add",
"or",
"set",
"a",
"global",
"variable",
"into",
"the",
"Set"
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/template.go#L62-L70 |
21,512 | CloudyKit/jet | template.go | NewSetLoader | func NewSetLoader(escapee SafeWriter, loader Loader) *Set {
return &Set{loader: loader, tmx: &sync.RWMutex{}, gmx: &sync.RWMutex{}, escapee: escapee, templates: make(map[string]*Template), defaultExtensions: append([]string{}, defaultExtensions...)}
} | go | func NewSetLoader(escapee SafeWriter, loader Loader) *Set {
return &Set{loader: loader, tmx: &sync.RWMutex{}, gmx: &sync.RWMutex{}, escapee: escapee, templates: make(map[string]*Template), defaultExtensions: append([]string{}, defaultExtensions...)}
} | [
"func",
"NewSetLoader",
"(",
"escapee",
"SafeWriter",
",",
"loader",
"Loader",
")",
"*",
"Set",
"{",
"return",
"&",
"Set",
"{",
"loader",
":",
"loader",
",",
"tmx",
":",
"&",
"sync",
".",
"RWMutex",
"{",
"}",
",",
"gmx",
":",
"&",
"sync",
".",
"RWM... | // NewSetLoader creates a new set with custom Loader | [
"NewSetLoader",
"creates",
"a",
"new",
"set",
"with",
"custom",
"Loader"
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/template.go#L77-L79 |
21,513 | CloudyKit/jet | template.go | NewSet | func NewSet(escapee SafeWriter, dirs ...string) *Set {
return NewSetLoader(escapee, &OSFileSystemLoader{dirs: dirs})
} | go | func NewSet(escapee SafeWriter, dirs ...string) *Set {
return NewSetLoader(escapee, &OSFileSystemLoader{dirs: dirs})
} | [
"func",
"NewSet",
"(",
"escapee",
"SafeWriter",
",",
"dirs",
"...",
"string",
")",
"*",
"Set",
"{",
"return",
"NewSetLoader",
"(",
"escapee",
",",
"&",
"OSFileSystemLoader",
"{",
"dirs",
":",
"dirs",
"}",
")",
"\n",
"}"
] | // NewSet creates a new set, dirs is a list of directories to be searched for templates | [
"NewSet",
"creates",
"a",
"new",
"set",
"dirs",
"is",
"a",
"list",
"of",
"directories",
"to",
"be",
"searched",
"for",
"templates"
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/template.go#L87-L89 |
21,514 | CloudyKit/jet | template.go | AddPath | func (s *Set) AddPath(path string) {
if loader, ok := s.loader.(hasAddPath); ok {
loader.AddPath(path)
} else {
panic(fmt.Sprintf("AddPath() not supported on custom loader of type %T", s.loader))
}
} | go | func (s *Set) AddPath(path string) {
if loader, ok := s.loader.(hasAddPath); ok {
loader.AddPath(path)
} else {
panic(fmt.Sprintf("AddPath() not supported on custom loader of type %T", s.loader))
}
} | [
"func",
"(",
"s",
"*",
"Set",
")",
"AddPath",
"(",
"path",
"string",
")",
"{",
"if",
"loader",
",",
"ok",
":=",
"s",
".",
"loader",
".",
"(",
"hasAddPath",
")",
";",
"ok",
"{",
"loader",
".",
"AddPath",
"(",
"path",
")",
"\n",
"}",
"else",
"{",... | // AddPath add path to the lookup list, when loading a template the Set will
// look into the lookup list for the file matching the provided name. | [
"AddPath",
"add",
"path",
"to",
"the",
"lookup",
"list",
"when",
"loading",
"a",
"template",
"the",
"Set",
"will",
"look",
"into",
"the",
"lookup",
"list",
"for",
"the",
"file",
"matching",
"the",
"provided",
"name",
"."
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/template.go#L98-L104 |
21,515 | CloudyKit/jet | template.go | AddGopathPath | func (s *Set) AddGopathPath(path string) {
if loader, ok := s.loader.(hasAddGopathPath); ok {
loader.AddGopathPath(path)
} else {
panic(fmt.Sprintf("AddGopathPath() not supported on custom loader of type %T", s.loader))
}
} | go | func (s *Set) AddGopathPath(path string) {
if loader, ok := s.loader.(hasAddGopathPath); ok {
loader.AddGopathPath(path)
} else {
panic(fmt.Sprintf("AddGopathPath() not supported on custom loader of type %T", s.loader))
}
} | [
"func",
"(",
"s",
"*",
"Set",
")",
"AddGopathPath",
"(",
"path",
"string",
")",
"{",
"if",
"loader",
",",
"ok",
":=",
"s",
".",
"loader",
".",
"(",
"hasAddGopathPath",
")",
";",
"ok",
"{",
"loader",
".",
"AddGopathPath",
"(",
"path",
")",
"\n",
"}"... | // AddGopathPath add path based on GOPATH env to the lookup list, when loading a template the Set will
// look into the lookup list for the file matching the provided name. | [
"AddGopathPath",
"add",
"path",
"based",
"on",
"GOPATH",
"env",
"to",
"the",
"lookup",
"list",
"when",
"loading",
"a",
"template",
"the",
"Set",
"will",
"look",
"into",
"the",
"lookup",
"list",
"for",
"the",
"file",
"matching",
"the",
"provided",
"name",
"... | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/template.go#L108-L114 |
21,516 | CloudyKit/jet | template.go | Parse | func (s *Set) Parse(name, content string) (*Template, error) {
sc := *s
sc.developmentMode = true
sc.tmx.RLock()
t, err := sc.parse(name, content)
sc.tmx.RUnlock()
return t, err
} | go | func (s *Set) Parse(name, content string) (*Template, error) {
sc := *s
sc.developmentMode = true
sc.tmx.RLock()
t, err := sc.parse(name, content)
sc.tmx.RUnlock()
return t, err
} | [
"func",
"(",
"s",
"*",
"Set",
")",
"Parse",
"(",
"name",
",",
"content",
"string",
")",
"(",
"*",
"Template",
",",
"error",
")",
"{",
"sc",
":=",
"*",
"s",
"\n",
"sc",
".",
"developmentMode",
"=",
"true",
"\n\n",
"sc",
".",
"tmx",
".",
"RLock",
... | // Parse parses the template, this method will link the template to the set but not the set to | [
"Parse",
"parses",
"the",
"template",
"this",
"method",
"will",
"link",
"the",
"template",
"to",
"the",
"set",
"but",
"not",
"the",
"set",
"to"
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/template.go#L168-L177 |
21,517 | CloudyKit/jet | template.go | getTemplate | func (s *Set) getTemplate(name, sibling string) (template *Template, err error) {
name = path.Clean(name)
if s.developmentMode {
s.tmx.RLock()
defer s.tmx.RUnlock()
if newName, fileName, foundLoaded, foundFile, _ := s.resolveNameSibling(name, sibling); foundFile || foundLoaded {
if foundFile {
template,... | go | func (s *Set) getTemplate(name, sibling string) (template *Template, err error) {
name = path.Clean(name)
if s.developmentMode {
s.tmx.RLock()
defer s.tmx.RUnlock()
if newName, fileName, foundLoaded, foundFile, _ := s.resolveNameSibling(name, sibling); foundFile || foundLoaded {
if foundFile {
template,... | [
"func",
"(",
"s",
"*",
"Set",
")",
"getTemplate",
"(",
"name",
",",
"sibling",
"string",
")",
"(",
"template",
"*",
"Template",
",",
"err",
"error",
")",
"{",
"name",
"=",
"path",
".",
"Clean",
"(",
"name",
")",
"\n\n",
"if",
"s",
".",
"development... | // getTemplate gets a template already loaded by name | [
"getTemplate",
"gets",
"a",
"template",
"already",
"loaded",
"by",
"name"
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/template.go#L222-L287 |
21,518 | CloudyKit/jet | template.go | Execute | func (t *Template) Execute(w io.Writer, variables VarMap, data interface{}) error {
return t.ExecuteI18N(nil, w, variables, data)
} | go | func (t *Template) Execute(w io.Writer, variables VarMap, data interface{}) error {
return t.ExecuteI18N(nil, w, variables, data)
} | [
"func",
"(",
"t",
"*",
"Template",
")",
"Execute",
"(",
"w",
"io",
".",
"Writer",
",",
"variables",
"VarMap",
",",
"data",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"t",
".",
"ExecuteI18N",
"(",
"nil",
",",
"w",
",",
"variables",
",",
"da... | // Execute executes the template in the w Writer | [
"Execute",
"executes",
"the",
"template",
"in",
"the",
"w",
"Writer"
] | 62edd43e4f88c6be452fd5feac77f716f546ebf6 | https://github.com/CloudyKit/jet/blob/62edd43e4f88c6be452fd5feac77f716f546ebf6/template.go#L382-L384 |
21,519 | Microsoft/hcsshim | internal/wclayer/createlayer.go | CreateLayer | func CreateLayer(path, parent string) (err error) {
title := "hcsshim::CreateLayer"
fields := logrus.Fields{
"parent": parent,
"path": path,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {
logrus.... | go | func CreateLayer(path, parent string) (err error) {
title := "hcsshim::CreateLayer"
fields := logrus.Fields{
"parent": parent,
"path": path,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {
logrus.... | [
"func",
"CreateLayer",
"(",
"path",
",",
"parent",
"string",
")",
"(",
"err",
"error",
")",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"fields",
":=",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"parent",
",",
"\"",
"\"",
":",
"path",
",",
"}",
"\n... | // CreateLayer creates a new, empty, read-only layer on the filesystem based on
// the parent layer provided. | [
"CreateLayer",
"creates",
"a",
"new",
"empty",
"read",
"-",
"only",
"layer",
"on",
"the",
"filesystem",
"based",
"on",
"the",
"parent",
"layer",
"provided",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/createlayer.go#L10-L31 |
21,520 | Microsoft/hcsshim | internal/mergemaps/merge.go | MergeJSON | func MergeJSON(object interface{}, additionalJSON []byte) (interface{}, error) {
if len(additionalJSON) == 0 {
return object, nil
}
objectJSON, err := json.Marshal(object)
if err != nil {
return nil, err
}
var objectMap, newMap map[string]interface{}
err = json.Unmarshal(objectJSON, &objectMap)
if err != ni... | go | func MergeJSON(object interface{}, additionalJSON []byte) (interface{}, error) {
if len(additionalJSON) == 0 {
return object, nil
}
objectJSON, err := json.Marshal(object)
if err != nil {
return nil, err
}
var objectMap, newMap map[string]interface{}
err = json.Unmarshal(objectJSON, &objectMap)
if err != ni... | [
"func",
"MergeJSON",
"(",
"object",
"interface",
"{",
"}",
",",
"additionalJSON",
"[",
"]",
"byte",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"len",
"(",
"additionalJSON",
")",
"==",
"0",
"{",
"return",
"object",
",",
"nil",
"\n"... | // MergeJSON merges the contents of a JSON string into an object representation,
// returning a new object suitable for translating to JSON. | [
"MergeJSON",
"merges",
"the",
"contents",
"of",
"a",
"JSON",
"string",
"into",
"an",
"object",
"representation",
"returning",
"a",
"new",
"object",
"suitable",
"for",
"translating",
"to",
"JSON",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/mergemaps/merge.go#L34-L52 |
21,521 | Microsoft/hcsshim | hnsnetwork.go | HNSListNetworkRequest | func HNSListNetworkRequest(method, path, request string) ([]HNSNetwork, error) {
return hns.HNSListNetworkRequest(method, path, request)
} | go | func HNSListNetworkRequest(method, path, request string) ([]HNSNetwork, error) {
return hns.HNSListNetworkRequest(method, path, request)
} | [
"func",
"HNSListNetworkRequest",
"(",
"method",
",",
"path",
",",
"request",
"string",
")",
"(",
"[",
"]",
"HNSNetwork",
",",
"error",
")",
"{",
"return",
"hns",
".",
"HNSListNetworkRequest",
"(",
"method",
",",
"path",
",",
"request",
")",
"\n",
"}"
] | // HNSListNetworkRequest makes a HNS call to query the list of available networks | [
"HNSListNetworkRequest",
"makes",
"a",
"HNS",
"call",
"to",
"query",
"the",
"list",
"of",
"available",
"networks"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hnsnetwork.go#L24-L26 |
21,522 | Microsoft/hcsshim | internal/hcs/errors.go | IsTimeout | func IsTimeout(err error) bool {
if err, ok := err.(net.Error); ok && err.Timeout() {
return true
}
err = getInnerError(err)
return err == ErrTimeout
} | go | func IsTimeout(err error) bool {
if err, ok := err.(net.Error); ok && err.Timeout() {
return true
}
err = getInnerError(err)
return err == ErrTimeout
} | [
"func",
"IsTimeout",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
",",
"ok",
":=",
"err",
".",
"(",
"net",
".",
"Error",
")",
";",
"ok",
"&&",
"err",
".",
"Timeout",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"err",
"=",
"getInner... | // IsTimeout returns a boolean indicating whether the error is caused by
// a timeout waiting for the operation to complete. | [
"IsTimeout",
"returns",
"a",
"boolean",
"indicating",
"whether",
"the",
"error",
"is",
"caused",
"by",
"a",
"timeout",
"waiting",
"for",
"the",
"operation",
"to",
"complete",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/errors.go#L281-L287 |
21,523 | Microsoft/hcsshim | internal/wclayer/getsharedbaseimages.go | GetSharedBaseImages | func GetSharedBaseImages() (imageData string, err error) {
title := "hcsshim::GetSharedBaseImages"
logrus.Debug(title)
defer func() {
if err != nil {
logrus.WithError(err).Error(err)
} else {
logrus.WithField("imageData", imageData).Debug(title + " - succeeded")
}
}()
var buffer *uint16
err = getBase... | go | func GetSharedBaseImages() (imageData string, err error) {
title := "hcsshim::GetSharedBaseImages"
logrus.Debug(title)
defer func() {
if err != nil {
logrus.WithError(err).Error(err)
} else {
logrus.WithField("imageData", imageData).Debug(title + " - succeeded")
}
}()
var buffer *uint16
err = getBase... | [
"func",
"GetSharedBaseImages",
"(",
")",
"(",
"imageData",
"string",
",",
"err",
"error",
")",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"logrus",
".",
"Debug",
"(",
"title",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"!=",
"nil",
"{",
"lo... | // GetSharedBaseImages will enumerate the images stored in the common central
// image store and return descriptive info about those images for the purpose
// of registering them with the graphdriver, graph, and tagstore. | [
"GetSharedBaseImages",
"will",
"enumerate",
"the",
"images",
"stored",
"in",
"the",
"common",
"central",
"image",
"store",
"and",
"return",
"descriptive",
"info",
"about",
"those",
"images",
"for",
"the",
"purpose",
"of",
"registering",
"them",
"with",
"the",
"g... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/getsharedbaseimages.go#L12-L29 |
21,524 | Microsoft/hcsshim | container.go | CreateContainer | func CreateContainer(id string, c *ContainerConfig) (Container, error) {
fullConfig, err := mergemaps.MergeJSON(c, createContainerAdditionalJSON)
if err != nil {
return nil, fmt.Errorf("failed to merge additional JSON '%s': %s", createContainerAdditionalJSON, err)
}
system, err := hcs.CreateComputeSystem(id, ful... | go | func CreateContainer(id string, c *ContainerConfig) (Container, error) {
fullConfig, err := mergemaps.MergeJSON(c, createContainerAdditionalJSON)
if err != nil {
return nil, fmt.Errorf("failed to merge additional JSON '%s': %s", createContainerAdditionalJSON, err)
}
system, err := hcs.CreateComputeSystem(id, ful... | [
"func",
"CreateContainer",
"(",
"id",
"string",
",",
"c",
"*",
"ContainerConfig",
")",
"(",
"Container",
",",
"error",
")",
"{",
"fullConfig",
",",
"err",
":=",
"mergemaps",
".",
"MergeJSON",
"(",
"c",
",",
"createContainerAdditionalJSON",
")",
"\n",
"if",
... | // CreateContainer creates a new container with the given configuration but does not start it. | [
"CreateContainer",
"creates",
"a",
"new",
"container",
"with",
"the",
"given",
"configuration",
"but",
"does",
"not",
"start",
"it",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/container.go#L72-L83 |
21,525 | Microsoft/hcsshim | container.go | OpenContainer | func OpenContainer(id string) (Container, error) {
system, err := hcs.OpenComputeSystem(id)
if err != nil {
return nil, err
}
return &container{system: system}, err
} | go | func OpenContainer(id string) (Container, error) {
system, err := hcs.OpenComputeSystem(id)
if err != nil {
return nil, err
}
return &container{system: system}, err
} | [
"func",
"OpenContainer",
"(",
"id",
"string",
")",
"(",
"Container",
",",
"error",
")",
"{",
"system",
",",
"err",
":=",
"hcs",
".",
"OpenComputeSystem",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"... | // OpenContainer opens an existing container by ID. | [
"OpenContainer",
"opens",
"an",
"existing",
"container",
"by",
"ID",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/container.go#L86-L92 |
21,526 | Microsoft/hcsshim | container.go | Wait | func (container *container) Wait() error {
err := container.system.Wait()
if err == nil {
err = container.system.ExitError()
}
return convertSystemError(err, container)
} | go | func (container *container) Wait() error {
err := container.system.Wait()
if err == nil {
err = container.system.ExitError()
}
return convertSystemError(err, container)
} | [
"func",
"(",
"container",
"*",
"container",
")",
"Wait",
"(",
")",
"error",
"{",
"err",
":=",
"container",
".",
"system",
".",
"Wait",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"err",
"=",
"container",
".",
"system",
".",
"ExitError",
"(",
")"... | // Waits synchronously waits for the container to shutdown or terminate. | [
"Waits",
"synchronously",
"waits",
"for",
"the",
"container",
"to",
"shutdown",
"or",
"terminate",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/container.go#L123-L129 |
21,527 | Microsoft/hcsshim | container.go | WaitTimeout | func (container *container) WaitTimeout(timeout time.Duration) error {
container.waitOnce.Do(func() {
container.waitCh = make(chan struct{})
go func() {
container.waitErr = container.Wait()
close(container.waitCh)
}()
})
t := time.NewTimer(timeout)
defer t.Stop()
select {
case <-t.C:
return &Contain... | go | func (container *container) WaitTimeout(timeout time.Duration) error {
container.waitOnce.Do(func() {
container.waitCh = make(chan struct{})
go func() {
container.waitErr = container.Wait()
close(container.waitCh)
}()
})
t := time.NewTimer(timeout)
defer t.Stop()
select {
case <-t.C:
return &Contain... | [
"func",
"(",
"container",
"*",
"container",
")",
"WaitTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"error",
"{",
"container",
".",
"waitOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"container",
".",
"waitCh",
"=",
"make",
"(",
"chan",
"stru... | // WaitTimeout synchronously waits for the container to terminate or the duration to elapse. It
// returns false if timeout occurs. | [
"WaitTimeout",
"synchronously",
"waits",
"for",
"the",
"container",
"to",
"terminate",
"or",
"the",
"duration",
"to",
"elapse",
".",
"It",
"returns",
"false",
"if",
"timeout",
"occurs",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/container.go#L133-L149 |
21,528 | Microsoft/hcsshim | container.go | Statistics | func (container *container) Statistics() (Statistics, error) {
properties, err := container.system.Properties(schema1.PropertyTypeStatistics)
if err != nil {
return Statistics{}, convertSystemError(err, container)
}
return properties.Statistics, nil
} | go | func (container *container) Statistics() (Statistics, error) {
properties, err := container.system.Properties(schema1.PropertyTypeStatistics)
if err != nil {
return Statistics{}, convertSystemError(err, container)
}
return properties.Statistics, nil
} | [
"func",
"(",
"container",
"*",
"container",
")",
"Statistics",
"(",
")",
"(",
"Statistics",
",",
"error",
")",
"{",
"properties",
",",
"err",
":=",
"container",
".",
"system",
".",
"Properties",
"(",
"schema1",
".",
"PropertyTypeStatistics",
")",
"\n",
"if... | // Statistics returns statistics for the container. This is a legacy v1 call | [
"Statistics",
"returns",
"statistics",
"for",
"the",
"container",
".",
"This",
"is",
"a",
"legacy",
"v1",
"call"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/container.go#L167-L174 |
21,529 | Microsoft/hcsshim | container.go | ProcessList | func (container *container) ProcessList() ([]ProcessListItem, error) {
properties, err := container.system.Properties(schema1.PropertyTypeProcessList)
if err != nil {
return nil, convertSystemError(err, container)
}
return properties.ProcessList, nil
} | go | func (container *container) ProcessList() ([]ProcessListItem, error) {
properties, err := container.system.Properties(schema1.PropertyTypeProcessList)
if err != nil {
return nil, convertSystemError(err, container)
}
return properties.ProcessList, nil
} | [
"func",
"(",
"container",
"*",
"container",
")",
"ProcessList",
"(",
")",
"(",
"[",
"]",
"ProcessListItem",
",",
"error",
")",
"{",
"properties",
",",
"err",
":=",
"container",
".",
"system",
".",
"Properties",
"(",
"schema1",
".",
"PropertyTypeProcessList",... | // ProcessList returns an array of ProcessListItems for the container. This is a legacy v1 call | [
"ProcessList",
"returns",
"an",
"array",
"of",
"ProcessListItems",
"for",
"the",
"container",
".",
"This",
"is",
"a",
"legacy",
"v1",
"call"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/container.go#L177-L184 |
21,530 | Microsoft/hcsshim | container.go | MappedVirtualDisks | func (container *container) MappedVirtualDisks() (map[int]MappedVirtualDiskController, error) {
properties, err := container.system.Properties(schema1.PropertyTypeMappedVirtualDisk)
if err != nil {
return nil, convertSystemError(err, container)
}
return properties.MappedVirtualDiskControllers, nil
} | go | func (container *container) MappedVirtualDisks() (map[int]MappedVirtualDiskController, error) {
properties, err := container.system.Properties(schema1.PropertyTypeMappedVirtualDisk)
if err != nil {
return nil, convertSystemError(err, container)
}
return properties.MappedVirtualDiskControllers, nil
} | [
"func",
"(",
"container",
"*",
"container",
")",
"MappedVirtualDisks",
"(",
")",
"(",
"map",
"[",
"int",
"]",
"MappedVirtualDiskController",
",",
"error",
")",
"{",
"properties",
",",
"err",
":=",
"container",
".",
"system",
".",
"Properties",
"(",
"schema1"... | // This is a legacy v1 call | [
"This",
"is",
"a",
"legacy",
"v1",
"call"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/container.go#L187-L194 |
21,531 | Microsoft/hcsshim | container.go | CreateProcess | func (container *container) CreateProcess(c *ProcessConfig) (Process, error) {
p, err := container.system.CreateProcess(c)
if err != nil {
return nil, convertSystemError(err, container)
}
return &process{p: p}, nil
} | go | func (container *container) CreateProcess(c *ProcessConfig) (Process, error) {
p, err := container.system.CreateProcess(c)
if err != nil {
return nil, convertSystemError(err, container)
}
return &process{p: p}, nil
} | [
"func",
"(",
"container",
"*",
"container",
")",
"CreateProcess",
"(",
"c",
"*",
"ProcessConfig",
")",
"(",
"Process",
",",
"error",
")",
"{",
"p",
",",
"err",
":=",
"container",
".",
"system",
".",
"CreateProcess",
"(",
"c",
")",
"\n",
"if",
"err",
... | // CreateProcess launches a new process within the container. | [
"CreateProcess",
"launches",
"a",
"new",
"process",
"within",
"the",
"container",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/container.go#L197-L203 |
21,532 | Microsoft/hcsshim | container.go | OpenProcess | func (container *container) OpenProcess(pid int) (Process, error) {
p, err := container.system.OpenProcess(pid)
if err != nil {
return nil, convertSystemError(err, container)
}
return &process{p: p}, nil
} | go | func (container *container) OpenProcess(pid int) (Process, error) {
p, err := container.system.OpenProcess(pid)
if err != nil {
return nil, convertSystemError(err, container)
}
return &process{p: p}, nil
} | [
"func",
"(",
"container",
"*",
"container",
")",
"OpenProcess",
"(",
"pid",
"int",
")",
"(",
"Process",
",",
"error",
")",
"{",
"p",
",",
"err",
":=",
"container",
".",
"system",
".",
"OpenProcess",
"(",
"pid",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // OpenProcess gets an interface to an existing process within the container. | [
"OpenProcess",
"gets",
"an",
"interface",
"to",
"an",
"existing",
"process",
"within",
"the",
"container",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/container.go#L206-L212 |
21,533 | Microsoft/hcsshim | container.go | Modify | func (container *container) Modify(config *ResourceModificationRequestResponse) error {
return convertSystemError(container.system.Modify(config), container)
} | go | func (container *container) Modify(config *ResourceModificationRequestResponse) error {
return convertSystemError(container.system.Modify(config), container)
} | [
"func",
"(",
"container",
"*",
"container",
")",
"Modify",
"(",
"config",
"*",
"ResourceModificationRequestResponse",
")",
"error",
"{",
"return",
"convertSystemError",
"(",
"container",
".",
"system",
".",
"Modify",
"(",
"config",
")",
",",
"container",
")",
... | // Modify the System | [
"Modify",
"the",
"System"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/container.go#L220-L222 |
21,534 | Microsoft/hcsshim | internal/wclayer/nametoguid.go | NameToGuid | func NameToGuid(name string) (id guid.GUID, err error) {
title := "hcsshim::NameToGuid"
fields := logrus.Fields{
"name": name,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {
logrus.WithFields(fields)... | go | func NameToGuid(name string) (id guid.GUID, err error) {
title := "hcsshim::NameToGuid"
fields := logrus.Fields{
"name": name,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {
logrus.WithFields(fields)... | [
"func",
"NameToGuid",
"(",
"name",
"string",
")",
"(",
"id",
"guid",
".",
"GUID",
",",
"err",
"error",
")",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"fields",
":=",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"name",
",",
"}",
"\n",
"logrus",
"."... | // NameToGuid converts the given string into a GUID using the algorithm in the
// Host Compute Service, ensuring GUIDs generated with the same string are common
// across all clients. | [
"NameToGuid",
"converts",
"the",
"given",
"string",
"into",
"a",
"GUID",
"using",
"the",
"algorithm",
"in",
"the",
"Host",
"Compute",
"Service",
"ensuring",
"GUIDs",
"generated",
"with",
"the",
"same",
"string",
"are",
"common",
"across",
"all",
"clients",
"."... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/nametoguid.go#L12-L34 |
21,535 | Microsoft/hcsshim | internal/copyfile/copyfile.go | CopyFile | func CopyFile(srcFile, destFile string, overwrite bool) error {
var bFailIfExists uint32 = 1
if overwrite {
bFailIfExists = 0
}
lpExistingFileName, err := syscall.UTF16PtrFromString(srcFile)
if err != nil {
return err
}
lpNewFileName, err := syscall.UTF16PtrFromString(destFile)
if err != nil {
return err... | go | func CopyFile(srcFile, destFile string, overwrite bool) error {
var bFailIfExists uint32 = 1
if overwrite {
bFailIfExists = 0
}
lpExistingFileName, err := syscall.UTF16PtrFromString(srcFile)
if err != nil {
return err
}
lpNewFileName, err := syscall.UTF16PtrFromString(destFile)
if err != nil {
return err... | [
"func",
"CopyFile",
"(",
"srcFile",
",",
"destFile",
"string",
",",
"overwrite",
"bool",
")",
"error",
"{",
"var",
"bFailIfExists",
"uint32",
"=",
"1",
"\n",
"if",
"overwrite",
"{",
"bFailIfExists",
"=",
"0",
"\n",
"}",
"\n\n",
"lpExistingFileName",
",",
"... | // CopyFile is a utility for copying a file - used for the LCOW scratch cache.
// Uses CopyFileW win32 API for performance. | [
"CopyFile",
"is",
"a",
"utility",
"for",
"copying",
"a",
"file",
"-",
"used",
"for",
"the",
"LCOW",
"scratch",
"cache",
".",
"Uses",
"CopyFileW",
"win32",
"API",
"for",
"performance",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/copyfile/copyfile.go#L16-L40 |
21,536 | Microsoft/hcsshim | internal/wclayer/exportlayer.go | NewLayerReader | func NewLayerReader(path string, parentLayerPaths []string) (LayerReader, error) {
exportPath, err := ioutil.TempDir("", "hcs")
if err != nil {
return nil, err
}
err = ExportLayer(path, exportPath, parentLayerPaths)
if err != nil {
os.RemoveAll(exportPath)
return nil, err
}
return &legacyLayerReaderWrapper... | go | func NewLayerReader(path string, parentLayerPaths []string) (LayerReader, error) {
exportPath, err := ioutil.TempDir("", "hcs")
if err != nil {
return nil, err
}
err = ExportLayer(path, exportPath, parentLayerPaths)
if err != nil {
os.RemoveAll(exportPath)
return nil, err
}
return &legacyLayerReaderWrapper... | [
"func",
"NewLayerReader",
"(",
"path",
"string",
",",
"parentLayerPaths",
"[",
"]",
"string",
")",
"(",
"LayerReader",
",",
"error",
")",
"{",
"exportPath",
",",
"err",
":=",
"ioutil",
".",
"TempDir",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
... | // NewLayerReader returns a new layer reader for reading the contents of an on-disk layer.
// The caller must have taken the SeBackupPrivilege privilege
// to call this and any methods on the resulting LayerReader. | [
"NewLayerReader",
"returns",
"a",
"new",
"layer",
"reader",
"for",
"reading",
"the",
"contents",
"of",
"an",
"on",
"-",
"disk",
"layer",
".",
"The",
"caller",
"must",
"have",
"taken",
"the",
"SeBackupPrivilege",
"privilege",
"to",
"call",
"this",
"and",
"any... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/exportlayer.go#L55-L66 |
21,537 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/exec_hcs.go | waitForContainerExit | func (he *hcsExec) waitForContainerExit() {
cexit := make(chan struct{})
go func() {
he.c.Wait()
close(cexit)
}()
select {
case <-cexit:
// Container exited first. We need to force the process into the exited
// state and cleanup any resources
he.sl.Lock()
switch he.state {
case shimExecStateCreated:... | go | func (he *hcsExec) waitForContainerExit() {
cexit := make(chan struct{})
go func() {
he.c.Wait()
close(cexit)
}()
select {
case <-cexit:
// Container exited first. We need to force the process into the exited
// state and cleanup any resources
he.sl.Lock()
switch he.state {
case shimExecStateCreated:... | [
"func",
"(",
"he",
"*",
"hcsExec",
")",
"waitForContainerExit",
"(",
")",
"{",
"cexit",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"he",
".",
"c",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"cexit",
"... | // waitForContainerExit waits for `he.c` to exit. Depending on the exec's state
// will forcibly transition this exec to the exited state and unblock any
// waiters.
//
// This MUST be called via a goroutine at exec create. | [
"waitForContainerExit",
"waits",
"for",
"he",
".",
"c",
"to",
"exit",
".",
"Depending",
"on",
"the",
"exec",
"s",
"state",
"will",
"forcibly",
"transition",
"this",
"exec",
"to",
"the",
"exited",
"state",
"and",
"unblock",
"any",
"waiters",
".",
"This",
"M... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/exec_hcs.go#L633-L656 |
21,538 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/exec_hcs.go | escapeArgs | func escapeArgs(args []string) string {
escapedArgs := make([]string, len(args))
for i, a := range args {
escapedArgs[i] = windows.EscapeArg(a)
}
return strings.Join(escapedArgs, " ")
} | go | func escapeArgs(args []string) string {
escapedArgs := make([]string, len(args))
for i, a := range args {
escapedArgs[i] = windows.EscapeArg(a)
}
return strings.Join(escapedArgs, " ")
} | [
"func",
"escapeArgs",
"(",
"args",
"[",
"]",
"string",
")",
"string",
"{",
"escapedArgs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"args",
")",
")",
"\n",
"for",
"i",
",",
"a",
":=",
"range",
"args",
"{",
"escapedArgs",
"[",
"i",
"... | // escapeArgs makes a Windows-style escaped command line from a set of arguments | [
"escapeArgs",
"makes",
"a",
"Windows",
"-",
"style",
"escaped",
"command",
"line",
"from",
"a",
"set",
"of",
"arguments"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/exec_hcs.go#L659-L665 |
21,539 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/serve.go | createEvent | func createEvent(event string) (windows.Handle, error) {
ev, _ := windows.UTF16PtrFromString(event)
sd, err := winio.SddlToSecurityDescriptor("D:P(A;;GA;;;BA)(A;;GA;;;SY)")
if err != nil {
return 0, errors.Wrapf(err, "failed to get security descriptor for event '%s'", event)
}
var sa windows.SecurityAttributes
... | go | func createEvent(event string) (windows.Handle, error) {
ev, _ := windows.UTF16PtrFromString(event)
sd, err := winio.SddlToSecurityDescriptor("D:P(A;;GA;;;BA)(A;;GA;;;SY)")
if err != nil {
return 0, errors.Wrapf(err, "failed to get security descriptor for event '%s'", event)
}
var sa windows.SecurityAttributes
... | [
"func",
"createEvent",
"(",
"event",
"string",
")",
"(",
"windows",
".",
"Handle",
",",
"error",
")",
"{",
"ev",
",",
"_",
":=",
"windows",
".",
"UTF16PtrFromString",
"(",
"event",
")",
"\n",
"sd",
",",
"err",
":=",
"winio",
".",
"SddlToSecurityDescripto... | // createEvent creates a Windows event ACL'd to builtin administrator
// and local system. Can use docker-signal to signal the event. | [
"createEvent",
"creates",
"a",
"Windows",
"event",
"ACL",
"d",
"to",
"builtin",
"administrator",
"and",
"local",
"system",
".",
"Can",
"use",
"docker",
"-",
"signal",
"to",
"signal",
"the",
"event",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/serve.go#L167-L182 |
21,540 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/serve.go | setupDebuggerEvent | func setupDebuggerEvent() {
if os.Getenv("CONTAINERD_SHIM_RUNHCS_V1_WAIT_DEBUGGER") == "" {
return
}
event := "Global\\debugger-" + fmt.Sprint(os.Getpid())
handle, err := createEvent(event)
if err != nil {
return
}
logrus.Infof("Halting until %s is signalled", event)
windows.WaitForSingleObject(handle, wind... | go | func setupDebuggerEvent() {
if os.Getenv("CONTAINERD_SHIM_RUNHCS_V1_WAIT_DEBUGGER") == "" {
return
}
event := "Global\\debugger-" + fmt.Sprint(os.Getpid())
handle, err := createEvent(event)
if err != nil {
return
}
logrus.Infof("Halting until %s is signalled", event)
windows.WaitForSingleObject(handle, wind... | [
"func",
"setupDebuggerEvent",
"(",
")",
"{",
"if",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"==",
"\"",
"\"",
"{",
"return",
"\n",
"}",
"\n",
"event",
":=",
"\"",
"\\\\",
"\"",
"+",
"fmt",
".",
"Sprint",
"(",
"os",
".",
"Getpid",
"(",
")",
")... | // setupDebuggerEvent listens for an event to allow a debugger such as delve
// to attach for advanced debugging. It's called when handling a ContainerCreate | [
"setupDebuggerEvent",
"listens",
"for",
"an",
"event",
"to",
"allow",
"a",
"debugger",
"such",
"as",
"delve",
"to",
"attach",
"for",
"advanced",
"debugging",
".",
"It",
"s",
"called",
"when",
"handling",
"a",
"ContainerCreate"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/serve.go#L186-L198 |
21,541 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/serve.go | setupDumpStacks | func setupDumpStacks() {
event := "Global\\stackdump-" + fmt.Sprint(os.Getpid())
handle, err := createEvent(event)
if err != nil {
return
}
go func() {
for {
windows.WaitForSingleObject(handle, windows.INFINITE)
dumpStacks(true)
}
}()
return
} | go | func setupDumpStacks() {
event := "Global\\stackdump-" + fmt.Sprint(os.Getpid())
handle, err := createEvent(event)
if err != nil {
return
}
go func() {
for {
windows.WaitForSingleObject(handle, windows.INFINITE)
dumpStacks(true)
}
}()
return
} | [
"func",
"setupDumpStacks",
"(",
")",
"{",
"event",
":=",
"\"",
"\\\\",
"\"",
"+",
"fmt",
".",
"Sprint",
"(",
"os",
".",
"Getpid",
"(",
")",
")",
"\n",
"handle",
",",
"err",
":=",
"createEvent",
"(",
"event",
")",
"\n",
"if",
"err",
"!=",
"nil",
"... | // setupDumpStacks listens for an event which when signalled dumps the
// stacks from this process to the log output. | [
"setupDumpStacks",
"listens",
"for",
"an",
"event",
"which",
"when",
"signalled",
"dumps",
"the",
"stacks",
"from",
"this",
"process",
"to",
"the",
"log",
"output",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/serve.go#L202-L215 |
21,542 | Microsoft/hcsshim | internal/runhcs/vm.go | IssueVMRequest | func IssueVMRequest(pipepath string, req *VMRequest) error {
pipe, err := winio.DialPipe(pipepath, nil)
if err != nil {
return err
}
defer pipe.Close()
if err := json.NewEncoder(pipe).Encode(req); err != nil {
return err
}
if err := GetErrorFromPipe(pipe, nil); err != nil {
return err
}
return nil
} | go | func IssueVMRequest(pipepath string, req *VMRequest) error {
pipe, err := winio.DialPipe(pipepath, nil)
if err != nil {
return err
}
defer pipe.Close()
if err := json.NewEncoder(pipe).Encode(req); err != nil {
return err
}
if err := GetErrorFromPipe(pipe, nil); err != nil {
return err
}
return nil
} | [
"func",
"IssueVMRequest",
"(",
"pipepath",
"string",
",",
"req",
"*",
"VMRequest",
")",
"error",
"{",
"pipe",
",",
"err",
":=",
"winio",
".",
"DialPipe",
"(",
"pipepath",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}... | // IssueVMRequest issues a request to a shim at the given pipe. | [
"IssueVMRequest",
"issues",
"a",
"request",
"to",
"a",
"shim",
"at",
"the",
"given",
"pipe",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/runhcs/vm.go#L30-L43 |
21,543 | Microsoft/hcsshim | internal/copywithtimeout/copywithtimeout.go | Copy | func Copy(dst io.Writer, src io.Reader, size int64, context string, timeout time.Duration) (int64, error) {
logrus.WithFields(logrus.Fields{
"stdval": context,
"size": size,
"timeout": timeout,
}).Debug("hcsshim::copywithtimeout - Begin")
type resultType struct {
err error
bytes int64
}
done := m... | go | func Copy(dst io.Writer, src io.Reader, size int64, context string, timeout time.Duration) (int64, error) {
logrus.WithFields(logrus.Fields{
"stdval": context,
"size": size,
"timeout": timeout,
}).Debug("hcsshim::copywithtimeout - Begin")
type resultType struct {
err error
bytes int64
}
done := m... | [
"func",
"Copy",
"(",
"dst",
"io",
".",
"Writer",
",",
"src",
"io",
".",
"Reader",
",",
"size",
"int64",
",",
"context",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"int64",
",",
"error",
")",
"{",
"logrus",
".",
"WithFields",
"(",
... | // Copy is a wrapper for io.Copy using a timeout duration | [
"Copy",
"is",
"a",
"wrapper",
"for",
"io",
".",
"Copy",
"using",
"a",
"timeout",
"duration"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/copywithtimeout/copywithtimeout.go#L33-L103 |
21,544 | Microsoft/hcsshim | internal/uvm/vsmb.go | findVSMBShare | func (uvm *UtilityVM) findVSMBShare(hostPath string) (*vsmbShare, error) {
share, ok := uvm.vsmbShares[hostPath]
if !ok {
return nil, ErrNotAttached
}
logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
"name": share.name,
"refCount": share.refCount,
}).Debu... | go | func (uvm *UtilityVM) findVSMBShare(hostPath string) (*vsmbShare, error) {
share, ok := uvm.vsmbShares[hostPath]
if !ok {
return nil, ErrNotAttached
}
logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
"name": share.name,
"refCount": share.refCount,
}).Debu... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"findVSMBShare",
"(",
"hostPath",
"string",
")",
"(",
"*",
"vsmbShare",
",",
"error",
")",
"{",
"share",
",",
"ok",
":=",
"uvm",
".",
"vsmbShares",
"[",
"hostPath",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",... | // findVSMBShare finds a share by `hostPath`. If not found returns `ErrNotAttached`. | [
"findVSMBShare",
"finds",
"a",
"share",
"by",
"hostPath",
".",
"If",
"not",
"found",
"returns",
"ErrNotAttached",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/vsmb.go#L14-L26 |
21,545 | Microsoft/hcsshim | internal/uvm/vsmb.go | AddVSMB | func (uvm *UtilityVM) AddVSMB(hostPath string, guestRequest interface{}, options *hcsschema.VirtualSmbShareOptions) (err error) {
op := "uvm::AddVSMB"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
})
log.Debugf(op+" - GuestRequest: %+v, Options: %+v - Begin Operatio... | go | func (uvm *UtilityVM) AddVSMB(hostPath string, guestRequest interface{}, options *hcsschema.VirtualSmbShareOptions) (err error) {
op := "uvm::AddVSMB"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
})
log.Debugf(op+" - GuestRequest: %+v, Options: %+v - Begin Operatio... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"AddVSMB",
"(",
"hostPath",
"string",
",",
"guestRequest",
"interface",
"{",
"}",
",",
"options",
"*",
"hcsschema",
".",
"VirtualSmbShareOptions",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n"... | // AddVSMB adds a VSMB share to a Windows utility VM. Each VSMB share is ref-counted and
// only added if it isn't already. This is used for read-only layers, mapped directories
// to a container, and for mapped pipes. | [
"AddVSMB",
"adds",
"a",
"VSMB",
"share",
"to",
"a",
"Windows",
"utility",
"VM",
".",
"Each",
"VSMB",
"share",
"is",
"ref",
"-",
"counted",
"and",
"only",
"added",
"if",
"it",
"isn",
"t",
"already",
".",
"This",
"is",
"used",
"for",
"read",
"-",
"only... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/vsmb.go#L35-L83 |
21,546 | Microsoft/hcsshim | internal/uvm/vsmb.go | RemoveVSMB | func (uvm *UtilityVM) RemoveVSMB(hostPath string) (err error) {
op := "uvm::RemoveVSMB"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - E... | go | func (uvm *UtilityVM) RemoveVSMB(hostPath string) (err error) {
op := "uvm::RemoveVSMB"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - E... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"RemoveVSMB",
"(",
"hostPath",
"string",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"logfields",
".",
"UVMI... | // RemoveVSMB removes a VSMB share from a utility VM. Each VSMB share is ref-counted
// and only actually removed when the ref-count drops to zero. | [
"RemoveVSMB",
"removes",
"a",
"VSMB",
"share",
"from",
"a",
"utility",
"VM",
".",
"Each",
"VSMB",
"share",
"is",
"ref",
"-",
"counted",
"and",
"only",
"actually",
"removed",
"when",
"the",
"ref",
"-",
"count",
"drops",
"to",
"zero",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/vsmb.go#L87-L130 |
21,547 | Microsoft/hcsshim | internal/uvm/vsmb.go | GetVSMBUvmPath | func (uvm *UtilityVM) GetVSMBUvmPath(hostPath string) (_ string, err error) {
op := "uvm::GetVSMBUvmPath"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
lo... | go | func (uvm *UtilityVM) GetVSMBUvmPath(hostPath string) (_ string, err error) {
op := "uvm::GetVSMBUvmPath"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
lo... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"GetVSMBUvmPath",
"(",
"hostPath",
"string",
")",
"(",
"_",
"string",
",",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",... | // GetVSMBUvmPath returns the guest path of a VSMB mount. | [
"GetVSMBUvmPath",
"returns",
"the",
"guest",
"path",
"of",
"a",
"VSMB",
"mount",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/vsmb.go#L133-L160 |
21,548 | Microsoft/hcsshim | internal/wclayer/layerexists.go | LayerExists | func LayerExists(path string) (_ bool, err error) {
title := "hcsshim::LayerExists"
fields := logrus.Fields{
"path": path,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {
logrus.WithFields(fields).Deb... | go | func LayerExists(path string) (_ bool, err error) {
title := "hcsshim::LayerExists"
fields := logrus.Fields{
"path": path,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {
logrus.WithFields(fields).Deb... | [
"func",
"LayerExists",
"(",
"path",
"string",
")",
"(",
"_",
"bool",
",",
"err",
"error",
")",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"fields",
":=",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"path",
",",
"}",
"\n",
"logrus",
".",
"WithFields",... | // LayerExists will return true if a layer with the given id exists and is known
// to the system. | [
"LayerExists",
"will",
"return",
"true",
"if",
"a",
"layer",
"with",
"the",
"given",
"id",
"exists",
"and",
"is",
"known",
"to",
"the",
"system",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/layerexists.go#L10-L33 |
21,549 | Microsoft/hcsshim | internal/wclayer/getlayermountpath.go | GetLayerMountPath | func GetLayerMountPath(path string) (_ string, err error) {
title := "hcsshim::GetLayerMountPath"
fields := logrus.Fields{
"path": path,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {
logrus.WithFiel... | go | func GetLayerMountPath(path string) (_ string, err error) {
title := "hcsshim::GetLayerMountPath"
fields := logrus.Fields{
"path": path,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {
logrus.WithFiel... | [
"func",
"GetLayerMountPath",
"(",
"path",
"string",
")",
"(",
"_",
"string",
",",
"err",
"error",
")",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"fields",
":=",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"path",
",",
"}",
"\n",
"logrus",
".",
"With... | // GetLayerMountPath will look for a mounted layer with the given path and return
// the path at which that layer can be accessed. This path may be a volume path
// if the layer is a mounted read-write layer, otherwise it is expected to be the
// folder path at which the layer is stored. | [
"GetLayerMountPath",
"will",
"look",
"for",
"a",
"mounted",
"layer",
"with",
"the",
"given",
"path",
"and",
"return",
"the",
"path",
"at",
"which",
"that",
"layer",
"can",
"be",
"accessed",
".",
"This",
"path",
"may",
"be",
"a",
"volume",
"path",
"if",
"... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/getlayermountpath.go#L14-L56 |
21,550 | Microsoft/hcsshim | hnsendpoint.go | HotAttachEndpoint | func HotAttachEndpoint(containerID string, endpointID string) error {
endpoint, err := GetHNSEndpointByID(endpointID)
isAttached, err := endpoint.IsAttached(containerID)
if isAttached {
return err
}
return modifyNetworkEndpoint(containerID, endpointID, Add)
} | go | func HotAttachEndpoint(containerID string, endpointID string) error {
endpoint, err := GetHNSEndpointByID(endpointID)
isAttached, err := endpoint.IsAttached(containerID)
if isAttached {
return err
}
return modifyNetworkEndpoint(containerID, endpointID, Add)
} | [
"func",
"HotAttachEndpoint",
"(",
"containerID",
"string",
",",
"endpointID",
"string",
")",
"error",
"{",
"endpoint",
",",
"err",
":=",
"GetHNSEndpointByID",
"(",
"endpointID",
")",
"\n",
"isAttached",
",",
"err",
":=",
"endpoint",
".",
"IsAttached",
"(",
"co... | // HotAttachEndpoint makes a HCS Call to attach the endpoint to the container | [
"HotAttachEndpoint",
"makes",
"a",
"HCS",
"Call",
"to",
"attach",
"the",
"endpoint",
"to",
"the",
"container"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hnsendpoint.go#L41-L48 |
21,551 | Microsoft/hcsshim | hnsendpoint.go | HotDetachEndpoint | func HotDetachEndpoint(containerID string, endpointID string) error {
endpoint, err := GetHNSEndpointByID(endpointID)
isAttached, err := endpoint.IsAttached(containerID)
if !isAttached {
return err
}
return modifyNetworkEndpoint(containerID, endpointID, Remove)
} | go | func HotDetachEndpoint(containerID string, endpointID string) error {
endpoint, err := GetHNSEndpointByID(endpointID)
isAttached, err := endpoint.IsAttached(containerID)
if !isAttached {
return err
}
return modifyNetworkEndpoint(containerID, endpointID, Remove)
} | [
"func",
"HotDetachEndpoint",
"(",
"containerID",
"string",
",",
"endpointID",
"string",
")",
"error",
"{",
"endpoint",
",",
"err",
":=",
"GetHNSEndpointByID",
"(",
"endpointID",
")",
"\n",
"isAttached",
",",
"err",
":=",
"endpoint",
".",
"IsAttached",
"(",
"co... | // HotDetachEndpoint makes a HCS Call to detach the endpoint from the container | [
"HotDetachEndpoint",
"makes",
"a",
"HCS",
"Call",
"to",
"detach",
"the",
"endpoint",
"from",
"the",
"container"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hnsendpoint.go#L51-L58 |
21,552 | Microsoft/hcsshim | hnsendpoint.go | modifyContainer | func modifyContainer(id string, request *ResourceModificationRequestResponse) error {
container, err := OpenContainer(id)
if err != nil {
if IsNotExist(err) {
return ErrComputeSystemDoesNotExist
}
return getInnerError(err)
}
defer container.Close()
err = container.Modify(request)
if err != nil {
if IsN... | go | func modifyContainer(id string, request *ResourceModificationRequestResponse) error {
container, err := OpenContainer(id)
if err != nil {
if IsNotExist(err) {
return ErrComputeSystemDoesNotExist
}
return getInnerError(err)
}
defer container.Close()
err = container.Modify(request)
if err != nil {
if IsN... | [
"func",
"modifyContainer",
"(",
"id",
"string",
",",
"request",
"*",
"ResourceModificationRequestResponse",
")",
"error",
"{",
"container",
",",
"err",
":=",
"OpenContainer",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"IsNotExist",
"(",
"err"... | // ModifyContainer corresponding to the container id, by sending a request | [
"ModifyContainer",
"corresponding",
"to",
"the",
"container",
"id",
"by",
"sending",
"a",
"request"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hnsendpoint.go#L61-L79 |
21,553 | Microsoft/hcsshim | internal/ospath/join.go | Join | func Join(os string, elem ...string) string {
if os == "windows" {
return filepath.Join(elem...)
}
return path.Join(elem...)
} | go | func Join(os string, elem ...string) string {
if os == "windows" {
return filepath.Join(elem...)
}
return path.Join(elem...)
} | [
"func",
"Join",
"(",
"os",
"string",
",",
"elem",
"...",
"string",
")",
"string",
"{",
"if",
"os",
"==",
"\"",
"\"",
"{",
"return",
"filepath",
".",
"Join",
"(",
"elem",
"...",
")",
"\n",
"}",
"\n",
"return",
"path",
".",
"Join",
"(",
"elem",
"..... | // Join joins paths using the target OS's path separator. | [
"Join",
"joins",
"paths",
"using",
"the",
"target",
"OS",
"s",
"path",
"separator",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/ospath/join.go#L9-L14 |
21,554 | Microsoft/hcsshim | internal/hns/hnspolicylist.go | HNSListPolicyListRequest | func HNSListPolicyListRequest() ([]PolicyList, error) {
var plist []PolicyList
err := hnsCall("GET", "/policylists/", "", &plist)
if err != nil {
return nil, err
}
return plist, nil
} | go | func HNSListPolicyListRequest() ([]PolicyList, error) {
var plist []PolicyList
err := hnsCall("GET", "/policylists/", "", &plist)
if err != nil {
return nil, err
}
return plist, nil
} | [
"func",
"HNSListPolicyListRequest",
"(",
")",
"(",
"[",
"]",
"PolicyList",
",",
"error",
")",
"{",
"var",
"plist",
"[",
"]",
"PolicyList",
"\n",
"err",
":=",
"hnsCall",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"&",
"plist",
")",
"\n"... | // HNSListPolicyListRequest gets all the policy list | [
"HNSListPolicyListRequest",
"gets",
"all",
"the",
"policy",
"list"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnspolicylist.go#L53-L61 |
21,555 | Microsoft/hcsshim | internal/hns/hnspolicylist.go | Create | func (policylist *PolicyList) Create() (*PolicyList, error) {
operation := "Create"
title := "hcsshim::PolicyList::" + operation
logrus.Debugf(title+" id=%s", policylist.ID)
jsonString, err := json.Marshal(policylist)
if err != nil {
return nil, err
}
return PolicyListRequest("POST", "", string(jsonString))
} | go | func (policylist *PolicyList) Create() (*PolicyList, error) {
operation := "Create"
title := "hcsshim::PolicyList::" + operation
logrus.Debugf(title+" id=%s", policylist.ID)
jsonString, err := json.Marshal(policylist)
if err != nil {
return nil, err
}
return PolicyListRequest("POST", "", string(jsonString))
} | [
"func",
"(",
"policylist",
"*",
"PolicyList",
")",
"Create",
"(",
")",
"(",
"*",
"PolicyList",
",",
"error",
")",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"title",
":=",
"\"",
"\"",
"+",
"operation",
"\n",
"logrus",
".",
"Debugf",
"(",
"title",
"+",... | // Create PolicyList by sending PolicyListRequest to HNS. | [
"Create",
"PolicyList",
"by",
"sending",
"PolicyListRequest",
"to",
"HNS",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnspolicylist.go#L80-L89 |
21,556 | Microsoft/hcsshim | internal/hns/hnspolicylist.go | Delete | func (policylist *PolicyList) Delete() (*PolicyList, error) {
operation := "Delete"
title := "hcsshim::PolicyList::" + operation
logrus.Debugf(title+" id=%s", policylist.ID)
return PolicyListRequest("DELETE", policylist.ID, "")
} | go | func (policylist *PolicyList) Delete() (*PolicyList, error) {
operation := "Delete"
title := "hcsshim::PolicyList::" + operation
logrus.Debugf(title+" id=%s", policylist.ID)
return PolicyListRequest("DELETE", policylist.ID, "")
} | [
"func",
"(",
"policylist",
"*",
"PolicyList",
")",
"Delete",
"(",
")",
"(",
"*",
"PolicyList",
",",
"error",
")",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"title",
":=",
"\"",
"\"",
"+",
"operation",
"\n",
"logrus",
".",
"Debugf",
"(",
"title",
"+",... | // Delete deletes PolicyList | [
"Delete",
"deletes",
"PolicyList"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnspolicylist.go#L92-L98 |
21,557 | Microsoft/hcsshim | internal/hns/hnspolicylist.go | AddEndpoint | func (policylist *PolicyList) AddEndpoint(endpoint *HNSEndpoint) (*PolicyList, error) {
operation := "AddEndpoint"
title := "hcsshim::PolicyList::" + operation
logrus.Debugf(title+" id=%s, endpointId:%s", policylist.ID, endpoint.Id)
_, err := policylist.Delete()
if err != nil {
return nil, err
}
// Add Endpo... | go | func (policylist *PolicyList) AddEndpoint(endpoint *HNSEndpoint) (*PolicyList, error) {
operation := "AddEndpoint"
title := "hcsshim::PolicyList::" + operation
logrus.Debugf(title+" id=%s, endpointId:%s", policylist.ID, endpoint.Id)
_, err := policylist.Delete()
if err != nil {
return nil, err
}
// Add Endpo... | [
"func",
"(",
"policylist",
"*",
"PolicyList",
")",
"AddEndpoint",
"(",
"endpoint",
"*",
"HNSEndpoint",
")",
"(",
"*",
"PolicyList",
",",
"error",
")",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"title",
":=",
"\"",
"\"",
"+",
"operation",
"\n",
"logrus",
... | // AddEndpoint add an endpoint to a Policy List | [
"AddEndpoint",
"add",
"an",
"endpoint",
"to",
"a",
"Policy",
"List"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnspolicylist.go#L101-L115 |
21,558 | Microsoft/hcsshim | internal/hns/hnspolicylist.go | RemoveEndpoint | func (policylist *PolicyList) RemoveEndpoint(endpoint *HNSEndpoint) (*PolicyList, error) {
operation := "RemoveEndpoint"
title := "hcsshim::PolicyList::" + operation
logrus.Debugf(title+" id=%s, endpointId:%s", policylist.ID, endpoint.Id)
_, err := policylist.Delete()
if err != nil {
return nil, err
}
elemen... | go | func (policylist *PolicyList) RemoveEndpoint(endpoint *HNSEndpoint) (*PolicyList, error) {
operation := "RemoveEndpoint"
title := "hcsshim::PolicyList::" + operation
logrus.Debugf(title+" id=%s, endpointId:%s", policylist.ID, endpoint.Id)
_, err := policylist.Delete()
if err != nil {
return nil, err
}
elemen... | [
"func",
"(",
"policylist",
"*",
"PolicyList",
")",
"RemoveEndpoint",
"(",
"endpoint",
"*",
"HNSEndpoint",
")",
"(",
"*",
"PolicyList",
",",
"error",
")",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"title",
":=",
"\"",
"\"",
"+",
"operation",
"\n",
"logrus... | // RemoveEndpoint removes an endpoint from the Policy List | [
"RemoveEndpoint",
"removes",
"an",
"endpoint",
"from",
"the",
"Policy",
"List"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnspolicylist.go#L118-L140 |
21,559 | Microsoft/hcsshim | internal/hcs/process.go | Signal | func (process *Process) Signal(options interface{}) (_ bool, err error) {
process.handleLock.RLock()
defer process.handleLock.RUnlock()
operation := "hcsshim::Process::Signal"
process.logOperationBegin(operation)
defer func() { process.logOperationEnd(operation, err) }()
if process.handle == 0 {
return false,... | go | func (process *Process) Signal(options interface{}) (_ bool, err error) {
process.handleLock.RLock()
defer process.handleLock.RUnlock()
operation := "hcsshim::Process::Signal"
process.logOperationBegin(operation)
defer func() { process.logOperationEnd(operation, err) }()
if process.handle == 0 {
return false,... | [
"func",
"(",
"process",
"*",
"Process",
")",
"Signal",
"(",
"options",
"interface",
"{",
"}",
")",
"(",
"_",
"bool",
",",
"err",
"error",
")",
"{",
"process",
".",
"handleLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"process",
".",
"handleLock",
"."... | // Signal signals the process with `options`.
//
// For LCOW `guestrequest.SignalProcessOptionsLCOW`.
//
// For WCOW `guestrequest.SignalProcessOptionsWCOW`. | [
"Signal",
"signals",
"the",
"process",
"with",
"options",
".",
"For",
"LCOW",
"guestrequest",
".",
"SignalProcessOptionsLCOW",
".",
"For",
"WCOW",
"guestrequest",
".",
"SignalProcessOptionsWCOW",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/process.go#L139-L168 |
21,560 | Microsoft/hcsshim | internal/hcs/process.go | StdioLegacy | func (process *Process) StdioLegacy() (_ io.WriteCloser, _ io.ReadCloser, _ io.ReadCloser, err error) {
process.handleLock.RLock()
defer process.handleLock.RUnlock()
operation := "hcsshim::Process::Stdio"
process.logOperationBegin(operation)
defer func() { process.logOperationEnd(operation, err) }()
if process.... | go | func (process *Process) StdioLegacy() (_ io.WriteCloser, _ io.ReadCloser, _ io.ReadCloser, err error) {
process.handleLock.RLock()
defer process.handleLock.RUnlock()
operation := "hcsshim::Process::Stdio"
process.logOperationBegin(operation)
defer func() { process.logOperationEnd(operation, err) }()
if process.... | [
"func",
"(",
"process",
"*",
"Process",
")",
"StdioLegacy",
"(",
")",
"(",
"_",
"io",
".",
"WriteCloser",
",",
"_",
"io",
".",
"ReadCloser",
",",
"_",
"io",
".",
"ReadCloser",
",",
"err",
"error",
")",
"{",
"process",
".",
"handleLock",
".",
"RLock",... | // StdioLegacy returns the stdin, stdout, and stderr pipes, respectively. Closing
// these pipes does not close the underlying pipes; it should be possible to
// call this multiple times to get multiple interfaces. | [
"StdioLegacy",
"returns",
"the",
"stdin",
"stdout",
"and",
"stderr",
"pipes",
"respectively",
".",
"Closing",
"these",
"pipes",
"does",
"not",
"close",
"the",
"underlying",
"pipes",
";",
"it",
"should",
"be",
"possible",
"to",
"call",
"this",
"multiple",
"time... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/process.go#L327-L355 |
21,561 | Microsoft/hcsshim | internal/hcs/process.go | Stdio | func (process *Process) Stdio() (stdin io.Writer, stdout, stderr io.Reader) {
return process.stdin, process.stdout, process.stderr
} | go | func (process *Process) Stdio() (stdin io.Writer, stdout, stderr io.Reader) {
return process.stdin, process.stdout, process.stderr
} | [
"func",
"(",
"process",
"*",
"Process",
")",
"Stdio",
"(",
")",
"(",
"stdin",
"io",
".",
"Writer",
",",
"stdout",
",",
"stderr",
"io",
".",
"Reader",
")",
"{",
"return",
"process",
".",
"stdin",
",",
"process",
".",
"stdout",
",",
"process",
".",
"... | // Stdio returns the stdin, stdout, and stderr pipes, respectively.
// To close them, close the process handle. | [
"Stdio",
"returns",
"the",
"stdin",
"stdout",
"and",
"stderr",
"pipes",
"respectively",
".",
"To",
"close",
"them",
"close",
"the",
"process",
"handle",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/process.go#L359-L361 |
21,562 | Microsoft/hcsshim | internal/hcs/process.go | CloseStdin | func (process *Process) CloseStdin() (err error) {
process.handleLock.RLock()
defer process.handleLock.RUnlock()
operation := "hcsshim::Process::CloseStdin"
process.logOperationBegin(operation)
defer func() { process.logOperationEnd(operation, err) }()
if process.handle == 0 {
return makeProcessError(process,... | go | func (process *Process) CloseStdin() (err error) {
process.handleLock.RLock()
defer process.handleLock.RUnlock()
operation := "hcsshim::Process::CloseStdin"
process.logOperationBegin(operation)
defer func() { process.logOperationEnd(operation, err) }()
if process.handle == 0 {
return makeProcessError(process,... | [
"func",
"(",
"process",
"*",
"Process",
")",
"CloseStdin",
"(",
")",
"(",
"err",
"error",
")",
"{",
"process",
".",
"handleLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"process",
".",
"handleLock",
".",
"RUnlock",
"(",
")",
"\n\n",
"operation",
":=",
... | // CloseStdin closes the write side of the stdin pipe so that the process is
// notified on the read side that there is no more data in stdin. | [
"CloseStdin",
"closes",
"the",
"write",
"side",
"of",
"the",
"stdin",
"pipe",
"so",
"that",
"the",
"process",
"is",
"notified",
"on",
"the",
"read",
"side",
"that",
"there",
"is",
"no",
"more",
"data",
"in",
"stdin",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/process.go#L365-L402 |
21,563 | Microsoft/hcsshim | internal/hcs/process.go | Close | func (process *Process) Close() (err error) {
process.handleLock.Lock()
defer process.handleLock.Unlock()
operation := "hcsshim::Process::Close"
process.logOperationBegin(operation)
defer func() { process.logOperationEnd(operation, err) }()
// Don't double free this
if process.handle == 0 {
return nil
}
i... | go | func (process *Process) Close() (err error) {
process.handleLock.Lock()
defer process.handleLock.Unlock()
operation := "hcsshim::Process::Close"
process.logOperationBegin(operation)
defer func() { process.logOperationEnd(operation, err) }()
// Don't double free this
if process.handle == 0 {
return nil
}
i... | [
"func",
"(",
"process",
"*",
"Process",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"process",
".",
"handleLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"process",
".",
"handleLock",
".",
"Unlock",
"(",
")",
"\n\n",
"operation",
":=",
"\"",... | // Close cleans up any state associated with the process but does not kill
// or wait on it. | [
"Close",
"cleans",
"up",
"any",
"state",
"associated",
"with",
"the",
"process",
"but",
"does",
"not",
"kill",
"or",
"wait",
"on",
"it",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/process.go#L406-L444 |
21,564 | Microsoft/hcsshim | hcn/hcnendpoint.go | ListEndpoints | func ListEndpoints() ([]HostComputeEndpoint, error) {
hcnQuery := defaultQuery()
endpoints, err := ListEndpointsQuery(hcnQuery)
if err != nil {
return nil, err
}
return endpoints, nil
} | go | func ListEndpoints() ([]HostComputeEndpoint, error) {
hcnQuery := defaultQuery()
endpoints, err := ListEndpointsQuery(hcnQuery)
if err != nil {
return nil, err
}
return endpoints, nil
} | [
"func",
"ListEndpoints",
"(",
")",
"(",
"[",
"]",
"HostComputeEndpoint",
",",
"error",
")",
"{",
"hcnQuery",
":=",
"defaultQuery",
"(",
")",
"\n",
"endpoints",
",",
"err",
":=",
"ListEndpointsQuery",
"(",
"hcnQuery",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // ListEndpoints makes a call to list all available endpoints. | [
"ListEndpoints",
"makes",
"a",
"call",
"to",
"list",
"all",
"available",
"endpoints",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnendpoint.go#L221-L228 |
21,565 | Microsoft/hcsshim | hcn/hcnendpoint.go | ListEndpointsQuery | func ListEndpointsQuery(query HostComputeQuery) ([]HostComputeEndpoint, error) {
queryJson, err := json.Marshal(query)
if err != nil {
return nil, err
}
endpoints, err := enumerateEndpoints(string(queryJson))
if err != nil {
return nil, err
}
return endpoints, nil
} | go | func ListEndpointsQuery(query HostComputeQuery) ([]HostComputeEndpoint, error) {
queryJson, err := json.Marshal(query)
if err != nil {
return nil, err
}
endpoints, err := enumerateEndpoints(string(queryJson))
if err != nil {
return nil, err
}
return endpoints, nil
} | [
"func",
"ListEndpointsQuery",
"(",
"query",
"HostComputeQuery",
")",
"(",
"[",
"]",
"HostComputeEndpoint",
",",
"error",
")",
"{",
"queryJson",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"query",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"n... | // ListEndpointsQuery makes a call to query the list of available endpoints. | [
"ListEndpointsQuery",
"makes",
"a",
"call",
"to",
"query",
"the",
"list",
"of",
"available",
"endpoints",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnendpoint.go#L231-L242 |
21,566 | Microsoft/hcsshim | hcn/hcnendpoint.go | ListEndpointsOfNetwork | func ListEndpointsOfNetwork(networkId string) ([]HostComputeEndpoint, error) {
hcnQuery := defaultQuery()
// TODO: Once query can convert schema, change to {HostComputeNetwork:networkId}
mapA := map[string]string{"VirtualNetwork": networkId}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
h... | go | func ListEndpointsOfNetwork(networkId string) ([]HostComputeEndpoint, error) {
hcnQuery := defaultQuery()
// TODO: Once query can convert schema, change to {HostComputeNetwork:networkId}
mapA := map[string]string{"VirtualNetwork": networkId}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
h... | [
"func",
"ListEndpointsOfNetwork",
"(",
"networkId",
"string",
")",
"(",
"[",
"]",
"HostComputeEndpoint",
",",
"error",
")",
"{",
"hcnQuery",
":=",
"defaultQuery",
"(",
")",
"\n",
"// TODO: Once query can convert schema, change to {HostComputeNetwork:networkId}",
"mapA",
"... | // ListEndpointsOfNetwork queries the list of endpoints on a network. | [
"ListEndpointsOfNetwork",
"queries",
"the",
"list",
"of",
"endpoints",
"on",
"a",
"network",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnendpoint.go#L245-L256 |
21,567 | Microsoft/hcsshim | hcn/hcnendpoint.go | GetEndpointByID | func GetEndpointByID(endpointId string) (*HostComputeEndpoint, error) {
hcnQuery := defaultQuery()
mapA := map[string]string{"ID": endpointId}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
hcnQuery.Filter = string(filter)
endpoints, err := ListEndpointsQuery(hcnQuery)
if err != nil {
... | go | func GetEndpointByID(endpointId string) (*HostComputeEndpoint, error) {
hcnQuery := defaultQuery()
mapA := map[string]string{"ID": endpointId}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
hcnQuery.Filter = string(filter)
endpoints, err := ListEndpointsQuery(hcnQuery)
if err != nil {
... | [
"func",
"GetEndpointByID",
"(",
"endpointId",
"string",
")",
"(",
"*",
"HostComputeEndpoint",
",",
"error",
")",
"{",
"hcnQuery",
":=",
"defaultQuery",
"(",
")",
"\n",
"mapA",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"endpointId",
... | // GetEndpointByID returns an endpoint specified by Id | [
"GetEndpointByID",
"returns",
"an",
"endpoint",
"specified",
"by",
"Id"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnendpoint.go#L259-L276 |
21,568 | Microsoft/hcsshim | hcn/hcnendpoint.go | GetEndpointByName | func GetEndpointByName(endpointName string) (*HostComputeEndpoint, error) {
hcnQuery := defaultQuery()
mapA := map[string]string{"Name": endpointName}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
hcnQuery.Filter = string(filter)
endpoints, err := ListEndpointsQuery(hcnQuery)
if err != ... | go | func GetEndpointByName(endpointName string) (*HostComputeEndpoint, error) {
hcnQuery := defaultQuery()
mapA := map[string]string{"Name": endpointName}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
hcnQuery.Filter = string(filter)
endpoints, err := ListEndpointsQuery(hcnQuery)
if err != ... | [
"func",
"GetEndpointByName",
"(",
"endpointName",
"string",
")",
"(",
"*",
"HostComputeEndpoint",
",",
"error",
")",
"{",
"hcnQuery",
":=",
"defaultQuery",
"(",
")",
"\n",
"mapA",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"endpointNa... | // GetEndpointByName returns an endpoint specified by Name | [
"GetEndpointByName",
"returns",
"an",
"endpoint",
"specified",
"by",
"Name"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnendpoint.go#L279-L296 |
21,569 | Microsoft/hcsshim | hcn/hcnendpoint.go | Create | func (endpoint *HostComputeEndpoint) Create() (*HostComputeEndpoint, error) {
logrus.Debugf("hcn::HostComputeEndpoint::Create id=%s", endpoint.Id)
if endpoint.HostComputeNamespace != "" {
return nil, errors.New("endpoint create error, endpoint json HostComputeNamespace is read only and should not be set")
}
jso... | go | func (endpoint *HostComputeEndpoint) Create() (*HostComputeEndpoint, error) {
logrus.Debugf("hcn::HostComputeEndpoint::Create id=%s", endpoint.Id)
if endpoint.HostComputeNamespace != "" {
return nil, errors.New("endpoint create error, endpoint json HostComputeNamespace is read only and should not be set")
}
jso... | [
"func",
"(",
"endpoint",
"*",
"HostComputeEndpoint",
")",
"Create",
"(",
")",
"(",
"*",
"HostComputeEndpoint",
",",
"error",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"endpoint",
".",
"Id",
")",
"\n\n",
"if",
"endpoint",
".",
"HostComputeN... | // Create Endpoint. | [
"Create",
"Endpoint",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnendpoint.go#L299-L317 |
21,570 | Microsoft/hcsshim | hcn/hcnendpoint.go | Delete | func (endpoint *HostComputeEndpoint) Delete() error {
logrus.Debugf("hcn::HostComputeEndpoint::Delete id=%s", endpoint.Id)
if err := deleteEndpoint(endpoint.Id); err != nil {
return err
}
return nil
} | go | func (endpoint *HostComputeEndpoint) Delete() error {
logrus.Debugf("hcn::HostComputeEndpoint::Delete id=%s", endpoint.Id)
if err := deleteEndpoint(endpoint.Id); err != nil {
return err
}
return nil
} | [
"func",
"(",
"endpoint",
"*",
"HostComputeEndpoint",
")",
"Delete",
"(",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"endpoint",
".",
"Id",
")",
"\n\n",
"if",
"err",
":=",
"deleteEndpoint",
"(",
"endpoint",
".",
"Id",
")",
";",
... | // Delete Endpoint. | [
"Delete",
"Endpoint",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnendpoint.go#L320-L327 |
21,571 | Microsoft/hcsshim | hcn/hcnendpoint.go | NamespaceAttach | func (endpoint *HostComputeEndpoint) NamespaceAttach(namespaceId string) error {
return AddNamespaceEndpoint(namespaceId, endpoint.Id)
} | go | func (endpoint *HostComputeEndpoint) NamespaceAttach(namespaceId string) error {
return AddNamespaceEndpoint(namespaceId, endpoint.Id)
} | [
"func",
"(",
"endpoint",
"*",
"HostComputeEndpoint",
")",
"NamespaceAttach",
"(",
"namespaceId",
"string",
")",
"error",
"{",
"return",
"AddNamespaceEndpoint",
"(",
"namespaceId",
",",
"endpoint",
".",
"Id",
")",
"\n",
"}"
] | // NamespaceAttach modifies a Namespace to add an endpoint. | [
"NamespaceAttach",
"modifies",
"a",
"Namespace",
"to",
"add",
"an",
"endpoint",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnendpoint.go#L363-L365 |
21,572 | Microsoft/hcsshim | hcn/hcnendpoint.go | NamespaceDetach | func (endpoint *HostComputeEndpoint) NamespaceDetach(namespaceId string) error {
return RemoveNamespaceEndpoint(namespaceId, endpoint.Id)
} | go | func (endpoint *HostComputeEndpoint) NamespaceDetach(namespaceId string) error {
return RemoveNamespaceEndpoint(namespaceId, endpoint.Id)
} | [
"func",
"(",
"endpoint",
"*",
"HostComputeEndpoint",
")",
"NamespaceDetach",
"(",
"namespaceId",
"string",
")",
"error",
"{",
"return",
"RemoveNamespaceEndpoint",
"(",
"namespaceId",
",",
"endpoint",
".",
"Id",
")",
"\n",
"}"
] | // NamespaceDetach modifies a Namespace to remove an endpoint. | [
"NamespaceDetach",
"modifies",
"a",
"Namespace",
"to",
"remove",
"an",
"endpoint",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnendpoint.go#L368-L370 |
21,573 | Microsoft/hcsshim | internal/wcow/scratch.go | CreateUVMScratch | func CreateUVMScratch(imagePath, destDirectory, vmID string) error {
sourceScratch := filepath.Join(imagePath, `UtilityVM\SystemTemplate.vhdx`)
targetScratch := filepath.Join(destDirectory, "sandbox.vhdx")
logrus.Debugf("uvm::CreateUVMScratch %s from %s", targetScratch, sourceScratch)
if err := copyfile.CopyFile(so... | go | func CreateUVMScratch(imagePath, destDirectory, vmID string) error {
sourceScratch := filepath.Join(imagePath, `UtilityVM\SystemTemplate.vhdx`)
targetScratch := filepath.Join(destDirectory, "sandbox.vhdx")
logrus.Debugf("uvm::CreateUVMScratch %s from %s", targetScratch, sourceScratch)
if err := copyfile.CopyFile(so... | [
"func",
"CreateUVMScratch",
"(",
"imagePath",
",",
"destDirectory",
",",
"vmID",
"string",
")",
"error",
"{",
"sourceScratch",
":=",
"filepath",
".",
"Join",
"(",
"imagePath",
",",
"`UtilityVM\\SystemTemplate.vhdx`",
")",
"\n",
"targetScratch",
":=",
"filepath",
"... | // CreateUVMScratch is a helper to create a scratch for a Windows utility VM
// with permissions to the specified VM ID in a specified directory | [
"CreateUVMScratch",
"is",
"a",
"helper",
"to",
"create",
"a",
"scratch",
"for",
"a",
"Windows",
"utility",
"VM",
"with",
"permissions",
"to",
"the",
"specified",
"VM",
"ID",
"in",
"a",
"specified",
"directory"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wcow/scratch.go#L14-L26 |
21,574 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/task_hcs.go | newHcsTask | func newHcsTask(
ctx context.Context,
events publisher,
parent *uvm.UtilityVM,
ownsParent bool,
req *task.CreateTaskRequest,
s *specs.Spec) (shimTask, error) {
logrus.WithFields(logrus.Fields{
"tid": req.ID,
"ownsParent": ownsParent,
}).Debug("newHcsTask")
owner := filepath.Base(os.Args[0])
io, e... | go | func newHcsTask(
ctx context.Context,
events publisher,
parent *uvm.UtilityVM,
ownsParent bool,
req *task.CreateTaskRequest,
s *specs.Spec) (shimTask, error) {
logrus.WithFields(logrus.Fields{
"tid": req.ID,
"ownsParent": ownsParent,
}).Debug("newHcsTask")
owner := filepath.Base(os.Args[0])
io, e... | [
"func",
"newHcsTask",
"(",
"ctx",
"context",
".",
"Context",
",",
"events",
"publisher",
",",
"parent",
"*",
"uvm",
".",
"UtilityVM",
",",
"ownsParent",
"bool",
",",
"req",
"*",
"task",
".",
"CreateTaskRequest",
",",
"s",
"*",
"specs",
".",
"Spec",
")",
... | // newHcsTask creates a container within `parent` and its init exec process in
// the `shimExecCreated` state and returns the task that tracks its lifetime.
//
// If `parent == nil` the container is created on the host. | [
"newHcsTask",
"creates",
"a",
"container",
"within",
"parent",
"and",
"its",
"init",
"exec",
"process",
"in",
"the",
"shimExecCreated",
"state",
"and",
"returns",
"the",
"task",
"that",
"tracks",
"its",
"lifetime",
".",
"If",
"parent",
"==",
"nil",
"the",
"c... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/task_hcs.go#L107-L197 |
21,575 | Microsoft/hcsshim | internal/uvm/capabilities.go | SignalProcessSupported | func (uvm *UtilityVM) SignalProcessSupported() bool {
if props, err := uvm.hcsSystem.Properties(schema1.PropertyTypeGuestConnection); err == nil {
return props.GuestConnectionInfo.GuestDefinedCapabilities.SignalProcessSupported
}
return false
} | go | func (uvm *UtilityVM) SignalProcessSupported() bool {
if props, err := uvm.hcsSystem.Properties(schema1.PropertyTypeGuestConnection); err == nil {
return props.GuestConnectionInfo.GuestDefinedCapabilities.SignalProcessSupported
}
return false
} | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"SignalProcessSupported",
"(",
")",
"bool",
"{",
"if",
"props",
",",
"err",
":=",
"uvm",
".",
"hcsSystem",
".",
"Properties",
"(",
"schema1",
".",
"PropertyTypeGuestConnection",
")",
";",
"err",
"==",
"nil",
"{",
... | // SignalProcessSupported returns `true` if the guest supports the capability to
// signal a process.
//
// This support was added RS5+ guests. | [
"SignalProcessSupported",
"returns",
"true",
"if",
"the",
"guest",
"supports",
"the",
"capability",
"to",
"signal",
"a",
"process",
".",
"This",
"support",
"was",
"added",
"RS5",
"+",
"guests",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/capabilities.go#L9-L14 |
21,576 | Microsoft/hcsshim | internal/uvm/scsi.go | allocateSCSI | func (uvm *UtilityVM) allocateSCSI(hostPath string, uvmPath string, isLayer bool) (int, int32, error) {
for controller, luns := range uvm.scsiLocations {
for lun, si := range luns {
if si.hostPath == "" {
uvm.scsiLocations[controller][lun].hostPath = hostPath
uvm.scsiLocations[controller][lun].uvmPath = u... | go | func (uvm *UtilityVM) allocateSCSI(hostPath string, uvmPath string, isLayer bool) (int, int32, error) {
for controller, luns := range uvm.scsiLocations {
for lun, si := range luns {
if si.hostPath == "" {
uvm.scsiLocations[controller][lun].hostPath = hostPath
uvm.scsiLocations[controller][lun].uvmPath = u... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"allocateSCSI",
"(",
"hostPath",
"string",
",",
"uvmPath",
"string",
",",
"isLayer",
"bool",
")",
"(",
"int",
",",
"int32",
",",
"error",
")",
"{",
"for",
"controller",
",",
"luns",
":=",
"range",
"uvm",
".",
... | // allocateSCSI finds the next available slot on the
// SCSI controllers associated with a utility VM to use.
// Lock must be held when calling this function | [
"allocateSCSI",
"finds",
"the",
"next",
"available",
"slot",
"on",
"the",
"SCSI",
"controllers",
"associated",
"with",
"a",
"utility",
"VM",
"to",
"use",
".",
"Lock",
"must",
"be",
"held",
"when",
"calling",
"this",
"function"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/scsi.go#L26-L51 |
21,577 | Microsoft/hcsshim | internal/uvm/scsi.go | findSCSIAttachment | func (uvm *UtilityVM) findSCSIAttachment(findThisHostPath string) (int, int32, string, error) {
for controller, luns := range uvm.scsiLocations {
for lun, si := range luns {
if si.hostPath == findThisHostPath {
logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": findThisHostPa... | go | func (uvm *UtilityVM) findSCSIAttachment(findThisHostPath string) (int, int32, string, error) {
for controller, luns := range uvm.scsiLocations {
for lun, si := range luns {
if si.hostPath == findThisHostPath {
logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": findThisHostPa... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"findSCSIAttachment",
"(",
"findThisHostPath",
"string",
")",
"(",
"int",
",",
"int32",
",",
"string",
",",
"error",
")",
"{",
"for",
"controller",
",",
"luns",
":=",
"range",
"uvm",
".",
"scsiLocations",
"{",
"... | // Lock must be held when calling this function. | [
"Lock",
"must",
"be",
"held",
"when",
"calling",
"this",
"function",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/scsi.go#L72-L90 |
21,578 | Microsoft/hcsshim | internal/uvm/scsi.go | RemoveSCSI | func (uvm *UtilityVM) RemoveSCSI(hostPath string) (err error) {
op := "uvm::RemoveSCSI"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - E... | go | func (uvm *UtilityVM) RemoveSCSI(hostPath string) (err error) {
op := "uvm::RemoveSCSI"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - E... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"RemoveSCSI",
"(",
"hostPath",
"string",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"logfields",
".",
"UVMI... | // RemoveSCSI removes a SCSI disk from a utility VM. As an external API, it
// is "safe". Internal use can call removeSCSI. | [
"RemoveSCSI",
"removes",
"a",
"SCSI",
"disk",
"from",
"a",
"utility",
"VM",
".",
"As",
"an",
"external",
"API",
"it",
"is",
"safe",
".",
"Internal",
"use",
"can",
"call",
"removeSCSI",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/scsi.go#L295-L336 |
21,579 | Microsoft/hcsshim | internal/uvm/scsi.go | removeSCSI | func (uvm *UtilityVM) removeSCSI(hostPath string, uvmPath string, controller int, lun int32) error {
scsiModification := &hcsschema.ModifySettingRequest{
RequestType: requesttype.Remove,
ResourcePath: fmt.Sprintf("VirtualMachine/Devices/Scsi/%d/Attachments/%d", controller, lun),
}
// Include the GuestRequest s... | go | func (uvm *UtilityVM) removeSCSI(hostPath string, uvmPath string, controller int, lun int32) error {
scsiModification := &hcsschema.ModifySettingRequest{
RequestType: requesttype.Remove,
ResourcePath: fmt.Sprintf("VirtualMachine/Devices/Scsi/%d/Attachments/%d", controller, lun),
}
// Include the GuestRequest s... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"removeSCSI",
"(",
"hostPath",
"string",
",",
"uvmPath",
"string",
",",
"controller",
"int",
",",
"lun",
"int32",
")",
"error",
"{",
"scsiModification",
":=",
"&",
"hcsschema",
".",
"ModifySettingRequest",
"{",
"Req... | // removeSCSI is the internally callable "unsafe" version of RemoveSCSI. The mutex
// MUST be held when calling this function. | [
"removeSCSI",
"is",
"the",
"internally",
"callable",
"unsafe",
"version",
"of",
"RemoveSCSI",
".",
"The",
"mutex",
"MUST",
"be",
"held",
"when",
"calling",
"this",
"function",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/scsi.go#L340-L378 |
21,580 | Microsoft/hcsshim | internal/uvm/scsi.go | GetScsiUvmPath | func (uvm *UtilityVM) GetScsiUvmPath(hostPath string) (_ string, err error) {
op := "uvm::GetScsiUvmPath"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
lo... | go | func (uvm *UtilityVM) GetScsiUvmPath(hostPath string) (_ string, err error) {
op := "uvm::GetScsiUvmPath"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
lo... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"GetScsiUvmPath",
"(",
"hostPath",
"string",
")",
"(",
"_",
"string",
",",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",... | // GetScsiUvmPath returns the guest mounted path of a SCSI drive.
//
// If `hostPath` is not mounted returns `ErrNotAttached`. | [
"GetScsiUvmPath",
"returns",
"the",
"guest",
"mounted",
"path",
"of",
"a",
"SCSI",
"drive",
".",
"If",
"hostPath",
"is",
"not",
"mounted",
"returns",
"ErrNotAttached",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/scsi.go#L383-L404 |
21,581 | Microsoft/hcsshim | process.go | WaitTimeout | func (process *process) WaitTimeout(timeout time.Duration) error {
process.waitOnce.Do(func() {
process.waitCh = make(chan struct{})
go func() {
process.waitErr = process.Wait()
close(process.waitCh)
}()
})
t := time.NewTimer(timeout)
defer t.Stop()
select {
case <-t.C:
return &ProcessError{Process:... | go | func (process *process) WaitTimeout(timeout time.Duration) error {
process.waitOnce.Do(func() {
process.waitCh = make(chan struct{})
go func() {
process.waitErr = process.Wait()
close(process.waitCh)
}()
})
t := time.NewTimer(timeout)
defer t.Stop()
select {
case <-t.C:
return &ProcessError{Process:... | [
"func",
"(",
"process",
"*",
"process",
")",
"WaitTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"error",
"{",
"process",
".",
"waitOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"process",
".",
"waitCh",
"=",
"make",
"(",
"chan",
"struct",
"... | // WaitTimeout waits for the process to exit or the duration to elapse. It returns
// false if timeout occurs. | [
"WaitTimeout",
"waits",
"for",
"the",
"process",
"to",
"exit",
"or",
"the",
"duration",
"to",
"elapse",
".",
"It",
"returns",
"false",
"if",
"timeout",
"occurs",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/process.go#L43-L59 |
21,582 | Microsoft/hcsshim | process.go | Stdio | func (process *process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, error) {
stdin, stdout, stderr, err := process.p.StdioLegacy()
if err != nil {
err = convertProcessError(err, process)
}
return stdin, stdout, stderr, err
} | go | func (process *process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, error) {
stdin, stdout, stderr, err := process.p.StdioLegacy()
if err != nil {
err = convertProcessError(err, process)
}
return stdin, stdout, stderr, err
} | [
"func",
"(",
"process",
"*",
"process",
")",
"Stdio",
"(",
")",
"(",
"io",
".",
"WriteCloser",
",",
"io",
".",
"ReadCloser",
",",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"stdin",
",",
"stdout",
",",
"stderr",
",",
"err",
":=",
"process",
"... | // Stdio returns the stdin, stdout, and stderr pipes, respectively. Closing
// these pipes does not close the underlying pipes; it should be possible to
// call this multiple times to get multiple interfaces. | [
"Stdio",
"returns",
"the",
"stdin",
"stdout",
"and",
"stderr",
"pipes",
"respectively",
".",
"Closing",
"these",
"pipes",
"does",
"not",
"close",
"the",
"underlying",
"pipes",
";",
"it",
"should",
"be",
"possible",
"to",
"call",
"this",
"multiple",
"times",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/process.go#L79-L85 |
21,583 | Microsoft/hcsshim | ext4/tar2ext4/tar2ext4.go | InlineData | func InlineData(p *params) {
p.ext4opts = append(p.ext4opts, compactext4.InlineData)
} | go | func InlineData(p *params) {
p.ext4opts = append(p.ext4opts, compactext4.InlineData)
} | [
"func",
"InlineData",
"(",
"p",
"*",
"params",
")",
"{",
"p",
".",
"ext4opts",
"=",
"append",
"(",
"p",
".",
"ext4opts",
",",
"compactext4",
".",
"InlineData",
")",
"\n",
"}"
] | // InlineData instructs the converter to write small files into the inode
// structures directly. This creates smaller images but currently is not
// compatible with DAX. | [
"InlineData",
"instructs",
"the",
"converter",
"to",
"write",
"small",
"files",
"into",
"the",
"inode",
"structures",
"directly",
".",
"This",
"creates",
"smaller",
"images",
"but",
"currently",
"is",
"not",
"compatible",
"with",
"DAX",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/ext4/tar2ext4/tar2ext4.go#L38-L40 |
21,584 | Microsoft/hcsshim | ext4/tar2ext4/tar2ext4.go | MaximumDiskSize | func MaximumDiskSize(size int64) Option {
return func(p *params) {
p.ext4opts = append(p.ext4opts, compactext4.MaximumDiskSize(size))
}
} | go | func MaximumDiskSize(size int64) Option {
return func(p *params) {
p.ext4opts = append(p.ext4opts, compactext4.MaximumDiskSize(size))
}
} | [
"func",
"MaximumDiskSize",
"(",
"size",
"int64",
")",
"Option",
"{",
"return",
"func",
"(",
"p",
"*",
"params",
")",
"{",
"p",
".",
"ext4opts",
"=",
"append",
"(",
"p",
".",
"ext4opts",
",",
"compactext4",
".",
"MaximumDiskSize",
"(",
"size",
")",
")",... | // MaximumDiskSize instructs the writer to limit the disk size to the specified
// value. This also reserves enough metadata space for the specified disk size.
// If not provided, then 16GB is the default. | [
"MaximumDiskSize",
"instructs",
"the",
"writer",
"to",
"limit",
"the",
"disk",
"size",
"to",
"the",
"specified",
"value",
".",
"This",
"also",
"reserves",
"enough",
"metadata",
"space",
"for",
"the",
"specified",
"disk",
"size",
".",
"If",
"not",
"provided",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/ext4/tar2ext4/tar2ext4.go#L45-L49 |
21,585 | Microsoft/hcsshim | internal/hcs/system.go | CreateComputeSystem | func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (_ *System, err error) {
operation := "hcsshim::CreateComputeSystem"
computeSystem := newSystem(id)
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
hcsDocumentB, err := json.Marshal(h... | go | func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (_ *System, err error) {
operation := "hcsshim::CreateComputeSystem"
computeSystem := newSystem(id)
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
hcsDocumentB, err := json.Marshal(h... | [
"func",
"CreateComputeSystem",
"(",
"id",
"string",
",",
"hcsDocumentInterface",
"interface",
"{",
"}",
")",
"(",
"_",
"*",
"System",
",",
"err",
"error",
")",
"{",
"operation",
":=",
"\"",
"\"",
"\n\n",
"computeSystem",
":=",
"newSystem",
"(",
"id",
")",
... | // CreateComputeSystem creates a new compute system with the given configuration but does not start it. | [
"CreateComputeSystem",
"creates",
"a",
"new",
"compute",
"system",
"with",
"the",
"given",
"configuration",
"but",
"does",
"not",
"start",
"it",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L79-L128 |
21,586 | Microsoft/hcsshim | internal/hcs/system.go | OpenComputeSystem | func OpenComputeSystem(id string) (_ *System, err error) {
operation := "hcsshim::OpenComputeSystem"
computeSystem := newSystem(id)
computeSystem.logOperationBegin(operation)
defer func() {
if IsNotExist(err) {
computeSystem.logOperationEnd(operation, nil)
} else {
computeSystem.logOperationEnd(operation... | go | func OpenComputeSystem(id string) (_ *System, err error) {
operation := "hcsshim::OpenComputeSystem"
computeSystem := newSystem(id)
computeSystem.logOperationBegin(operation)
defer func() {
if IsNotExist(err) {
computeSystem.logOperationEnd(operation, nil)
} else {
computeSystem.logOperationEnd(operation... | [
"func",
"OpenComputeSystem",
"(",
"id",
"string",
")",
"(",
"_",
"*",
"System",
",",
"err",
"error",
")",
"{",
"operation",
":=",
"\"",
"\"",
"\n\n",
"computeSystem",
":=",
"newSystem",
"(",
"id",
")",
"\n",
"computeSystem",
".",
"logOperationBegin",
"(",
... | // OpenComputeSystem opens an existing compute system by ID. | [
"OpenComputeSystem",
"opens",
"an",
"existing",
"compute",
"system",
"by",
"ID",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L131-L162 |
21,587 | Microsoft/hcsshim | internal/hcs/system.go | GetComputeSystems | func GetComputeSystems(q schema1.ComputeSystemQuery) (_ []schema1.ContainerProperties, err error) {
operation := "hcsshim::GetComputeSystems"
fields := logrus.Fields{}
logOperationBegin(
fields,
operation+" - Begin Operation")
defer func() {
var result string
if err == nil {
result = "Success"
} else ... | go | func GetComputeSystems(q schema1.ComputeSystemQuery) (_ []schema1.ContainerProperties, err error) {
operation := "hcsshim::GetComputeSystems"
fields := logrus.Fields{}
logOperationBegin(
fields,
operation+" - Begin Operation")
defer func() {
var result string
if err == nil {
result = "Success"
} else ... | [
"func",
"GetComputeSystems",
"(",
"q",
"schema1",
".",
"ComputeSystemQuery",
")",
"(",
"_",
"[",
"]",
"schema1",
".",
"ContainerProperties",
",",
"err",
"error",
")",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"fields",
":=",
"logrus",
".",
"Fields",
"{",
... | // GetComputeSystems gets a list of the compute systems on the system that match the query | [
"GetComputeSystems",
"gets",
"a",
"list",
"of",
"the",
"compute",
"systems",
"on",
"the",
"system",
"that",
"match",
"the",
"query"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L165-L220 |
21,588 | Microsoft/hcsshim | internal/hcs/system.go | Start | func (computeSystem *System) Start() (err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::Start"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
if computeSystem.handle == 0 {
r... | go | func (computeSystem *System) Start() (err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::Start"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
if computeSystem.handle == 0 {
r... | [
"func",
"(",
"computeSystem",
"*",
"System",
")",
"Start",
"(",
")",
"(",
"err",
"error",
")",
"{",
"computeSystem",
".",
"handleLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"computeSystem",
".",
"handleLock",
".",
"RUnlock",
"(",
")",
"\n\n",
"operatio... | // Start synchronously starts the computeSystem. | [
"Start",
"synchronously",
"starts",
"the",
"computeSystem",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L223-L271 |
21,589 | Microsoft/hcsshim | internal/hcs/system.go | Shutdown | func (computeSystem *System) Shutdown() (err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::Shutdown"
computeSystem.logOperationBegin(operation)
defer func() {
computeSystem.logOperationEnd(operation, err)
}()
if computeSystem.handle =... | go | func (computeSystem *System) Shutdown() (err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::Shutdown"
computeSystem.logOperationBegin(operation)
defer func() {
computeSystem.logOperationEnd(operation, err)
}()
if computeSystem.handle =... | [
"func",
"(",
"computeSystem",
"*",
"System",
")",
"Shutdown",
"(",
")",
"(",
"err",
"error",
")",
"{",
"computeSystem",
".",
"handleLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"computeSystem",
".",
"handleLock",
".",
"RUnlock",
"(",
")",
"\n\n",
"opera... | // Shutdown requests a compute system shutdown. | [
"Shutdown",
"requests",
"a",
"compute",
"system",
"shutdown",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L279-L304 |
21,590 | Microsoft/hcsshim | internal/hcs/system.go | ExitError | func (computeSystem *System) ExitError() (err error) {
select {
case <-computeSystem.waitBlock:
if computeSystem.waitError != nil {
return computeSystem.waitError
}
return computeSystem.exitError
default:
return errors.New("container not exited")
}
} | go | func (computeSystem *System) ExitError() (err error) {
select {
case <-computeSystem.waitBlock:
if computeSystem.waitError != nil {
return computeSystem.waitError
}
return computeSystem.exitError
default:
return errors.New("container not exited")
}
} | [
"func",
"(",
"computeSystem",
"*",
"System",
")",
"ExitError",
"(",
")",
"(",
"err",
"error",
")",
"{",
"select",
"{",
"case",
"<-",
"computeSystem",
".",
"waitBlock",
":",
"if",
"computeSystem",
".",
"waitError",
"!=",
"nil",
"{",
"return",
"computeSystem... | // ExitError returns an error describing the reason the compute system terminated. | [
"ExitError",
"returns",
"an",
"error",
"describing",
"the",
"reason",
"the",
"compute",
"system",
"terminated",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L367-L377 |
21,591 | Microsoft/hcsshim | internal/hcs/system.go | Pause | func (computeSystem *System) Pause() (err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::Pause"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
if computeSystem.handle == 0 {
r... | go | func (computeSystem *System) Pause() (err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::Pause"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
if computeSystem.handle == 0 {
r... | [
"func",
"(",
"computeSystem",
"*",
"System",
")",
"Pause",
"(",
")",
"(",
"err",
"error",
")",
"{",
"computeSystem",
".",
"handleLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"computeSystem",
".",
"handleLock",
".",
"RUnlock",
"(",
")",
"\n\n",
"operatio... | // Pause pauses the execution of the computeSystem. This feature is not enabled in TP5. | [
"Pause",
"pauses",
"the",
"execution",
"of",
"the",
"computeSystem",
".",
"This",
"feature",
"is",
"not",
"enabled",
"in",
"TP5",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L419-L441 |
21,592 | Microsoft/hcsshim | internal/hcs/system.go | Resume | func (computeSystem *System) Resume() (err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::Resume"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
if computeSystem.handle == 0 {
... | go | func (computeSystem *System) Resume() (err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::Resume"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
if computeSystem.handle == 0 {
... | [
"func",
"(",
"computeSystem",
"*",
"System",
")",
"Resume",
"(",
")",
"(",
"err",
"error",
")",
"{",
"computeSystem",
".",
"handleLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"computeSystem",
".",
"handleLock",
".",
"RUnlock",
"(",
")",
"\n\n",
"operati... | // Resume resumes the execution of the computeSystem. This feature is not enabled in TP5. | [
"Resume",
"resumes",
"the",
"execution",
"of",
"the",
"computeSystem",
".",
"This",
"feature",
"is",
"not",
"enabled",
"in",
"TP5",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L444-L466 |
21,593 | Microsoft/hcsshim | internal/hcs/system.go | CreateProcess | func (computeSystem *System) CreateProcess(c interface{}) (_ *Process, err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::CreateProcess"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err)... | go | func (computeSystem *System) CreateProcess(c interface{}) (_ *Process, err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::CreateProcess"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err)... | [
"func",
"(",
"computeSystem",
"*",
"System",
")",
"CreateProcess",
"(",
"c",
"interface",
"{",
"}",
")",
"(",
"_",
"*",
"Process",
",",
"err",
"error",
")",
"{",
"computeSystem",
".",
"handleLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"computeSystem",
... | // CreateProcess launches a new process within the computeSystem. | [
"CreateProcess",
"launches",
"a",
"new",
"process",
"within",
"the",
"computeSystem",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L469-L529 |
21,594 | Microsoft/hcsshim | internal/hcs/system.go | OpenProcess | func (computeSystem *System) OpenProcess(pid int) (_ *Process, err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
// Add PID for the context of this operation
computeSystem.logctx[logfields.ProcessID] = pid
defer delete(computeSystem.logctx, logfields.ProcessID)
operation := ... | go | func (computeSystem *System) OpenProcess(pid int) (_ *Process, err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
// Add PID for the context of this operation
computeSystem.logctx[logfields.ProcessID] = pid
defer delete(computeSystem.logctx, logfields.ProcessID)
operation := ... | [
"func",
"(",
"computeSystem",
"*",
"System",
")",
"OpenProcess",
"(",
"pid",
"int",
")",
"(",
"_",
"*",
"Process",
",",
"err",
"error",
")",
"{",
"computeSystem",
".",
"handleLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"computeSystem",
".",
"handleLock... | // OpenProcess gets an interface to an existing process within the computeSystem. | [
"OpenProcess",
"gets",
"an",
"interface",
"to",
"an",
"existing",
"process",
"within",
"the",
"computeSystem",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L532-L568 |
21,595 | Microsoft/hcsshim | internal/hcs/system.go | Close | func (computeSystem *System) Close() (err error) {
computeSystem.handleLock.Lock()
defer computeSystem.handleLock.Unlock()
operation := "hcsshim::ComputeSystem::Close"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
// Don't double free this
if comput... | go | func (computeSystem *System) Close() (err error) {
computeSystem.handleLock.Lock()
defer computeSystem.handleLock.Unlock()
operation := "hcsshim::ComputeSystem::Close"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
// Don't double free this
if comput... | [
"func",
"(",
"computeSystem",
"*",
"System",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"computeSystem",
".",
"handleLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"computeSystem",
".",
"handleLock",
".",
"Unlock",
"(",
")",
"\n\n",
"operation"... | // Close cleans up any state associated with the compute system but does not terminate or wait for it. | [
"Close",
"cleans",
"up",
"any",
"state",
"associated",
"with",
"the",
"compute",
"system",
"but",
"does",
"not",
"terminate",
"or",
"wait",
"for",
"it",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L571-L602 |
21,596 | Microsoft/hcsshim | internal/hcs/system.go | Modify | func (computeSystem *System) Modify(config interface{}) (err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::Modify"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
if computeSyst... | go | func (computeSystem *System) Modify(config interface{}) (err error) {
computeSystem.handleLock.RLock()
defer computeSystem.handleLock.RUnlock()
operation := "hcsshim::ComputeSystem::Modify"
computeSystem.logOperationBegin(operation)
defer func() { computeSystem.logOperationEnd(operation, err) }()
if computeSyst... | [
"func",
"(",
"computeSystem",
"*",
"System",
")",
"Modify",
"(",
"config",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"computeSystem",
".",
"handleLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"computeSystem",
".",
"handleLock",
".",
"RUn... | // Modify the System by sending a request to HCS | [
"Modify",
"the",
"System",
"by",
"sending",
"a",
"request",
"to",
"HCS"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/system.go#L663-L696 |
21,597 | Microsoft/hcsshim | internal/wclayer/expandscratchsize.go | ExpandScratchSize | func ExpandScratchSize(path string, size uint64) (err error) {
title := "hcsshim::ExpandScratchSize"
fields := logrus.Fields{
"path": path,
"size": size,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {... | go | func ExpandScratchSize(path string, size uint64) (err error) {
title := "hcsshim::ExpandScratchSize"
fields := logrus.Fields{
"path": path,
"size": size,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else {... | [
"func",
"ExpandScratchSize",
"(",
"path",
"string",
",",
"size",
"uint64",
")",
"(",
"err",
"error",
")",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"fields",
":=",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"path",
",",
"\"",
"\"",
":",
"size",
","... | // ExpandScratchSize expands the size of a layer to at least size bytes. | [
"ExpandScratchSize",
"expands",
"the",
"size",
"of",
"a",
"layer",
"to",
"at",
"least",
"size",
"bytes",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/expandscratchsize.go#L9-L30 |
21,598 | Microsoft/hcsshim | hcn/hcnloadbalancer.go | ListLoadBalancers | func ListLoadBalancers() ([]HostComputeLoadBalancer, error) {
hcnQuery := defaultQuery()
loadBalancers, err := ListLoadBalancersQuery(hcnQuery)
if err != nil {
return nil, err
}
return loadBalancers, nil
} | go | func ListLoadBalancers() ([]HostComputeLoadBalancer, error) {
hcnQuery := defaultQuery()
loadBalancers, err := ListLoadBalancersQuery(hcnQuery)
if err != nil {
return nil, err
}
return loadBalancers, nil
} | [
"func",
"ListLoadBalancers",
"(",
")",
"(",
"[",
"]",
"HostComputeLoadBalancer",
",",
"error",
")",
"{",
"hcnQuery",
":=",
"defaultQuery",
"(",
")",
"\n",
"loadBalancers",
",",
"err",
":=",
"ListLoadBalancersQuery",
"(",
"hcnQuery",
")",
"\n",
"if",
"err",
"... | // ListLoadBalancers makes a call to list all available loadBalancers. | [
"ListLoadBalancers",
"makes",
"a",
"call",
"to",
"list",
"all",
"available",
"loadBalancers",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnloadbalancer.go#L202-L209 |
21,599 | Microsoft/hcsshim | hcn/hcnloadbalancer.go | ListLoadBalancersQuery | func ListLoadBalancersQuery(query HostComputeQuery) ([]HostComputeLoadBalancer, error) {
queryJson, err := json.Marshal(query)
if err != nil {
return nil, err
}
loadBalancers, err := enumerateLoadBalancers(string(queryJson))
if err != nil {
return nil, err
}
return loadBalancers, nil
} | go | func ListLoadBalancersQuery(query HostComputeQuery) ([]HostComputeLoadBalancer, error) {
queryJson, err := json.Marshal(query)
if err != nil {
return nil, err
}
loadBalancers, err := enumerateLoadBalancers(string(queryJson))
if err != nil {
return nil, err
}
return loadBalancers, nil
} | [
"func",
"ListLoadBalancersQuery",
"(",
"query",
"HostComputeQuery",
")",
"(",
"[",
"]",
"HostComputeLoadBalancer",
",",
"error",
")",
"{",
"queryJson",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"query",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"retur... | // ListLoadBalancersQuery makes a call to query the list of available loadBalancers. | [
"ListLoadBalancersQuery",
"makes",
"a",
"call",
"to",
"query",
"the",
"list",
"of",
"available",
"loadBalancers",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnloadbalancer.go#L212-L223 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.