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 listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
143,600 | 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 |
143,601 | 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 |
143,602 | 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 |
143,603 | 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 |
143,604 | 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 |
143,605 | 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 |
143,606 | 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 |
143,607 | 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 |
143,608 | 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 |
143,609 | 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 |
143,610 | 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 |
143,611 | 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 |
143,612 | 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 |
143,613 | 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 |
143,614 | 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 |
143,615 | 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 |
143,616 | Microsoft/hcsshim | hcn/hcnloadbalancer.go | GetLoadBalancerByID | func GetLoadBalancerByID(loadBalancerId string) (*HostComputeLoadBalancer, error) {
hcnQuery := defaultQuery()
mapA := map[string]string{"ID": loadBalancerId}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
hcnQuery.Filter = string(filter)
loadBalancers, err := ListLoadBalancersQuery(hcnQu... | go | func GetLoadBalancerByID(loadBalancerId string) (*HostComputeLoadBalancer, error) {
hcnQuery := defaultQuery()
mapA := map[string]string{"ID": loadBalancerId}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
hcnQuery.Filter = string(filter)
loadBalancers, err := ListLoadBalancersQuery(hcnQu... | [
"func",
"GetLoadBalancerByID",
"(",
"loadBalancerId",
"string",
")",
"(",
"*",
"HostComputeLoadBalancer",
",",
"error",
")",
"{",
"hcnQuery",
":=",
"defaultQuery",
"(",
")",
"\n",
"mapA",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"lo... | // GetLoadBalancerByID returns the LoadBalancer specified by Id. | [
"GetLoadBalancerByID",
"returns",
"the",
"LoadBalancer",
"specified",
"by",
"Id",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnloadbalancer.go#L226-L243 |
143,617 | Microsoft/hcsshim | hcn/hcnloadbalancer.go | Create | func (loadBalancer *HostComputeLoadBalancer) Create() (*HostComputeLoadBalancer, error) {
logrus.Debugf("hcn::HostComputeLoadBalancer::Create id=%s", loadBalancer.Id)
jsonString, err := json.Marshal(loadBalancer)
if err != nil {
return nil, err
}
logrus.Debugf("hcn::HostComputeLoadBalancer::Create JSON: %s", j... | go | func (loadBalancer *HostComputeLoadBalancer) Create() (*HostComputeLoadBalancer, error) {
logrus.Debugf("hcn::HostComputeLoadBalancer::Create id=%s", loadBalancer.Id)
jsonString, err := json.Marshal(loadBalancer)
if err != nil {
return nil, err
}
logrus.Debugf("hcn::HostComputeLoadBalancer::Create JSON: %s", j... | [
"func",
"(",
"loadBalancer",
"*",
"HostComputeLoadBalancer",
")",
"Create",
"(",
")",
"(",
"*",
"HostComputeLoadBalancer",
",",
"error",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"loadBalancer",
".",
"Id",
")",
"\n\n",
"jsonString",
",",
"er... | // Create LoadBalancer. | [
"Create",
"LoadBalancer",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnloadbalancer.go#L246-L260 |
143,618 | Microsoft/hcsshim | hcn/hcnloadbalancer.go | Delete | func (loadBalancer *HostComputeLoadBalancer) Delete() error {
logrus.Debugf("hcn::HostComputeLoadBalancer::Delete id=%s", loadBalancer.Id)
if err := deleteLoadBalancer(loadBalancer.Id); err != nil {
return err
}
return nil
} | go | func (loadBalancer *HostComputeLoadBalancer) Delete() error {
logrus.Debugf("hcn::HostComputeLoadBalancer::Delete id=%s", loadBalancer.Id)
if err := deleteLoadBalancer(loadBalancer.Id); err != nil {
return err
}
return nil
} | [
"func",
"(",
"loadBalancer",
"*",
"HostComputeLoadBalancer",
")",
"Delete",
"(",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"loadBalancer",
".",
"Id",
")",
"\n\n",
"if",
"err",
":=",
"deleteLoadBalancer",
"(",
"loadBalancer",
".",
"I... | // Delete LoadBalancer. | [
"Delete",
"LoadBalancer",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnloadbalancer.go#L263-L270 |
143,619 | Microsoft/hcsshim | hcn/hcnloadbalancer.go | AddEndpoint | func (loadBalancer *HostComputeLoadBalancer) AddEndpoint(endpoint *HostComputeEndpoint) (*HostComputeLoadBalancer, error) {
logrus.Debugf("hcn::HostComputeLoadBalancer::AddEndpoint loadBalancer=%s endpoint=%s", loadBalancer.Id, endpoint.Id)
err := loadBalancer.Delete()
if err != nil {
return nil, err
}
// Add ... | go | func (loadBalancer *HostComputeLoadBalancer) AddEndpoint(endpoint *HostComputeEndpoint) (*HostComputeLoadBalancer, error) {
logrus.Debugf("hcn::HostComputeLoadBalancer::AddEndpoint loadBalancer=%s endpoint=%s", loadBalancer.Id, endpoint.Id)
err := loadBalancer.Delete()
if err != nil {
return nil, err
}
// Add ... | [
"func",
"(",
"loadBalancer",
"*",
"HostComputeLoadBalancer",
")",
"AddEndpoint",
"(",
"endpoint",
"*",
"HostComputeEndpoint",
")",
"(",
"*",
"HostComputeLoadBalancer",
",",
"error",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"loadBalancer",
".",
... | // AddEndpoint add an endpoint to a LoadBalancer | [
"AddEndpoint",
"add",
"an",
"endpoint",
"to",
"a",
"LoadBalancer"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnloadbalancer.go#L273-L285 |
143,620 | Microsoft/hcsshim | hcn/hcnloadbalancer.go | RemoveEndpoint | func (loadBalancer *HostComputeLoadBalancer) RemoveEndpoint(endpoint *HostComputeEndpoint) (*HostComputeLoadBalancer, error) {
logrus.Debugf("hcn::HostComputeLoadBalancer::RemoveEndpoint loadBalancer=%s endpoint=%s", loadBalancer.Id, endpoint.Id)
err := loadBalancer.Delete()
if err != nil {
return nil, err
}
/... | go | func (loadBalancer *HostComputeLoadBalancer) RemoveEndpoint(endpoint *HostComputeEndpoint) (*HostComputeLoadBalancer, error) {
logrus.Debugf("hcn::HostComputeLoadBalancer::RemoveEndpoint loadBalancer=%s endpoint=%s", loadBalancer.Id, endpoint.Id)
err := loadBalancer.Delete()
if err != nil {
return nil, err
}
/... | [
"func",
"(",
"loadBalancer",
"*",
"HostComputeLoadBalancer",
")",
"RemoveEndpoint",
"(",
"endpoint",
"*",
"HostComputeEndpoint",
")",
"(",
"*",
"HostComputeLoadBalancer",
",",
"error",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"loadBalancer",
".",... | // RemoveEndpoint removes an endpoint from a LoadBalancer | [
"RemoveEndpoint",
"removes",
"an",
"endpoint",
"from",
"a",
"LoadBalancer"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnloadbalancer.go#L288-L306 |
143,621 | Microsoft/hcsshim | hcn/hcnloadbalancer.go | AddLoadBalancer | func AddLoadBalancer(endpoints []HostComputeEndpoint, flags LoadBalancerFlags, portMappingFlags LoadBalancerPortMappingFlags, sourceVIP string, frontendVIPs []string, protocol uint16, internalPort uint16, externalPort uint16) (*HostComputeLoadBalancer, error) {
logrus.Debugf("hcn::HostComputeLoadBalancer::AddLoadBalan... | go | func AddLoadBalancer(endpoints []HostComputeEndpoint, flags LoadBalancerFlags, portMappingFlags LoadBalancerPortMappingFlags, sourceVIP string, frontendVIPs []string, protocol uint16, internalPort uint16, externalPort uint16) (*HostComputeLoadBalancer, error) {
logrus.Debugf("hcn::HostComputeLoadBalancer::AddLoadBalan... | [
"func",
"AddLoadBalancer",
"(",
"endpoints",
"[",
"]",
"HostComputeEndpoint",
",",
"flags",
"LoadBalancerFlags",
",",
"portMappingFlags",
"LoadBalancerPortMappingFlags",
",",
"sourceVIP",
"string",
",",
"frontendVIPs",
"[",
"]",
"string",
",",
"protocol",
"uint16",
",... | // AddLoadBalancer for the specified endpoints | [
"AddLoadBalancer",
"for",
"the",
"specified",
"endpoints"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnloadbalancer.go#L309-L335 |
143,622 | Microsoft/hcsshim | layer.go | CreateSandboxLayer | func CreateSandboxLayer(info DriverInfo, layerId, parentId string, parentLayerPaths []string) error {
return wclayer.CreateScratchLayer(layerPath(&info, layerId), parentLayerPaths)
} | go | func CreateSandboxLayer(info DriverInfo, layerId, parentId string, parentLayerPaths []string) error {
return wclayer.CreateScratchLayer(layerPath(&info, layerId), parentLayerPaths)
} | [
"func",
"CreateSandboxLayer",
"(",
"info",
"DriverInfo",
",",
"layerId",
",",
"parentId",
"string",
",",
"parentLayerPaths",
"[",
"]",
"string",
")",
"error",
"{",
"return",
"wclayer",
".",
"CreateScratchLayer",
"(",
"layerPath",
"(",
"&",
"info",
",",
"layerI... | // New clients should use CreateScratchLayer instead. Kept in to preserve API compatibility. | [
"New",
"clients",
"should",
"use",
"CreateScratchLayer",
"instead",
".",
"Kept",
"in",
"to",
"preserve",
"API",
"compatibility",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/layer.go#L23-L25 |
143,623 | Microsoft/hcsshim | layer.go | ExpandSandboxSize | func ExpandSandboxSize(info DriverInfo, layerId string, size uint64) error {
return wclayer.ExpandScratchSize(layerPath(&info, layerId), size)
} | go | func ExpandSandboxSize(info DriverInfo, layerId string, size uint64) error {
return wclayer.ExpandScratchSize(layerPath(&info, layerId), size)
} | [
"func",
"ExpandSandboxSize",
"(",
"info",
"DriverInfo",
",",
"layerId",
"string",
",",
"size",
"uint64",
")",
"error",
"{",
"return",
"wclayer",
".",
"ExpandScratchSize",
"(",
"layerPath",
"(",
"&",
"info",
",",
"layerId",
")",
",",
"size",
")",
"\n",
"}"
... | // New clients should use ExpandScratchSize instead. Kept in to preserve API compatibility. | [
"New",
"clients",
"should",
"use",
"ExpandScratchSize",
"instead",
".",
"Kept",
"in",
"to",
"preserve",
"API",
"compatibility",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/layer.go#L37-L39 |
143,624 | Microsoft/hcsshim | hcn/hcnnamespace.go | ListNamespaces | func ListNamespaces() ([]HostComputeNamespace, error) {
hcnQuery := defaultQuery()
namespaces, err := ListNamespacesQuery(hcnQuery)
if err != nil {
return nil, err
}
return namespaces, nil
} | go | func ListNamespaces() ([]HostComputeNamespace, error) {
hcnQuery := defaultQuery()
namespaces, err := ListNamespacesQuery(hcnQuery)
if err != nil {
return nil, err
}
return namespaces, nil
} | [
"func",
"ListNamespaces",
"(",
")",
"(",
"[",
"]",
"HostComputeNamespace",
",",
"error",
")",
"{",
"hcnQuery",
":=",
"defaultQuery",
"(",
")",
"\n",
"namespaces",
",",
"err",
":=",
"ListNamespacesQuery",
"(",
"hcnQuery",
")",
"\n",
"if",
"err",
"!=",
"nil"... | // ListNamespaces makes a call to list all available namespaces. | [
"ListNamespaces",
"makes",
"a",
"call",
"to",
"list",
"all",
"available",
"namespaces",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnamespace.go#L219-L226 |
143,625 | Microsoft/hcsshim | hcn/hcnnamespace.go | ListNamespacesQuery | func ListNamespacesQuery(query HostComputeQuery) ([]HostComputeNamespace, error) {
queryJson, err := json.Marshal(query)
if err != nil {
return nil, err
}
namespaces, err := enumerateNamespaces(string(queryJson))
if err != nil {
return nil, err
}
return namespaces, nil
} | go | func ListNamespacesQuery(query HostComputeQuery) ([]HostComputeNamespace, error) {
queryJson, err := json.Marshal(query)
if err != nil {
return nil, err
}
namespaces, err := enumerateNamespaces(string(queryJson))
if err != nil {
return nil, err
}
return namespaces, nil
} | [
"func",
"ListNamespacesQuery",
"(",
"query",
"HostComputeQuery",
")",
"(",
"[",
"]",
"HostComputeNamespace",
",",
"error",
")",
"{",
"queryJson",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"query",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // ListNamespacesQuery makes a call to query the list of available namespaces. | [
"ListNamespacesQuery",
"makes",
"a",
"call",
"to",
"query",
"the",
"list",
"of",
"available",
"namespaces",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnamespace.go#L229-L240 |
143,626 | Microsoft/hcsshim | hcn/hcnnamespace.go | GetNamespaceByID | func GetNamespaceByID(namespaceId string) (*HostComputeNamespace, error) {
return getNamespace(guid.FromString(namespaceId), defaultQueryJson())
} | go | func GetNamespaceByID(namespaceId string) (*HostComputeNamespace, error) {
return getNamespace(guid.FromString(namespaceId), defaultQueryJson())
} | [
"func",
"GetNamespaceByID",
"(",
"namespaceId",
"string",
")",
"(",
"*",
"HostComputeNamespace",
",",
"error",
")",
"{",
"return",
"getNamespace",
"(",
"guid",
".",
"FromString",
"(",
"namespaceId",
")",
",",
"defaultQueryJson",
"(",
")",
")",
"\n",
"}"
] | // GetNamespaceByID returns the Namespace specified by Id. | [
"GetNamespaceByID",
"returns",
"the",
"Namespace",
"specified",
"by",
"Id",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnamespace.go#L243-L245 |
143,627 | Microsoft/hcsshim | hcn/hcnnamespace.go | GetNamespaceEndpointIds | func GetNamespaceEndpointIds(namespaceId string) ([]string, error) {
namespace, err := GetNamespaceByID(namespaceId)
if err != nil {
return nil, err
}
var endpointsIds []string
for _, resource := range namespace.Resources {
if resource.Type == "Endpoint" {
var endpointResource NamespaceResourceEndpoint
i... | go | func GetNamespaceEndpointIds(namespaceId string) ([]string, error) {
namespace, err := GetNamespaceByID(namespaceId)
if err != nil {
return nil, err
}
var endpointsIds []string
for _, resource := range namespace.Resources {
if resource.Type == "Endpoint" {
var endpointResource NamespaceResourceEndpoint
i... | [
"func",
"GetNamespaceEndpointIds",
"(",
"namespaceId",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"namespace",
",",
"err",
":=",
"GetNamespaceByID",
"(",
"namespaceId",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
... | // GetNamespaceEndpointIds returns the endpoints of the Namespace specified by Id. | [
"GetNamespaceEndpointIds",
"returns",
"the",
"endpoints",
"of",
"the",
"Namespace",
"specified",
"by",
"Id",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnamespace.go#L248-L264 |
143,628 | Microsoft/hcsshim | hcn/hcnnamespace.go | GetNamespaceContainerIds | func GetNamespaceContainerIds(namespaceId string) ([]string, error) {
namespace, err := GetNamespaceByID(namespaceId)
if err != nil {
return nil, err
}
var containerIds []string
for _, resource := range namespace.Resources {
if resource.Type == "Container" {
var contaienrResource NamespaceResourceContainer
... | go | func GetNamespaceContainerIds(namespaceId string) ([]string, error) {
namespace, err := GetNamespaceByID(namespaceId)
if err != nil {
return nil, err
}
var containerIds []string
for _, resource := range namespace.Resources {
if resource.Type == "Container" {
var contaienrResource NamespaceResourceContainer
... | [
"func",
"GetNamespaceContainerIds",
"(",
"namespaceId",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"namespace",
",",
"err",
":=",
"GetNamespaceByID",
"(",
"namespaceId",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
... | // GetNamespaceContainerIds returns the containers of the Namespace specified by Id. | [
"GetNamespaceContainerIds",
"returns",
"the",
"containers",
"of",
"the",
"Namespace",
"specified",
"by",
"Id",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnamespace.go#L267-L283 |
143,629 | Microsoft/hcsshim | hcn/hcnnamespace.go | Create | func (namespace *HostComputeNamespace) Create() (*HostComputeNamespace, error) {
logrus.Debugf("hcn::HostComputeNamespace::Create id=%s", namespace.Id)
jsonString, err := json.Marshal(namespace)
if err != nil {
return nil, err
}
logrus.Debugf("hcn::HostComputeNamespace::Create JSON: %s", jsonString)
namespace... | go | func (namespace *HostComputeNamespace) Create() (*HostComputeNamespace, error) {
logrus.Debugf("hcn::HostComputeNamespace::Create id=%s", namespace.Id)
jsonString, err := json.Marshal(namespace)
if err != nil {
return nil, err
}
logrus.Debugf("hcn::HostComputeNamespace::Create JSON: %s", jsonString)
namespace... | [
"func",
"(",
"namespace",
"*",
"HostComputeNamespace",
")",
"Create",
"(",
")",
"(",
"*",
"HostComputeNamespace",
",",
"error",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"namespace",
".",
"Id",
")",
"\n\n",
"jsonString",
",",
"err",
":=",
... | // Create Namespace. | [
"Create",
"Namespace",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnamespace.go#L294-L308 |
143,630 | Microsoft/hcsshim | hcn/hcnnamespace.go | Delete | func (namespace *HostComputeNamespace) Delete() error {
logrus.Debugf("hcn::HostComputeNamespace::Delete id=%s", namespace.Id)
if err := deleteNamespace(namespace.Id); err != nil {
return err
}
return nil
} | go | func (namespace *HostComputeNamespace) Delete() error {
logrus.Debugf("hcn::HostComputeNamespace::Delete id=%s", namespace.Id)
if err := deleteNamespace(namespace.Id); err != nil {
return err
}
return nil
} | [
"func",
"(",
"namespace",
"*",
"HostComputeNamespace",
")",
"Delete",
"(",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"namespace",
".",
"Id",
")",
"\n\n",
"if",
"err",
":=",
"deleteNamespace",
"(",
"namespace",
".",
"Id",
")",
";... | // Delete Namespace. | [
"Delete",
"Namespace",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnamespace.go#L311-L318 |
143,631 | Microsoft/hcsshim | hcn/hcnnamespace.go | AddNamespaceEndpoint | func AddNamespaceEndpoint(namespaceId string, endpointId string) error {
logrus.Debugf("hcn::HostComputeEndpoint::AddNamespaceEndpoint id=%s", endpointId)
mapA := map[string]string{"EndpointId": endpointId}
settingsJson, err := json.Marshal(mapA)
if err != nil {
return err
}
requestMessage := &ModifyNamespaceS... | go | func AddNamespaceEndpoint(namespaceId string, endpointId string) error {
logrus.Debugf("hcn::HostComputeEndpoint::AddNamespaceEndpoint id=%s", endpointId)
mapA := map[string]string{"EndpointId": endpointId}
settingsJson, err := json.Marshal(mapA)
if err != nil {
return err
}
requestMessage := &ModifyNamespaceS... | [
"func",
"AddNamespaceEndpoint",
"(",
"namespaceId",
"string",
",",
"endpointId",
"string",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"endpointId",
")",
"\n\n",
"mapA",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":... | // AddNamespaceEndpoint adds an endpoint to a Namespace. | [
"AddNamespaceEndpoint",
"adds",
"an",
"endpoint",
"to",
"a",
"Namespace",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnamespace.go#L391-L406 |
143,632 | Microsoft/hcsshim | internal/oci/util.go | IsIsolated | func IsIsolated(s *specs.Spec) bool {
return IsLCOW(s) || (s.Windows != nil && s.Windows.HyperV != nil)
} | go | func IsIsolated(s *specs.Spec) bool {
return IsLCOW(s) || (s.Windows != nil && s.Windows.HyperV != nil)
} | [
"func",
"IsIsolated",
"(",
"s",
"*",
"specs",
".",
"Spec",
")",
"bool",
"{",
"return",
"IsLCOW",
"(",
"s",
")",
"||",
"(",
"s",
".",
"Windows",
"!=",
"nil",
"&&",
"s",
".",
"Windows",
".",
"HyperV",
"!=",
"nil",
")",
"\n",
"}"
] | // IsIsolated checks if `s` is hypervisor isolated. | [
"IsIsolated",
"checks",
"if",
"s",
"is",
"hypervisor",
"isolated",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/util.go#L16-L18 |
143,633 | Microsoft/hcsshim | internal/ociwclayer/import.go | ImportLayer | func ImportLayer(r io.Reader, path string, parentLayerPaths []string) (int64, error) {
err := os.MkdirAll(path, 0)
if err != nil {
return 0, err
}
w, err := hcsshim.NewLayerWriter(hcsshim.DriverInfo{}, path, parentLayerPaths)
if err != nil {
return 0, err
}
n, err := writeLayerFromTar(r, w, path)
cerr := w.... | go | func ImportLayer(r io.Reader, path string, parentLayerPaths []string) (int64, error) {
err := os.MkdirAll(path, 0)
if err != nil {
return 0, err
}
w, err := hcsshim.NewLayerWriter(hcsshim.DriverInfo{}, path, parentLayerPaths)
if err != nil {
return 0, err
}
n, err := writeLayerFromTar(r, w, path)
cerr := w.... | [
"func",
"ImportLayer",
"(",
"r",
"io",
".",
"Reader",
",",
"path",
"string",
",",
"parentLayerPaths",
"[",
"]",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"path",
",",
"0",
")",
"\n",
"if",
"err",
... | // ImportLayer reads a layer from an OCI layer tar stream and extracts it to the
// specified path. The caller must specify the parent layers, if any, ordered
// from lowest to highest layer.
//
// The caller must ensure that the thread or process has acquired backup and
// restore privileges.
//
// This function retur... | [
"ImportLayer",
"reads",
"a",
"layer",
"from",
"an",
"OCI",
"layer",
"tar",
"stream",
"and",
"extracts",
"it",
"to",
"the",
"specified",
"path",
".",
"The",
"caller",
"must",
"specify",
"the",
"parent",
"layers",
"if",
"any",
"ordered",
"from",
"lowest",
"t... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/ociwclayer/import.go#L38-L56 |
143,634 | Microsoft/hcsshim | internal/lcow/tar2vhd.go | TarToVhd | func TarToVhd(lcowUVM *uvm.UtilityVM, targetVHDFile string, reader io.Reader) (int64, error) {
logrus.Debugf("hcsshim: TarToVhd: %s", targetVHDFile)
if lcowUVM == nil {
return 0, fmt.Errorf("no utility VM passed")
}
//defer uvm.DebugLCOWGCS()
outFile, err := os.Create(targetVHDFile)
if err != nil {
return ... | go | func TarToVhd(lcowUVM *uvm.UtilityVM, targetVHDFile string, reader io.Reader) (int64, error) {
logrus.Debugf("hcsshim: TarToVhd: %s", targetVHDFile)
if lcowUVM == nil {
return 0, fmt.Errorf("no utility VM passed")
}
//defer uvm.DebugLCOWGCS()
outFile, err := os.Create(targetVHDFile)
if err != nil {
return ... | [
"func",
"TarToVhd",
"(",
"lcowUVM",
"*",
"uvm",
".",
"UtilityVM",
",",
"targetVHDFile",
"string",
",",
"reader",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"targetVHDFile",
")",
"\n\n"... | // TarToVhd streams a tarstream contained in an io.Reader to a fixed vhd file | [
"TarToVhd",
"streams",
"a",
"tarstream",
"contained",
"in",
"an",
"io",
".",
"Reader",
"to",
"a",
"fixed",
"vhd",
"file"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/lcow/tar2vhd.go#L15-L46 |
143,635 | Microsoft/hcsshim | internal/uvm/network.go | AddNetNS | func (uvm *UtilityVM) AddNetNS(id string) (err error) {
op := "uvm::AddNetNS"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"netns-id": id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - End Operation - E... | go | func (uvm *UtilityVM) AddNetNS(id string) (err error) {
op := "uvm::AddNetNS"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"netns-id": id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - End Operation - E... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"AddNetNS",
"(",
"id",
"string",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"logfields",
".",
"UVMID",
":... | // AddNetNS adds network namespace inside the guest.
//
// If a namespace with `id` already exists returns `ErrNetNSAlreadyAttached`. | [
"AddNetNS",
"adds",
"network",
"namespace",
"inside",
"the",
"guest",
".",
"If",
"a",
"namespace",
"with",
"id",
"already",
"exists",
"returns",
"ErrNetNSAlreadyAttached",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/network.go#L32-L82 |
143,636 | Microsoft/hcsshim | internal/uvm/network.go | AddEndpointsToNS | func (uvm *UtilityVM) AddEndpointsToNS(id string, endpoints []*hns.HNSEndpoint) (err error) {
op := "uvm::AddEndpointsToNS"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"netns-id": id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey]... | go | func (uvm *UtilityVM) AddEndpointsToNS(id string, endpoints []*hns.HNSEndpoint) (err error) {
op := "uvm::AddEndpointsToNS"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"netns-id": id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey]... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"AddEndpointsToNS",
"(",
"id",
"string",
",",
"endpoints",
"[",
"]",
"*",
"hns",
".",
"HNSEndpoint",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields"... | // AddEndpointsToNS adds all unique `endpoints` to the network namespace
// matching `id`. On failure does not roll back any previously successfully
// added endpoints.
//
// If no network namespace matches `id` returns `ErrNetNSNotFound`. | [
"AddEndpointsToNS",
"adds",
"all",
"unique",
"endpoints",
"to",
"the",
"network",
"namespace",
"matching",
"id",
".",
"On",
"failure",
"does",
"not",
"roll",
"back",
"any",
"previously",
"successfully",
"added",
"endpoints",
".",
"If",
"no",
"network",
"namespac... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/network.go#L89-L126 |
143,637 | Microsoft/hcsshim | internal/uvm/network.go | RemoveNetNS | func (uvm *UtilityVM) RemoveNetNS(id string) (err error) {
op := "uvm::RemoveNetNS"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"netns-id": id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - End Operati... | go | func (uvm *UtilityVM) RemoveNetNS(id string) (err error) {
op := "uvm::RemoveNetNS"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"netns-id": id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - End Operati... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"RemoveNetNS",
"(",
"id",
"string",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"logfields",
".",
"UVMID",
... | // RemoveNetNS removes the namespace from the uvm and all remaining endpoints in
// the namespace.
//
// If a namespace matching `id` is not found this command silently succeeds. | [
"RemoveNetNS",
"removes",
"the",
"namespace",
"from",
"the",
"uvm",
"and",
"all",
"remaining",
"endpoints",
"in",
"the",
"namespace",
".",
"If",
"a",
"namespace",
"matching",
"id",
"is",
"not",
"found",
"this",
"command",
"silently",
"succeeds",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/network.go#L132-L179 |
143,638 | Microsoft/hcsshim | internal/uvm/network.go | RemoveEndpointsFromNS | func (uvm *UtilityVM) RemoveEndpointsFromNS(id string, endpoints []*hns.HNSEndpoint) (err error) {
op := "uvm::RemoveEndpointsFromNS"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"netns-id": id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus... | go | func (uvm *UtilityVM) RemoveEndpointsFromNS(id string, endpoints []*hns.HNSEndpoint) (err error) {
op := "uvm::RemoveEndpointsFromNS"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"netns-id": id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"RemoveEndpointsFromNS",
"(",
"id",
"string",
",",
"endpoints",
"[",
"]",
"*",
"hns",
".",
"HNSEndpoint",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFi... | // RemoveEndpointsFromNS removes all matching `endpoints` in the network
// namespace matching `id`. If no endpoint matching `endpoint.Id` is found in
// the network namespace this command silently succeeds.
//
// If no network namespace matches `id` returns `ErrNetNSNotFound`. | [
"RemoveEndpointsFromNS",
"removes",
"all",
"matching",
"endpoints",
"in",
"the",
"network",
"namespace",
"matching",
"id",
".",
"If",
"no",
"endpoint",
"matching",
"endpoint",
".",
"Id",
"is",
"found",
"in",
"the",
"network",
"namespace",
"this",
"command",
"sil... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/network.go#L186-L219 |
143,639 | Microsoft/hcsshim | internal/uvm/network.go | isNetworkNamespaceSupported | func (uvm *UtilityVM) isNetworkNamespaceSupported() bool {
p, err := uvm.ComputeSystem().Properties(schema1.PropertyTypeGuestConnection)
if err == nil {
return p.GuestConnectionInfo.GuestDefinedCapabilities.NamespaceAddRequestSupported
}
return false
} | go | func (uvm *UtilityVM) isNetworkNamespaceSupported() bool {
p, err := uvm.ComputeSystem().Properties(schema1.PropertyTypeGuestConnection)
if err == nil {
return p.GuestConnectionInfo.GuestDefinedCapabilities.NamespaceAddRequestSupported
}
return false
} | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"isNetworkNamespaceSupported",
"(",
")",
"bool",
"{",
"p",
",",
"err",
":=",
"uvm",
".",
"ComputeSystem",
"(",
")",
".",
"Properties",
"(",
"schema1",
".",
"PropertyTypeGuestConnection",
")",
"\n",
"if",
"err",
"=... | // IsNetworkNamespaceSupported returns bool value specifying if network namespace is supported inside the guest | [
"IsNetworkNamespaceSupported",
"returns",
"bool",
"value",
"specifying",
"if",
"network",
"namespace",
"is",
"supported",
"inside",
"the",
"guest"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/network.go#L222-L229 |
143,640 | Microsoft/hcsshim | internal/hcs/utils.go | makeOpenFiles | func makeOpenFiles(hs []syscall.Handle) (_ []io.ReadWriteCloser, err error) {
fs := make([]io.ReadWriteCloser, len(hs))
for i, h := range hs {
if h != syscall.Handle(0) {
if err == nil {
fs[i], err = winio.MakeOpenFile(h)
}
if err != nil {
syscall.Close(h)
}
}
}
if err != nil {
for _, f :=... | go | func makeOpenFiles(hs []syscall.Handle) (_ []io.ReadWriteCloser, err error) {
fs := make([]io.ReadWriteCloser, len(hs))
for i, h := range hs {
if h != syscall.Handle(0) {
if err == nil {
fs[i], err = winio.MakeOpenFile(h)
}
if err != nil {
syscall.Close(h)
}
}
}
if err != nil {
for _, f :=... | [
"func",
"makeOpenFiles",
"(",
"hs",
"[",
"]",
"syscall",
".",
"Handle",
")",
"(",
"_",
"[",
"]",
"io",
".",
"ReadWriteCloser",
",",
"err",
"error",
")",
"{",
"fs",
":=",
"make",
"(",
"[",
"]",
"io",
".",
"ReadWriteCloser",
",",
"len",
"(",
"hs",
... | // makeOpenFiles calls winio.MakeOpenFile for each handle in a slice but closes all the handles
// if there is an error. | [
"makeOpenFiles",
"calls",
"winio",
".",
"MakeOpenFile",
"for",
"each",
"handle",
"in",
"a",
"slice",
"but",
"closes",
"all",
"the",
"handles",
"if",
"there",
"is",
"an",
"error",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcs/utils.go#L12-L33 |
143,641 | Microsoft/hcsshim | internal/uvm/plan9.go | AddPlan9 | func (uvm *UtilityVM) AddPlan9(hostPath string, uvmPath string, readOnly bool, restrict bool, allowedNames []string) (_ *Plan9Share, err error) {
op := "uvm::AddPlan9"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
"uvm-path": uvmPath,
"readOnly": readOnl... | go | func (uvm *UtilityVM) AddPlan9(hostPath string, uvmPath string, readOnly bool, restrict bool, allowedNames []string) (_ *Plan9Share, err error) {
op := "uvm::AddPlan9"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": hostPath,
"uvm-path": uvmPath,
"readOnly": readOnl... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"AddPlan9",
"(",
"hostPath",
"string",
",",
"uvmPath",
"string",
",",
"readOnly",
"bool",
",",
"restrict",
"bool",
",",
"allowedNames",
"[",
"]",
"string",
")",
"(",
"_",
"*",
"Plan9Share",
",",
"err",
"error",
... | // AddPlan9 adds a Plan9 share to a utility VM. | [
"AddPlan9",
"adds",
"a",
"Plan9",
"share",
"to",
"a",
"utility",
"VM",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/plan9.go#L23-L108 |
143,642 | Microsoft/hcsshim | internal/uvm/plan9.go | RemovePlan9 | func (uvm *UtilityVM) RemovePlan9(share *Plan9Share) (err error) {
op := "uvm::RemovePlan9"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"name": share.name,
"uvm-path": share.uvmPath,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus... | go | func (uvm *UtilityVM) RemovePlan9(share *Plan9Share) (err error) {
op := "uvm::RemovePlan9"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"name": share.name,
"uvm-path": share.uvmPath,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"RemovePlan9",
"(",
"share",
"*",
"Plan9Share",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"logfields",
"."... | // RemovePlan9 removes a Plan9 share from a utility VM. Each Plan9 share is ref-counted
// and only actually removed when the ref-count drops to zero. | [
"RemovePlan9",
"removes",
"a",
"Plan9",
"share",
"from",
"a",
"utility",
"VM",
".",
"Each",
"Plan9",
"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/plan9.go#L112-L155 |
143,643 | Microsoft/hcsshim | internal/hns/hnsnetwork.go | GetHNSNetworkByName | func GetHNSNetworkByName(networkName string) (*HNSNetwork, error) {
hsnnetworks, err := HNSListNetworkRequest("GET", "", "")
if err != nil {
return nil, err
}
for _, hnsnetwork := range hsnnetworks {
if hnsnetwork.Name == networkName {
return &hnsnetwork, nil
}
}
return nil, NetworkNotFoundError{NetworkN... | go | func GetHNSNetworkByName(networkName string) (*HNSNetwork, error) {
hsnnetworks, err := HNSListNetworkRequest("GET", "", "")
if err != nil {
return nil, err
}
for _, hnsnetwork := range hsnnetworks {
if hnsnetwork.Name == networkName {
return &hnsnetwork, nil
}
}
return nil, NetworkNotFoundError{NetworkN... | [
"func",
"GetHNSNetworkByName",
"(",
"networkName",
"string",
")",
"(",
"*",
"HNSNetwork",
",",
"error",
")",
"{",
"hsnnetworks",
",",
"err",
":=",
"HNSListNetworkRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
... | // GetHNSNetworkName filtered by Name | [
"GetHNSNetworkName",
"filtered",
"by",
"Name"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnsnetwork.go#L82-L93 |
143,644 | Microsoft/hcsshim | internal/hns/hnsnetwork.go | Create | func (network *HNSNetwork) Create() (*HNSNetwork, error) {
operation := "Create"
title := "hcsshim::HNSNetwork::" + operation
logrus.Debugf(title+" id=%s", network.Id)
for _, subnet := range network.Subnets {
if (subnet.AddressPrefix != "") && (subnet.GatewayAddress == "") {
return nil, errors.New("network cr... | go | func (network *HNSNetwork) Create() (*HNSNetwork, error) {
operation := "Create"
title := "hcsshim::HNSNetwork::" + operation
logrus.Debugf(title+" id=%s", network.Id)
for _, subnet := range network.Subnets {
if (subnet.AddressPrefix != "") && (subnet.GatewayAddress == "") {
return nil, errors.New("network cr... | [
"func",
"(",
"network",
"*",
"HNSNetwork",
")",
"Create",
"(",
")",
"(",
"*",
"HNSNetwork",
",",
"error",
")",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"title",
":=",
"\"",
"\"",
"+",
"operation",
"\n",
"logrus",
".",
"Debugf",
"(",
"title",
"+",
... | // Create Network by sending NetworkRequest to HNS. | [
"Create",
"Network",
"by",
"sending",
"NetworkRequest",
"to",
"HNS",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnsnetwork.go#L96-L112 |
143,645 | Microsoft/hcsshim | internal/hns/hnsnetwork.go | Delete | func (network *HNSNetwork) Delete() (*HNSNetwork, error) {
operation := "Delete"
title := "hcsshim::HNSNetwork::" + operation
logrus.Debugf(title+" id=%s", network.Id)
return HNSNetworkRequest("DELETE", network.Id, "")
} | go | func (network *HNSNetwork) Delete() (*HNSNetwork, error) {
operation := "Delete"
title := "hcsshim::HNSNetwork::" + operation
logrus.Debugf(title+" id=%s", network.Id)
return HNSNetworkRequest("DELETE", network.Id, "")
} | [
"func",
"(",
"network",
"*",
"HNSNetwork",
")",
"Delete",
"(",
")",
"(",
"*",
"HNSNetwork",
",",
"error",
")",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"title",
":=",
"\"",
"\"",
"+",
"operation",
"\n",
"logrus",
".",
"Debugf",
"(",
"title",
"+",
... | // Delete Network by sending NetworkRequest to HNS | [
"Delete",
"Network",
"by",
"sending",
"NetworkRequest",
"to",
"HNS"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnsnetwork.go#L115-L121 |
143,646 | Microsoft/hcsshim | internal/hns/hnsnetwork.go | NewEndpoint | func (network *HNSNetwork) NewEndpoint(ipAddress net.IP, macAddress net.HardwareAddr) *HNSEndpoint {
return &HNSEndpoint{
VirtualNetwork: network.Id,
IPAddress: ipAddress,
MacAddress: string(macAddress),
}
} | go | func (network *HNSNetwork) NewEndpoint(ipAddress net.IP, macAddress net.HardwareAddr) *HNSEndpoint {
return &HNSEndpoint{
VirtualNetwork: network.Id,
IPAddress: ipAddress,
MacAddress: string(macAddress),
}
} | [
"func",
"(",
"network",
"*",
"HNSNetwork",
")",
"NewEndpoint",
"(",
"ipAddress",
"net",
".",
"IP",
",",
"macAddress",
"net",
".",
"HardwareAddr",
")",
"*",
"HNSEndpoint",
"{",
"return",
"&",
"HNSEndpoint",
"{",
"VirtualNetwork",
":",
"network",
".",
"Id",
... | // Creates an endpoint on the Network. | [
"Creates",
"an",
"endpoint",
"on",
"the",
"Network",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnsnetwork.go#L124-L130 |
143,647 | Microsoft/hcsshim | internal/runhcs/container.go | GetErrorFromPipe | func GetErrorFromPipe(pipe io.Reader, p *os.Process) error {
serr, err := ioutil.ReadAll(pipe)
if err != nil {
return err
}
if bytes.Equal(serr, ShimSuccess) {
return nil
}
extra := ""
if p != nil {
p.Kill()
state, err := p.Wait()
if err != nil {
panic(err)
}
extra = fmt.Sprintf(", exit code %... | go | func GetErrorFromPipe(pipe io.Reader, p *os.Process) error {
serr, err := ioutil.ReadAll(pipe)
if err != nil {
return err
}
if bytes.Equal(serr, ShimSuccess) {
return nil
}
extra := ""
if p != nil {
p.Kill()
state, err := p.Wait()
if err != nil {
panic(err)
}
extra = fmt.Sprintf(", exit code %... | [
"func",
"GetErrorFromPipe",
"(",
"pipe",
"io",
".",
"Reader",
",",
"p",
"*",
"os",
".",
"Process",
")",
"error",
"{",
"serr",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"pipe",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
... | // GetErrorFromPipe returns reads from `pipe` and verifies if the operation
// returned success or error. If error converts that to an error and returns. If
// `p` is not nill will issue a `Kill` and `Wait` for exit. | [
"GetErrorFromPipe",
"returns",
"reads",
"from",
"pipe",
"and",
"verifies",
"if",
"the",
"operation",
"returned",
"success",
"or",
"error",
".",
"If",
"error",
"converts",
"that",
"to",
"an",
"error",
"and",
"returns",
".",
"If",
"p",
"is",
"not",
"nill",
"... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/runhcs/container.go#L42-L66 |
143,648 | Microsoft/hcsshim | internal/hcsoci/network.go | GetNamespaceEndpoints | func GetNamespaceEndpoints(netNS string) ([]*hns.HNSEndpoint, error) {
op := "hcsoci::GetNamespaceEndpoints"
log := logrus.WithField("netns-id", netNS)
log.Debug(op + " - Begin")
defer func() {
log.Debug(op + " - End")
}()
ids, err := hns.GetNamespaceEndpoints(netNS)
if err != nil {
return nil, err
}
var ... | go | func GetNamespaceEndpoints(netNS string) ([]*hns.HNSEndpoint, error) {
op := "hcsoci::GetNamespaceEndpoints"
log := logrus.WithField("netns-id", netNS)
log.Debug(op + " - Begin")
defer func() {
log.Debug(op + " - End")
}()
ids, err := hns.GetNamespaceEndpoints(netNS)
if err != nil {
return nil, err
}
var ... | [
"func",
"GetNamespaceEndpoints",
"(",
"netNS",
"string",
")",
"(",
"[",
"]",
"*",
"hns",
".",
"HNSEndpoint",
",",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"netNS",
")",
"\n",
"l... | // GetNamespaceEndpoints gets all endpoints in `netNS` | [
"GetNamespaceEndpoints",
"gets",
"all",
"endpoints",
"in",
"netNS"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hcsoci/network.go#L36-L57 |
143,649 | Microsoft/hcsshim | hcn/hcnerrors.go | IsNotFoundError | func IsNotFoundError(err error) bool {
switch err.(type) {
case NetworkNotFoundError:
return true
case EndpointNotFoundError:
return true
case NamespaceNotFoundError:
return true
case LoadBalancerNotFoundError:
return true
}
return false
} | go | func IsNotFoundError(err error) bool {
switch err.(type) {
case NetworkNotFoundError:
return true
case EndpointNotFoundError:
return true
case NamespaceNotFoundError:
return true
case LoadBalancerNotFoundError:
return true
}
return false
} | [
"func",
"IsNotFoundError",
"(",
"err",
"error",
")",
"bool",
"{",
"switch",
"err",
".",
"(",
"type",
")",
"{",
"case",
"NetworkNotFoundError",
":",
"return",
"true",
"\n",
"case",
"EndpointNotFoundError",
":",
"return",
"true",
"\n",
"case",
"NamespaceNotFound... | // IsNotFoundError returns a boolean indicating whether the error was caused by
// a resource not being found. | [
"IsNotFoundError",
"returns",
"a",
"boolean",
"indicating",
"whether",
"the",
"error",
"was",
"caused",
"by",
"a",
"resource",
"not",
"being",
"found",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnerrors.go#L83-L95 |
143,650 | Microsoft/hcsshim | pkg/go-runhcs/runhcs_delete.go | Delete | func (r *Runhcs) Delete(context context.Context, id string, opts *DeleteOpts) error {
args := []string{"delete"}
if opts != nil {
oargs, err := opts.args()
if err != nil {
return err
}
args = append(args, oargs...)
}
return r.runOrError(r.command(context, append(args, id)...))
} | go | func (r *Runhcs) Delete(context context.Context, id string, opts *DeleteOpts) error {
args := []string{"delete"}
if opts != nil {
oargs, err := opts.args()
if err != nil {
return err
}
args = append(args, oargs...)
}
return r.runOrError(r.command(context, append(args, id)...))
} | [
"func",
"(",
"r",
"*",
"Runhcs",
")",
"Delete",
"(",
"context",
"context",
".",
"Context",
",",
"id",
"string",
",",
"opts",
"*",
"DeleteOpts",
")",
"error",
"{",
"args",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"if",
"opts",
"!=",
"... | // Delete any resources held by the container often used with detached
// containers. | [
"Delete",
"any",
"resources",
"held",
"by",
"the",
"container",
"often",
"used",
"with",
"detached",
"containers",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/pkg/go-runhcs/runhcs_delete.go#L23-L33 |
143,651 | Microsoft/hcsshim | internal/wclayer/baselayer.go | reapplyDirectoryTimes | func reapplyDirectoryTimes(root *os.File, dis []dirInfo) error {
for i := range dis {
di := &dis[len(dis)-i-1] // reverse order: process child directories first
f, err := safefile.OpenRelative(di.path, root, syscall.GENERIC_READ|syscall.GENERIC_WRITE, syscall.FILE_SHARE_READ, safefile.FILE_OPEN, safefile.FILE_DIRE... | go | func reapplyDirectoryTimes(root *os.File, dis []dirInfo) error {
for i := range dis {
di := &dis[len(dis)-i-1] // reverse order: process child directories first
f, err := safefile.OpenRelative(di.path, root, syscall.GENERIC_READ|syscall.GENERIC_WRITE, syscall.FILE_SHARE_READ, safefile.FILE_OPEN, safefile.FILE_DIRE... | [
"func",
"reapplyDirectoryTimes",
"(",
"root",
"*",
"os",
".",
"File",
",",
"dis",
"[",
"]",
"dirInfo",
")",
"error",
"{",
"for",
"i",
":=",
"range",
"dis",
"{",
"di",
":=",
"&",
"dis",
"[",
"len",
"(",
"dis",
")",
"-",
"i",
"-",
"1",
"]",
"// r... | // reapplyDirectoryTimes reapplies directory modification, creation, etc. times
// after processing of the directory tree has completed. The times are expected
// to be ordered such that parent directories come before child directories. | [
"reapplyDirectoryTimes",
"reapplies",
"directory",
"modification",
"creation",
"etc",
".",
"times",
"after",
"processing",
"of",
"the",
"directory",
"tree",
"has",
"completed",
".",
"The",
"times",
"are",
"expected",
"to",
"be",
"ordered",
"such",
"that",
"parent"... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/baselayer.go#L31-L46 |
143,652 | Microsoft/hcsshim | internal/uvm/create.go | newDefaultOptions | func newDefaultOptions(id, owner string) *Options {
opts := &Options{
ID: id,
Owner: owner,
MemorySizeInMB: 1024,
AllowOvercommit: true,
EnableDeferredCommit: false,
ProcessorCount: defaultProcessorCount(),
}
if opts.ID == "" {
opts.ID = guid.New().Str... | go | func newDefaultOptions(id, owner string) *Options {
opts := &Options{
ID: id,
Owner: owner,
MemorySizeInMB: 1024,
AllowOvercommit: true,
EnableDeferredCommit: false,
ProcessorCount: defaultProcessorCount(),
}
if opts.ID == "" {
opts.ID = guid.New().Str... | [
"func",
"newDefaultOptions",
"(",
"id",
",",
"owner",
"string",
")",
"*",
"Options",
"{",
"opts",
":=",
"&",
"Options",
"{",
"ID",
":",
"id",
",",
"Owner",
":",
"owner",
",",
"MemorySizeInMB",
":",
"1024",
",",
"AllowOvercommit",
":",
"true",
",",
"Ena... | // newDefaultOptions returns the default base options for WCOW and LCOW.
//
// If `id` is empty it will be generated.
//
// If `owner` is empty it will be set to the calling executables name. | [
"newDefaultOptions",
"returns",
"the",
"default",
"base",
"options",
"for",
"WCOW",
"and",
"LCOW",
".",
"If",
"id",
"is",
"empty",
"it",
"will",
"be",
"generated",
".",
"If",
"owner",
"is",
"empty",
"it",
"will",
"be",
"set",
"to",
"the",
"calling",
"exe... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/create.go#L57-L75 |
143,653 | Microsoft/hcsshim | internal/uvm/create.go | Close | func (uvm *UtilityVM) Close() (err error) {
op := "uvm::Close"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - End Operation - Error")
} else {
log.Debug(op + " ... | go | func (uvm *UtilityVM) Close() (err error) {
op := "uvm::Close"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - End Operation - Error")
} else {
log.Debug(op + " ... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"logfields",
".",
"UVMID",
":",
"uvm",
".",
"i... | // Close terminates and releases resources associated with the utility VM. | [
"Close",
"terminates",
"and",
"releases",
"resources",
"associated",
"with",
"the",
"utility",
"VM",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/create.go#L88-L115 |
143,654 | Microsoft/hcsshim | internal/longpath/longpath.go | LongAbs | func LongAbs(path string) (string, error) {
if strings.HasPrefix(path, `\\?\`) || strings.HasPrefix(path, `\\.\`) {
return path, nil
}
if !filepath.IsAbs(path) {
absPath, err := filepath.Abs(path)
if err != nil {
return "", err
}
path = absPath
}
if strings.HasPrefix(path, `\\`) {
return `\\?\UNC\` ... | go | func LongAbs(path string) (string, error) {
if strings.HasPrefix(path, `\\?\`) || strings.HasPrefix(path, `\\.\`) {
return path, nil
}
if !filepath.IsAbs(path) {
absPath, err := filepath.Abs(path)
if err != nil {
return "", err
}
path = absPath
}
if strings.HasPrefix(path, `\\`) {
return `\\?\UNC\` ... | [
"func",
"LongAbs",
"(",
"path",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"path",
",",
"`\\\\?\\`",
")",
"||",
"strings",
".",
"HasPrefix",
"(",
"path",
",",
"`\\\\.\\`",
")",
"{",
"return",
"path",
... | // LongAbs makes a path absolute and returns it in NT long path form. | [
"LongAbs",
"makes",
"a",
"path",
"absolute",
"and",
"returns",
"it",
"in",
"NT",
"long",
"path",
"form",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/longpath/longpath.go#L9-L24 |
143,655 | Microsoft/hcsshim | internal/wclayer/grantvmaccess.go | GrantVmAccess | func GrantVmAccess(vmid string, filepath string) (err error) {
title := "hcsshim::GrantVmAccess"
fields := logrus.Fields{
"vm-id": vmid,
"path": filepath,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else... | go | func GrantVmAccess(vmid string, filepath string) (err error) {
title := "hcsshim::GrantVmAccess"
fields := logrus.Fields{
"vm-id": vmid,
"path": filepath,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.ErrorKey] = err
logrus.WithFields(fields).Error(err)
} else... | [
"func",
"GrantVmAccess",
"(",
"vmid",
"string",
",",
"filepath",
"string",
")",
"(",
"err",
"error",
")",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"fields",
":=",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"vmid",
",",
"\"",
"\"",
":",
"filepath",
... | // GrantVmAccess adds access to a file for a given VM | [
"GrantVmAccess",
"adds",
"access",
"to",
"a",
"file",
"for",
"a",
"given",
"VM"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/grantvmaccess.go#L9-L30 |
143,656 | Microsoft/hcsshim | internal/uvm/start.go | Start | func (uvm *UtilityVM) Start() (err error) {
op := "uvm::Start"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - End Operation - Error")
} else {
log.Debug(op + " ... | go | func (uvm *UtilityVM) Start() (err error) {
op := "uvm::Start"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - End Operation - Error")
} else {
log.Debug(op + " ... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"Start",
"(",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"logfields",
".",
"UVMID",
":",
"uvm",
".",
"i... | // Start synchronously starts the utility VM. | [
"Start",
"synchronously",
"starts",
"the",
"utility",
"VM",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/start.go#L135-L157 |
143,657 | Microsoft/hcsshim | hcn/hcnnetwork.go | ListNetworks | func ListNetworks() ([]HostComputeNetwork, error) {
hcnQuery := defaultQuery()
networks, err := ListNetworksQuery(hcnQuery)
if err != nil {
return nil, err
}
return networks, nil
} | go | func ListNetworks() ([]HostComputeNetwork, error) {
hcnQuery := defaultQuery()
networks, err := ListNetworksQuery(hcnQuery)
if err != nil {
return nil, err
}
return networks, nil
} | [
"func",
"ListNetworks",
"(",
")",
"(",
"[",
"]",
"HostComputeNetwork",
",",
"error",
")",
"{",
"hcnQuery",
":=",
"defaultQuery",
"(",
")",
"\n",
"networks",
",",
"err",
":=",
"ListNetworksQuery",
"(",
"hcnQuery",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // ListNetworks makes a call to list all available networks. | [
"ListNetworks",
"makes",
"a",
"call",
"to",
"list",
"all",
"available",
"networks",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnetwork.go#L257-L264 |
143,658 | Microsoft/hcsshim | hcn/hcnnetwork.go | ListNetworksQuery | func ListNetworksQuery(query HostComputeQuery) ([]HostComputeNetwork, error) {
queryJson, err := json.Marshal(query)
if err != nil {
return nil, err
}
networks, err := enumerateNetworks(string(queryJson))
if err != nil {
return nil, err
}
return networks, nil
} | go | func ListNetworksQuery(query HostComputeQuery) ([]HostComputeNetwork, error) {
queryJson, err := json.Marshal(query)
if err != nil {
return nil, err
}
networks, err := enumerateNetworks(string(queryJson))
if err != nil {
return nil, err
}
return networks, nil
} | [
"func",
"ListNetworksQuery",
"(",
"query",
"HostComputeQuery",
")",
"(",
"[",
"]",
"HostComputeNetwork",
",",
"error",
")",
"{",
"queryJson",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"query",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil... | // ListNetworksQuery makes a call to query the list of available networks. | [
"ListNetworksQuery",
"makes",
"a",
"call",
"to",
"query",
"the",
"list",
"of",
"available",
"networks",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnetwork.go#L267-L278 |
143,659 | Microsoft/hcsshim | hcn/hcnnetwork.go | GetNetworkByID | func GetNetworkByID(networkID string) (*HostComputeNetwork, error) {
hcnQuery := defaultQuery()
mapA := map[string]string{"ID": networkID}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
hcnQuery.Filter = string(filter)
networks, err := ListNetworksQuery(hcnQuery)
if err != nil {
return... | go | func GetNetworkByID(networkID string) (*HostComputeNetwork, error) {
hcnQuery := defaultQuery()
mapA := map[string]string{"ID": networkID}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
hcnQuery.Filter = string(filter)
networks, err := ListNetworksQuery(hcnQuery)
if err != nil {
return... | [
"func",
"GetNetworkByID",
"(",
"networkID",
"string",
")",
"(",
"*",
"HostComputeNetwork",
",",
"error",
")",
"{",
"hcnQuery",
":=",
"defaultQuery",
"(",
")",
"\n",
"mapA",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"networkID",
"}"... | // GetNetworkByID returns the network specified by Id. | [
"GetNetworkByID",
"returns",
"the",
"network",
"specified",
"by",
"Id",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnetwork.go#L281-L298 |
143,660 | Microsoft/hcsshim | hcn/hcnnetwork.go | GetNetworkByName | func GetNetworkByName(networkName string) (*HostComputeNetwork, error) {
hcnQuery := defaultQuery()
mapA := map[string]string{"Name": networkName}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
hcnQuery.Filter = string(filter)
networks, err := ListNetworksQuery(hcnQuery)
if err != nil {
... | go | func GetNetworkByName(networkName string) (*HostComputeNetwork, error) {
hcnQuery := defaultQuery()
mapA := map[string]string{"Name": networkName}
filter, err := json.Marshal(mapA)
if err != nil {
return nil, err
}
hcnQuery.Filter = string(filter)
networks, err := ListNetworksQuery(hcnQuery)
if err != nil {
... | [
"func",
"GetNetworkByName",
"(",
"networkName",
"string",
")",
"(",
"*",
"HostComputeNetwork",
",",
"error",
")",
"{",
"hcnQuery",
":=",
"defaultQuery",
"(",
")",
"\n",
"mapA",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"networkName",... | // GetNetworkByName returns the network specified by Name. | [
"GetNetworkByName",
"returns",
"the",
"network",
"specified",
"by",
"Name",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnetwork.go#L301-L318 |
143,661 | Microsoft/hcsshim | hcn/hcnnetwork.go | Create | func (network *HostComputeNetwork) Create() (*HostComputeNetwork, error) {
logrus.Debugf("hcn::HostComputeNetwork::Create id=%s", network.Id)
for _, ipam := range network.Ipams {
for _, subnet := range ipam.Subnets {
if subnet.IpAddressPrefix != "" {
hasDefault := false
for _, route := range subnet.Route... | go | func (network *HostComputeNetwork) Create() (*HostComputeNetwork, error) {
logrus.Debugf("hcn::HostComputeNetwork::Create id=%s", network.Id)
for _, ipam := range network.Ipams {
for _, subnet := range ipam.Subnets {
if subnet.IpAddressPrefix != "" {
hasDefault := false
for _, route := range subnet.Route... | [
"func",
"(",
"network",
"*",
"HostComputeNetwork",
")",
"Create",
"(",
")",
"(",
"*",
"HostComputeNetwork",
",",
"error",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"network",
".",
"Id",
")",
"\n",
"for",
"_",
",",
"ipam",
":=",
"range"... | // Create Network. | [
"Create",
"Network",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnetwork.go#L321-L353 |
143,662 | Microsoft/hcsshim | hcn/hcnnetwork.go | Delete | func (network *HostComputeNetwork) Delete() error {
logrus.Debugf("hcn::HostComputeNetwork::Delete id=%s", network.Id)
if err := deleteNetwork(network.Id); err != nil {
return err
}
return nil
} | go | func (network *HostComputeNetwork) Delete() error {
logrus.Debugf("hcn::HostComputeNetwork::Delete id=%s", network.Id)
if err := deleteNetwork(network.Id); err != nil {
return err
}
return nil
} | [
"func",
"(",
"network",
"*",
"HostComputeNetwork",
")",
"Delete",
"(",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"network",
".",
"Id",
")",
"\n\n",
"if",
"err",
":=",
"deleteNetwork",
"(",
"network",
".",
"Id",
")",
";",
"err"... | // Delete Network. | [
"Delete",
"Network",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnetwork.go#L356-L363 |
143,663 | Microsoft/hcsshim | hcn/hcnnetwork.go | ModifyNetworkSettings | func (network *HostComputeNetwork) ModifyNetworkSettings(request *ModifyNetworkSettingRequest) error {
logrus.Debugf("hcn::HostComputeNetwork::ModifyNetworkSettings id=%s", network.Id)
networkSettingsRequest, err := json.Marshal(request)
if err != nil {
return err
}
_, err = modifyNetwork(network.Id, string(ne... | go | func (network *HostComputeNetwork) ModifyNetworkSettings(request *ModifyNetworkSettingRequest) error {
logrus.Debugf("hcn::HostComputeNetwork::ModifyNetworkSettings id=%s", network.Id)
networkSettingsRequest, err := json.Marshal(request)
if err != nil {
return err
}
_, err = modifyNetwork(network.Id, string(ne... | [
"func",
"(",
"network",
"*",
"HostComputeNetwork",
")",
"ModifyNetworkSettings",
"(",
"request",
"*",
"ModifyNetworkSettingRequest",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"network",
".",
"Id",
")",
"\n\n",
"networkSettingsRequest",
",... | // ModifyNetworkSettings updates the Policy for a network. | [
"ModifyNetworkSettings",
"updates",
"the",
"Policy",
"for",
"a",
"network",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnetwork.go#L366-L379 |
143,664 | Microsoft/hcsshim | hcn/hcnnetwork.go | CreateEndpoint | func (network *HostComputeNetwork) CreateEndpoint(endpoint *HostComputeEndpoint) (*HostComputeEndpoint, error) {
isRemote := endpoint.Flags&EndpointFlagsRemoteEndpoint != 0
logrus.Debugf("hcn::HostComputeNetwork::CreatEndpoint, networkId=%s remote=%t", network.Id, isRemote)
endpoint.HostComputeNetwork = network.Id
... | go | func (network *HostComputeNetwork) CreateEndpoint(endpoint *HostComputeEndpoint) (*HostComputeEndpoint, error) {
isRemote := endpoint.Flags&EndpointFlagsRemoteEndpoint != 0
logrus.Debugf("hcn::HostComputeNetwork::CreatEndpoint, networkId=%s remote=%t", network.Id, isRemote)
endpoint.HostComputeNetwork = network.Id
... | [
"func",
"(",
"network",
"*",
"HostComputeNetwork",
")",
"CreateEndpoint",
"(",
"endpoint",
"*",
"HostComputeEndpoint",
")",
"(",
"*",
"HostComputeEndpoint",
",",
"error",
")",
"{",
"isRemote",
":=",
"endpoint",
".",
"Flags",
"&",
"EndpointFlagsRemoteEndpoint",
"!=... | // CreateEndpoint creates an endpoint on the Network. | [
"CreateEndpoint",
"creates",
"an",
"endpoint",
"on",
"the",
"Network",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnetwork.go#L416-L430 |
143,665 | Microsoft/hcsshim | hcn/hcnnetwork.go | CreateRemoteEndpoint | func (network *HostComputeNetwork) CreateRemoteEndpoint(endpoint *HostComputeEndpoint) (*HostComputeEndpoint, error) {
endpoint.Flags = EndpointFlagsRemoteEndpoint | endpoint.Flags
return network.CreateEndpoint(endpoint)
} | go | func (network *HostComputeNetwork) CreateRemoteEndpoint(endpoint *HostComputeEndpoint) (*HostComputeEndpoint, error) {
endpoint.Flags = EndpointFlagsRemoteEndpoint | endpoint.Flags
return network.CreateEndpoint(endpoint)
} | [
"func",
"(",
"network",
"*",
"HostComputeNetwork",
")",
"CreateRemoteEndpoint",
"(",
"endpoint",
"*",
"HostComputeEndpoint",
")",
"(",
"*",
"HostComputeEndpoint",
",",
"error",
")",
"{",
"endpoint",
".",
"Flags",
"=",
"EndpointFlagsRemoteEndpoint",
"|",
"endpoint",
... | // CreateRemoteEndpoint creates a remote endpoint on the Network. | [
"CreateRemoteEndpoint",
"creates",
"a",
"remote",
"endpoint",
"on",
"the",
"Network",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnnetwork.go#L433-L436 |
143,666 | Microsoft/hcsshim | internal/uvm/vpmem.go | allocateVPMEM | func (uvm *UtilityVM) allocateVPMEM(hostPath string) (uint32, error) {
for index, vi := range uvm.vpmemDevices {
if vi.hostPath == "" {
vi.hostPath = hostPath
logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": vi.hostPath,
"uvm-path": vi.uvmPath,
"refCount": vi... | go | func (uvm *UtilityVM) allocateVPMEM(hostPath string) (uint32, error) {
for index, vi := range uvm.vpmemDevices {
if vi.hostPath == "" {
vi.hostPath = hostPath
logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": vi.hostPath,
"uvm-path": vi.uvmPath,
"refCount": vi... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"allocateVPMEM",
"(",
"hostPath",
"string",
")",
"(",
"uint32",
",",
"error",
")",
"{",
"for",
"index",
",",
"vi",
":=",
"range",
"uvm",
".",
"vpmemDevices",
"{",
"if",
"vi",
".",
"hostPath",
"==",
"\"",
"\"... | // allocateVPMEM finds the next available VPMem slot. The lock MUST be held
// when calling this function. | [
"allocateVPMEM",
"finds",
"the",
"next",
"available",
"VPMem",
"slot",
".",
"The",
"lock",
"MUST",
"be",
"held",
"when",
"calling",
"this",
"function",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/vpmem.go#L15-L30 |
143,667 | Microsoft/hcsshim | internal/uvm/vpmem.go | findVPMEMDevice | func (uvm *UtilityVM) findVPMEMDevice(findThisHostPath string) (uint32, string, error) {
for deviceNumber, vi := range uvm.vpmemDevices {
if vi.hostPath == findThisHostPath {
logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": findThisHostPath,
"uvm-path": vi.uvmPath,
"... | go | func (uvm *UtilityVM) findVPMEMDevice(findThisHostPath string) (uint32, string, error) {
for deviceNumber, vi := range uvm.vpmemDevices {
if vi.hostPath == findThisHostPath {
logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
"host-path": findThisHostPath,
"uvm-path": vi.uvmPath,
"... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"findVPMEMDevice",
"(",
"findThisHostPath",
"string",
")",
"(",
"uint32",
",",
"string",
",",
"error",
")",
"{",
"for",
"deviceNumber",
",",
"vi",
":=",
"range",
"uvm",
".",
"vpmemDevices",
"{",
"if",
"vi",
".",... | // 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/vpmem.go#L51-L65 |
143,668 | Microsoft/hcsshim | internal/uvm/vpmem.go | RemoveVPMEM | func (uvm *UtilityVM) RemoveVPMEM(hostPath string) (err error) {
op := "uvm::RemoveVPMEM"
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 + " -... | go | func (uvm *UtilityVM) RemoveVPMEM(hostPath string) (err error) {
op := "uvm::RemoveVPMEM"
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 + " -... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"RemoveVPMEM",
"(",
"hostPath",
"string",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"logfields",
".",
"UVM... | // RemoveVPMEM removes a VPMEM disk from a utility VM. As an external API, it
// is "safe". Internal use can call removeVPMEM. | [
"RemoveVPMEM",
"removes",
"a",
"VPMEM",
"disk",
"from",
"a",
"utility",
"VM",
".",
"As",
"an",
"external",
"API",
"it",
"is",
"safe",
".",
"Internal",
"use",
"can",
"call",
"removeVPMEM",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/vpmem.go#L151-L184 |
143,669 | Microsoft/hcsshim | internal/uvm/vpmem.go | removeVPMEM | func (uvm *UtilityVM) removeVPMEM(hostPath string, uvmPath string, deviceNumber uint32) error {
if uvm.vpmemDevices[deviceNumber].refCount == 1 {
modification := &hcsschema.ModifySettingRequest{
RequestType: requesttype.Remove,
ResourcePath: fmt.Sprintf("VirtualMachine/Devices/VirtualPMem/Devices/%d", deviceN... | go | func (uvm *UtilityVM) removeVPMEM(hostPath string, uvmPath string, deviceNumber uint32) error {
if uvm.vpmemDevices[deviceNumber].refCount == 1 {
modification := &hcsschema.ModifySettingRequest{
RequestType: requesttype.Remove,
ResourcePath: fmt.Sprintf("VirtualMachine/Devices/VirtualPMem/Devices/%d", deviceN... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"removeVPMEM",
"(",
"hostPath",
"string",
",",
"uvmPath",
"string",
",",
"deviceNumber",
"uint32",
")",
"error",
"{",
"if",
"uvm",
".",
"vpmemDevices",
"[",
"deviceNumber",
"]",
".",
"refCount",
"==",
"1",
"{",
... | // removeVPMEM is the internally callable "unsafe" version of RemoveVPMEM. The mutex
// MUST be held when calling this function. | [
"removeVPMEM",
"is",
"the",
"internally",
"callable",
"unsafe",
"version",
"of",
"RemoveVPMEM",
".",
"The",
"mutex",
"MUST",
"be",
"held",
"when",
"calling",
"this",
"function",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/vpmem.go#L188-L212 |
143,670 | Microsoft/hcsshim | internal/ociwclayer/export.go | ExportLayer | func ExportLayer(w io.Writer, path string, parentLayerPaths []string) error {
err := hcsshim.ActivateLayer(driverInfo, path)
if err != nil {
return err
}
defer hcsshim.DeactivateLayer(driverInfo, path)
// Prepare and unprepare the layer to ensure that it has been initialized.
err = hcsshim.PrepareLayer(driverI... | go | func ExportLayer(w io.Writer, path string, parentLayerPaths []string) error {
err := hcsshim.ActivateLayer(driverInfo, path)
if err != nil {
return err
}
defer hcsshim.DeactivateLayer(driverInfo, path)
// Prepare and unprepare the layer to ensure that it has been initialized.
err = hcsshim.PrepareLayer(driverI... | [
"func",
"ExportLayer",
"(",
"w",
"io",
".",
"Writer",
",",
"path",
"string",
",",
"parentLayerPaths",
"[",
"]",
"string",
")",
"error",
"{",
"err",
":=",
"hcsshim",
".",
"ActivateLayer",
"(",
"driverInfo",
",",
"path",
")",
"\n",
"if",
"err",
"!=",
"ni... | // ExportLayer writes an OCI layer tar stream from the provided on-disk layer.
// The caller must specify the parent layers, if any, ordered from lowest to
// highest layer.
//
// The layer will be mounted for this process, so the caller should ensure that
// it is not currently mounted. | [
"ExportLayer",
"writes",
"an",
"OCI",
"layer",
"tar",
"stream",
"from",
"the",
"provided",
"on",
"-",
"disk",
"layer",
".",
"The",
"caller",
"must",
"specify",
"the",
"parent",
"layers",
"if",
"any",
"ordered",
"from",
"lowest",
"to",
"highest",
"layer",
"... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/ociwclayer/export.go#L22-L50 |
143,671 | Microsoft/hcsshim | internal/uvm/modify.go | Modify | func (uvm *UtilityVM) Modify(hcsModificationDocument interface{}) (err error) {
op := "uvm::Modify"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - End Operation - Er... | go | func (uvm *UtilityVM) Modify(hcsModificationDocument interface{}) (err error) {
op := "uvm::Modify"
log := logrus.WithFields(logrus.Fields{
logfields.UVMID: uvm.id,
})
log.Debug(op + " - Begin Operation")
defer func() {
if err != nil {
log.Data[logrus.ErrorKey] = err
log.Error(op + " - End Operation - Er... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"Modify",
"(",
"hcsModificationDocument",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"log",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
... | // Modify modifies the compute system by sending a request to HCS. | [
"Modify",
"modifies",
"the",
"compute",
"system",
"by",
"sending",
"a",
"request",
"to",
"HCS",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/modify.go#L9-L25 |
143,672 | Microsoft/hcsshim | internal/uvm/wait.go | Wait | func (uvm *UtilityVM) Wait() error {
err := uvm.hcsSystem.Wait()
// outputProcessingCancel will only cancel waiting for the vsockexec
// connection, it won't stop output processing once the connection is
// established.
if uvm.outputProcessingCancel != nil {
uvm.outputProcessingCancel()
}
uvm.waitForOutput()
... | go | func (uvm *UtilityVM) Wait() error {
err := uvm.hcsSystem.Wait()
// outputProcessingCancel will only cancel waiting for the vsockexec
// connection, it won't stop output processing once the connection is
// established.
if uvm.outputProcessingCancel != nil {
uvm.outputProcessingCancel()
}
uvm.waitForOutput()
... | [
"func",
"(",
"uvm",
"*",
"UtilityVM",
")",
"Wait",
"(",
")",
"error",
"{",
"err",
":=",
"uvm",
".",
"hcsSystem",
".",
"Wait",
"(",
")",
"\n\n",
"// outputProcessingCancel will only cancel waiting for the vsockexec",
"// connection, it won't stop output processing once the... | // Wait waits synchronously for a utility VM to terminate. | [
"Wait",
"waits",
"synchronously",
"for",
"a",
"utility",
"VM",
"to",
"terminate",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/wait.go#L17-L29 |
143,673 | Microsoft/hcsshim | internal/oci/uvm.go | parseAnnotationsBool | func parseAnnotationsBool(a map[string]string, key string, def bool) bool {
if v, ok := a[key]; ok {
switch strings.ToLower(v) {
case "true":
return true
case "false":
return false
default:
logrus.WithFields(logrus.Fields{
logfields.OCIAnnotation: key,
logfields.Value: v,
logfields... | go | func parseAnnotationsBool(a map[string]string, key string, def bool) bool {
if v, ok := a[key]; ok {
switch strings.ToLower(v) {
case "true":
return true
case "false":
return false
default:
logrus.WithFields(logrus.Fields{
logfields.OCIAnnotation: key,
logfields.Value: v,
logfields... | [
"func",
"parseAnnotationsBool",
"(",
"a",
"map",
"[",
"string",
"]",
"string",
",",
"key",
"string",
",",
"def",
"bool",
")",
"bool",
"{",
"if",
"v",
",",
"ok",
":=",
"a",
"[",
"key",
"]",
";",
"ok",
"{",
"switch",
"strings",
".",
"ToLower",
"(",
... | // parseAnnotationsBool searches `a` for `key` and if found verifies that the
// value is `true` or `false` in any case. If `key` is not found returns `def`. | [
"parseAnnotationsBool",
"searches",
"a",
"for",
"key",
"and",
"if",
"found",
"verifies",
"that",
"the",
"value",
"is",
"true",
"or",
"false",
"in",
"any",
"case",
".",
"If",
"key",
"is",
"not",
"found",
"returns",
"def",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L120-L136 |
143,674 | Microsoft/hcsshim | internal/oci/uvm.go | ParseAnnotationsCPUCount | func ParseAnnotationsCPUCount(s *specs.Spec, annotation string, def int32) int32 {
if m := parseAnnotationsUint64(s.Annotations, annotation, 0); m != 0 {
return int32(m)
}
if s.Windows != nil &&
s.Windows.Resources != nil &&
s.Windows.Resources.CPU != nil &&
s.Windows.Resources.CPU.Count != nil &&
*s.Windo... | go | func ParseAnnotationsCPUCount(s *specs.Spec, annotation string, def int32) int32 {
if m := parseAnnotationsUint64(s.Annotations, annotation, 0); m != 0 {
return int32(m)
}
if s.Windows != nil &&
s.Windows.Resources != nil &&
s.Windows.Resources.CPU != nil &&
s.Windows.Resources.CPU.Count != nil &&
*s.Windo... | [
"func",
"ParseAnnotationsCPUCount",
"(",
"s",
"*",
"specs",
".",
"Spec",
",",
"annotation",
"string",
",",
"def",
"int32",
")",
"int32",
"{",
"if",
"m",
":=",
"parseAnnotationsUint64",
"(",
"s",
".",
"Annotations",
",",
"annotation",
",",
"0",
")",
";",
... | // ParseAnnotationsCPUCount searches `s.Annotations` for the CPU annotation. If
// not found searches `s` for the Windows CPU section. If neither are found
// returns `def`. | [
"ParseAnnotationsCPUCount",
"searches",
"s",
".",
"Annotations",
"for",
"the",
"CPU",
"annotation",
".",
"If",
"not",
"found",
"searches",
"s",
"for",
"the",
"Windows",
"CPU",
"section",
".",
"If",
"neither",
"are",
"found",
"returns",
"def",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L141-L153 |
143,675 | Microsoft/hcsshim | internal/oci/uvm.go | ParseAnnotationsCPULimit | func ParseAnnotationsCPULimit(s *specs.Spec, annotation string, def int32) int32 {
if m := parseAnnotationsUint64(s.Annotations, annotation, 0); m != 0 {
return int32(m)
}
if s.Windows != nil &&
s.Windows.Resources != nil &&
s.Windows.Resources.CPU != nil &&
s.Windows.Resources.CPU.Maximum != nil &&
*s.Win... | go | func ParseAnnotationsCPULimit(s *specs.Spec, annotation string, def int32) int32 {
if m := parseAnnotationsUint64(s.Annotations, annotation, 0); m != 0 {
return int32(m)
}
if s.Windows != nil &&
s.Windows.Resources != nil &&
s.Windows.Resources.CPU != nil &&
s.Windows.Resources.CPU.Maximum != nil &&
*s.Win... | [
"func",
"ParseAnnotationsCPULimit",
"(",
"s",
"*",
"specs",
".",
"Spec",
",",
"annotation",
"string",
",",
"def",
"int32",
")",
"int32",
"{",
"if",
"m",
":=",
"parseAnnotationsUint64",
"(",
"s",
".",
"Annotations",
",",
"annotation",
",",
"0",
")",
";",
... | // ParseAnnotationsCPULimit searches `s.Annotations` for the CPU annotation. If
// not found searches `s` for the Windows CPU section. If neither are found
// returns `def`. | [
"ParseAnnotationsCPULimit",
"searches",
"s",
".",
"Annotations",
"for",
"the",
"CPU",
"annotation",
".",
"If",
"not",
"found",
"searches",
"s",
"for",
"the",
"Windows",
"CPU",
"section",
".",
"If",
"neither",
"are",
"found",
"returns",
"def",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L158-L170 |
143,676 | Microsoft/hcsshim | internal/oci/uvm.go | ParseAnnotationsCPUWeight | func ParseAnnotationsCPUWeight(s *specs.Spec, annotation string, def int32) int32 {
if m := parseAnnotationsUint64(s.Annotations, annotation, 0); m != 0 {
return int32(m)
}
if s.Windows != nil &&
s.Windows.Resources != nil &&
s.Windows.Resources.CPU != nil &&
s.Windows.Resources.CPU.Shares != nil &&
*s.Win... | go | func ParseAnnotationsCPUWeight(s *specs.Spec, annotation string, def int32) int32 {
if m := parseAnnotationsUint64(s.Annotations, annotation, 0); m != 0 {
return int32(m)
}
if s.Windows != nil &&
s.Windows.Resources != nil &&
s.Windows.Resources.CPU != nil &&
s.Windows.Resources.CPU.Shares != nil &&
*s.Win... | [
"func",
"ParseAnnotationsCPUWeight",
"(",
"s",
"*",
"specs",
".",
"Spec",
",",
"annotation",
"string",
",",
"def",
"int32",
")",
"int32",
"{",
"if",
"m",
":=",
"parseAnnotationsUint64",
"(",
"s",
".",
"Annotations",
",",
"annotation",
",",
"0",
")",
";",
... | // ParseAnnotationsCPUWeight searches `s.Annotations` for the CPU annotation. If
// not found searches `s` for the Windows CPU section. If neither are found
// returns `def`. | [
"ParseAnnotationsCPUWeight",
"searches",
"s",
".",
"Annotations",
"for",
"the",
"CPU",
"annotation",
".",
"If",
"not",
"found",
"searches",
"s",
"for",
"the",
"Windows",
"CPU",
"section",
".",
"If",
"neither",
"are",
"found",
"returns",
"def",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L175-L187 |
143,677 | Microsoft/hcsshim | internal/oci/uvm.go | ParseAnnotationsStorageIops | func ParseAnnotationsStorageIops(s *specs.Spec, annotation string, def int32) int32 {
if m := parseAnnotationsUint64(s.Annotations, annotation, 0); m != 0 {
return int32(m)
}
if s.Windows != nil &&
s.Windows.Resources != nil &&
s.Windows.Resources.Storage != nil &&
s.Windows.Resources.Storage.Iops != nil &&
... | go | func ParseAnnotationsStorageIops(s *specs.Spec, annotation string, def int32) int32 {
if m := parseAnnotationsUint64(s.Annotations, annotation, 0); m != 0 {
return int32(m)
}
if s.Windows != nil &&
s.Windows.Resources != nil &&
s.Windows.Resources.Storage != nil &&
s.Windows.Resources.Storage.Iops != nil &&
... | [
"func",
"ParseAnnotationsStorageIops",
"(",
"s",
"*",
"specs",
".",
"Spec",
",",
"annotation",
"string",
",",
"def",
"int32",
")",
"int32",
"{",
"if",
"m",
":=",
"parseAnnotationsUint64",
"(",
"s",
".",
"Annotations",
",",
"annotation",
",",
"0",
")",
";",... | // ParseAnnotationsStorageIops searches `s.Annotations` for the `Iops`
// annotation. If not found searches `s` for the Windows Storage section. If
// neither are found returns `def`. | [
"ParseAnnotationsStorageIops",
"searches",
"s",
".",
"Annotations",
"for",
"the",
"Iops",
"annotation",
".",
"If",
"not",
"found",
"searches",
"s",
"for",
"the",
"Windows",
"Storage",
"section",
".",
"If",
"neither",
"are",
"found",
"returns",
"def",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L192-L204 |
143,678 | Microsoft/hcsshim | internal/oci/uvm.go | ParseAnnotationsStorageBps | func ParseAnnotationsStorageBps(s *specs.Spec, annotation string, def int32) int32 {
if m := parseAnnotationsUint64(s.Annotations, annotation, 0); m != 0 {
return int32(m)
}
if s.Windows != nil &&
s.Windows.Resources != nil &&
s.Windows.Resources.Storage != nil &&
s.Windows.Resources.Storage.Bps != nil &&
... | go | func ParseAnnotationsStorageBps(s *specs.Spec, annotation string, def int32) int32 {
if m := parseAnnotationsUint64(s.Annotations, annotation, 0); m != 0 {
return int32(m)
}
if s.Windows != nil &&
s.Windows.Resources != nil &&
s.Windows.Resources.Storage != nil &&
s.Windows.Resources.Storage.Bps != nil &&
... | [
"func",
"ParseAnnotationsStorageBps",
"(",
"s",
"*",
"specs",
".",
"Spec",
",",
"annotation",
"string",
",",
"def",
"int32",
")",
"int32",
"{",
"if",
"m",
":=",
"parseAnnotationsUint64",
"(",
"s",
".",
"Annotations",
",",
"annotation",
",",
"0",
")",
";",
... | // ParseAnnotationsStorageBps searches `s.Annotations` for the `Bps` annotation.
// If not found searches `s` for the Windows Storage section. If neither are
// found returns `def`. | [
"ParseAnnotationsStorageBps",
"searches",
"s",
".",
"Annotations",
"for",
"the",
"Bps",
"annotation",
".",
"If",
"not",
"found",
"searches",
"s",
"for",
"the",
"Windows",
"Storage",
"section",
".",
"If",
"neither",
"are",
"found",
"returns",
"def",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L209-L221 |
143,679 | Microsoft/hcsshim | internal/oci/uvm.go | parseAnnotationsPreferredRootFSType | func parseAnnotationsPreferredRootFSType(a map[string]string, key string, def uvm.PreferredRootFSType) uvm.PreferredRootFSType {
if v, ok := a[key]; ok {
switch v {
case "initrd":
return uvm.PreferredRootFSTypeInitRd
case "vhd":
return uvm.PreferredRootFSTypeVHD
default:
logrus.Warningf("annotation: '... | go | func parseAnnotationsPreferredRootFSType(a map[string]string, key string, def uvm.PreferredRootFSType) uvm.PreferredRootFSType {
if v, ok := a[key]; ok {
switch v {
case "initrd":
return uvm.PreferredRootFSTypeInitRd
case "vhd":
return uvm.PreferredRootFSTypeVHD
default:
logrus.Warningf("annotation: '... | [
"func",
"parseAnnotationsPreferredRootFSType",
"(",
"a",
"map",
"[",
"string",
"]",
"string",
",",
"key",
"string",
",",
"def",
"uvm",
".",
"PreferredRootFSType",
")",
"uvm",
".",
"PreferredRootFSType",
"{",
"if",
"v",
",",
"ok",
":=",
"a",
"[",
"key",
"]"... | // parseAnnotationsPreferredRootFSType searches `a` for `key` and verifies that the
// value is in the set of allowed values. If `key` is not found returns `def`. | [
"parseAnnotationsPreferredRootFSType",
"searches",
"a",
"for",
"key",
"and",
"verifies",
"that",
"the",
"value",
"is",
"in",
"the",
"set",
"of",
"allowed",
"values",
".",
"If",
"key",
"is",
"not",
"found",
"returns",
"def",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L244-L256 |
143,680 | Microsoft/hcsshim | internal/oci/uvm.go | parseAnnotationsUint32 | func parseAnnotationsUint32(a map[string]string, key string, def uint32) uint32 {
if v, ok := a[key]; ok {
countu, err := strconv.ParseUint(v, 10, 32)
if err == nil {
v := uint32(countu)
return v
}
logrus.WithFields(logrus.Fields{
logfields.OCIAnnotation: key,
logfields.Value: v,
logfiel... | go | func parseAnnotationsUint32(a map[string]string, key string, def uint32) uint32 {
if v, ok := a[key]; ok {
countu, err := strconv.ParseUint(v, 10, 32)
if err == nil {
v := uint32(countu)
return v
}
logrus.WithFields(logrus.Fields{
logfields.OCIAnnotation: key,
logfields.Value: v,
logfiel... | [
"func",
"parseAnnotationsUint32",
"(",
"a",
"map",
"[",
"string",
"]",
"string",
",",
"key",
"string",
",",
"def",
"uint32",
")",
"uint32",
"{",
"if",
"v",
",",
"ok",
":=",
"a",
"[",
"key",
"]",
";",
"ok",
"{",
"countu",
",",
"err",
":=",
"strconv"... | // parseAnnotationsUint32 searches `a` for `key` and if found verifies that the
// value is a 32 bit unsigned integer. If `key` is not found returns `def`. | [
"parseAnnotationsUint32",
"searches",
"a",
"for",
"key",
"and",
"if",
"found",
"verifies",
"that",
"the",
"value",
"is",
"a",
"32",
"bit",
"unsigned",
"integer",
".",
"If",
"key",
"is",
"not",
"found",
"returns",
"def",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L260-L275 |
143,681 | Microsoft/hcsshim | internal/oci/uvm.go | parseAnnotationsUint64 | func parseAnnotationsUint64(a map[string]string, key string, def uint64) uint64 {
if v, ok := a[key]; ok {
countu, err := strconv.ParseUint(v, 10, 64)
if err == nil {
return countu
}
logrus.WithFields(logrus.Fields{
logfields.OCIAnnotation: key,
logfields.Value: v,
logfields.ExpectedType: ... | go | func parseAnnotationsUint64(a map[string]string, key string, def uint64) uint64 {
if v, ok := a[key]; ok {
countu, err := strconv.ParseUint(v, 10, 64)
if err == nil {
return countu
}
logrus.WithFields(logrus.Fields{
logfields.OCIAnnotation: key,
logfields.Value: v,
logfields.ExpectedType: ... | [
"func",
"parseAnnotationsUint64",
"(",
"a",
"map",
"[",
"string",
"]",
"string",
",",
"key",
"string",
",",
"def",
"uint64",
")",
"uint64",
"{",
"if",
"v",
",",
"ok",
":=",
"a",
"[",
"key",
"]",
";",
"ok",
"{",
"countu",
",",
"err",
":=",
"strconv"... | // parseAnnotationsUint64 searches `a` for `key` and if found verifies that the
// value is a 64 bit unsigned integer. If `key` is not found returns `def`. | [
"parseAnnotationsUint64",
"searches",
"a",
"for",
"key",
"and",
"if",
"found",
"verifies",
"that",
"the",
"value",
"is",
"a",
"64",
"bit",
"unsigned",
"integer",
".",
"If",
"key",
"is",
"not",
"found",
"returns",
"def",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L279-L293 |
143,682 | Microsoft/hcsshim | internal/oci/uvm.go | parseAnnotationsString | func parseAnnotationsString(a map[string]string, key string, def string) string {
if v, ok := a[key]; ok {
return v
}
return def
} | go | func parseAnnotationsString(a map[string]string, key string, def string) string {
if v, ok := a[key]; ok {
return v
}
return def
} | [
"func",
"parseAnnotationsString",
"(",
"a",
"map",
"[",
"string",
"]",
"string",
",",
"key",
"string",
",",
"def",
"string",
")",
"string",
"{",
"if",
"v",
",",
"ok",
":=",
"a",
"[",
"key",
"]",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"re... | // parseAnnotationsString searches `a` for `key`. If `key` is not found returns `def`. | [
"parseAnnotationsString",
"searches",
"a",
"for",
"key",
".",
"If",
"key",
"is",
"not",
"found",
"returns",
"def",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L296-L301 |
143,683 | Microsoft/hcsshim | internal/oci/uvm.go | UpdateSpecFromOptions | func UpdateSpecFromOptions(s specs.Spec, opts *runhcsopts.Options) specs.Spec {
if opts != nil && opts.BootFilesRootPath != "" {
s.Annotations[annotationBootFilesRootPath] = opts.BootFilesRootPath
}
return s
} | go | func UpdateSpecFromOptions(s specs.Spec, opts *runhcsopts.Options) specs.Spec {
if opts != nil && opts.BootFilesRootPath != "" {
s.Annotations[annotationBootFilesRootPath] = opts.BootFilesRootPath
}
return s
} | [
"func",
"UpdateSpecFromOptions",
"(",
"s",
"specs",
".",
"Spec",
",",
"opts",
"*",
"runhcsopts",
".",
"Options",
")",
"specs",
".",
"Spec",
"{",
"if",
"opts",
"!=",
"nil",
"&&",
"opts",
".",
"BootFilesRootPath",
"!=",
"\"",
"\"",
"{",
"s",
".",
"Annota... | // UpdateSpecFromOptions sets extra annotations on the OCI spec based on the
// `opts` struct. | [
"UpdateSpecFromOptions",
"sets",
"extra",
"annotations",
"on",
"the",
"OCI",
"spec",
"based",
"on",
"the",
"opts",
"struct",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/oci/uvm.go#L347-L353 |
143,684 | Microsoft/hcsshim | internal/uvm/create_lcow.go | defaultLCOWOSBootFilesPath | func defaultLCOWOSBootFilesPath() string {
localDirPath := filepath.Join(filepath.Dir(os.Args[0]), "LinuxBootFiles")
if _, err := os.Stat(localDirPath); err == nil {
return localDirPath
}
return filepath.Join(os.Getenv("ProgramFiles"), "Linux Containers")
} | go | func defaultLCOWOSBootFilesPath() string {
localDirPath := filepath.Join(filepath.Dir(os.Args[0]), "LinuxBootFiles")
if _, err := os.Stat(localDirPath); err == nil {
return localDirPath
}
return filepath.Join(os.Getenv("ProgramFiles"), "Linux Containers")
} | [
"func",
"defaultLCOWOSBootFilesPath",
"(",
")",
"string",
"{",
"localDirPath",
":=",
"filepath",
".",
"Join",
"(",
"filepath",
".",
"Dir",
"(",
"os",
".",
"Args",
"[",
"0",
"]",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"os",
".... | // defaultLCOWOSBootFilesPath returns the default path used to locate the LCOW
// OS kernel and root FS files. This default is the subdirectory
// `LinuxBootFiles` in the directory of the executable that started the current
// process; or, if it does not exist, `%ProgramFiles%\Linux Containers`. | [
"defaultLCOWOSBootFilesPath",
"returns",
"the",
"default",
"path",
"used",
"to",
"locate",
"the",
"LCOW",
"OS",
"kernel",
"and",
"root",
"FS",
"files",
".",
"This",
"default",
"is",
"the",
"subdirectory",
"LinuxBootFiles",
"in",
"the",
"directory",
"of",
"the",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/create_lcow.go#L69-L75 |
143,685 | Microsoft/hcsshim | internal/uvm/create_lcow.go | NewDefaultOptionsLCOW | func NewDefaultOptionsLCOW(id, owner string) *OptionsLCOW {
// Use KernelDirect boot by default on all builds that support it.
kernelDirectSupported := osversion.Get().Build >= 18286
opts := &OptionsLCOW{
Options: newDefaultOptions(id, owner),
BootFilesPath: defaultLCOWOSBootFilesPath(),
... | go | func NewDefaultOptionsLCOW(id, owner string) *OptionsLCOW {
// Use KernelDirect boot by default on all builds that support it.
kernelDirectSupported := osversion.Get().Build >= 18286
opts := &OptionsLCOW{
Options: newDefaultOptions(id, owner),
BootFilesPath: defaultLCOWOSBootFilesPath(),
... | [
"func",
"NewDefaultOptionsLCOW",
"(",
"id",
",",
"owner",
"string",
")",
"*",
"OptionsLCOW",
"{",
"// Use KernelDirect boot by default on all builds that support it.",
"kernelDirectSupported",
":=",
"osversion",
".",
"Get",
"(",
")",
".",
"Build",
">=",
"18286",
"\n",
... | // NewDefaultOptionsLCOW creates the default options for a bootable version of
// LCOW.
//
// `id` the ID of the compute system. If not passed will generate a new GUID.
//
// `owner` the owner of the compute system. If not passed will use the
// executable files name. | [
"NewDefaultOptionsLCOW",
"creates",
"the",
"default",
"options",
"for",
"a",
"bootable",
"version",
"of",
"LCOW",
".",
"id",
"the",
"ID",
"of",
"the",
"compute",
"system",
".",
"If",
"not",
"passed",
"will",
"generate",
"a",
"new",
"GUID",
".",
"owner",
"t... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/create_lcow.go#L84-L123 |
143,686 | Microsoft/hcsshim | internal/wclayer/legacy.go | newLegacyLayerReader | func newLegacyLayerReader(root string) *legacyLayerReader {
r := &legacyLayerReader{
root: root,
result: make(chan *fileEntry),
proceed: make(chan bool),
}
go r.walk()
return r
} | go | func newLegacyLayerReader(root string) *legacyLayerReader {
r := &legacyLayerReader{
root: root,
result: make(chan *fileEntry),
proceed: make(chan bool),
}
go r.walk()
return r
} | [
"func",
"newLegacyLayerReader",
"(",
"root",
"string",
")",
"*",
"legacyLayerReader",
"{",
"r",
":=",
"&",
"legacyLayerReader",
"{",
"root",
":",
"root",
",",
"result",
":",
"make",
"(",
"chan",
"*",
"fileEntry",
")",
",",
"proceed",
":",
"make",
"(",
"c... | // newLegacyLayerReader returns a new LayerReader that can read the Windows
// container layer transport format from disk. | [
"newLegacyLayerReader",
"returns",
"a",
"new",
"LayerReader",
"that",
"can",
"read",
"the",
"Windows",
"container",
"layer",
"transport",
"format",
"from",
"disk",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/legacy.go#L60-L68 |
143,687 | Microsoft/hcsshim | internal/wclayer/legacy.go | newLegacyLayerWriter | func newLegacyLayerWriter(root string, parentRoots []string, destRoot string) (w *legacyLayerWriter, err error) {
w = &legacyLayerWriter{
addedFiles: make(map[string]bool),
}
defer func() {
if err != nil {
w.CloseRoots()
w = nil
}
}()
w.root, err = safefile.OpenRoot(root)
if err != nil {
return
}
... | go | func newLegacyLayerWriter(root string, parentRoots []string, destRoot string) (w *legacyLayerWriter, err error) {
w = &legacyLayerWriter{
addedFiles: make(map[string]bool),
}
defer func() {
if err != nil {
w.CloseRoots()
w = nil
}
}()
w.root, err = safefile.OpenRoot(root)
if err != nil {
return
}
... | [
"func",
"newLegacyLayerWriter",
"(",
"root",
"string",
",",
"parentRoots",
"[",
"]",
"string",
",",
"destRoot",
"string",
")",
"(",
"w",
"*",
"legacyLayerWriter",
",",
"err",
"error",
")",
"{",
"w",
"=",
"&",
"legacyLayerWriter",
"{",
"addedFiles",
":",
"m... | // newLegacyLayerWriter returns a LayerWriter that can write the contaler layer
// transport format to disk. | [
"newLegacyLayerWriter",
"returns",
"a",
"LayerWriter",
"that",
"can",
"write",
"the",
"contaler",
"layer",
"transport",
"format",
"to",
"disk",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/legacy.go#L353-L380 |
143,688 | Microsoft/hcsshim | internal/wclayer/legacy.go | cloneTree | func cloneTree(srcRoot *os.File, destRoot *os.File, subPath string, mutatedFiles map[string]bool) error {
var di []dirInfo
err := safefile.EnsureNotReparsePointRelative(subPath, srcRoot)
if err != nil {
return err
}
err = filepath.Walk(filepath.Join(srcRoot.Name(), subPath), func(srcFilePath string, info os.File... | go | func cloneTree(srcRoot *os.File, destRoot *os.File, subPath string, mutatedFiles map[string]bool) error {
var di []dirInfo
err := safefile.EnsureNotReparsePointRelative(subPath, srcRoot)
if err != nil {
return err
}
err = filepath.Walk(filepath.Join(srcRoot.Name(), subPath), func(srcFilePath string, info os.File... | [
"func",
"cloneTree",
"(",
"srcRoot",
"*",
"os",
".",
"File",
",",
"destRoot",
"*",
"os",
".",
"File",
",",
"subPath",
"string",
",",
"mutatedFiles",
"map",
"[",
"string",
"]",
"bool",
")",
"error",
"{",
"var",
"di",
"[",
"]",
"dirInfo",
"\n",
"err",
... | // cloneTree clones a directory tree using hard links. It skips hard links for
// the file names in the provided map and just copies those files. | [
"cloneTree",
"clones",
"a",
"directory",
"tree",
"using",
"hard",
"links",
".",
"It",
"skips",
"hard",
"links",
"for",
"the",
"file",
"names",
"in",
"the",
"provided",
"map",
"and",
"just",
"copies",
"those",
"files",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/legacy.go#L528-L575 |
143,689 | Microsoft/hcsshim | hcn/hcnglobals.go | GetGlobals | func GetGlobals() (*Globals, error) {
var version Version
err := hnsCall("GET", "/globals/version", "", &version)
if err != nil {
return nil, err
}
globals := &Globals{
Version: version,
}
return globals, nil
} | go | func GetGlobals() (*Globals, error) {
var version Version
err := hnsCall("GET", "/globals/version", "", &version)
if err != nil {
return nil, err
}
globals := &Globals{
Version: version,
}
return globals, nil
} | [
"func",
"GetGlobals",
"(",
")",
"(",
"*",
"Globals",
",",
"error",
")",
"{",
"var",
"version",
"Version",
"\n",
"err",
":=",
"hnsCall",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"&",
"version",
")",
"\n",
"if",
"err",
"!=",
"nil",
... | // GetGlobals returns the global properties of the HCN Service. | [
"GetGlobals",
"returns",
"the",
"global",
"properties",
"of",
"the",
"HCN",
"Service",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnglobals.go#L37-L49 |
143,690 | Microsoft/hcsshim | internal/hns/hnsendpoint.go | HNSListEndpointRequest | func HNSListEndpointRequest() ([]HNSEndpoint, error) {
var endpoint []HNSEndpoint
err := hnsCall("GET", "/endpoints/", "", &endpoint)
if err != nil {
return nil, err
}
return endpoint, nil
} | go | func HNSListEndpointRequest() ([]HNSEndpoint, error) {
var endpoint []HNSEndpoint
err := hnsCall("GET", "/endpoints/", "", &endpoint)
if err != nil {
return nil, err
}
return endpoint, nil
} | [
"func",
"HNSListEndpointRequest",
"(",
")",
"(",
"[",
"]",
"HNSEndpoint",
",",
"error",
")",
"{",
"var",
"endpoint",
"[",
"]",
"HNSEndpoint",
"\n",
"err",
":=",
"hnsCall",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"&",
"endpoint",
")",
... | // HNSListEndpointRequest makes a HNS call to query the list of available endpoints | [
"HNSListEndpointRequest",
"makes",
"a",
"HNS",
"call",
"to",
"query",
"the",
"list",
"of",
"available",
"endpoints"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnsendpoint.go#L69-L77 |
143,691 | Microsoft/hcsshim | internal/hns/hnsendpoint.go | GetHNSEndpointByName | func GetHNSEndpointByName(endpointName string) (*HNSEndpoint, error) {
hnsResponse, err := HNSListEndpointRequest()
if err != nil {
return nil, err
}
for _, hnsEndpoint := range hnsResponse {
if hnsEndpoint.Name == endpointName {
return &hnsEndpoint, nil
}
}
return nil, EndpointNotFoundError{EndpointName... | go | func GetHNSEndpointByName(endpointName string) (*HNSEndpoint, error) {
hnsResponse, err := HNSListEndpointRequest()
if err != nil {
return nil, err
}
for _, hnsEndpoint := range hnsResponse {
if hnsEndpoint.Name == endpointName {
return &hnsEndpoint, nil
}
}
return nil, EndpointNotFoundError{EndpointName... | [
"func",
"GetHNSEndpointByName",
"(",
"endpointName",
"string",
")",
"(",
"*",
"HNSEndpoint",
",",
"error",
")",
"{",
"hnsResponse",
",",
"err",
":=",
"HNSListEndpointRequest",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n"... | // GetHNSEndpointByName gets the endpoint filtered by Name | [
"GetHNSEndpointByName",
"gets",
"the",
"endpoint",
"filtered",
"by",
"Name"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnsendpoint.go#L85-L96 |
143,692 | Microsoft/hcsshim | internal/hns/hnsendpoint.go | Delete | func (endpoint *HNSEndpoint) Delete() (*HNSEndpoint, error) {
operation := "Delete"
title := "hcsshim::HNSEndpoint::" + operation
logrus.Debugf(title+" id=%s", endpoint.Id)
return HNSEndpointRequest("DELETE", endpoint.Id, "")
} | go | func (endpoint *HNSEndpoint) Delete() (*HNSEndpoint, error) {
operation := "Delete"
title := "hcsshim::HNSEndpoint::" + operation
logrus.Debugf(title+" id=%s", endpoint.Id)
return HNSEndpointRequest("DELETE", endpoint.Id, "")
} | [
"func",
"(",
"endpoint",
"*",
"HNSEndpoint",
")",
"Delete",
"(",
")",
"(",
"*",
"HNSEndpoint",
",",
"error",
")",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"title",
":=",
"\"",
"\"",
"+",
"operation",
"\n",
"logrus",
".",
"Debugf",
"(",
"title",
"+",... | // Delete Endpoint by sending EndpointRequest to HNS | [
"Delete",
"Endpoint",
"by",
"sending",
"EndpointRequest",
"to",
"HNS"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnsendpoint.go#L133-L139 |
143,693 | Microsoft/hcsshim | internal/hns/hnsendpoint.go | ApplyACLPolicy | func (endpoint *HNSEndpoint) ApplyACLPolicy(policies ...*ACLPolicy) error {
operation := "ApplyACLPolicy"
title := "hcsshim::HNSEndpoint::" + operation
logrus.Debugf(title+" id=%s", endpoint.Id)
for _, policy := range policies {
if policy == nil {
continue
}
jsonString, err := json.Marshal(policy)
if er... | go | func (endpoint *HNSEndpoint) ApplyACLPolicy(policies ...*ACLPolicy) error {
operation := "ApplyACLPolicy"
title := "hcsshim::HNSEndpoint::" + operation
logrus.Debugf(title+" id=%s", endpoint.Id)
for _, policy := range policies {
if policy == nil {
continue
}
jsonString, err := json.Marshal(policy)
if er... | [
"func",
"(",
"endpoint",
"*",
"HNSEndpoint",
")",
"ApplyACLPolicy",
"(",
"policies",
"...",
"*",
"ACLPolicy",
")",
"error",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"title",
":=",
"\"",
"\"",
"+",
"operation",
"\n",
"logrus",
".",
"Debugf",
"(",
"title"... | // ApplyACLPolicy applies a set of ACL Policies on the Endpoint | [
"ApplyACLPolicy",
"applies",
"a",
"set",
"of",
"ACL",
"Policies",
"on",
"the",
"Endpoint"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnsendpoint.go#L156-L174 |
143,694 | Microsoft/hcsshim | internal/hns/hnsendpoint.go | ContainerAttach | func (endpoint *HNSEndpoint) ContainerAttach(containerID string, compartmentID uint16) error {
operation := "ContainerAttach"
title := "hcsshim::HNSEndpoint::" + operation
logrus.Debugf(title+" id=%s", endpoint.Id)
requestMessage := &EndpointAttachDetachRequest{
ContainerID: containerID,
CompartmentID: compa... | go | func (endpoint *HNSEndpoint) ContainerAttach(containerID string, compartmentID uint16) error {
operation := "ContainerAttach"
title := "hcsshim::HNSEndpoint::" + operation
logrus.Debugf(title+" id=%s", endpoint.Id)
requestMessage := &EndpointAttachDetachRequest{
ContainerID: containerID,
CompartmentID: compa... | [
"func",
"(",
"endpoint",
"*",
"HNSEndpoint",
")",
"ContainerAttach",
"(",
"containerID",
"string",
",",
"compartmentID",
"uint16",
")",
"error",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"title",
":=",
"\"",
"\"",
"+",
"operation",
"\n",
"logrus",
".",
"De... | // ContainerAttach attaches an endpoint to container | [
"ContainerAttach",
"attaches",
"an",
"endpoint",
"to",
"container"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnsendpoint.go#L177-L193 |
143,695 | Microsoft/hcsshim | internal/hns/hnsendpoint.go | HostAttach | func (endpoint *HNSEndpoint) HostAttach(compartmentID uint16) error {
operation := "HostAttach"
title := "hcsshim::HNSEndpoint::" + operation
logrus.Debugf(title+" id=%s", endpoint.Id)
requestMessage := &EndpointAttachDetachRequest{
CompartmentID: compartmentID,
SystemType: HostType,
}
response := &Endpoin... | go | func (endpoint *HNSEndpoint) HostAttach(compartmentID uint16) error {
operation := "HostAttach"
title := "hcsshim::HNSEndpoint::" + operation
logrus.Debugf(title+" id=%s", endpoint.Id)
requestMessage := &EndpointAttachDetachRequest{
CompartmentID: compartmentID,
SystemType: HostType,
}
response := &Endpoin... | [
"func",
"(",
"endpoint",
"*",
"HNSEndpoint",
")",
"HostAttach",
"(",
"compartmentID",
"uint16",
")",
"error",
"{",
"operation",
":=",
"\"",
"\"",
"\n",
"title",
":=",
"\"",
"\"",
"+",
"operation",
"\n",
"logrus",
".",
"Debugf",
"(",
"title",
"+",
"\"",
... | // HostAttach attaches a nic on the host | [
"HostAttach",
"attaches",
"a",
"nic",
"on",
"the",
"host"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/hns/hnsendpoint.go#L215-L231 |
143,696 | Microsoft/hcsshim | hcn/hcnsupport.go | GetSupportedFeatures | func GetSupportedFeatures() SupportedFeatures {
var features SupportedFeatures
globals, err := GetGlobals()
if err != nil {
// Expected on pre-1803 builds, all features will be false/unsupported
logrus.Debugf("Unable to obtain globals: %s", err)
return features
}
features.Acl = AclFeatures{
AclAddressLis... | go | func GetSupportedFeatures() SupportedFeatures {
var features SupportedFeatures
globals, err := GetGlobals()
if err != nil {
// Expected on pre-1803 builds, all features will be false/unsupported
logrus.Debugf("Unable to obtain globals: %s", err)
return features
}
features.Acl = AclFeatures{
AclAddressLis... | [
"func",
"GetSupportedFeatures",
"(",
")",
"SupportedFeatures",
"{",
"var",
"features",
"SupportedFeatures",
"\n\n",
"globals",
",",
"err",
":=",
"GetGlobals",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Expected on pre-1803 builds, all features will be false/unsu... | // GetSupportedFeatures returns the features supported by the Service. | [
"GetSupportedFeatures",
"returns",
"the",
"features",
"supported",
"by",
"the",
"Service",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/hcn/hcnsupport.go#L31-L58 |
143,697 | Microsoft/hcsshim | cmd/runhcs/container.go | startVMShim | func (c *container) startVMShim(logFile string, opts interface{}) (*os.Process, error) {
var os string
if _, ok := opts.(*uvm.OptionsLCOW); ok {
os = "linux"
} else {
os = "windows"
}
args := []string{"--os", os}
if strings.HasPrefix(logFile, runhcs.SafePipePrefix) {
args = append(args, "--log-pipe", logFil... | go | func (c *container) startVMShim(logFile string, opts interface{}) (*os.Process, error) {
var os string
if _, ok := opts.(*uvm.OptionsLCOW); ok {
os = "linux"
} else {
os = "windows"
}
args := []string{"--os", os}
if strings.HasPrefix(logFile, runhcs.SafePipePrefix) {
args = append(args, "--log-pipe", logFil... | [
"func",
"(",
"c",
"*",
"container",
")",
"startVMShim",
"(",
"logFile",
"string",
",",
"opts",
"interface",
"{",
"}",
")",
"(",
"*",
"os",
".",
"Process",
",",
"error",
")",
"{",
"var",
"os",
"string",
"\n",
"if",
"_",
",",
"ok",
":=",
"opts",
".... | // startVMShim starts a vm-shim command with the specified `opts`. `opts` can be `uvm.OptionsWCOW` or `uvm.OptionsLCOW` | [
"startVMShim",
"starts",
"a",
"vm",
"-",
"shim",
"command",
"with",
"the",
"specified",
"opts",
".",
"opts",
"can",
"be",
"uvm",
".",
"OptionsWCOW",
"or",
"uvm",
".",
"OptionsLCOW"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/runhcs/container.go#L229-L242 |
143,698 | Microsoft/hcsshim | internal/appargs/appargs.go | Int | func Int(base int, min int, max int) Validator {
return func(args []string) int {
if len(args) == 0 {
return -1
}
i, err := strconv.ParseInt(args[0], base, 0)
if err != nil || int(i) < min || int(i) > max {
return -1
}
return 1
}
} | go | func Int(base int, min int, max int) Validator {
return func(args []string) int {
if len(args) == 0 {
return -1
}
i, err := strconv.ParseInt(args[0], base, 0)
if err != nil || int(i) < min || int(i) > max {
return -1
}
return 1
}
} | [
"func",
"Int",
"(",
"base",
"int",
",",
"min",
"int",
",",
"max",
"int",
")",
"Validator",
"{",
"return",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"int",
"{",
"if",
"len",
"(",
"args",
")",
"==",
"0",
"{",
"return",
"-",
"1",
"\n",
"}",
... | // Int returns a validator for integers. | [
"Int",
"returns",
"a",
"validator",
"for",
"integers",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/appargs/appargs.go#L33-L44 |
143,699 | Microsoft/hcsshim | internal/appargs/appargs.go | Optional | func Optional(v Validator) Validator {
return func(args []string) int {
if len(args) == 0 {
return 0
}
return v(args)
}
} | go | func Optional(v Validator) Validator {
return func(args []string) int {
if len(args) == 0 {
return 0
}
return v(args)
}
} | [
"func",
"Optional",
"(",
"v",
"Validator",
")",
"Validator",
"{",
"return",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"int",
"{",
"if",
"len",
"(",
"args",
")",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"v",
"(",
"args",
")",
... | // Optional returns a validator that treats an argument as optional. | [
"Optional",
"returns",
"a",
"validator",
"that",
"treats",
"an",
"argument",
"as",
"optional",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/appargs/appargs.go#L47-L54 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.