id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
21,600 | 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 |
21,601 | 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 |
21,602 | 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 |
21,603 | 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 |
21,604 | 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 |
21,605 | 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 |
21,606 | 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 |
21,607 | 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 |
21,608 | 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 |
21,609 | 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 |
21,610 | 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 |
21,611 | 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 |
21,612 | 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 |
21,613 | 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 |
21,614 | 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 |
21,615 | 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 |
21,616 | 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 |
21,617 | 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 |
21,618 | 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 |
21,619 | 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 |
21,620 | 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 |
21,621 | 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 |
21,622 | 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 |
21,623 | 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 |
21,624 | 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 |
21,625 | 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 |
21,626 | 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 |
21,627 | 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 |
21,628 | 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 |
21,629 | 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 |
21,630 | 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 |
21,631 | 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 |
21,632 | 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 |
21,633 | 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 |
21,634 | 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 |
21,635 | 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 |
21,636 | 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 |
21,637 | 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 |
21,638 | 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 |
21,639 | 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 |
21,640 | 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 |
21,641 | 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 |
21,642 | 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 |
21,643 | 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 |
21,644 | 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 |
21,645 | 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 |
21,646 | 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 |
21,647 | 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 |
21,648 | 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 |
21,649 | 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 |
21,650 | 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 |
21,651 | 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 |
21,652 | 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 |
21,653 | 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 |
21,654 | 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 |
21,655 | 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 |
21,656 | 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 |
21,657 | 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 |
21,658 | 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 |
21,659 | 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 |
21,660 | 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 |
21,661 | 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 |
21,662 | 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 |
21,663 | 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 |
21,664 | 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 |
21,665 | 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 |
21,666 | 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 |
21,667 | 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 |
21,668 | 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 |
21,669 | 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 |
21,670 | 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 |
21,671 | 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 |
21,672 | 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 |
21,673 | 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 |
21,674 | 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 |
21,675 | 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 |
21,676 | 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 |
21,677 | 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 |
21,678 | 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 |
21,679 | 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 |
21,680 | 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 |
21,681 | 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 |
21,682 | 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 |
21,683 | 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 |
21,684 | Microsoft/hcsshim | internal/appargs/appargs.go | Rest | func Rest(v Validator) Validator {
return func(args []string) int {
count := len(args)
for len(args) != 0 {
n := v(args)
if n < 0 {
return n
}
args = args[n:]
}
return count
}
} | go | func Rest(v Validator) Validator {
return func(args []string) int {
count := len(args)
for len(args) != 0 {
n := v(args)
if n < 0 {
return n
}
args = args[n:]
}
return count
}
} | [
"func",
"Rest",
"(",
"v",
"Validator",
")",
"Validator",
"{",
"return",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"int",
"{",
"count",
":=",
"len",
"(",
"args",
")",
"\n",
"for",
"len",
"(",
"args",
")",
"!=",
"0",
"{",
"n",
":=",
"v",
"(",... | // Rest returns a validator that validates each of the remaining arguments. | [
"Rest",
"returns",
"a",
"validator",
"that",
"validates",
"each",
"of",
"the",
"remaining",
"arguments",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/appargs/appargs.go#L57-L69 |
21,685 | Microsoft/hcsshim | internal/appargs/appargs.go | Validate | func Validate(vs ...Validator) cli.BeforeFunc {
return func(context *cli.Context) error {
remaining := context.Args()
for _, v := range vs {
consumed := v(remaining)
if consumed < 0 {
return ErrInvalidUsage
}
remaining = remaining[consumed:]
}
if len(remaining) > 0 {
return ErrInvalidUsage
... | go | func Validate(vs ...Validator) cli.BeforeFunc {
return func(context *cli.Context) error {
remaining := context.Args()
for _, v := range vs {
consumed := v(remaining)
if consumed < 0 {
return ErrInvalidUsage
}
remaining = remaining[consumed:]
}
if len(remaining) > 0 {
return ErrInvalidUsage
... | [
"func",
"Validate",
"(",
"vs",
"...",
"Validator",
")",
"cli",
".",
"BeforeFunc",
"{",
"return",
"func",
"(",
"context",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"remaining",
":=",
"context",
".",
"Args",
"(",
")",
"\n",
"for",
"_",
",",
"v",
... | // Validate can be used as a command's Before function to validate the arguments
// to the command. | [
"Validate",
"can",
"be",
"used",
"as",
"a",
"command",
"s",
"Before",
"function",
"to",
"validate",
"the",
"arguments",
"to",
"the",
"command",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/appargs/appargs.go#L76-L93 |
21,686 | Microsoft/hcsshim | internal/wclayer/layerid.go | LayerID | func LayerID(path string) (guid.GUID, error) {
_, file := filepath.Split(path)
return NameToGuid(file)
} | go | func LayerID(path string) (guid.GUID, error) {
_, file := filepath.Split(path)
return NameToGuid(file)
} | [
"func",
"LayerID",
"(",
"path",
"string",
")",
"(",
"guid",
".",
"GUID",
",",
"error",
")",
"{",
"_",
",",
"file",
":=",
"filepath",
".",
"Split",
"(",
"path",
")",
"\n",
"return",
"NameToGuid",
"(",
"file",
")",
"\n",
"}"
] | // LayerID returns the layer ID of a layer on disk. | [
"LayerID",
"returns",
"the",
"layer",
"ID",
"of",
"a",
"layer",
"on",
"disk",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/layerid.go#L10-L13 |
21,687 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go | newWcowPodSandboxTask | func newWcowPodSandboxTask(ctx context.Context, events publisher, id, bundle string, parent *uvm.UtilityVM) shimTask {
logrus.WithFields(logrus.Fields{
"tid": id,
}).Debug("newWcowPodSandboxTask")
wpst := &wcowPodSandboxTask{
events: events,
id: id,
init: newWcowPodSandboxExec(ctx, events, id, bundle)... | go | func newWcowPodSandboxTask(ctx context.Context, events publisher, id, bundle string, parent *uvm.UtilityVM) shimTask {
logrus.WithFields(logrus.Fields{
"tid": id,
}).Debug("newWcowPodSandboxTask")
wpst := &wcowPodSandboxTask{
events: events,
id: id,
init: newWcowPodSandboxExec(ctx, events, id, bundle)... | [
"func",
"newWcowPodSandboxTask",
"(",
"ctx",
"context",
".",
"Context",
",",
"events",
"publisher",
",",
"id",
",",
"bundle",
"string",
",",
"parent",
"*",
"uvm",
".",
"UtilityVM",
")",
"shimTask",
"{",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fie... | // newWcowPodSandboxTask creates a fake WCOW task with a fake WCOW `init`
// process as a performance optimization rather than creating an actual
// container and process since it is not needed to hold open any namespaces like
// the equivalent on Linux.
//
// It is assumed that this is the only fake WCOW task and that... | [
"newWcowPodSandboxTask",
"creates",
"a",
"fake",
"WCOW",
"task",
"with",
"a",
"fake",
"WCOW",
"init",
"process",
"as",
"a",
"performance",
"optimization",
"rather",
"than",
"creating",
"an",
"actual",
"container",
"and",
"process",
"since",
"it",
"is",
"not",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go#L28-L71 |
21,688 | Microsoft/hcsshim | cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go | close | func (wpst *wcowPodSandboxTask) close() {
wpst.closeOnce.Do(func() {
logrus.WithFields(logrus.Fields{
"tid": wpst.id,
}).Debug("wcowPodSandboxTask::close")
if wpst.host != nil {
if err := wpst.host.Close(); err != nil {
logrus.WithFields(logrus.Fields{
"tid": wpst.id,
logrus.ErrorK... | go | func (wpst *wcowPodSandboxTask) close() {
wpst.closeOnce.Do(func() {
logrus.WithFields(logrus.Fields{
"tid": wpst.id,
}).Debug("wcowPodSandboxTask::close")
if wpst.host != nil {
if err := wpst.host.Close(); err != nil {
logrus.WithFields(logrus.Fields{
"tid": wpst.id,
logrus.ErrorK... | [
"func",
"(",
"wpst",
"*",
"wcowPodSandboxTask",
")",
"close",
"(",
")",
"{",
"wpst",
".",
"closeOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"wpst",
".",
"id",
",",
... | // close safely closes the hosting UVM. Because of the specialty of this task it
// is assumed that this is always the owner of `wpst.host`. Once closed and all
// resources released it events the `runtime.TaskExitEventTopic` for all
// upstream listeners.
//
// This call is idempotent and safe to call multiple times. | [
"close",
"safely",
"closes",
"the",
"hosting",
"UVM",
".",
"Because",
"of",
"the",
"specialty",
"of",
"this",
"task",
"it",
"is",
"assumed",
"that",
"this",
"is",
"always",
"the",
"owner",
"of",
"wpst",
".",
"host",
".",
"Once",
"closed",
"and",
"all",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/cmd/containerd-shim-runhcs-v1/task_wcow_podsandbox.go#L205-L232 |
21,689 | Microsoft/hcsshim | pkg/go-runhcs/runhcs_ps.go | Ps | func (r *Runhcs) Ps(context context.Context, id string) ([]int, error) {
data, err := cmdOutput(r.command(context, "ps", "--format=json", id), true)
if err != nil {
return nil, fmt.Errorf("%s: %s", err, data)
}
var out []int
if err := json.Unmarshal(data, &out); err != nil {
return nil, err
}
return out, nil... | go | func (r *Runhcs) Ps(context context.Context, id string) ([]int, error) {
data, err := cmdOutput(r.command(context, "ps", "--format=json", id), true)
if err != nil {
return nil, fmt.Errorf("%s: %s", err, data)
}
var out []int
if err := json.Unmarshal(data, &out); err != nil {
return nil, err
}
return out, nil... | [
"func",
"(",
"r",
"*",
"Runhcs",
")",
"Ps",
"(",
"context",
"context",
".",
"Context",
",",
"id",
"string",
")",
"(",
"[",
"]",
"int",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"cmdOutput",
"(",
"r",
".",
"command",
"(",
"context",
",",
... | // Ps displays the processes running inside a container. | [
"Ps",
"displays",
"the",
"processes",
"running",
"inside",
"a",
"container",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/pkg/go-runhcs/runhcs_ps.go#L10-L20 |
21,690 | Microsoft/hcsshim | internal/schemaversion/schemaversion.go | IsSupported | func IsSupported(sv *hcsschema.Version) error {
if IsV10(sv) {
return nil
}
if IsV21(sv) {
if osversion.Get().Build < osversion.RS5 {
return fmt.Errorf("unsupported on this Windows build")
}
return nil
}
return fmt.Errorf("unknown schema version %s", String(sv))
} | go | func IsSupported(sv *hcsschema.Version) error {
if IsV10(sv) {
return nil
}
if IsV21(sv) {
if osversion.Get().Build < osversion.RS5 {
return fmt.Errorf("unsupported on this Windows build")
}
return nil
}
return fmt.Errorf("unknown schema version %s", String(sv))
} | [
"func",
"IsSupported",
"(",
"sv",
"*",
"hcsschema",
".",
"Version",
")",
"error",
"{",
"if",
"IsV10",
"(",
"sv",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"IsV21",
"(",
"sv",
")",
"{",
"if",
"osversion",
".",
"Get",
"(",
")",
".",
"Build"... | // isSupported determines if a given schema version is supported | [
"isSupported",
"determines",
"if",
"a",
"given",
"schema",
"version",
"is",
"supported"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/schemaversion/schemaversion.go#L25-L36 |
21,691 | Microsoft/hcsshim | internal/schemaversion/schemaversion.go | IsV10 | func IsV10(sv *hcsschema.Version) bool {
if sv.Major == 1 && sv.Minor == 0 {
return true
}
return false
} | go | func IsV10(sv *hcsschema.Version) bool {
if sv.Major == 1 && sv.Minor == 0 {
return true
}
return false
} | [
"func",
"IsV10",
"(",
"sv",
"*",
"hcsschema",
".",
"Version",
")",
"bool",
"{",
"if",
"sv",
".",
"Major",
"==",
"1",
"&&",
"sv",
".",
"Minor",
"==",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // IsV10 determines if a given schema version object is 1.0. This was the only thing
// supported in RS1..3. It lives on in RS5, but will be deprecated in a future release. | [
"IsV10",
"determines",
"if",
"a",
"given",
"schema",
"version",
"object",
"is",
"1",
".",
"0",
".",
"This",
"was",
"the",
"only",
"thing",
"supported",
"in",
"RS1",
"..",
"3",
".",
"It",
"lives",
"on",
"in",
"RS5",
"but",
"will",
"be",
"deprecated",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/schemaversion/schemaversion.go#L40-L45 |
21,692 | Microsoft/hcsshim | internal/schemaversion/schemaversion.go | String | func String(sv *hcsschema.Version) string {
b, err := json.Marshal(sv)
if err != nil {
return ""
}
return string(b[:])
} | go | func String(sv *hcsschema.Version) string {
b, err := json.Marshal(sv)
if err != nil {
return ""
}
return string(b[:])
} | [
"func",
"String",
"(",
"sv",
"*",
"hcsschema",
".",
"Version",
")",
"string",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"sv",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"string",
"(",... | // String returns a JSON encoding of a schema version object | [
"String",
"returns",
"a",
"JSON",
"encoding",
"of",
"a",
"schema",
"version",
"object"
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/schemaversion/schemaversion.go#L58-L64 |
21,693 | Microsoft/hcsshim | internal/schemaversion/schemaversion.go | DetermineSchemaVersion | func DetermineSchemaVersion(requestedSV *hcsschema.Version) *hcsschema.Version {
sv := SchemaV10()
if osversion.Get().Build >= osversion.RS5 {
sv = SchemaV21()
}
if requestedSV != nil {
if err := IsSupported(requestedSV); err == nil {
sv = requestedSV
} else {
logrus.Warnf("Ignoring unsupported requeste... | go | func DetermineSchemaVersion(requestedSV *hcsschema.Version) *hcsschema.Version {
sv := SchemaV10()
if osversion.Get().Build >= osversion.RS5 {
sv = SchemaV21()
}
if requestedSV != nil {
if err := IsSupported(requestedSV); err == nil {
sv = requestedSV
} else {
logrus.Warnf("Ignoring unsupported requeste... | [
"func",
"DetermineSchemaVersion",
"(",
"requestedSV",
"*",
"hcsschema",
".",
"Version",
")",
"*",
"hcsschema",
".",
"Version",
"{",
"sv",
":=",
"SchemaV10",
"(",
")",
"\n",
"if",
"osversion",
".",
"Get",
"(",
")",
".",
"Build",
">=",
"osversion",
".",
"R... | // DetermineSchemaVersion works out what schema version to use based on build and
// requested option. | [
"DetermineSchemaVersion",
"works",
"out",
"what",
"schema",
"version",
"to",
"use",
"based",
"on",
"build",
"and",
"requested",
"option",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/schemaversion/schemaversion.go#L68-L81 |
21,694 | Microsoft/hcsshim | pkg/go-runhcs/runhcs_create-scratch.go | CreateScratch | func (r *Runhcs) CreateScratch(context context.Context, destpath string) error {
return r.runOrError(r.command(context, "create-scratch", "--destpath", destpath))
} | go | func (r *Runhcs) CreateScratch(context context.Context, destpath string) error {
return r.runOrError(r.command(context, "create-scratch", "--destpath", destpath))
} | [
"func",
"(",
"r",
"*",
"Runhcs",
")",
"CreateScratch",
"(",
"context",
"context",
".",
"Context",
",",
"destpath",
"string",
")",
"error",
"{",
"return",
"r",
".",
"runOrError",
"(",
"r",
".",
"command",
"(",
"context",
",",
"\"",
"\"",
",",
"\"",
"\... | // CreateScratch creates a scratch vhdx at 'destpath' that is ext4 formatted. | [
"CreateScratch",
"creates",
"a",
"scratch",
"vhdx",
"at",
"destpath",
"that",
"is",
"ext4",
"formatted",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/pkg/go-runhcs/runhcs_create-scratch.go#L8-L10 |
21,695 | Microsoft/hcsshim | internal/wclayer/importlayer.go | ImportLayer | func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) (err error) {
title := "hcsshim::ImportLayer"
fields := logrus.Fields{
"path": path,
"importFolderPath": importFolderPath,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.Err... | go | func ImportLayer(path string, importFolderPath string, parentLayerPaths []string) (err error) {
title := "hcsshim::ImportLayer"
fields := logrus.Fields{
"path": path,
"importFolderPath": importFolderPath,
}
logrus.WithFields(fields).Debug(title)
defer func() {
if err != nil {
fields[logrus.Err... | [
"func",
"ImportLayer",
"(",
"path",
"string",
",",
"importFolderPath",
"string",
",",
"parentLayerPaths",
"[",
"]",
"string",
")",
"(",
"err",
"error",
")",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"fields",
":=",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
... | // ImportLayer will take the contents of the folder at importFolderPath and import
// that into a layer with the id layerId. Note that in order to correctly populate
// the layer and interperet the transport format, all parent layers must already
// be present on the system at the paths provided in parentLayerPaths. | [
"ImportLayer",
"will",
"take",
"the",
"contents",
"of",
"the",
"folder",
"at",
"importFolderPath",
"and",
"import",
"that",
"into",
"a",
"layer",
"with",
"the",
"id",
"layerId",
".",
"Note",
"that",
"in",
"order",
"to",
"correctly",
"populate",
"the",
"layer... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/importlayer.go#L18-L45 |
21,696 | Microsoft/hcsshim | internal/wclayer/importlayer.go | NewLayerWriter | func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error) {
if len(parentLayerPaths) == 0 {
// This is a base layer. It gets imported differently.
f, err := safefile.OpenRoot(path)
if err != nil {
return nil, err
}
return &baseLayerWriter{
root: f,
}, nil
}
importPath, err :... | go | func NewLayerWriter(path string, parentLayerPaths []string) (LayerWriter, error) {
if len(parentLayerPaths) == 0 {
// This is a base layer. It gets imported differently.
f, err := safefile.OpenRoot(path)
if err != nil {
return nil, err
}
return &baseLayerWriter{
root: f,
}, nil
}
importPath, err :... | [
"func",
"NewLayerWriter",
"(",
"path",
"string",
",",
"parentLayerPaths",
"[",
"]",
"string",
")",
"(",
"LayerWriter",
",",
"error",
")",
"{",
"if",
"len",
"(",
"parentLayerPaths",
")",
"==",
"0",
"{",
"// This is a base layer. It gets imported differently.",
"f",... | // NewLayerWriter returns a new layer writer for creating a layer on disk.
// The caller must have taken the SeBackupPrivilege and SeRestorePrivilege privileges
// to call this and any methods on the resulting LayerWriter. | [
"NewLayerWriter",
"returns",
"a",
"new",
"layer",
"writer",
"for",
"creating",
"a",
"layer",
"on",
"disk",
".",
"The",
"caller",
"must",
"have",
"taken",
"the",
"SeBackupPrivilege",
"and",
"SeRestorePrivilege",
"privileges",
"to",
"call",
"this",
"and",
"any",
... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/wclayer/importlayer.go#L110-L135 |
21,697 | Microsoft/hcsshim | internal/uvm/create_wcow.go | NewDefaultOptionsWCOW | func NewDefaultOptionsWCOW(id, owner string) *OptionsWCOW {
return &OptionsWCOW{
Options: newDefaultOptions(id, owner),
}
} | go | func NewDefaultOptionsWCOW(id, owner string) *OptionsWCOW {
return &OptionsWCOW{
Options: newDefaultOptions(id, owner),
}
} | [
"func",
"NewDefaultOptionsWCOW",
"(",
"id",
",",
"owner",
"string",
")",
"*",
"OptionsWCOW",
"{",
"return",
"&",
"OptionsWCOW",
"{",
"Options",
":",
"newDefaultOptions",
"(",
"id",
",",
"owner",
")",
",",
"}",
"\n",
"}"
] | // NewDefaultOptionsWCOW creates the default options for a bootable version of
// WCOW. The caller `MUST` set the `LayerFolders` path on the returned value.
//
// `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
// execu... | [
"NewDefaultOptionsWCOW",
"creates",
"the",
"default",
"options",
"for",
"a",
"bootable",
"version",
"of",
"WCOW",
".",
"The",
"caller",
"MUST",
"set",
"the",
"LayerFolders",
"path",
"on",
"the",
"returned",
"value",
".",
"id",
"the",
"ID",
"of",
"the",
"comp... | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/internal/uvm/create_wcow.go#L32-L36 |
21,698 | Microsoft/hcsshim | ext4/internal/compactext4/compact.go | Create | func (w *Writer) Create(name string, f *File) error {
if err := w.finishInode(); err != nil {
return err
}
dir, existing, childname, err := w.lookup(name, false)
if err != nil {
return err
}
var reuse *inode
if existing != nil {
if existing.IsDir() {
if f.Mode&TypeMask != S_IFDIR {
return fmt.Errorf... | go | func (w *Writer) Create(name string, f *File) error {
if err := w.finishInode(); err != nil {
return err
}
dir, existing, childname, err := w.lookup(name, false)
if err != nil {
return err
}
var reuse *inode
if existing != nil {
if existing.IsDir() {
if f.Mode&TypeMask != S_IFDIR {
return fmt.Errorf... | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Create",
"(",
"name",
"string",
",",
"f",
"*",
"File",
")",
"error",
"{",
"if",
"err",
":=",
"w",
".",
"finishInode",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"dir",
",",
... | // Create adds a file to the file system. | [
"Create",
"adds",
"a",
"file",
"to",
"the",
"file",
"system",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/ext4/internal/compactext4/compact.go#L518-L561 |
21,699 | Microsoft/hcsshim | ext4/internal/compactext4/compact.go | Link | func (w *Writer) Link(oldname, newname string) error {
if err := w.finishInode(); err != nil {
return err
}
newdir, existing, newchildname, err := w.lookup(newname, false)
if err != nil {
return err
}
if existing != nil && (existing.IsDir() || existing.LinkCount < 2) {
return fmt.Errorf("%s: cannot orphan e... | go | func (w *Writer) Link(oldname, newname string) error {
if err := w.finishInode(); err != nil {
return err
}
newdir, existing, newchildname, err := w.lookup(newname, false)
if err != nil {
return err
}
if existing != nil && (existing.IsDir() || existing.LinkCount < 2) {
return fmt.Errorf("%s: cannot orphan e... | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Link",
"(",
"oldname",
",",
"newname",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"w",
".",
"finishInode",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"newdir",
",",
"exist... | // Link adds a hard link to the file system. | [
"Link",
"adds",
"a",
"hard",
"link",
"to",
"the",
"file",
"system",
"."
] | 5a7443890943600c562e1f2390ab3fef8c56a45f | https://github.com/Microsoft/hcsshim/blob/5a7443890943600c562e1f2390ab3fef8c56a45f/ext4/internal/compactext4/compact.go#L564-L595 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.