id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
27,800
cri-o/cri-o
lib/config.go
ToFile
func (c *Config) ToFile(path string) error { var w bytes.Buffer e := toml.NewEncoder(&w) t := new(tomlConfig) t.fromConfig(c) if err := e.Encode(*t); err != nil { return err } return ioutil.WriteFile(path, w.Bytes(), 0644) }
go
func (c *Config) ToFile(path string) error { var w bytes.Buffer e := toml.NewEncoder(&w) t := new(tomlConfig) t.fromConfig(c) if err := e.Encode(*t); err != nil { return err } return ioutil.WriteFile(path, w.Bytes(), 0644) }
[ "func", "(", "c", "*", "Config", ")", "ToFile", "(", "path", "string", ")", "error", "{", "var", "w", "bytes", ".", "Buffer", "\n", "e", ":=", "toml", ".", "NewEncoder", "(", "&", "w", ")", "\n\n", "t", ":=", "new", "(", "tomlConfig", ")", "\n", ...
// ToFile outputs the given Config as a TOML-encoded file at the given path. // Returns errors encountered when generating or writing the file, or nil // otherwise.
[ "ToFile", "outputs", "the", "given", "Config", "as", "a", "TOML", "-", "encoded", "file", "at", "the", "given", "path", ".", "Returns", "errors", "encountered", "when", "generating", "or", "writing", "the", "file", "or", "nil", "otherwise", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/config.go#L341-L353
27,801
cri-o/cri-o
lib/config.go
Validate
func (c *Config) Validate(onExecution bool) error { if err := c.RootConfig.Validate(onExecution); err != nil { return errors.Wrapf(err, "root config") } if err := c.RuntimeConfig.Validate(onExecution); err != nil { return errors.Wrapf(err, "runtime config") } if err := c.NetworkConfig.Validate(onExecution); ...
go
func (c *Config) Validate(onExecution bool) error { if err := c.RootConfig.Validate(onExecution); err != nil { return errors.Wrapf(err, "root config") } if err := c.RuntimeConfig.Validate(onExecution); err != nil { return errors.Wrapf(err, "runtime config") } if err := c.NetworkConfig.Validate(onExecution); ...
[ "func", "(", "c", "*", "Config", ")", "Validate", "(", "onExecution", "bool", ")", "error", "{", "if", "err", ":=", "c", ".", "RootConfig", ".", "Validate", "(", "onExecution", ")", ";", "err", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(",...
// Validate is the main entry point for library configuration validation. // The parameter `onExecution` specifies if the validation should include // execution checks. It returns an `error` on validation failure, otherwise // `nil`.
[ "Validate", "is", "the", "main", "entry", "point", "for", "library", "configuration", "validation", ".", "The", "parameter", "onExecution", "specifies", "if", "the", "validation", "should", "include", "execution", "checks", ".", "It", "returns", "an", "error", "...
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/config.go#L422-L436
27,802
cri-o/cri-o
lib/config.go
Validate
func (c *RootConfig) Validate(onExecution bool) error { if onExecution { if err := os.MkdirAll(c.LogDir, 0700); err != nil { return errors.Wrapf(err, "invalid log_dir") } } return nil }
go
func (c *RootConfig) Validate(onExecution bool) error { if onExecution { if err := os.MkdirAll(c.LogDir, 0700); err != nil { return errors.Wrapf(err, "invalid log_dir") } } return nil }
[ "func", "(", "c", "*", "RootConfig", ")", "Validate", "(", "onExecution", "bool", ")", "error", "{", "if", "onExecution", "{", "if", "err", ":=", "os", ".", "MkdirAll", "(", "c", ".", "LogDir", ",", "0700", ")", ";", "err", "!=", "nil", "{", "retur...
// Validate is the main entry point for root configuration validation. // The parameter `onExecution` specifies if the validation should include // execution checks. It returns an `error` on validation failure, otherwise // `nil`.
[ "Validate", "is", "the", "main", "entry", "point", "for", "root", "configuration", "validation", ".", "The", "parameter", "onExecution", "specifies", "if", "the", "validation", "should", "include", "execution", "checks", ".", "It", "returns", "an", "error", "on"...
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/config.go#L442-L450
27,803
cri-o/cri-o
lib/config.go
Validate
func (c *RuntimeConfig) Validate(onExecution bool) error { // This is somehow duplicated with server.getUlimitsFromConfig under server/utils.go // but I don't want to export that function for the sake of validation here // so, keep it in mind if things start to blow up. // Reason for having this here is that I don'...
go
func (c *RuntimeConfig) Validate(onExecution bool) error { // This is somehow duplicated with server.getUlimitsFromConfig under server/utils.go // but I don't want to export that function for the sake of validation here // so, keep it in mind if things start to blow up. // Reason for having this here is that I don'...
[ "func", "(", "c", "*", "RuntimeConfig", ")", "Validate", "(", "onExecution", "bool", ")", "error", "{", "// This is somehow duplicated with server.getUlimitsFromConfig under server/utils.go", "// but I don't want to export that function for the sake of validation here", "// so, keep it...
// Validate is the main entry point for runtime configuration validation // The parameter `onExecution` specifies if the validation should include // execution checks. It returns an `error` on validation failure, otherwise // `nil`.
[ "Validate", "is", "the", "main", "entry", "point", "for", "runtime", "configuration", "validation", "The", "parameter", "onExecution", "specifies", "if", "the", "validation", "should", "include", "execution", "checks", ".", "It", "returns", "an", "error", "on", ...
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/config.go#L456-L531
27,804
cri-o/cri-o
lib/config.go
Validate
func (c *NetworkConfig) Validate(onExecution bool) error { if onExecution { if _, err := os.Stat(c.NetworkDir); err != nil { return errors.Wrapf(err, "invalid network_dir") } for _, pluginDir := range c.PluginDir { if err := os.MkdirAll(pluginDir, 0755); err != nil { return errors.Wrapf(err, "invalid ...
go
func (c *NetworkConfig) Validate(onExecution bool) error { if onExecution { if _, err := os.Stat(c.NetworkDir); err != nil { return errors.Wrapf(err, "invalid network_dir") } for _, pluginDir := range c.PluginDir { if err := os.MkdirAll(pluginDir, 0755); err != nil { return errors.Wrapf(err, "invalid ...
[ "func", "(", "c", "*", "NetworkConfig", ")", "Validate", "(", "onExecution", "bool", ")", "error", "{", "if", "onExecution", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "c", ".", "NetworkDir", ")", ";", "err", "!=", "nil", "{", "retur...
// Validate is the main entry point for network configuration validation. // The parameter `onExecution` specifies if the validation should include // execution checks. It returns an `error` on validation failure, otherwise // `nil`.
[ "Validate", "is", "the", "main", "entry", "point", "for", "network", "configuration", "validation", ".", "The", "parameter", "onExecution", "specifies", "if", "the", "validation", "should", "include", "execution", "checks", ".", "It", "returns", "an", "error", "...
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/config.go#L537-L551
27,805
cri-o/cri-o
server/sandbox_run.go
privilegedSandbox
func (s *Server) privilegedSandbox(req *pb.RunPodSandboxRequest) bool { securityContext := req.GetConfig().GetLinux().GetSecurityContext() if securityContext == nil { return false } if securityContext.Privileged { return true } namespaceOptions := securityContext.GetNamespaceOptions() if namespaceOptions =...
go
func (s *Server) privilegedSandbox(req *pb.RunPodSandboxRequest) bool { securityContext := req.GetConfig().GetLinux().GetSecurityContext() if securityContext == nil { return false } if securityContext.Privileged { return true } namespaceOptions := securityContext.GetNamespaceOptions() if namespaceOptions =...
[ "func", "(", "s", "*", "Server", ")", "privilegedSandbox", "(", "req", "*", "pb", ".", "RunPodSandboxRequest", ")", "bool", "{", "securityContext", ":=", "req", ".", "GetConfig", "(", ")", ".", "GetLinux", "(", ")", ".", "GetSecurityContext", "(", ")", "...
// privilegedSandbox returns true if the sandbox configuration // requires additional host privileges for the sandbox.
[ "privilegedSandbox", "returns", "true", "if", "the", "sandbox", "configuration", "requires", "additional", "host", "privileges", "for", "the", "sandbox", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_run.go#L28-L50
27,806
cri-o/cri-o
server/sandbox_run.go
runtimeHandler
func (s *Server) runtimeHandler(req *pb.RunPodSandboxRequest) (string, error) { handler := req.GetRuntimeHandler() if handler == "" { return handler, nil } runtime, ok := s.Runtime().(*oci.Runtime) if !ok { return "", fmt.Errorf("runtime interface conversion error") } if _, err := runtime.ValidateRuntimeHa...
go
func (s *Server) runtimeHandler(req *pb.RunPodSandboxRequest) (string, error) { handler := req.GetRuntimeHandler() if handler == "" { return handler, nil } runtime, ok := s.Runtime().(*oci.Runtime) if !ok { return "", fmt.Errorf("runtime interface conversion error") } if _, err := runtime.ValidateRuntimeHa...
[ "func", "(", "s", "*", "Server", ")", "runtimeHandler", "(", "req", "*", "pb", ".", "RunPodSandboxRequest", ")", "(", "string", ",", "error", ")", "{", "handler", ":=", "req", ".", "GetRuntimeHandler", "(", ")", "\n", "if", "handler", "==", "\"", "\"",...
// runtimeHandler returns the runtime handler key provided by CRI if the key // does exist and the associated data are valid. If the key is empty, there // is nothing to do, and the empty key is returned. For every other case, this // function will return an empty string with the error associated.
[ "runtimeHandler", "returns", "the", "runtime", "handler", "key", "provided", "by", "CRI", "if", "the", "key", "does", "exist", "and", "the", "associated", "data", "are", "valid", ".", "If", "the", "key", "is", "empty", "there", "is", "nothing", "to", "do",...
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_run.go#L56-L72
27,807
cri-o/cri-o
server/sandbox_run.go
RunPodSandbox
func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest) (resp *pb.RunPodSandboxResponse, err error) { // platform dependent call return s.runPodSandbox(ctx, req) }
go
func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest) (resp *pb.RunPodSandboxResponse, err error) { // platform dependent call return s.runPodSandbox(ctx, req) }
[ "func", "(", "s", "*", "Server", ")", "RunPodSandbox", "(", "ctx", "context", ".", "Context", ",", "req", "*", "pb", ".", "RunPodSandboxRequest", ")", "(", "resp", "*", "pb", ".", "RunPodSandboxResponse", ",", "err", "error", ")", "{", "// platform depende...
// RunPodSandbox creates and runs a pod-level sandbox.
[ "RunPodSandbox", "creates", "and", "runs", "a", "pod", "-", "level", "sandbox", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_run.go#L79-L82
27,808
cri-o/cri-o
server/sandbox_stop.go
StopPodSandbox
func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxRequest) (resp *pb.StopPodSandboxResponse, err error) { // platform dependent call return s.stopPodSandbox(ctx, req) }
go
func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxRequest) (resp *pb.StopPodSandboxResponse, err error) { // platform dependent call return s.stopPodSandbox(ctx, req) }
[ "func", "(", "s", "*", "Server", ")", "StopPodSandbox", "(", "ctx", "context", ".", "Context", ",", "req", "*", "pb", ".", "StopPodSandboxRequest", ")", "(", "resp", "*", "pb", ".", "StopPodSandboxResponse", ",", "err", "error", ")", "{", "// platform depe...
// StopPodSandbox stops the sandbox. If there are any running containers in the // sandbox, they should be force terminated.
[ "StopPodSandbox", "stops", "the", "sandbox", ".", "If", "there", "are", "any", "running", "containers", "in", "the", "sandbox", "they", "should", "be", "force", "terminated", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_stop.go#L11-L14
27,809
cri-o/cri-o
server/sandbox_stop.go
stopAllPodSandboxes
func (s *Server) stopAllPodSandboxes(ctx context.Context) { logrus.Debugf("stopAllPodSandboxes") for _, sb := range s.ContainerServer.ListSandboxes() { pod := &pb.StopPodSandboxRequest{ PodSandboxId: sb.ID(), } if _, err := s.StopPodSandbox(ctx, pod); err != nil { logrus.Warnf("could not StopPodSandbox %s...
go
func (s *Server) stopAllPodSandboxes(ctx context.Context) { logrus.Debugf("stopAllPodSandboxes") for _, sb := range s.ContainerServer.ListSandboxes() { pod := &pb.StopPodSandboxRequest{ PodSandboxId: sb.ID(), } if _, err := s.StopPodSandbox(ctx, pod); err != nil { logrus.Warnf("could not StopPodSandbox %s...
[ "func", "(", "s", "*", "Server", ")", "stopAllPodSandboxes", "(", "ctx", "context", ".", "Context", ")", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ")", "\n", "for", "_", ",", "sb", ":=", "range", "s", ".", "ContainerServer", ".", "ListSandboxes", ...
// stopAllPodSandboxes removes all pod sandboxes
[ "stopAllPodSandboxes", "removes", "all", "pod", "sandboxes" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_stop.go#L17-L27
27,810
cri-o/cri-o
lib/container_server.go
localeToLanguage
func localeToLanguage(locale string) string { locale = strings.Replace(strings.SplitN(locale, ".", 2)[0], "_", "-", 1) langString, ok := localeToLanguageMap[strings.ToLower(locale)] if !ok { langString = locale } return langString }
go
func localeToLanguage(locale string) string { locale = strings.Replace(strings.SplitN(locale, ".", 2)[0], "_", "-", 1) langString, ok := localeToLanguageMap[strings.ToLower(locale)] if !ok { langString = locale } return langString }
[ "func", "localeToLanguage", "(", "locale", "string", ")", "string", "{", "locale", "=", "strings", ".", "Replace", "(", "strings", ".", "SplitN", "(", "locale", ",", "\"", "\"", ",", "2", ")", "[", "0", "]", ",", "\"", "\"", ",", "\"", "\"", ",", ...
// localeToLanguage translates POSIX locale strings to BCP 47 language tags.
[ "localeToLanguage", "translates", "POSIX", "locale", "strings", "to", "BCP", "47", "language", "tags", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L111-L118
27,811
cri-o/cri-o
lib/container_server.go
ContainerStateFromDisk
func (c *ContainerServer) ContainerStateFromDisk(ctr *oci.Container) error { if err := ctr.FromDisk(); err != nil { return err } // ignore errors, this is a best effort to have up-to-date info about // a given container before its state gets stored c.runtime.UpdateContainerStatus(ctr) return nil }
go
func (c *ContainerServer) ContainerStateFromDisk(ctr *oci.Container) error { if err := ctr.FromDisk(); err != nil { return err } // ignore errors, this is a best effort to have up-to-date info about // a given container before its state gets stored c.runtime.UpdateContainerStatus(ctr) return nil }
[ "func", "(", "c", "*", "ContainerServer", ")", "ContainerStateFromDisk", "(", "ctr", "*", "oci", ".", "Container", ")", "error", "{", "if", "err", ":=", "ctr", ".", "FromDisk", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n",...
// ContainerStateFromDisk retrieves information on the state of a running container // from the disk
[ "ContainerStateFromDisk", "retrieves", "information", "on", "the", "state", "of", "a", "running", "container", "from", "the", "disk" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L599-L608
27,812
cri-o/cri-o
lib/container_server.go
ContainerStateToDisk
func (c *ContainerServer) ContainerStateToDisk(ctr *oci.Container) error { // ignore errors, this is a best effort to have up-to-date info about // a given container before its state gets stored c.Runtime().UpdateContainerStatus(ctr) jsonSource, err := ioutils.NewAtomicFileWriter(ctr.StatePath(), 0644) if err != ...
go
func (c *ContainerServer) ContainerStateToDisk(ctr *oci.Container) error { // ignore errors, this is a best effort to have up-to-date info about // a given container before its state gets stored c.Runtime().UpdateContainerStatus(ctr) jsonSource, err := ioutils.NewAtomicFileWriter(ctr.StatePath(), 0644) if err != ...
[ "func", "(", "c", "*", "ContainerServer", ")", "ContainerStateToDisk", "(", "ctr", "*", "oci", ".", "Container", ")", "error", "{", "// ignore errors, this is a best effort to have up-to-date info about", "// a given container before its state gets stored", "c", ".", "Runtime...
// ContainerStateToDisk writes the container's state information to a JSON file // on disk
[ "ContainerStateToDisk", "writes", "the", "container", "s", "state", "information", "to", "a", "JSON", "file", "on", "disk" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L612-L624
27,813
cri-o/cri-o
lib/container_server.go
ReserveContainerName
func (c *ContainerServer) ReserveContainerName(id, name string) (string, error) { if err := c.ctrNameIndex.Reserve(name, id); err != nil { err = fmt.Errorf("error reserving ctr name %s for id %s", name, id) logrus.Warn(err) return "", err } return name, nil }
go
func (c *ContainerServer) ReserveContainerName(id, name string) (string, error) { if err := c.ctrNameIndex.Reserve(name, id); err != nil { err = fmt.Errorf("error reserving ctr name %s for id %s", name, id) logrus.Warn(err) return "", err } return name, nil }
[ "func", "(", "c", "*", "ContainerServer", ")", "ReserveContainerName", "(", "id", ",", "name", "string", ")", "(", "string", ",", "error", ")", "{", "if", "err", ":=", "c", ".", "ctrNameIndex", ".", "Reserve", "(", "name", ",", "id", ")", ";", "err",...
// ReserveContainerName holds a name for a container that is being created
[ "ReserveContainerName", "holds", "a", "name", "for", "a", "container", "that", "is", "being", "created" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L627-L634
27,814
cri-o/cri-o
lib/container_server.go
ReservePodName
func (c *ContainerServer) ReservePodName(id, name string) (string, error) { if err := c.podNameIndex.Reserve(name, id); err != nil { err = fmt.Errorf("error reserving pod name %s for id %s", name, id) logrus.Warn(err) return "", err } return name, nil }
go
func (c *ContainerServer) ReservePodName(id, name string) (string, error) { if err := c.podNameIndex.Reserve(name, id); err != nil { err = fmt.Errorf("error reserving pod name %s for id %s", name, id) logrus.Warn(err) return "", err } return name, nil }
[ "func", "(", "c", "*", "ContainerServer", ")", "ReservePodName", "(", "id", ",", "name", "string", ")", "(", "string", ",", "error", ")", "{", "if", "err", ":=", "c", ".", "podNameIndex", ".", "Reserve", "(", "name", ",", "id", ")", ";", "err", "!=...
// ReservePodName holds a name for a pod that is being created
[ "ReservePodName", "holds", "a", "name", "for", "a", "pod", "that", "is", "being", "created" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L643-L650
27,815
cri-o/cri-o
lib/container_server.go
AddContainer
func (c *ContainerServer) AddContainer(ctr *oci.Container) { sandbox := c.state.sandboxes.Get(ctr.Sandbox()) if sandbox == nil { return } sandbox.AddContainer(ctr) c.state.containers.Add(ctr.ID(), ctr) }
go
func (c *ContainerServer) AddContainer(ctr *oci.Container) { sandbox := c.state.sandboxes.Get(ctr.Sandbox()) if sandbox == nil { return } sandbox.AddContainer(ctr) c.state.containers.Add(ctr.ID(), ctr) }
[ "func", "(", "c", "*", "ContainerServer", ")", "AddContainer", "(", "ctr", "*", "oci", ".", "Container", ")", "{", "sandbox", ":=", "c", ".", "state", ".", "sandboxes", ".", "Get", "(", "ctr", ".", "Sandbox", "(", ")", ")", "\n", "if", "sandbox", "...
// AddContainer adds a container to the container state store
[ "AddContainer", "adds", "a", "container", "to", "the", "container", "state", "store" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L676-L683
27,816
cri-o/cri-o
lib/container_server.go
AddInfraContainer
func (c *ContainerServer) AddInfraContainer(ctr *oci.Container) { c.state.infraContainers.Add(ctr.ID(), ctr) }
go
func (c *ContainerServer) AddInfraContainer(ctr *oci.Container) { c.state.infraContainers.Add(ctr.ID(), ctr) }
[ "func", "(", "c", "*", "ContainerServer", ")", "AddInfraContainer", "(", "ctr", "*", "oci", ".", "Container", ")", "{", "c", ".", "state", ".", "infraContainers", ".", "Add", "(", "ctr", ".", "ID", "(", ")", ",", "ctr", ")", "\n", "}" ]
// AddInfraContainer adds a container to the container state store
[ "AddInfraContainer", "adds", "a", "container", "to", "the", "container", "state", "store" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L686-L688
27,817
cri-o/cri-o
lib/container_server.go
GetContainer
func (c *ContainerServer) GetContainer(id string) *oci.Container { return c.state.containers.Get(id) }
go
func (c *ContainerServer) GetContainer(id string) *oci.Container { return c.state.containers.Get(id) }
[ "func", "(", "c", "*", "ContainerServer", ")", "GetContainer", "(", "id", "string", ")", "*", "oci", ".", "Container", "{", "return", "c", ".", "state", ".", "containers", ".", "Get", "(", "id", ")", "\n", "}" ]
// GetContainer returns a container by its ID
[ "GetContainer", "returns", "a", "container", "by", "its", "ID" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L691-L693
27,818
cri-o/cri-o
lib/container_server.go
GetInfraContainer
func (c *ContainerServer) GetInfraContainer(id string) *oci.Container { return c.state.infraContainers.Get(id) }
go
func (c *ContainerServer) GetInfraContainer(id string) *oci.Container { return c.state.infraContainers.Get(id) }
[ "func", "(", "c", "*", "ContainerServer", ")", "GetInfraContainer", "(", "id", "string", ")", "*", "oci", ".", "Container", "{", "return", "c", ".", "state", ".", "infraContainers", ".", "Get", "(", "id", ")", "\n", "}" ]
// GetInfraContainer returns a container by its ID
[ "GetInfraContainer", "returns", "a", "container", "by", "its", "ID" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L696-L698
27,819
cri-o/cri-o
lib/container_server.go
HasContainer
func (c *ContainerServer) HasContainer(id string) bool { return c.state.containers.Get(id) != nil }
go
func (c *ContainerServer) HasContainer(id string) bool { return c.state.containers.Get(id) != nil }
[ "func", "(", "c", "*", "ContainerServer", ")", "HasContainer", "(", "id", "string", ")", "bool", "{", "return", "c", ".", "state", ".", "containers", ".", "Get", "(", "id", ")", "!=", "nil", "\n", "}" ]
// HasContainer checks if a container exists in the state
[ "HasContainer", "checks", "if", "a", "container", "exists", "in", "the", "state" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L701-L703
27,820
cri-o/cri-o
lib/container_server.go
RemoveContainer
func (c *ContainerServer) RemoveContainer(ctr *oci.Container) { sbID := ctr.Sandbox() sb := c.state.sandboxes.Get(sbID) if sb == nil { return } sb.RemoveContainer(ctr) c.state.containers.Delete(ctr.ID()) }
go
func (c *ContainerServer) RemoveContainer(ctr *oci.Container) { sbID := ctr.Sandbox() sb := c.state.sandboxes.Get(sbID) if sb == nil { return } sb.RemoveContainer(ctr) c.state.containers.Delete(ctr.ID()) }
[ "func", "(", "c", "*", "ContainerServer", ")", "RemoveContainer", "(", "ctr", "*", "oci", ".", "Container", ")", "{", "sbID", ":=", "ctr", ".", "Sandbox", "(", ")", "\n", "sb", ":=", "c", ".", "state", ".", "sandboxes", ".", "Get", "(", "sbID", ")"...
// RemoveContainer removes a container from the container state store
[ "RemoveContainer", "removes", "a", "container", "from", "the", "container", "state", "store" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L706-L714
27,821
cri-o/cri-o
lib/container_server.go
RemoveInfraContainer
func (c *ContainerServer) RemoveInfraContainer(ctr *oci.Container) { c.state.infraContainers.Delete(ctr.ID()) }
go
func (c *ContainerServer) RemoveInfraContainer(ctr *oci.Container) { c.state.infraContainers.Delete(ctr.ID()) }
[ "func", "(", "c", "*", "ContainerServer", ")", "RemoveInfraContainer", "(", "ctr", "*", "oci", ".", "Container", ")", "{", "c", ".", "state", ".", "infraContainers", ".", "Delete", "(", "ctr", ".", "ID", "(", ")", ")", "\n", "}" ]
// RemoveInfraContainer removes a container from the container state store
[ "RemoveInfraContainer", "removes", "a", "container", "from", "the", "container", "state", "store" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L717-L719
27,822
cri-o/cri-o
lib/container_server.go
ListContainers
func (c *ContainerServer) ListContainers(filters ...func(*oci.Container) bool) ([]*oci.Container, error) { containers := c.listContainers() if len(filters) == 0 { return containers, nil } filteredContainers := make([]*oci.Container, 0, len(containers)) for _, container := range containers { for _, filter := ra...
go
func (c *ContainerServer) ListContainers(filters ...func(*oci.Container) bool) ([]*oci.Container, error) { containers := c.listContainers() if len(filters) == 0 { return containers, nil } filteredContainers := make([]*oci.Container, 0, len(containers)) for _, container := range containers { for _, filter := ra...
[ "func", "(", "c", "*", "ContainerServer", ")", "ListContainers", "(", "filters", "...", "func", "(", "*", "oci", ".", "Container", ")", "bool", ")", "(", "[", "]", "*", "oci", ".", "Container", ",", "error", ")", "{", "containers", ":=", "c", ".", ...
// ListContainers returns a list of all containers stored by the server state // that match the given filter function
[ "ListContainers", "returns", "a", "list", "of", "all", "containers", "stored", "by", "the", "server", "state", "that", "match", "the", "given", "filter", "function" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L728-L742
27,823
cri-o/cri-o
lib/container_server.go
AddSandbox
func (c *ContainerServer) AddSandbox(sb *sandbox.Sandbox) error { c.state.sandboxes.Add(sb.ID(), sb) c.stateLock.Lock() defer c.stateLock.Unlock() return c.addSandboxPlatform(sb) }
go
func (c *ContainerServer) AddSandbox(sb *sandbox.Sandbox) error { c.state.sandboxes.Add(sb.ID(), sb) c.stateLock.Lock() defer c.stateLock.Unlock() return c.addSandboxPlatform(sb) }
[ "func", "(", "c", "*", "ContainerServer", ")", "AddSandbox", "(", "sb", "*", "sandbox", ".", "Sandbox", ")", "error", "{", "c", ".", "state", ".", "sandboxes", ".", "Add", "(", "sb", ".", "ID", "(", ")", ",", "sb", ")", "\n\n", "c", ".", "stateLo...
// AddSandbox adds a sandbox to the sandbox state store
[ "AddSandbox", "adds", "a", "sandbox", "to", "the", "sandbox", "state", "store" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L745-L751
27,824
cri-o/cri-o
lib/container_server.go
GetSandbox
func (c *ContainerServer) GetSandbox(id string) *sandbox.Sandbox { return c.state.sandboxes.Get(id) }
go
func (c *ContainerServer) GetSandbox(id string) *sandbox.Sandbox { return c.state.sandboxes.Get(id) }
[ "func", "(", "c", "*", "ContainerServer", ")", "GetSandbox", "(", "id", "string", ")", "*", "sandbox", ".", "Sandbox", "{", "return", "c", ".", "state", ".", "sandboxes", ".", "Get", "(", "id", ")", "\n", "}" ]
// GetSandbox returns a sandbox by its ID
[ "GetSandbox", "returns", "a", "sandbox", "by", "its", "ID" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L754-L756
27,825
cri-o/cri-o
lib/container_server.go
GetSandboxContainer
func (c *ContainerServer) GetSandboxContainer(id string) *oci.Container { sb := c.state.sandboxes.Get(id) if sb == nil { return nil } return sb.InfraContainer() }
go
func (c *ContainerServer) GetSandboxContainer(id string) *oci.Container { sb := c.state.sandboxes.Get(id) if sb == nil { return nil } return sb.InfraContainer() }
[ "func", "(", "c", "*", "ContainerServer", ")", "GetSandboxContainer", "(", "id", "string", ")", "*", "oci", ".", "Container", "{", "sb", ":=", "c", ".", "state", ".", "sandboxes", ".", "Get", "(", "id", ")", "\n", "if", "sb", "==", "nil", "{", "ret...
// GetSandboxContainer returns a sandbox's infra container
[ "GetSandboxContainer", "returns", "a", "sandbox", "s", "infra", "container" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L759-L765
27,826
cri-o/cri-o
lib/container_server.go
HasSandbox
func (c *ContainerServer) HasSandbox(id string) bool { return c.state.sandboxes.Get(id) != nil }
go
func (c *ContainerServer) HasSandbox(id string) bool { return c.state.sandboxes.Get(id) != nil }
[ "func", "(", "c", "*", "ContainerServer", ")", "HasSandbox", "(", "id", "string", ")", "bool", "{", "return", "c", ".", "state", ".", "sandboxes", ".", "Get", "(", "id", ")", "!=", "nil", "\n", "}" ]
// HasSandbox checks if a sandbox exists in the state
[ "HasSandbox", "checks", "if", "a", "sandbox", "exists", "in", "the", "state" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L768-L770
27,827
cri-o/cri-o
lib/container_server.go
RemoveSandbox
func (c *ContainerServer) RemoveSandbox(id string) error { sb := c.state.sandboxes.Get(id) if sb == nil { return nil } c.stateLock.Lock() defer c.stateLock.Unlock() if err := c.removeSandboxPlatform(sb); err != nil { return err } c.state.sandboxes.Delete(id) return nil }
go
func (c *ContainerServer) RemoveSandbox(id string) error { sb := c.state.sandboxes.Get(id) if sb == nil { return nil } c.stateLock.Lock() defer c.stateLock.Unlock() if err := c.removeSandboxPlatform(sb); err != nil { return err } c.state.sandboxes.Delete(id) return nil }
[ "func", "(", "c", "*", "ContainerServer", ")", "RemoveSandbox", "(", "id", "string", ")", "error", "{", "sb", ":=", "c", ".", "state", ".", "sandboxes", ".", "Get", "(", "id", ")", "\n", "if", "sb", "==", "nil", "{", "return", "nil", "\n", "}", "...
// RemoveSandbox removes a sandbox from the state store
[ "RemoveSandbox", "removes", "a", "sandbox", "from", "the", "state", "store" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/container_server.go#L773-L787
27,828
cri-o/cri-o
server/sandbox_status.go
PodSandboxStatus
func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusRequest) (resp *pb.PodSandboxStatusResponse, err error) { const operation = "pod_sandbox_status" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() logrus.Debugf("PodSandboxStatusRequest %+v", req)...
go
func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusRequest) (resp *pb.PodSandboxStatusResponse, err error) { const operation = "pod_sandbox_status" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() logrus.Debugf("PodSandboxStatusRequest %+v", req)...
[ "func", "(", "s", "*", "Server", ")", "PodSandboxStatus", "(", "ctx", "context", ".", "Context", ",", "req", "*", "pb", ".", "PodSandboxStatusRequest", ")", "(", "resp", "*", "pb", ".", "PodSandboxStatusResponse", ",", "err", "error", ")", "{", "const", ...
// PodSandboxStatus returns the Status of the PodSandbox.
[ "PodSandboxStatus", "returns", "the", "Status", "of", "the", "PodSandbox", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_status.go#L13-L60
27,829
cri-o/cri-o
server/runtime_status.go
Status
func (s *Server) Status(ctx context.Context, req *pb.StatusRequest) (resp *pb.StatusResponse, err error) { const operation = "status" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() runtimeCondition := &pb.RuntimeCondition{ Type: pb.RuntimeReady, Status: true, } ne...
go
func (s *Server) Status(ctx context.Context, req *pb.StatusRequest) (resp *pb.StatusResponse, err error) { const operation = "status" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() runtimeCondition := &pb.RuntimeCondition{ Type: pb.RuntimeReady, Status: true, } ne...
[ "func", "(", "s", "*", "Server", ")", "Status", "(", "ctx", "context", ".", "Context", ",", "req", "*", "pb", ".", "StatusRequest", ")", "(", "resp", "*", "pb", ".", "StatusResponse", ",", "err", "error", ")", "{", "const", "operation", "=", "\"", ...
// Status returns the status of the runtime
[ "Status", "returns", "the", "status", "of", "the", "runtime" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/runtime_status.go#L15-L47
27,830
cri-o/cri-o
server/metrics/metrics.go
Register
func Register() { registerMetrics.Do(func() { prometheus.MustRegister(CRIOOperations) prometheus.MustRegister(CRIOOperationsLatency) prometheus.MustRegister(CRIOOperationsErrors) }) }
go
func Register() { registerMetrics.Do(func() { prometheus.MustRegister(CRIOOperations) prometheus.MustRegister(CRIOOperationsLatency) prometheus.MustRegister(CRIOOperationsErrors) }) }
[ "func", "Register", "(", ")", "{", "registerMetrics", ".", "Do", "(", "func", "(", ")", "{", "prometheus", ".", "MustRegister", "(", "CRIOOperations", ")", "\n", "prometheus", ".", "MustRegister", "(", "CRIOOperationsLatency", ")", "\n", "prometheus", ".", "...
// Register all metrics
[ "Register", "all", "metrics" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/metrics/metrics.go#L59-L65
27,831
cri-o/cri-o
pkg/storage/image.go
prepareReference
func (svc *imageService) prepareReference(imageName string, options *copy.Options) (types.ImageReference, error) { if imageName == "" { return nil, storage.ErrNotAnImage } srcRef, err := alltransports.ParseImageName(imageName) if err != nil { if svc.defaultTransport == "" { return nil, err } srcRef2, er...
go
func (svc *imageService) prepareReference(imageName string, options *copy.Options) (types.ImageReference, error) { if imageName == "" { return nil, storage.ErrNotAnImage } srcRef, err := alltransports.ParseImageName(imageName) if err != nil { if svc.defaultTransport == "" { return nil, err } srcRef2, er...
[ "func", "(", "svc", "*", "imageService", ")", "prepareReference", "(", "imageName", "string", ",", "options", "*", "copy", ".", "Options", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "if", "imageName", "==", "\"", "\"", "{", "return...
// prepareReference creates an image reference from an image string and set options // for the source context
[ "prepareReference", "creates", "an", "image", "reference", "from", "an", "image", "string", "and", "set", "options", "for", "the", "source", "context" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/pkg/storage/image.go#L358-L386
27,832
cri-o/cri-o
server/container_updateruntimeconfig.go
UpdateRuntimeConfig
func (s *Server) UpdateRuntimeConfig(ctx context.Context, req *pb.UpdateRuntimeConfigRequest) (resp *pb.UpdateRuntimeConfigResponse, err error) { const operation = "update_runtime_config" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() return &pb.UpdateRuntimeConfigRespons...
go
func (s *Server) UpdateRuntimeConfig(ctx context.Context, req *pb.UpdateRuntimeConfigRequest) (resp *pb.UpdateRuntimeConfigResponse, err error) { const operation = "update_runtime_config" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() return &pb.UpdateRuntimeConfigRespons...
[ "func", "(", "s", "*", "Server", ")", "UpdateRuntimeConfig", "(", "ctx", "context", ".", "Context", ",", "req", "*", "pb", ".", "UpdateRuntimeConfigRequest", ")", "(", "resp", "*", "pb", ".", "UpdateRuntimeConfigResponse", ",", "err", "error", ")", "{", "c...
// UpdateRuntimeConfig updates the configuration of a running container.
[ "UpdateRuntimeConfig", "updates", "the", "configuration", "of", "a", "running", "container", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/container_updateruntimeconfig.go#L11-L19
27,833
cri-o/cri-o
server/container_attach.go
Attach
func (ss StreamService) Attach(containerID string, inputStream io.Reader, outputStream, errorStream io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error { c, err := ss.runtimeServer.GetContainerFromShortID(containerID) if err != nil { return fmt.Errorf("could not find container %q: %v", contain...
go
func (ss StreamService) Attach(containerID string, inputStream io.Reader, outputStream, errorStream io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error { c, err := ss.runtimeServer.GetContainerFromShortID(containerID) if err != nil { return fmt.Errorf("could not find container %q: %v", contain...
[ "func", "(", "ss", "StreamService", ")", "Attach", "(", "containerID", "string", ",", "inputStream", "io", ".", "Reader", ",", "outputStream", ",", "errorStream", "io", ".", "WriteCloser", ",", "tty", "bool", ",", "resize", "<-", "chan", "remotecommand", "."...
// Attach endpoint for streaming.Runtime
[ "Attach", "endpoint", "for", "streaming", ".", "Runtime" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/container_attach.go#L33-L49
27,834
cri-o/cri-o
server/sandbox_network.go
networkStart
func (s *Server) networkStart(sb *sandbox.Sandbox) (podIP string, result cnitypes.Result, err error) { if sb.HostNetwork() { return s.hostIP, nil, nil } // Ensure network resources are cleaned up if the plugin succeeded // but an error happened between plugin success and the end of networkStart() defer func() {...
go
func (s *Server) networkStart(sb *sandbox.Sandbox) (podIP string, result cnitypes.Result, err error) { if sb.HostNetwork() { return s.hostIP, nil, nil } // Ensure network resources are cleaned up if the plugin succeeded // but an error happened between plugin success and the end of networkStart() defer func() {...
[ "func", "(", "s", "*", "Server", ")", "networkStart", "(", "sb", "*", "sandbox", ".", "Sandbox", ")", "(", "podIP", "string", ",", "result", "cnitypes", ".", "Result", ",", "err", "error", ")", "{", "if", "sb", ".", "HostNetwork", "(", ")", "{", "r...
// networkStart sets up the sandbox's network and returns the pod IP on success // or an error
[ "networkStart", "sets", "up", "the", "sandbox", "s", "network", "and", "returns", "the", "pod", "IP", "on", "success", "or", "an", "error" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_network.go#L17-L75
27,835
cri-o/cri-o
server/sandbox_network.go
getSandboxIP
func (s *Server) getSandboxIP(sb *sandbox.Sandbox) (string, error) { if sb.HostNetwork() { return s.hostIP, nil } podNetwork := newPodNetwork(sb) result, err := s.netPlugin.GetPodNetworkStatus(podNetwork) if err != nil { return "", fmt.Errorf("failed to get network status for pod sandbox %s(%s): %v", sb.Name(...
go
func (s *Server) getSandboxIP(sb *sandbox.Sandbox) (string, error) { if sb.HostNetwork() { return s.hostIP, nil } podNetwork := newPodNetwork(sb) result, err := s.netPlugin.GetPodNetworkStatus(podNetwork) if err != nil { return "", fmt.Errorf("failed to get network status for pod sandbox %s(%s): %v", sb.Name(...
[ "func", "(", "s", "*", "Server", ")", "getSandboxIP", "(", "sb", "*", "sandbox", ".", "Sandbox", ")", "(", "string", ",", "error", ")", "{", "if", "sb", ".", "HostNetwork", "(", ")", "{", "return", "s", ".", "hostIP", ",", "nil", "\n", "}", "\n\n...
// getSandboxIP retrieves the IP address for the sandbox
[ "getSandboxIP", "retrieves", "the", "IP", "address", "for", "the", "sandbox" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_network.go#L78-L95
27,836
cri-o/cri-o
server/sandbox_network.go
networkStop
func (s *Server) networkStop(sb *sandbox.Sandbox) { if sb.HostNetwork() { return } if err := s.hostportManager.Remove(sb.ID(), &hostport.PodPortMapping{ Name: sb.Name(), PortMappings: sb.PortMappings(), HostNetwork: false, }); err != nil { logrus.Warnf("failed to remove hostport for pod sandbox ...
go
func (s *Server) networkStop(sb *sandbox.Sandbox) { if sb.HostNetwork() { return } if err := s.hostportManager.Remove(sb.ID(), &hostport.PodPortMapping{ Name: sb.Name(), PortMappings: sb.PortMappings(), HostNetwork: false, }); err != nil { logrus.Warnf("failed to remove hostport for pod sandbox ...
[ "func", "(", "s", "*", "Server", ")", "networkStop", "(", "sb", "*", "sandbox", ".", "Sandbox", ")", "{", "if", "sb", ".", "HostNetwork", "(", ")", "{", "return", "\n", "}", "\n\n", "if", "err", ":=", "s", ".", "hostportManager", ".", "Remove", "("...
// networkStop cleans up and removes a pod's network. It is best-effort and // must call the network plugin even if the network namespace is already gone
[ "networkStop", "cleans", "up", "and", "removes", "a", "pod", "s", "network", ".", "It", "is", "best", "-", "effort", "and", "must", "call", "the", "network", "plugin", "even", "if", "the", "network", "namespace", "is", "already", "gone" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_network.go#L99-L118
27,837
cri-o/cri-o
server/image_status.go
getUserFromImage
func getUserFromImage(user string) (*int64, string) { // return both empty if user is not specified in the image. if user == "" { return nil, "" } // split instances where the id may contain user:group user = strings.Split(user, ":")[0] // user could be either uid or user name. Try to interpret as numeric uid. ...
go
func getUserFromImage(user string) (*int64, string) { // return both empty if user is not specified in the image. if user == "" { return nil, "" } // split instances where the id may contain user:group user = strings.Split(user, ":")[0] // user could be either uid or user name. Try to interpret as numeric uid. ...
[ "func", "getUserFromImage", "(", "user", "string", ")", "(", "*", "int64", ",", "string", ")", "{", "// return both empty if user is not specified in the image.", "if", "user", "==", "\"", "\"", "{", "return", "nil", ",", "\"", "\"", "\n", "}", "\n", "// split...
// getUserFromImage gets uid or user name of the image user. // If user is numeric, it will be treated as uid; or else, it is treated as user name.
[ "getUserFromImage", "gets", "uid", "or", "user", "name", "of", "the", "image", "user", ".", "If", "user", "is", "numeric", "it", "will", "be", "treated", "as", "uid", ";", "or", "else", "it", "is", "treated", "as", "user", "name", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/image_status.go#L94-L109
27,838
cri-o/cri-o
server/container_reopen_log.go
ReopenContainerLog
func (s *Server) ReopenContainerLog(ctx context.Context, req *pb.ReopenContainerLogRequest) (resp *pb.ReopenContainerLogResponse, err error) { const operation = "container_reopen_log" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() logrus.Debugf("ReopenContainerLogRequest ...
go
func (s *Server) ReopenContainerLog(ctx context.Context, req *pb.ReopenContainerLogRequest) (resp *pb.ReopenContainerLogResponse, err error) { const operation = "container_reopen_log" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() logrus.Debugf("ReopenContainerLogRequest ...
[ "func", "(", "s", "*", "Server", ")", "ReopenContainerLog", "(", "ctx", "context", ".", "Context", ",", "req", "*", "pb", ".", "ReopenContainerLogRequest", ")", "(", "resp", "*", "pb", ".", "ReopenContainerLogResponse", ",", "err", "error", ")", "{", "cons...
// ReopenContainerLog reopens the containers log file
[ "ReopenContainerLog", "reopens", "the", "containers", "log", "file" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/container_reopen_log.go#L14-L45
27,839
cri-o/cri-o
server/sandbox_list.go
filterSandbox
func filterSandbox(p *pb.PodSandbox, filter *pb.PodSandboxFilter) bool { if filter != nil { if filter.State != nil { if p.State != filter.State.State { return false } } if filter.LabelSelector != nil { sel := fields.SelectorFromSet(filter.LabelSelector) if !sel.Matches(fields.Set(p.Labels)) { ...
go
func filterSandbox(p *pb.PodSandbox, filter *pb.PodSandboxFilter) bool { if filter != nil { if filter.State != nil { if p.State != filter.State.State { return false } } if filter.LabelSelector != nil { sel := fields.SelectorFromSet(filter.LabelSelector) if !sel.Matches(fields.Set(p.Labels)) { ...
[ "func", "filterSandbox", "(", "p", "*", "pb", ".", "PodSandbox", ",", "filter", "*", "pb", ".", "PodSandboxFilter", ")", "bool", "{", "if", "filter", "!=", "nil", "{", "if", "filter", ".", "State", "!=", "nil", "{", "if", "p", ".", "State", "!=", "...
// filterSandbox returns whether passed container matches filtering criteria
[ "filterSandbox", "returns", "whether", "passed", "container", "matches", "filtering", "criteria" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_list.go#L15-L30
27,840
cri-o/cri-o
server/sandbox_list.go
ListPodSandbox
func (s *Server) ListPodSandbox(ctx context.Context, req *pb.ListPodSandboxRequest) (resp *pb.ListPodSandboxResponse, err error) { const operation = "list_pod_sandbox" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() logrus.Debugf("ListPodSandboxRequest %+v", req) var pods...
go
func (s *Server) ListPodSandbox(ctx context.Context, req *pb.ListPodSandboxRequest) (resp *pb.ListPodSandboxResponse, err error) { const operation = "list_pod_sandbox" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() logrus.Debugf("ListPodSandboxRequest %+v", req) var pods...
[ "func", "(", "s", "*", "Server", ")", "ListPodSandbox", "(", "ctx", "context", ".", "Context", ",", "req", "*", "pb", ".", "ListPodSandboxRequest", ")", "(", "resp", "*", "pb", ".", "ListPodSandboxResponse", ",", "err", "error", ")", "{", "const", "opera...
// ListPodSandbox returns a list of SandBoxes.
[ "ListPodSandbox", "returns", "a", "list", "of", "SandBoxes", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/sandbox_list.go#L33-L103
27,841
cri-o/cri-o
server/container_remove.go
RemoveContainer
func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerRequest) (resp *pb.RemoveContainerResponse, err error) { const operation = "remove_container" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() logrus.Debugf("RemoveContainerRequest: %+v", req) // ...
go
func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerRequest) (resp *pb.RemoveContainerResponse, err error) { const operation = "remove_container" defer func() { recordOperation(operation, time.Now()) recordError(operation, err) }() logrus.Debugf("RemoveContainerRequest: %+v", req) // ...
[ "func", "(", "s", "*", "Server", ")", "RemoveContainer", "(", "ctx", "context", ".", "Context", ",", "req", "*", "pb", ".", "RemoveContainerRequest", ")", "(", "resp", "*", "pb", ".", "RemoveContainerResponse", ",", "err", "error", ")", "{", "const", "op...
// RemoveContainer removes the container. If the container is running, the container // should be force removed.
[ "RemoveContainer", "removes", "the", "container", ".", "If", "the", "container", "is", "running", "the", "container", "should", "be", "force", "removed", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/container_remove.go#L13-L36
27,842
cri-o/cri-o
utils/ioutil/read_closer.go
Close
func (w *wrapReadCloser) Close() error { w.reader.Close() w.writer.Close() return nil }
go
func (w *wrapReadCloser) Close() error { w.reader.Close() w.writer.Close() return nil }
[ "func", "(", "w", "*", "wrapReadCloser", ")", "Close", "(", ")", "error", "{", "w", ".", "reader", ".", "Close", "(", ")", "\n", "w", ".", "writer", ".", "Close", "(", ")", "\n", "return", "nil", "\n", "}" ]
// Close closes read closer.
[ "Close", "closes", "read", "closer", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/ioutil/read_closer.go#L53-L57
27,843
cri-o/cri-o
server/config.go
Validate
func (c *Config) Validate(onExecution bool) error { switch c.ImageVolumes { case lib.ImageVolumesMkdir: case lib.ImageVolumesIgnore: case lib.ImageVolumesBind: default: return fmt.Errorf("unrecognized image volume type specified") } if err := c.Config.Validate(onExecution); err != nil { return errors.Wrapf(...
go
func (c *Config) Validate(onExecution bool) error { switch c.ImageVolumes { case lib.ImageVolumesMkdir: case lib.ImageVolumesIgnore: case lib.ImageVolumesBind: default: return fmt.Errorf("unrecognized image volume type specified") } if err := c.Config.Validate(onExecution); err != nil { return errors.Wrapf(...
[ "func", "(", "c", "*", "Config", ")", "Validate", "(", "onExecution", "bool", ")", "error", "{", "switch", "c", ".", "ImageVolumes", "{", "case", "lib", ".", "ImageVolumesMkdir", ":", "case", "lib", ".", "ImageVolumesIgnore", ":", "case", "lib", ".", "Im...
// Validate is the main entry point for configuration validation // The parameter `onExecution` specifies if the validation should include // execution checks. It returns an `error` on validation failure, otherwise // `nil`.
[ "Validate", "is", "the", "main", "entry", "point", "for", "configuration", "validation", "The", "parameter", "onExecution", "specifies", "if", "the", "validation", "should", "include", "execution", "checks", ".", "It", "returns", "an", "error", "on", "validation",...
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/config.go#L167-L192
27,844
cri-o/cri-o
oci/runtime_oci.go
newRuntimeOCI
func newRuntimeOCI(r *Runtime, handler *RuntimeHandler) RuntimeImpl { return &runtimeOCI{ Runtime: r, path: handler.RuntimePath, root: handler.RuntimeRoot, } }
go
func newRuntimeOCI(r *Runtime, handler *RuntimeHandler) RuntimeImpl { return &runtimeOCI{ Runtime: r, path: handler.RuntimePath, root: handler.RuntimeRoot, } }
[ "func", "newRuntimeOCI", "(", "r", "*", "Runtime", ",", "handler", "*", "RuntimeHandler", ")", "RuntimeImpl", "{", "return", "&", "runtimeOCI", "{", "Runtime", ":", "r", ",", "path", ":", "handler", ".", "RuntimePath", ",", "root", ":", "handler", ".", "...
// newRuntimeOCI creates a new runtimeOCI instance
[ "newRuntimeOCI", "creates", "a", "new", "runtimeOCI", "instance" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/runtime_oci.go#L49-L55
27,845
cri-o/cri-o
lib/sandbox/history.go
Less
func (history *History) Less(i, j int) bool { sandboxes := *history // FIXME: state access should be serialized return sandboxes[j].createdAt.Before(sandboxes[i].createdAt) }
go
func (history *History) Less(i, j int) bool { sandboxes := *history // FIXME: state access should be serialized return sandboxes[j].createdAt.Before(sandboxes[i].createdAt) }
[ "func", "(", "history", "*", "History", ")", "Less", "(", "i", ",", "j", "int", ")", "bool", "{", "sandboxes", ":=", "*", "history", "\n", "// FIXME: state access should be serialized", "return", "sandboxes", "[", "j", "]", ".", "createdAt", ".", "Before", ...
// Less compares two sandboxes and returns true if the second one // was created before the first one.
[ "Less", "compares", "two", "sandboxes", "and", "returns", "true", "if", "the", "second", "one", "was", "created", "before", "the", "first", "one", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/history.go#L16-L20
27,846
cri-o/cri-o
lib/sandbox/history.go
Swap
func (history *History) Swap(i, j int) { sandboxes := *history sandboxes[i], sandboxes[j] = sandboxes[j], sandboxes[i] }
go
func (history *History) Swap(i, j int) { sandboxes := *history sandboxes[i], sandboxes[j] = sandboxes[j], sandboxes[i] }
[ "func", "(", "history", "*", "History", ")", "Swap", "(", "i", ",", "j", "int", ")", "{", "sandboxes", ":=", "*", "history", "\n", "sandboxes", "[", "i", "]", ",", "sandboxes", "[", "j", "]", "=", "sandboxes", "[", "j", "]", ",", "sandboxes", "["...
// Swap switches sandboxes i and j positions in the history.
[ "Swap", "switches", "sandboxes", "i", "and", "j", "positions", "in", "the", "history", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/history.go#L23-L26
27,847
cri-o/cri-o
utils/io/exec_io.go
NewExecIO
func NewExecIO(id, root string, tty, stdin bool) (*ExecIO, error) { fifos, err := newFifos(root, id, tty, stdin) if err != nil { return nil, err } stdio, closer, err := newStdioPipes(fifos) if err != nil { return nil, err } return &ExecIO{ id: id, fifos: fifos, stdioPipes: stdio, closer:...
go
func NewExecIO(id, root string, tty, stdin bool) (*ExecIO, error) { fifos, err := newFifos(root, id, tty, stdin) if err != nil { return nil, err } stdio, closer, err := newStdioPipes(fifos) if err != nil { return nil, err } return &ExecIO{ id: id, fifos: fifos, stdioPipes: stdio, closer:...
[ "func", "NewExecIO", "(", "id", ",", "root", "string", ",", "tty", ",", "stdin", "bool", ")", "(", "*", "ExecIO", ",", "error", ")", "{", "fifos", ",", "err", ":=", "newFifos", "(", "root", ",", "id", ",", "tty", ",", "stdin", ")", "\n", "if", ...
// NewExecIO creates exec io.
[ "NewExecIO", "creates", "exec", "io", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/io/exec_io.go#L40-L55
27,848
cri-o/cri-o
utils/io/exec_io.go
Attach
func (e *ExecIO) Attach(opts AttachOptions) <-chan struct{} { var wg sync.WaitGroup var stdinStreamRC io.ReadCloser if e.stdin != nil && opts.Stdin != nil { stdinStreamRC = cioutil.NewWrapReadCloser(opts.Stdin) wg.Add(1) go func() { if _, err := io.Copy(e.stdin, stdinStreamRC); err != nil { logrus.WithE...
go
func (e *ExecIO) Attach(opts AttachOptions) <-chan struct{} { var wg sync.WaitGroup var stdinStreamRC io.ReadCloser if e.stdin != nil && opts.Stdin != nil { stdinStreamRC = cioutil.NewWrapReadCloser(opts.Stdin) wg.Add(1) go func() { if _, err := io.Copy(e.stdin, stdinStreamRC); err != nil { logrus.WithE...
[ "func", "(", "e", "*", "ExecIO", ")", "Attach", "(", "opts", "AttachOptions", ")", "<-", "chan", "struct", "{", "}", "{", "var", "wg", "sync", ".", "WaitGroup", "\n", "var", "stdinStreamRC", "io", ".", "ReadCloser", "\n", "if", "e", ".", "stdin", "!=...
// Attach attaches exec stdio. The logic is similar with container io attach.
[ "Attach", "attaches", "exec", "stdio", ".", "The", "logic", "is", "similar", "with", "container", "io", "attach", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/io/exec_io.go#L63-L125
27,849
cri-o/cri-o
oci/stats.go
getContainerNetIO
func getContainerNetIO(stats *libcontainer.Stats) (received uint64, transmitted uint64) { for _, iface := range stats.Interfaces { received += iface.RxBytes transmitted += iface.TxBytes } return }
go
func getContainerNetIO(stats *libcontainer.Stats) (received uint64, transmitted uint64) { for _, iface := range stats.Interfaces { received += iface.RxBytes transmitted += iface.TxBytes } return }
[ "func", "getContainerNetIO", "(", "stats", "*", "libcontainer", ".", "Stats", ")", "(", "received", "uint64", ",", "transmitted", "uint64", ")", "{", "for", "_", ",", "iface", ":=", "range", "stats", ".", "Interfaces", "{", "received", "+=", "iface", ".", ...
// Returns the total number of bytes transmitted and received for the given container stats
[ "Returns", "the", "total", "number", "of", "bytes", "transmitted", "and", "received", "for", "the", "given", "container", "stats" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/stats.go#L27-L33
27,850
cri-o/cri-o
oci/stats.go
getMemLimit
func getMemLimit(cgroupLimit uint64) uint64 { si := &syscall.Sysinfo_t{} err := syscall.Sysinfo(si) if err != nil { return cgroupLimit } physicalLimit := si.Totalram if cgroupLimit > physicalLimit { return physicalLimit } return cgroupLimit }
go
func getMemLimit(cgroupLimit uint64) uint64 { si := &syscall.Sysinfo_t{} err := syscall.Sysinfo(si) if err != nil { return cgroupLimit } physicalLimit := si.Totalram if cgroupLimit > physicalLimit { return physicalLimit } return cgroupLimit }
[ "func", "getMemLimit", "(", "cgroupLimit", "uint64", ")", "uint64", "{", "si", ":=", "&", "syscall", ".", "Sysinfo_t", "{", "}", "\n", "err", ":=", "syscall", ".", "Sysinfo", "(", "si", ")", "\n", "if", "err", "!=", "nil", "{", "return", "cgroupLimit",...
// getMemory limit returns the memory limit for a given cgroup // If the configured memory limit is larger than the total memory on the sys, the // physical system memory size is returned
[ "getMemory", "limit", "returns", "the", "memory", "limit", "for", "a", "given", "cgroup", "If", "the", "configured", "memory", "limit", "is", "larger", "than", "the", "total", "memory", "on", "the", "sys", "the", "physical", "system", "memory", "size", "is",...
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/stats.go#L50-L62
27,851
cri-o/cri-o
utils/io/container_io.go
streamKey
func streamKey(id, name string, stream StreamType) string { return strings.Join([]string{id, name, string(stream)}, "-") }
go
func streamKey(id, name string, stream StreamType) string { return strings.Join([]string{id, name, string(stream)}, "-") }
[ "func", "streamKey", "(", "id", ",", "name", "string", ",", "stream", "StreamType", ")", "string", "{", "return", "strings", ".", "Join", "(", "[", "]", "string", "{", "id", ",", "name", ",", "string", "(", "stream", ")", "}", ",", "\"", "\"", ")",...
// streamKey generates a key for the stream.
[ "streamKey", "generates", "a", "key", "for", "the", "stream", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/io/container_io.go#L33-L35
27,852
cri-o/cri-o
utils/io/container_io.go
WithFIFOs
func WithFIFOs(fifos *cio.FIFOSet) ContainerIOOpts { return func(c *ContainerIO) error { c.fifos = fifos return nil } }
go
func WithFIFOs(fifos *cio.FIFOSet) ContainerIOOpts { return func(c *ContainerIO) error { c.fifos = fifos return nil } }
[ "func", "WithFIFOs", "(", "fifos", "*", "cio", ".", "FIFOSet", ")", "ContainerIOOpts", "{", "return", "func", "(", "c", "*", "ContainerIO", ")", "error", "{", "c", ".", "fifos", "=", "fifos", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithFIFOs specifies existing fifos for the container io.
[ "WithFIFOs", "specifies", "existing", "fifos", "for", "the", "container", "io", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/io/container_io.go#L56-L61
27,853
cri-o/cri-o
utils/io/container_io.go
WithNewFIFOs
func WithNewFIFOs(root string, tty, stdin bool) ContainerIOOpts { return func(c *ContainerIO) error { fifos, err := newFifos(root, c.id, tty, stdin) if err != nil { return err } return WithFIFOs(fifos)(c) } }
go
func WithNewFIFOs(root string, tty, stdin bool) ContainerIOOpts { return func(c *ContainerIO) error { fifos, err := newFifos(root, c.id, tty, stdin) if err != nil { return err } return WithFIFOs(fifos)(c) } }
[ "func", "WithNewFIFOs", "(", "root", "string", ",", "tty", ",", "stdin", "bool", ")", "ContainerIOOpts", "{", "return", "func", "(", "c", "*", "ContainerIO", ")", "error", "{", "fifos", ",", "err", ":=", "newFifos", "(", "root", ",", "c", ".", "id", ...
// WithNewFIFOs creates new fifos for the container io.
[ "WithNewFIFOs", "creates", "new", "fifos", "for", "the", "container", "io", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/io/container_io.go#L64-L72
27,854
cri-o/cri-o
utils/io/container_io.go
NewContainerIO
func NewContainerIO(id string, opts ...ContainerIOOpts) (_ *ContainerIO, err error) { c := &ContainerIO{ id: id, stdoutGroup: cioutil.NewWriterGroup(), stderrGroup: cioutil.NewWriterGroup(), } for _, opt := range opts { if err := opt(c); err != nil { return nil, err } } if c.fifos == nil { ...
go
func NewContainerIO(id string, opts ...ContainerIOOpts) (_ *ContainerIO, err error) { c := &ContainerIO{ id: id, stdoutGroup: cioutil.NewWriterGroup(), stderrGroup: cioutil.NewWriterGroup(), } for _, opt := range opts { if err := opt(c); err != nil { return nil, err } } if c.fifos == nil { ...
[ "func", "NewContainerIO", "(", "id", "string", ",", "opts", "...", "ContainerIOOpts", ")", "(", "_", "*", "ContainerIO", ",", "err", "error", ")", "{", "c", ":=", "&", "ContainerIO", "{", "id", ":", "id", ",", "stdoutGroup", ":", "cioutil", ".", "NewWr...
// NewContainerIO creates container io.
[ "NewContainerIO", "creates", "container", "io", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/io/container_io.go#L75-L97
27,855
cri-o/cri-o
utils/io/container_io.go
Pipe
func (c *ContainerIO) Pipe() { wg := c.closer.wg wg.Add(1) go func() { if _, err := io.Copy(c.stdoutGroup, c.stdout); err != nil { logrus.WithError(err).Errorf("Failed to pipe stdout of container %q", c.id) } c.stdout.Close() c.stdoutGroup.Close() wg.Done() logrus.Infof("Finish piping stdout of contai...
go
func (c *ContainerIO) Pipe() { wg := c.closer.wg wg.Add(1) go func() { if _, err := io.Copy(c.stdoutGroup, c.stdout); err != nil { logrus.WithError(err).Errorf("Failed to pipe stdout of container %q", c.id) } c.stdout.Close() c.stdoutGroup.Close() wg.Done() logrus.Infof("Finish piping stdout of contai...
[ "func", "(", "c", "*", "ContainerIO", ")", "Pipe", "(", ")", "{", "wg", ":=", "c", ".", "closer", ".", "wg", "\n", "wg", ".", "Add", "(", "1", ")", "\n", "go", "func", "(", ")", "{", "if", "_", ",", "err", ":=", "io", ".", "Copy", "(", "c...
// Pipe creates container fifos and pipe container output // to output stream.
[ "Pipe", "creates", "container", "fifos", "and", "pipe", "container", "output", "to", "output", "stream", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/io/container_io.go#L106-L131
27,856
cri-o/cri-o
utils/io/container_io.go
AddOutput
func (c *ContainerIO) AddOutput(name string, stdout, stderr io.WriteCloser) (io.WriteCloser, io.WriteCloser) { var oldStdout, oldStderr io.WriteCloser if stdout != nil { key := streamKey(c.id, name, Stdout) oldStdout = c.stdoutGroup.Get(key) c.stdoutGroup.Add(key, stdout) } if stderr != nil { key := streamK...
go
func (c *ContainerIO) AddOutput(name string, stdout, stderr io.WriteCloser) (io.WriteCloser, io.WriteCloser) { var oldStdout, oldStderr io.WriteCloser if stdout != nil { key := streamKey(c.id, name, Stdout) oldStdout = c.stdoutGroup.Get(key) c.stdoutGroup.Add(key, stdout) } if stderr != nil { key := streamK...
[ "func", "(", "c", "*", "ContainerIO", ")", "AddOutput", "(", "name", "string", ",", "stdout", ",", "stderr", "io", ".", "WriteCloser", ")", "(", "io", ".", "WriteCloser", ",", "io", ".", "WriteCloser", ")", "{", "var", "oldStdout", ",", "oldStderr", "i...
// AddOutput adds new write closers to the container stream, and returns existing // write closers if there are any.
[ "AddOutput", "adds", "new", "write", "closers", "to", "the", "container", "stream", "and", "returns", "existing", "write", "closers", "if", "there", "are", "any", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/io/container_io.go#L202-L215
27,857
cri-o/cri-o
lib/logs.go
GetLogs
func (c *ContainerServer) GetLogs(container string, logChan chan string, opts LogOptions) error { defer close(logChan) // Get the full ID of the container ctr, err := c.LookupContainer(container) if err != nil { return err } containerID := ctr.ID() sandbox := ctr.Sandbox() if sandbox == "" { sandbox = cont...
go
func (c *ContainerServer) GetLogs(container string, logChan chan string, opts LogOptions) error { defer close(logChan) // Get the full ID of the container ctr, err := c.LookupContainer(container) if err != nil { return err } containerID := ctr.ID() sandbox := ctr.Sandbox() if sandbox == "" { sandbox = cont...
[ "func", "(", "c", "*", "ContainerServer", ")", "GetLogs", "(", "container", "string", ",", "logChan", "chan", "string", ",", "opts", "LogOptions", ")", "error", "{", "defer", "close", "(", "logChan", ")", "\n", "// Get the full ID of the container", "ctr", ","...
// GetLogs gets each line of a log file and, if it matches the criteria in logOptions, sends it down logChan
[ "GetLogs", "gets", "each", "line", "of", "a", "log", "file", "and", "if", "it", "matches", "the", "criteria", "in", "logOptions", "sends", "it", "down", "logChan" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/logs.go#L20-L52
27,858
cri-o/cri-o
oci/container.go
NewContainer
func NewContainer(id string, name string, bundlePath string, logPath string, netns string, labels map[string]string, crioAnnotations map[string]string, annotations map[string]string, image string, imageName string, imageRef string, metadata *pb.ContainerMetadata, sandbox string, terminal bool, stdin bool, stdinOnce boo...
go
func NewContainer(id string, name string, bundlePath string, logPath string, netns string, labels map[string]string, crioAnnotations map[string]string, annotations map[string]string, image string, imageName string, imageRef string, metadata *pb.ContainerMetadata, sandbox string, terminal bool, stdin bool, stdinOnce boo...
[ "func", "NewContainer", "(", "id", "string", ",", "name", "string", ",", "bundlePath", "string", ",", "logPath", "string", ",", "netns", "string", ",", "labels", "map", "[", "string", "]", "string", ",", "crioAnnotations", "map", "[", "string", "]", "strin...
// NewContainer creates a container object.
[ "NewContainer", "creates", "a", "container", "object", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/container.go#L79-L106
27,859
cri-o/cri-o
oci/container.go
GetStopSignal
func (c *Container) GetStopSignal() string { if c.stopSignal == "" { return defaultStopSignal } cleanSignal := strings.TrimPrefix(strings.ToUpper(c.stopSignal), "SIG") _, ok := signal.SignalMap[cleanSignal] if !ok { return defaultStopSignal } return cleanSignal }
go
func (c *Container) GetStopSignal() string { if c.stopSignal == "" { return defaultStopSignal } cleanSignal := strings.TrimPrefix(strings.ToUpper(c.stopSignal), "SIG") _, ok := signal.SignalMap[cleanSignal] if !ok { return defaultStopSignal } return cleanSignal }
[ "func", "(", "c", "*", "Container", ")", "GetStopSignal", "(", ")", "string", "{", "if", "c", ".", "stopSignal", "==", "\"", "\"", "{", "return", "defaultStopSignal", "\n", "}", "\n", "cleanSignal", ":=", "strings", ".", "TrimPrefix", "(", "strings", "."...
// GetStopSignal returns the container's own stop signal configured from the // image configuration or the default one.
[ "GetStopSignal", "returns", "the", "container", "s", "own", "stop", "signal", "configured", "from", "the", "image", "configuration", "or", "the", "default", "one", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/container.go#L120-L130
27,860
cri-o/cri-o
oci/container.go
StopSignal
func (c *Container) StopSignal() syscall.Signal { if c.stopSignal == "" { return defaultStopSignalInt } cleanSignal := strings.TrimPrefix(strings.ToUpper(c.stopSignal), "SIG") sig, ok := signal.SignalMap[cleanSignal] if !ok { return defaultStopSignalInt } return sig }
go
func (c *Container) StopSignal() syscall.Signal { if c.stopSignal == "" { return defaultStopSignalInt } cleanSignal := strings.TrimPrefix(strings.ToUpper(c.stopSignal), "SIG") sig, ok := signal.SignalMap[cleanSignal] if !ok { return defaultStopSignalInt } return sig }
[ "func", "(", "c", "*", "Container", ")", "StopSignal", "(", ")", "syscall", ".", "Signal", "{", "if", "c", ".", "stopSignal", "==", "\"", "\"", "{", "return", "defaultStopSignalInt", "\n", "}", "\n", "cleanSignal", ":=", "strings", ".", "TrimPrefix", "("...
// StopSignal returns the container's own stop signal configured from // the image configuration or the default one.
[ "StopSignal", "returns", "the", "container", "s", "own", "stop", "signal", "configured", "from", "the", "image", "configuration", "or", "the", "default", "one", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/container.go#L134-L144
27,861
cri-o/cri-o
oci/container.go
FromDisk
func (c *Container) FromDisk() error { jsonSource, err := os.Open(c.StatePath()) if err != nil { return err } defer jsonSource.Close() dec := json.NewDecoder(jsonSource) return dec.Decode(c.state) }
go
func (c *Container) FromDisk() error { jsonSource, err := os.Open(c.StatePath()) if err != nil { return err } defer jsonSource.Close() dec := json.NewDecoder(jsonSource) return dec.Decode(c.state) }
[ "func", "(", "c", "*", "Container", ")", "FromDisk", "(", ")", "error", "{", "jsonSource", ",", "err", ":=", "os", ".", "Open", "(", "c", ".", "StatePath", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "d...
// FromDisk restores container's state from disk
[ "FromDisk", "restores", "container", "s", "state", "from", "disk" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/container.go#L147-L156
27,862
cri-o/cri-o
oci/container.go
NetNsPath
func (c *Container) NetNsPath() (string, error) { if c.state == nil { return "", fmt.Errorf("container state is not populated") } if c.netns == "" { return fmt.Sprintf("/proc/%d/ns/net", c.state.Pid), nil } return c.netns, nil }
go
func (c *Container) NetNsPath() (string, error) { if c.state == nil { return "", fmt.Errorf("container state is not populated") } if c.netns == "" { return fmt.Sprintf("/proc/%d/ns/net", c.state.Pid), nil } return c.netns, nil }
[ "func", "(", "c", "*", "Container", ")", "NetNsPath", "(", ")", "(", "string", ",", "error", ")", "{", "if", "c", ".", "state", "==", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", ...
// NetNsPath returns the path to the network namespace of the container.
[ "NetNsPath", "returns", "the", "path", "to", "the", "network", "namespace", "of", "the", "container", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/container.go#L239-L249
27,863
cri-o/cri-o
oci/container.go
State
func (c *Container) State() *ContainerState { c.opLock.RLock() defer c.opLock.RUnlock() return c.state }
go
func (c *Container) State() *ContainerState { c.opLock.RLock() defer c.opLock.RUnlock() return c.state }
[ "func", "(", "c", "*", "Container", ")", "State", "(", ")", "*", "ContainerState", "{", "c", ".", "opLock", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "opLock", ".", "RUnlock", "(", ")", "\n", "return", "c", ".", "state", "\n", "}" ]
// State returns the state of the running container
[ "State", "returns", "the", "state", "of", "the", "running", "container" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/container.go#L257-L261
27,864
cri-o/cri-o
oci/container.go
AddVolume
func (c *Container) AddVolume(v ContainerVolume) { c.volumes = append(c.volumes, v) }
go
func (c *Container) AddVolume(v ContainerVolume) { c.volumes = append(c.volumes, v) }
[ "func", "(", "c", "*", "Container", ")", "AddVolume", "(", "v", "ContainerVolume", ")", "{", "c", ".", "volumes", "=", "append", "(", "c", ".", "volumes", ",", "v", ")", "\n", "}" ]
// AddVolume adds a volume to list of container volumes.
[ "AddVolume", "adds", "a", "volume", "to", "list", "of", "container", "volumes", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/container.go#L269-L271
27,865
cri-o/cri-o
oci/container.go
SetStartFailed
func (c *Container) SetStartFailed(err error) { c.opLock.Lock() defer c.opLock.Unlock() // adjust finished and started times c.state.Finished, c.state.Started = c.state.Created, c.state.Created if err != nil { c.state.Error = err.Error() } }
go
func (c *Container) SetStartFailed(err error) { c.opLock.Lock() defer c.opLock.Unlock() // adjust finished and started times c.state.Finished, c.state.Started = c.state.Created, c.state.Created if err != nil { c.state.Error = err.Error() } }
[ "func", "(", "c", "*", "Container", ")", "SetStartFailed", "(", "err", "error", ")", "{", "c", ".", "opLock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "opLock", ".", "Unlock", "(", ")", "\n", "// adjust finished and started times", "c", ".", "st...
// SetStartFailed sets the container state appropriately after a start failure
[ "SetStartFailed", "sets", "the", "container", "state", "appropriately", "after", "a", "start", "failure" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/container.go#L310-L318
27,866
cri-o/cri-o
oci/container.go
Description
func (c *Container) Description() string { return fmt.Sprintf("%s/%s/%s", c.Labels()[types.KubernetesPodNamespaceLabel], c.Labels()[types.KubernetesPodNameLabel], c.Labels()[types.KubernetesContainerNameLabel]) }
go
func (c *Container) Description() string { return fmt.Sprintf("%s/%s/%s", c.Labels()[types.KubernetesPodNamespaceLabel], c.Labels()[types.KubernetesPodNameLabel], c.Labels()[types.KubernetesContainerNameLabel]) }
[ "func", "(", "c", "*", "Container", ")", "Description", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "Labels", "(", ")", "[", "types", ".", "KubernetesPodNamespaceLabel", "]", ",", "c", ".", "Labels", "(",...
// Description returns a description for the container
[ "Description", "returns", "a", "description", "for", "the", "container" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/oci/container.go#L321-L323
27,867
cri-o/cri-o
utils/ioutil/write_closer.go
NewWriteCloseInformer
func NewWriteCloseInformer(wc io.WriteCloser) (io.WriteCloser, <-chan struct{}) { close := make(chan struct{}) return &writeCloseInformer{ close: close, wc: wc, }, close }
go
func NewWriteCloseInformer(wc io.WriteCloser) (io.WriteCloser, <-chan struct{}) { close := make(chan struct{}) return &writeCloseInformer{ close: close, wc: wc, }, close }
[ "func", "NewWriteCloseInformer", "(", "wc", "io", ".", "WriteCloser", ")", "(", "io", ".", "WriteCloser", ",", "<-", "chan", "struct", "{", "}", ")", "{", "close", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "return", "&", "writeCloseInfo...
// NewWriteCloseInformer creates the writeCloseInformer from a write closer.
[ "NewWriteCloseInformer", "creates", "the", "writeCloseInformer", "from", "a", "write", "closer", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/ioutil/write_closer.go#L33-L39
27,868
cri-o/cri-o
utils/ioutil/write_closer.go
Write
func (w *writeCloseInformer) Write(p []byte) (int, error) { return w.wc.Write(p) }
go
func (w *writeCloseInformer) Write(p []byte) (int, error) { return w.wc.Write(p) }
[ "func", "(", "w", "*", "writeCloseInformer", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "return", "w", ".", "wc", ".", "Write", "(", "p", ")", "\n", "}" ]
// Write passes through the data into the internal write closer.
[ "Write", "passes", "through", "the", "data", "into", "the", "internal", "write", "closer", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/ioutil/write_closer.go#L42-L44
27,869
cri-o/cri-o
utils/ioutil/write_closer.go
Close
func (w *writeCloseInformer) Close() error { err := w.wc.Close() close(w.close) return err }
go
func (w *writeCloseInformer) Close() error { err := w.wc.Close() close(w.close) return err }
[ "func", "(", "w", "*", "writeCloseInformer", ")", "Close", "(", ")", "error", "{", "err", ":=", "w", ".", "wc", ".", "Close", "(", ")", "\n", "close", "(", "w", ".", "close", ")", "\n", "return", "err", "\n", "}" ]
// Close closes the internal write closer and inform the close channel.
[ "Close", "closes", "the", "internal", "write", "closer", "and", "inform", "the", "close", "channel", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/ioutil/write_closer.go#L47-L51
27,870
cri-o/cri-o
utils/ioutil/write_closer.go
Write
func (n *nopWriteCloser) Write(p []byte) (int, error) { return n.w.Write(p) }
go
func (n *nopWriteCloser) Write(p []byte) (int, error) { return n.w.Write(p) }
[ "func", "(", "n", "*", "nopWriteCloser", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "return", "n", ".", "w", ".", "Write", "(", "p", ")", "\n", "}" ]
// Write passes through the data into the internal writer.
[ "Write", "passes", "through", "the", "data", "into", "the", "internal", "writer", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/ioutil/write_closer.go#L64-L66
27,871
cri-o/cri-o
utils/ioutil/write_closer.go
Write
func (s *serialWriteCloser) Write(data []byte) (int, error) { s.mu.Lock() defer s.mu.Unlock() return s.wc.Write(data) }
go
func (s *serialWriteCloser) Write(data []byte) (int, error) { s.mu.Lock() defer s.mu.Unlock() return s.wc.Write(data) }
[ "func", "(", "s", "*", "serialWriteCloser", ")", "Write", "(", "data", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "...
// Write writes a group of byte arrays in order atomically.
[ "Write", "writes", "a", "group", "of", "byte", "arrays", "in", "order", "atomically", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/ioutil/write_closer.go#L91-L95
27,872
cri-o/cri-o
utils/ioutil/write_closer.go
Close
func (s *serialWriteCloser) Close() error { s.mu.Lock() defer s.mu.Unlock() return s.wc.Close() }
go
func (s *serialWriteCloser) Close() error { s.mu.Lock() defer s.mu.Unlock() return s.wc.Close() }
[ "func", "(", "s", "*", "serialWriteCloser", ")", "Close", "(", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "s", ".", "wc", ".", "Close", "(", ")", "\n", "}"...
// Close closes the write closer.
[ "Close", "closes", "the", "write", "closer", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/ioutil/write_closer.go#L98-L102
27,873
cri-o/cri-o
pkg/seccomp/seccomp.go
IsEnabled
func IsEnabled() bool { enabled := false // Check if Seccomp is supported, via CONFIG_SECCOMP. if err := unix.Prctl(unix.PR_GET_SECCOMP, 0, 0, 0, 0); err != unix.EINVAL { // Make sure the kernel has CONFIG_SECCOMP_FILTER. if err := unix.Prctl(unix.PR_SET_SECCOMP, unix.SECCOMP_MODE_FILTER, 0, 0, 0); err != unix.E...
go
func IsEnabled() bool { enabled := false // Check if Seccomp is supported, via CONFIG_SECCOMP. if err := unix.Prctl(unix.PR_GET_SECCOMP, 0, 0, 0, 0); err != unix.EINVAL { // Make sure the kernel has CONFIG_SECCOMP_FILTER. if err := unix.Prctl(unix.PR_SET_SECCOMP, unix.SECCOMP_MODE_FILTER, 0, 0, 0); err != unix.E...
[ "func", "IsEnabled", "(", ")", "bool", "{", "enabled", ":=", "false", "\n", "// Check if Seccomp is supported, via CONFIG_SECCOMP.", "if", "err", ":=", "unix", ".", "Prctl", "(", "unix", ".", "PR_GET_SECCOMP", ",", "0", ",", "0", ",", "0", ",", "0", ")", "...
// IsEnabled returns true if seccomp is enabled for the host.
[ "IsEnabled", "returns", "true", "if", "seccomp", "is", "enabled", "for", "the", "host", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/pkg/seccomp/seccomp.go#L19-L30
27,874
cri-o/cri-o
pkg/seccomp/seccomp.go
LoadProfileFromStruct
func LoadProfileFromStruct(config *Seccomp, specgen *generate.Generator) error { return setupSeccomp(config, specgen) }
go
func LoadProfileFromStruct(config *Seccomp, specgen *generate.Generator) error { return setupSeccomp(config, specgen) }
[ "func", "LoadProfileFromStruct", "(", "config", "*", "Seccomp", ",", "specgen", "*", "generate", ".", "Generator", ")", "error", "{", "return", "setupSeccomp", "(", "config", ",", "specgen", ")", "\n", "}" ]
// LoadProfileFromStruct takes a Seccomp struct and setup seccomp in the spec.
[ "LoadProfileFromStruct", "takes", "a", "Seccomp", "struct", "and", "setup", "seccomp", "in", "the", "spec", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/pkg/seccomp/seccomp.go#L33-L35
27,875
cri-o/cri-o
pkg/seccomp/seccomp.go
LoadProfileFromBytes
func LoadProfileFromBytes(body []byte, specgen *generate.Generator) error { config := &Seccomp{} if err := json.Unmarshal(body, config); err != nil { return fmt.Errorf("decoding seccomp profile failed: %v", err) } return setupSeccomp(config, specgen) }
go
func LoadProfileFromBytes(body []byte, specgen *generate.Generator) error { config := &Seccomp{} if err := json.Unmarshal(body, config); err != nil { return fmt.Errorf("decoding seccomp profile failed: %v", err) } return setupSeccomp(config, specgen) }
[ "func", "LoadProfileFromBytes", "(", "body", "[", "]", "byte", ",", "specgen", "*", "generate", ".", "Generator", ")", "error", "{", "config", ":=", "&", "Seccomp", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "body", ",", "config"...
// LoadProfileFromBytes takes a byte slice and decodes the seccomp profile.
[ "LoadProfileFromBytes", "takes", "a", "byte", "slice", "and", "decodes", "the", "seccomp", "profile", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/pkg/seccomp/seccomp.go#L38-L44
27,876
cri-o/cri-o
lib/remove.go
Remove
func (c *ContainerServer) Remove(ctx context.Context, container string, force bool) (string, error) { ctr, err := c.LookupContainer(container) if err != nil { return "", err } ctrID := ctr.ID() cStatus := ctr.State() switch cStatus.Status { case oci.ContainerStatePaused: return "", errors.Errorf("cannot rem...
go
func (c *ContainerServer) Remove(ctx context.Context, container string, force bool) (string, error) { ctr, err := c.LookupContainer(container) if err != nil { return "", err } ctrID := ctr.ID() cStatus := ctr.State() switch cStatus.Status { case oci.ContainerStatePaused: return "", errors.Errorf("cannot rem...
[ "func", "(", "c", "*", "ContainerServer", ")", "Remove", "(", "ctx", "context", ".", "Context", ",", "container", "string", ",", "force", "bool", ")", "(", "string", ",", "error", ")", "{", "ctr", ",", "err", ":=", "c", ".", "LookupContainer", "(", "...
// Remove removes a container
[ "Remove", "removes", "a", "container" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/remove.go#L13-L53
27,877
cri-o/cri-o
utils/typeurl/types.go
Register
func Register(v interface{}, args ...string) { var ( t = tryDereference(v) p = path.Join(args...) ) mu.Lock() defer mu.Unlock() if et, ok := registry[t]; ok { if et != p { panic(errors.Errorf("type registred with alternate path %q != %q", et, p)) } return } registry[t] = p }
go
func Register(v interface{}, args ...string) { var ( t = tryDereference(v) p = path.Join(args...) ) mu.Lock() defer mu.Unlock() if et, ok := registry[t]; ok { if et != p { panic(errors.Errorf("type registred with alternate path %q != %q", et, p)) } return } registry[t] = p }
[ "func", "Register", "(", "v", "interface", "{", "}", ",", "args", "...", "string", ")", "{", "var", "(", "t", "=", "tryDereference", "(", "v", ")", "\n", "p", "=", "path", ".", "Join", "(", "args", "...", ")", "\n", ")", "\n", "mu", ".", "Lock"...
// Register a type with the base url of the type
[ "Register", "a", "type", "with", "the", "base", "url", "of", "the", "type" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/typeurl/types.go#L38-L52
27,878
cri-o/cri-o
utils/typeurl/types.go
Is
func Is(any *types.Any, v interface{}) bool { // call to check that v is a pointer tryDereference(v) url, err := TypeURL(v) if err != nil { return false } return any.TypeUrl == url }
go
func Is(any *types.Any, v interface{}) bool { // call to check that v is a pointer tryDereference(v) url, err := TypeURL(v) if err != nil { return false } return any.TypeUrl == url }
[ "func", "Is", "(", "any", "*", "types", ".", "Any", ",", "v", "interface", "{", "}", ")", "bool", "{", "// call to check that v is a pointer", "tryDereference", "(", "v", ")", "\n", "url", ",", "err", ":=", "TypeURL", "(", "v", ")", "\n", "if", "err", ...
// Is returns true if the type of the Any is the same as v
[ "Is", "returns", "true", "if", "the", "type", "of", "the", "Any", "is", "the", "same", "as", "v" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/typeurl/types.go#L71-L79
27,879
cri-o/cri-o
utils/typeurl/types.go
MarshalAny
func MarshalAny(v interface{}) (*types.Any, error) { var marshal func(v interface{}) ([]byte, error) switch t := v.(type) { case *types.Any: // avoid reserializing the type if we have an any. return t, nil case proto.Message: marshal = func(v interface{}) ([]byte, error) { return proto.Marshal(t) } defa...
go
func MarshalAny(v interface{}) (*types.Any, error) { var marshal func(v interface{}) ([]byte, error) switch t := v.(type) { case *types.Any: // avoid reserializing the type if we have an any. return t, nil case proto.Message: marshal = func(v interface{}) ([]byte, error) { return proto.Marshal(t) } defa...
[ "func", "MarshalAny", "(", "v", "interface", "{", "}", ")", "(", "*", "types", ".", "Any", ",", "error", ")", "{", "var", "marshal", "func", "(", "v", "interface", "{", "}", ")", "(", "[", "]", "byte", ",", "error", ")", "\n", "switch", "t", ":...
// MarshalAny marshals the value v into an any with the correct TypeUrl
[ "MarshalAny", "marshals", "the", "value", "v", "into", "an", "any", "with", "the", "correct", "TypeUrl" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/typeurl/types.go#L82-L109
27,880
cri-o/cri-o
utils/typeurl/types.go
UnmarshalAny
func UnmarshalAny(any *types.Any) (interface{}, error) { t, err := getTypeByURL(any.TypeUrl) if err != nil { return nil, err } v := reflect.New(t.t).Interface() if t.isProto { err = proto.Unmarshal(any.Value, v.(proto.Message)) } else { err = json.Unmarshal(any.Value, v) } return v, err }
go
func UnmarshalAny(any *types.Any) (interface{}, error) { t, err := getTypeByURL(any.TypeUrl) if err != nil { return nil, err } v := reflect.New(t.t).Interface() if t.isProto { err = proto.Unmarshal(any.Value, v.(proto.Message)) } else { err = json.Unmarshal(any.Value, v) } return v, err }
[ "func", "UnmarshalAny", "(", "any", "*", "types", ".", "Any", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "t", ",", "err", ":=", "getTypeByURL", "(", "any", ".", "TypeUrl", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", "...
// UnmarshalAny unmarshals the any type into a concrete type
[ "UnmarshalAny", "unmarshals", "the", "any", "type", "into", "a", "concrete", "type" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/typeurl/types.go#L112-L124
27,881
cri-o/cri-o
server/container_create.go
resolveSymbolicLink
func resolveSymbolicLink(path, scope string) (string, error) { info, err := os.Lstat(path) if err != nil { return "", err } if info.Mode()&os.ModeSymlink != os.ModeSymlink { return path, nil } if scope == "" { scope = "/" } return symlink.FollowSymlinkInScope(path, scope) }
go
func resolveSymbolicLink(path, scope string) (string, error) { info, err := os.Lstat(path) if err != nil { return "", err } if info.Mode()&os.ModeSymlink != os.ModeSymlink { return path, nil } if scope == "" { scope = "/" } return symlink.FollowSymlinkInScope(path, scope) }
[ "func", "resolveSymbolicLink", "(", "path", ",", "scope", "string", ")", "(", "string", ",", "error", ")", "{", "info", ",", "err", ":=", "os", ".", "Lstat", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", ...
// resolveSymbolicLink resolves a possbile symlink path. If the path is a symlink, returns resolved // path; if not, returns the original path.
[ "resolveSymbolicLink", "resolves", "a", "possbile", "symlink", "path", ".", "If", "the", "path", "is", "a", "symlink", "returns", "resolved", "path", ";", "if", "not", "returns", "the", "original", "path", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/container_create.go#L202-L214
27,882
cri-o/cri-o
server/container_create.go
buildOCIProcessArgs
func buildOCIProcessArgs(containerKubeConfig *pb.ContainerConfig, imageOCIConfig *v1.Image) ([]string, error) { // # Start the nginx container using the default command, but use custom // arguments (arg1 .. argN) for that command. // kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN> // # Start the nginx ...
go
func buildOCIProcessArgs(containerKubeConfig *pb.ContainerConfig, imageOCIConfig *v1.Image) ([]string, error) { // # Start the nginx container using the default command, but use custom // arguments (arg1 .. argN) for that command. // kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN> // # Start the nginx ...
[ "func", "buildOCIProcessArgs", "(", "containerKubeConfig", "*", "pb", ".", "ContainerConfig", ",", "imageOCIConfig", "*", "v1", ".", "Image", ")", "(", "[", "]", "string", ",", "error", ")", "{", "// # Start the nginx container using the default command, but use custom"...
// buildOCIProcessArgs build an OCI compatible process arguments slice.
[ "buildOCIProcessArgs", "build", "an", "OCI", "compatible", "process", "arguments", "slice", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/container_create.go#L221-L265
27,883
cri-o/cri-o
server/container_create.go
setupContainerUser
func setupContainerUser(specgen *generate.Generator, rootfs, mountLabel, ctrRunDir string, sc *pb.LinuxContainerSecurityContext, imageConfig *v1.Image) error { if sc == nil { return nil } if sc.GetRunAsGroup() != nil && sc.GetRunAsUser() == nil && sc.GetRunAsUsername() == "" { return fmt.Errorf("user group is sp...
go
func setupContainerUser(specgen *generate.Generator, rootfs, mountLabel, ctrRunDir string, sc *pb.LinuxContainerSecurityContext, imageConfig *v1.Image) error { if sc == nil { return nil } if sc.GetRunAsGroup() != nil && sc.GetRunAsUser() == nil && sc.GetRunAsUsername() == "" { return fmt.Errorf("user group is sp...
[ "func", "setupContainerUser", "(", "specgen", "*", "generate", ".", "Generator", ",", "rootfs", ",", "mountLabel", ",", "ctrRunDir", "string", ",", "sc", "*", "pb", ".", "LinuxContainerSecurityContext", ",", "imageConfig", "*", "v1", ".", "Image", ")", "error"...
// setupContainerUser sets the UID, GID and supplemental groups in OCI runtime config
[ "setupContainerUser", "sets", "the", "UID", "GID", "and", "supplemental", "groups", "in", "OCI", "runtime", "config" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/container_create.go#L268-L327
27,884
cri-o/cri-o
server/container_create.go
generateUserString
func generateUserString(username, imageUser string, uid *pb.Int64Value) string { var userstr string if uid != nil { userstr = strconv.FormatInt(uid.GetValue(), 10) } if username != "" { userstr = username } // We use the user from the image config if nothing is provided if userstr == "" { userstr = imageUs...
go
func generateUserString(username, imageUser string, uid *pb.Int64Value) string { var userstr string if uid != nil { userstr = strconv.FormatInt(uid.GetValue(), 10) } if username != "" { userstr = username } // We use the user from the image config if nothing is provided if userstr == "" { userstr = imageUs...
[ "func", "generateUserString", "(", "username", ",", "imageUser", "string", ",", "uid", "*", "pb", ".", "Int64Value", ")", "string", "{", "var", "userstr", "string", "\n", "if", "uid", "!=", "nil", "{", "userstr", "=", "strconv", ".", "FormatInt", "(", "u...
// generateUserString generates valid user string based on OCI Image Spec v1.0.0.
[ "generateUserString", "generates", "valid", "user", "string", "based", "on", "OCI", "Image", "Spec", "v1", ".", "0", ".", "0", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/container_create.go#L330-L346
27,885
cri-o/cri-o
server/container_create.go
addSecretsBindMounts
func addSecretsBindMounts(mountLabel, ctrRunDir string, defaultMounts []string, specgen generate.Generator) ([]rspec.Mount, error) { containerMounts := specgen.Config.Mounts mounts, err := secretMounts(defaultMounts, mountLabel, ctrRunDir, containerMounts) if err != nil { return nil, err } return mounts, nil }
go
func addSecretsBindMounts(mountLabel, ctrRunDir string, defaultMounts []string, specgen generate.Generator) ([]rspec.Mount, error) { containerMounts := specgen.Config.Mounts mounts, err := secretMounts(defaultMounts, mountLabel, ctrRunDir, containerMounts) if err != nil { return nil, err } return mounts, nil }
[ "func", "addSecretsBindMounts", "(", "mountLabel", ",", "ctrRunDir", "string", ",", "defaultMounts", "[", "]", "string", ",", "specgen", "generate", ".", "Generator", ")", "(", "[", "]", "rspec", ".", "Mount", ",", "error", ")", "{", "containerMounts", ":=",...
// addSecretsBindMounts mounts user defined secrets to the container
[ "addSecretsBindMounts", "mounts", "user", "defined", "secrets", "to", "the", "container" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/container_create.go#L482-L489
27,886
cri-o/cri-o
server/container_create.go
getAppArmorProfileName
func (s *Server) getAppArmorProfileName(profile string) string { if profile == "" { return "" } if profile == apparmorRuntimeDefault { // If the value is runtime/default, then return default profile. return s.appArmorProfile } return strings.TrimPrefix(profile, apparmorLocalHostPrefix) }
go
func (s *Server) getAppArmorProfileName(profile string) string { if profile == "" { return "" } if profile == apparmorRuntimeDefault { // If the value is runtime/default, then return default profile. return s.appArmorProfile } return strings.TrimPrefix(profile, apparmorLocalHostPrefix) }
[ "func", "(", "s", "*", "Server", ")", "getAppArmorProfileName", "(", "profile", "string", ")", "string", "{", "if", "profile", "==", "\"", "\"", "{", "return", "\"", "\"", "\n", "}", "\n\n", "if", "profile", "==", "apparmorRuntimeDefault", "{", "// If the ...
// getAppArmorProfileName gets the profile name for the given container.
[ "getAppArmorProfileName", "gets", "the", "profile", "name", "for", "the", "given", "container", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/server/container_create.go#L640-L651
27,887
cri-o/cri-o
pkg/storage/runtime.go
GetRuntimeService
func GetRuntimeService(ctx context.Context, storageImageServer ImageServer, pauseImage, pauseImageAuthFile string) RuntimeServer { return &runtimeService{ storageImageServer: storageImageServer, pauseImage: pauseImage, pauseImageAuthFile: pauseImageAuthFile, ctx: ctx, } }
go
func GetRuntimeService(ctx context.Context, storageImageServer ImageServer, pauseImage, pauseImageAuthFile string) RuntimeServer { return &runtimeService{ storageImageServer: storageImageServer, pauseImage: pauseImage, pauseImageAuthFile: pauseImageAuthFile, ctx: ctx, } }
[ "func", "GetRuntimeService", "(", "ctx", "context", ".", "Context", ",", "storageImageServer", "ImageServer", ",", "pauseImage", ",", "pauseImageAuthFile", "string", ")", "RuntimeServer", "{", "return", "&", "runtimeService", "{", "storageImageServer", ":", "storageIm...
// GetRuntimeService returns a RuntimeServer that uses the passed-in image // service to pull and manage images, and its store to manage containers based // on those images.
[ "GetRuntimeService", "returns", "a", "RuntimeServer", "that", "uses", "the", "passed", "-", "in", "image", "service", "to", "pull", "and", "manage", "images", "and", "its", "store", "to", "manage", "containers", "based", "on", "those", "images", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/pkg/storage/runtime.go#L469-L476
27,888
cri-o/cri-o
lib/sandbox/memory_store.go
List
func (c *memoryStore) List() []*Sandbox { sandboxes := History(c.all()) sandboxes.sort() return sandboxes }
go
func (c *memoryStore) List() []*Sandbox { sandboxes := History(c.all()) sandboxes.sort() return sandboxes }
[ "func", "(", "c", "*", "memoryStore", ")", "List", "(", ")", "[", "]", "*", "Sandbox", "{", "sandboxes", ":=", "History", "(", "c", ".", "all", "(", ")", ")", "\n", "sandboxes", ".", "sort", "(", ")", "\n", "return", "sandboxes", "\n", "}" ]
// List returns a sorted list of sandboxes from the store. // The sandboxes are ordered by creation date.
[ "List", "returns", "a", "sorted", "list", "of", "sandboxes", "from", "the", "store", ".", "The", "sandboxes", "are", "ordered", "by", "creation", "date", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/memory_store.go#L44-L48
27,889
cri-o/cri-o
lib/sandbox/memory_store.go
First
func (c *memoryStore) First(filter StoreFilter) *Sandbox { for _, cont := range c.all() { if filter(cont) { return cont } } return nil }
go
func (c *memoryStore) First(filter StoreFilter) *Sandbox { for _, cont := range c.all() { if filter(cont) { return cont } } return nil }
[ "func", "(", "c", "*", "memoryStore", ")", "First", "(", "filter", "StoreFilter", ")", "*", "Sandbox", "{", "for", "_", ",", "cont", ":=", "range", "c", ".", "all", "(", ")", "{", "if", "filter", "(", "cont", ")", "{", "return", "cont", "\n", "}"...
// First returns the first sandbox found in the store by a given filter.
[ "First", "returns", "the", "first", "sandbox", "found", "in", "the", "store", "by", "a", "given", "filter", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/memory_store.go#L58-L65
27,890
cri-o/cri-o
lib/rename.go
ContainerRename
func (c *ContainerServer) ContainerRename(container, name string) error { ctr, err := c.LookupContainer(container) if err != nil { return err } oldName := ctr.Name() _, err = c.ReserveContainerName(ctr.ID(), name) if err != nil { return err } defer func() { if err != nil { c.ReleaseContainerName(name)...
go
func (c *ContainerServer) ContainerRename(container, name string) error { ctr, err := c.LookupContainer(container) if err != nil { return err } oldName := ctr.Name() _, err = c.ReserveContainerName(ctr.ID(), name) if err != nil { return err } defer func() { if err != nil { c.ReleaseContainerName(name)...
[ "func", "(", "c", "*", "ContainerServer", ")", "ContainerRename", "(", "container", ",", "name", "string", ")", "error", "{", "ctr", ",", "err", ":=", "c", ".", "LookupContainer", "(", "container", ")", "\n", "if", "err", "!=", "nil", "{", "return", "e...
// ContainerRename renames the given container
[ "ContainerRename", "renames", "the", "given", "container" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/rename.go#L18-L57
27,891
cri-o/cri-o
lib/rename.go
updateMetadata
func updateMetadata(specAnnotations map[string]string, name string) string { oldMetadata := specAnnotations[annotations.Metadata] containerType := specAnnotations[annotations.ContainerType] switch containerType { case "container": metadata := runtime.ContainerMetadata{} err := json.Unmarshal([]byte(oldMetadata)...
go
func updateMetadata(specAnnotations map[string]string, name string) string { oldMetadata := specAnnotations[annotations.Metadata] containerType := specAnnotations[annotations.ContainerType] switch containerType { case "container": metadata := runtime.ContainerMetadata{} err := json.Unmarshal([]byte(oldMetadata)...
[ "func", "updateMetadata", "(", "specAnnotations", "map", "[", "string", "]", "string", ",", "name", "string", ")", "string", "{", "oldMetadata", ":=", "specAnnotations", "[", "annotations", ".", "Metadata", "]", "\n", "containerType", ":=", "specAnnotations", "[...
// Attempts to update a metadata annotation
[ "Attempts", "to", "update", "a", "metadata", "annotation" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/rename.go#L86-L119
27,892
cri-o/cri-o
utils/filesystem.go
GetDiskUsageStats
func GetDiskUsageStats(path string) (dirSize, inodeCount uint64, err error) { err = filepath.Walk(path, func(path string, info os.FileInfo, err error) error { // Walk does not follow symbolic links if err != nil { return err } dirSize += uint64(info.Size()) inodeCount++ return nil }) if err != nil ...
go
func GetDiskUsageStats(path string) (dirSize, inodeCount uint64, err error) { err = filepath.Walk(path, func(path string, info os.FileInfo, err error) error { // Walk does not follow symbolic links if err != nil { return err } dirSize += uint64(info.Size()) inodeCount++ return nil }) if err != nil ...
[ "func", "GetDiskUsageStats", "(", "path", "string", ")", "(", "dirSize", ",", "inodeCount", "uint64", ",", "err", "error", ")", "{", "err", "=", "filepath", ".", "Walk", "(", "path", ",", "func", "(", "path", "string", ",", "info", "os", ".", "FileInfo...
// GetDiskUsageStats accepts a path to a directory or file // and returns the number of bytes and inodes used by the path
[ "GetDiskUsageStats", "accepts", "a", "path", "to", "a", "directory", "or", "file", "and", "returns", "the", "number", "of", "bytes", "and", "inodes", "used", "by", "the", "path" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/filesystem.go#L10-L28
27,893
cri-o/cri-o
lib/kill.go
ContainerKill
func (c *ContainerServer) ContainerKill(container string, killSignal syscall.Signal) (string, error) { ctr, err := c.LookupContainer(container) if err != nil { return "", errors.Wrapf(err, "failed to find container %s", container) } c.runtime.UpdateContainerStatus(ctr) cStatus := ctr.State() // If the containe...
go
func (c *ContainerServer) ContainerKill(container string, killSignal syscall.Signal) (string, error) { ctr, err := c.LookupContainer(container) if err != nil { return "", errors.Wrapf(err, "failed to find container %s", container) } c.runtime.UpdateContainerStatus(ctr) cStatus := ctr.State() // If the containe...
[ "func", "(", "c", "*", "ContainerServer", ")", "ContainerKill", "(", "container", "string", ",", "killSignal", "syscall", ".", "Signal", ")", "(", "string", ",", "error", ")", "{", "ctr", ",", "err", ":=", "c", ".", "LookupContainer", "(", "container", "...
// ContainerKill sends the user provided signal to the containers primary process.
[ "ContainerKill", "sends", "the", "user", "provided", "signal", "to", "the", "containers", "primary", "process", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/kill.go#L11-L30
27,894
cri-o/cri-o
lib/sandbox/sandbox_linux.go
Initialize
func (n *NetNs) Initialize() (NetNsIface, error) { netNS, err := ns.NewNS() if err != nil { return nil, err } n.netNS = netNS n.closed = false n.initialized = true return n, nil }
go
func (n *NetNs) Initialize() (NetNsIface, error) { netNS, err := ns.NewNS() if err != nil { return nil, err } n.netNS = netNS n.closed = false n.initialized = true return n, nil }
[ "func", "(", "n", "*", "NetNs", ")", "Initialize", "(", ")", "(", "NetNsIface", ",", "error", ")", "{", "netNS", ",", "err", ":=", "ns", ".", "NewNS", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", ...
// Initialize does the necessary setup for a NetNs
[ "Initialize", "does", "the", "necessary", "setup", "for", "a", "NetNs" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox_linux.go#L30-L39
27,895
cri-o/cri-o
lib/sandbox/sandbox_linux.go
SymlinkCreate
func (n *NetNs) SymlinkCreate(name string) error { if n.netNS == nil { return errors.New("no netns set up") } b := make([]byte, 4) _, randErr := rand.Reader.Read(b) if randErr != nil { return randErr } nsName := fmt.Sprintf("%s-%x", name, b) symlinkPath := filepath.Join(NsRunDir, nsName) if err := os.Sym...
go
func (n *NetNs) SymlinkCreate(name string) error { if n.netNS == nil { return errors.New("no netns set up") } b := make([]byte, 4) _, randErr := rand.Reader.Read(b) if randErr != nil { return randErr } nsName := fmt.Sprintf("%s-%x", name, b) symlinkPath := filepath.Join(NsRunDir, nsName) if err := os.Sym...
[ "func", "(", "n", "*", "NetNs", ")", "SymlinkCreate", "(", "name", "string", ")", "error", "{", "if", "n", ".", "netNS", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "b", ":=", "make", "(", "[", "]", ...
// SymlinkCreate creates the necessary symlinks for the NetNs
[ "SymlinkCreate", "creates", "the", "necessary", "symlinks", "for", "the", "NetNs" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox_linux.go#L61-L90
27,896
cri-o/cri-o
lib/sandbox/sandbox_linux.go
Path
func (n *NetNs) Path() string { if n == nil || n.netNS == nil { return "" } return n.netNS.Path() }
go
func (n *NetNs) Path() string { if n == nil || n.netNS == nil { return "" } return n.netNS.Path() }
[ "func", "(", "n", "*", "NetNs", ")", "Path", "(", ")", "string", "{", "if", "n", "==", "nil", "||", "n", ".", "netNS", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "n", ".", "netNS", ".", "Path", "(", ")", "\n", "}" ]
// Path returns the path of the network namespace handle
[ "Path", "returns", "the", "path", "of", "the", "network", "namespace", "handle" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox_linux.go#L93-L98
27,897
cri-o/cri-o
lib/sandbox/sandbox_linux.go
Close
func (n *NetNs) Close() error { if n == nil || n.netNS == nil { return nil } return n.netNS.Close() }
go
func (n *NetNs) Close() error { if n == nil || n.netNS == nil { return nil } return n.netNS.Close() }
[ "func", "(", "n", "*", "NetNs", ")", "Close", "(", ")", "error", "{", "if", "n", "==", "nil", "||", "n", ".", "netNS", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "n", ".", "netNS", ".", "Close", "(", ")", "\n", "}" ]
// Close closes this network namespace
[ "Close", "closes", "this", "network", "namespace" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox_linux.go#L101-L106
27,898
cri-o/cri-o
lib/sandbox/sandbox_linux.go
Remove
func (n *NetNs) Remove() error { n.Lock() defer n.Unlock() if n.closed { // netNsRemove() can be called multiple // times without returning an error. return nil } if err := n.symlinkRemove(); err != nil { return err } if err := n.Close(); err != nil { return err } n.closed = true if n.restored ...
go
func (n *NetNs) Remove() error { n.Lock() defer n.Unlock() if n.closed { // netNsRemove() can be called multiple // times without returning an error. return nil } if err := n.symlinkRemove(); err != nil { return err } if err := n.Close(); err != nil { return err } n.closed = true if n.restored ...
[ "func", "(", "n", "*", "NetNs", ")", "Remove", "(", ")", "error", "{", "n", ".", "Lock", "(", ")", "\n", "defer", "n", ".", "Unlock", "(", ")", "\n\n", "if", "n", ".", "closed", "{", "// netNsRemove() can be called multiple", "// times without returning an...
// Remove ensures this network namespace handle is closed and removed
[ "Remove", "ensures", "this", "network", "namespace", "handle", "is", "closed", "and", "removed" ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/lib/sandbox/sandbox_linux.go#L109-L152
27,899
cri-o/cri-o
utils/io/helpers.go
newFifos
func newFifos(root, id string, tty, stdin bool) (*cio.FIFOSet, error) { root = filepath.Join(root, "io") if err := os.MkdirAll(root, 0700); err != nil { return nil, err } fifos, err := cio.NewFIFOSetInDir(root, id, tty) if err != nil { return nil, err } if !stdin { fifos.Stdin = "" } return fifos, nil }
go
func newFifos(root, id string, tty, stdin bool) (*cio.FIFOSet, error) { root = filepath.Join(root, "io") if err := os.MkdirAll(root, 0700); err != nil { return nil, err } fifos, err := cio.NewFIFOSetInDir(root, id, tty) if err != nil { return nil, err } if !stdin { fifos.Stdin = "" } return fifos, nil }
[ "func", "newFifos", "(", "root", ",", "id", "string", ",", "tty", ",", "stdin", "bool", ")", "(", "*", "cio", ".", "FIFOSet", ",", "error", ")", "{", "root", "=", "filepath", ".", "Join", "(", "root", ",", "\"", "\"", ")", "\n", "if", "err", ":...
// newFifos creates fifos directory for a container.
[ "newFifos", "creates", "fifos", "directory", "for", "a", "container", "." ]
0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5
https://github.com/cri-o/cri-o/blob/0eac7be02d0a9d12b8b4bd1f2f0919c386ed61f5/utils/io/helpers.go#L77-L90