id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
130,200
containerd/containerd
runtime/v2/runhcs/io.go
newPipeSet
func newPipeSet(ctx context.Context, stdin, stdout, stderr string, terminal bool) (*pipeSet, error) { var ( err error set = &pipeSet{} ) defer func() { if err != nil { set.Close() } }() g, _ := errgroup.WithContext(ctx) dialfn := func(name string, conn *net.Conn) error { if name == "" { return ...
go
func newPipeSet(ctx context.Context, stdin, stdout, stderr string, terminal bool) (*pipeSet, error) { var ( err error set = &pipeSet{} ) defer func() { if err != nil { set.Close() } }() g, _ := errgroup.WithContext(ctx) dialfn := func(name string, conn *net.Conn) error { if name == "" { return ...
[ "func", "newPipeSet", "(", "ctx", "context", ".", "Context", ",", "stdin", ",", "stdout", ",", "stderr", "string", ",", "terminal", "bool", ")", "(", "*", "pipeSet", ",", "error", ")", "{", "var", "(", "err", "error", "\n", "set", "=", "&", "pipeSet"...
// newPipeSet connects to the provided pipe addresses
[ "newPipeSet", "connects", "to", "the", "provided", "pipe", "addresses" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runhcs/io.go#L42-L84
130,201
containerd/containerd
runtime/v2/runhcs/io.go
closeIO
func (pr *pipeRelay) closeIO() { if pr.ps.stdin != nil { pr.ps.stdin.Close() pr.io.Stdin().Close() } }
go
func (pr *pipeRelay) closeIO() { if pr.ps.stdin != nil { pr.ps.stdin.Close() pr.io.Stdin().Close() } }
[ "func", "(", "pr", "*", "pipeRelay", ")", "closeIO", "(", ")", "{", "if", "pr", ".", "ps", ".", "stdin", "!=", "nil", "{", "pr", ".", "ps", ".", "stdin", ".", "Close", "(", ")", "\n", "pr", ".", "io", ".", "Stdin", "(", ")", ".", "Close", "...
// closeIO closes stdin to unblock an waiters
[ "closeIO", "closes", "stdin", "to", "unblock", "an", "waiters" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runhcs/io.go#L146-L151
130,202
containerd/containerd
runtime/v2/runhcs/io.go
close
func (pr *pipeRelay) close() { pr.once.Do(func() { pr.io.Close() pr.ps.Close() }) }
go
func (pr *pipeRelay) close() { pr.once.Do(func() { pr.io.Close() pr.ps.Close() }) }
[ "func", "(", "pr", "*", "pipeRelay", ")", "close", "(", ")", "{", "pr", ".", "once", ".", "Do", "(", "func", "(", ")", "{", "pr", ".", "io", ".", "Close", "(", ")", "\n", "pr", ".", "ps", ".", "Close", "(", ")", "\n", "}", ")", "\n", "}" ...
// close closes all open pipes
[ "close", "closes", "all", "open", "pipes" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runhcs/io.go#L154-L159
130,203
containerd/containerd
snapshots/snapshotter.go
ParseKind
func ParseKind(s string) Kind { s = strings.ToLower(s) switch s { case "view": return KindView case "active": return KindActive case "committed": return KindCommitted } return KindUnknown }
go
func ParseKind(s string) Kind { s = strings.ToLower(s) switch s { case "view": return KindView case "active": return KindActive case "committed": return KindCommitted } return KindUnknown }
[ "func", "ParseKind", "(", "s", "string", ")", "Kind", "{", "s", "=", "strings", ".", "ToLower", "(", "s", ")", "\n", "switch", "s", "{", "case", "\"", "\"", ":", "return", "KindView", "\n", "case", "\"", "\"", ":", "return", "KindActive", "\n", "ca...
// ParseKind parses the provided string into a Kind // // If the string cannot be parsed KindUnknown is returned
[ "ParseKind", "parses", "the", "provided", "string", "into", "a", "Kind", "If", "the", "string", "cannot", "be", "parsed", "KindUnknown", "is", "returned" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/snapshotter.go#L42-L54
130,204
containerd/containerd
snapshots/snapshotter.go
UnmarshalJSON
func (k *Kind) UnmarshalJSON(b []byte) error { var s string if err := json.Unmarshal(b, &s); err != nil { return err } *k = ParseKind(s) return nil }
go
func (k *Kind) UnmarshalJSON(b []byte) error { var s string if err := json.Unmarshal(b, &s); err != nil { return err } *k = ParseKind(s) return nil }
[ "func", "(", "k", "*", "Kind", ")", "UnmarshalJSON", "(", "b", "[", "]", "byte", ")", "error", "{", "var", "s", "string", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "b", ",", "&", "s", ")", ";", "err", "!=", "nil", "{", "return", ...
// UnmarshalJSON the Kind from JSON
[ "UnmarshalJSON", "the", "Kind", "from", "JSON" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/snapshotter.go#L76-L84
130,205
containerd/containerd
snapshots/snapshotter.go
Add
func (u *Usage) Add(other Usage) { u.Size += other.Size // TODO(stevvooe): assumes independent inodes, but provides and upper // bound. This should be pretty close, assuming the inodes for a // snapshot are roughly unique to it. Don't trust this assumption. u.Inodes += other.Inodes }
go
func (u *Usage) Add(other Usage) { u.Size += other.Size // TODO(stevvooe): assumes independent inodes, but provides and upper // bound. This should be pretty close, assuming the inodes for a // snapshot are roughly unique to it. Don't trust this assumption. u.Inodes += other.Inodes }
[ "func", "(", "u", "*", "Usage", ")", "Add", "(", "other", "Usage", ")", "{", "u", ".", "Size", "+=", "other", ".", "Size", "\n\n", "// TODO(stevvooe): assumes independent inodes, but provides and upper", "// bound. This should be pretty close, assuming the inodes for a", ...
// Add the provided usage to the current usage
[ "Add", "the", "provided", "usage", "to", "the", "current", "usage" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/snapshotter.go#L107-L114
130,206
containerd/containerd
remotes/docker/authorizer.go
NewAuthorizer
func NewAuthorizer(client *http.Client, f func(string) (string, string, error)) Authorizer { if client == nil { client = http.DefaultClient } return &dockerAuthorizer{ credentials: f, client: client, auth: map[string]string{}, } }
go
func NewAuthorizer(client *http.Client, f func(string) (string, string, error)) Authorizer { if client == nil { client = http.DefaultClient } return &dockerAuthorizer{ credentials: f, client: client, auth: map[string]string{}, } }
[ "func", "NewAuthorizer", "(", "client", "*", "http", ".", "Client", ",", "f", "func", "(", "string", ")", "(", "string", ",", "string", ",", "error", ")", ")", "Authorizer", "{", "if", "client", "==", "nil", "{", "client", "=", "http", ".", "DefaultC...
// NewAuthorizer creates a Docker authorizer using the provided function to // get credentials for the token server or basic auth.
[ "NewAuthorizer", "creates", "a", "Docker", "authorizer", "using", "the", "provided", "function", "to", "get", "credentials", "for", "the", "token", "server", "or", "basic", "auth", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/docker/authorizer.go#L50-L59
130,207
containerd/containerd
remotes/docker/authorizer.go
fetchToken
func (a *dockerAuthorizer) fetchToken(ctx context.Context, to tokenOptions) (string, error) { req, err := http.NewRequest("GET", to.realm, nil) if err != nil { return "", err } reqParams := req.URL.Query() if to.service != "" { reqParams.Add("service", to.service) } for _, scope := range to.scopes { req...
go
func (a *dockerAuthorizer) fetchToken(ctx context.Context, to tokenOptions) (string, error) { req, err := http.NewRequest("GET", to.realm, nil) if err != nil { return "", err } reqParams := req.URL.Query() if to.service != "" { reqParams.Add("service", to.service) } for _, scope := range to.scopes { req...
[ "func", "(", "a", "*", "dockerAuthorizer", ")", "fetchToken", "(", "ctx", "context", ".", "Context", ",", "to", "tokenOptions", ")", "(", "string", ",", "error", ")", "{", "req", ",", "err", ":=", "http", ".", "NewRequest", "(", "\"", "\"", ",", "to"...
// getToken fetches a token using a GET request
[ "getToken", "fetches", "a", "token", "using", "a", "GET", "request" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/docker/authorizer.go#L241-L293
130,208
containerd/containerd
runtime/v1/linux/proc/utils.go
criuError
func criuError(err error) string { parts := strings.Split(err.Error(), "\n") return parts[0] }
go
func criuError(err error) string { parts := strings.Split(err.Error(), "\n") return parts[0] }
[ "func", "criuError", "(", "err", "error", ")", "string", "{", "parts", ":=", "strings", ".", "Split", "(", "err", ".", "Error", "(", ")", ",", "\"", "\\n", "\"", ")", "\n", "return", "parts", "[", "0", "]", "\n", "}" ]
// criuError returns only the first line of the error message from criu // it tries to add an invalid dump log location when returning the message
[ "criuError", "returns", "only", "the", "first", "line", "of", "the", "error", "message", "from", "criu", "it", "tries", "to", "add", "an", "invalid", "dump", "log", "location", "when", "returning", "the", "message" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v1/linux/proc/utils.go#L84-L87
130,209
containerd/containerd
sys/oom_unix.go
SetOOMScore
func SetOOMScore(pid, score int) error { path := fmt.Sprintf("/proc/%d/oom_score_adj", pid) f, err := os.OpenFile(path, os.O_WRONLY, 0) if err != nil { return err } defer f.Close() if _, err = f.WriteString(strconv.Itoa(score)); err != nil { if os.IsPermission(err) && (system.RunningInUserNS() || RunningUnpri...
go
func SetOOMScore(pid, score int) error { path := fmt.Sprintf("/proc/%d/oom_score_adj", pid) f, err := os.OpenFile(path, os.O_WRONLY, 0) if err != nil { return err } defer f.Close() if _, err = f.WriteString(strconv.Itoa(score)); err != nil { if os.IsPermission(err) && (system.RunningInUserNS() || RunningUnpri...
[ "func", "SetOOMScore", "(", "pid", ",", "score", "int", ")", "error", "{", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pid", ")", "\n", "f", ",", "err", ":=", "os", ".", "OpenFile", "(", "path", ",", "os", ".", "O_WRONLY", ",", ...
// SetOOMScore sets the oom score for the provided pid
[ "SetOOMScore", "sets", "the", "oom", "score", "for", "the", "provided", "pid" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/sys/oom_unix.go#L35-L49
130,210
containerd/containerd
sys/oom_unix.go
GetOOMScoreAdj
func GetOOMScoreAdj(pid int) (int, error) { path := fmt.Sprintf("/proc/%d/oom_score_adj", pid) data, err := ioutil.ReadFile(path) if err != nil { return 0, err } return strconv.Atoi(strings.TrimSpace(string(data))) }
go
func GetOOMScoreAdj(pid int) (int, error) { path := fmt.Sprintf("/proc/%d/oom_score_adj", pid) data, err := ioutil.ReadFile(path) if err != nil { return 0, err } return strconv.Atoi(strings.TrimSpace(string(data))) }
[ "func", "GetOOMScoreAdj", "(", "pid", "int", ")", "(", "int", ",", "error", ")", "{", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pid", ")", "\n", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", ...
// GetOOMScoreAdj gets the oom score for a process
[ "GetOOMScoreAdj", "gets", "the", "oom", "score", "for", "a", "process" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/sys/oom_unix.go#L52-L59
130,211
containerd/containerd
cmd/containerd/command/config.go
WriteTo
func (c *Config) WriteTo(w io.Writer) (int64, error) { return 0, toml.NewEncoder(w).Encode(c) }
go
func (c *Config) WriteTo(w io.Writer) (int64, error) { return 0, toml.NewEncoder(w).Encode(c) }
[ "func", "(", "c", "*", "Config", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "0", ",", "toml", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "c", ")", "\n", "}" ]
// WriteTo marshals the config to the provided writer
[ "WriteTo", "marshals", "the", "config", "to", "the", "provided", "writer" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cmd/containerd/command/config.go#L38-L40
130,212
containerd/containerd
cmd/ctr/commands/signals.go
ForwardAllSignals
func ForwardAllSignals(ctx gocontext.Context, task killer) chan os.Signal { sigc := make(chan os.Signal, 128) signal.Notify(sigc) go func() { for s := range sigc { logrus.Debug("forwarding signal ", s) if err := task.Kill(ctx, s.(syscall.Signal)); err != nil { logrus.WithError(err).Errorf("forward signal...
go
func ForwardAllSignals(ctx gocontext.Context, task killer) chan os.Signal { sigc := make(chan os.Signal, 128) signal.Notify(sigc) go func() { for s := range sigc { logrus.Debug("forwarding signal ", s) if err := task.Kill(ctx, s.(syscall.Signal)); err != nil { logrus.WithError(err).Errorf("forward signal...
[ "func", "ForwardAllSignals", "(", "ctx", "gocontext", ".", "Context", ",", "task", "killer", ")", "chan", "os", ".", "Signal", "{", "sigc", ":=", "make", "(", "chan", "os", ".", "Signal", ",", "128", ")", "\n", "signal", ".", "Notify", "(", "sigc", "...
// ForwardAllSignals forwards signals
[ "ForwardAllSignals", "forwards", "signals" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cmd/ctr/commands/signals.go#L34-L46
130,213
containerd/containerd
archive/compression/compression.go
CompressStream
func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error) { switch compression { case Uncompressed: return &writeCloserWrapper{dest, nil}, nil case Gzip: return gzip.NewWriter(dest), nil default: return nil, fmt.Errorf("unsupported compression format %s", (&compression).Extension())...
go
func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error) { switch compression { case Uncompressed: return &writeCloserWrapper{dest, nil}, nil case Gzip: return gzip.NewWriter(dest), nil default: return nil, fmt.Errorf("unsupported compression format %s", (&compression).Extension())...
[ "func", "CompressStream", "(", "dest", "io", ".", "Writer", ",", "compression", "Compression", ")", "(", "io", ".", "WriteCloser", ",", "error", ")", "{", "switch", "compression", "{", "case", "Uncompressed", ":", "return", "&", "writeCloserWrapper", "{", "d...
// CompressStream compresseses the dest with specified compression algorithm.
[ "CompressStream", "compresseses", "the", "dest", "with", "specified", "compression", "algorithm", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/archive/compression/compression.go#L184-L193
130,214
containerd/containerd
mount/temp_unix.go
SetTempMountLocation
func SetTempMountLocation(root string) error { root, err := filepath.Abs(root) if err != nil { return err } if err := os.MkdirAll(root, 0700); err != nil { return err } tempMountLocation = root return nil }
go
func SetTempMountLocation(root string) error { root, err := filepath.Abs(root) if err != nil { return err } if err := os.MkdirAll(root, 0700); err != nil { return err } tempMountLocation = root return nil }
[ "func", "SetTempMountLocation", "(", "root", "string", ")", "error", "{", "root", ",", "err", ":=", "filepath", ".", "Abs", "(", "root", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "os", ".", "Mkdi...
// SetTempMountLocation sets the temporary mount location
[ "SetTempMountLocation", "sets", "the", "temporary", "mount", "location" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/mount/temp_unix.go#L29-L39
130,215
containerd/containerd
mount/temp_unix.go
CleanupTempMounts
func CleanupTempMounts(flags int) (warnings []error, err error) { mounts, err := Self() if err != nil { return nil, err } var toUnmount []string for _, m := range mounts { if strings.HasPrefix(m.Mountpoint, tempMountLocation) { toUnmount = append(toUnmount, m.Mountpoint) } } sort.Sort(sort.Reverse(sort....
go
func CleanupTempMounts(flags int) (warnings []error, err error) { mounts, err := Self() if err != nil { return nil, err } var toUnmount []string for _, m := range mounts { if strings.HasPrefix(m.Mountpoint, tempMountLocation) { toUnmount = append(toUnmount, m.Mountpoint) } } sort.Sort(sort.Reverse(sort....
[ "func", "CleanupTempMounts", "(", "flags", "int", ")", "(", "warnings", "[", "]", "error", ",", "err", "error", ")", "{", "mounts", ",", "err", ":=", "Self", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "...
// CleanupTempMounts all temp mounts and remove the directories
[ "CleanupTempMounts", "all", "temp", "mounts", "and", "remove", "the", "directories" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/mount/temp_unix.go#L42-L64
130,216
containerd/containerd
container_opts.go
WithRuntime
func WithRuntime(name string, options interface{}) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { var ( any *types.Any err error ) if options != nil { any, err = typeurl.MarshalAny(options) if err != nil { return err } } c.Runtime = con...
go
func WithRuntime(name string, options interface{}) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { var ( any *types.Any err error ) if options != nil { any, err = typeurl.MarshalAny(options) if err != nil { return err } } c.Runtime = con...
[ "func", "WithRuntime", "(", "name", "string", ",", "options", "interface", "{", "}", ")", "NewContainerOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "client", "*", "Client", ",", "c", "*", "containers", ".", "Container", ")", ...
// WithRuntime allows a user to specify the runtime name and additional options that should // be used to create tasks for the container
[ "WithRuntime", "allows", "a", "user", "to", "specify", "the", "runtime", "name", "and", "additional", "options", "that", "should", "be", "used", "to", "create", "tasks", "for", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container_opts.go#L46-L64
130,217
containerd/containerd
container_opts.go
WithImage
func WithImage(i Image) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { c.Image = i.Name() return nil } }
go
func WithImage(i Image) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { c.Image = i.Name() return nil } }
[ "func", "WithImage", "(", "i", "Image", ")", "NewContainerOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "client", "*", "Client", ",", "c", "*", "containers", ".", "Container", ")", "error", "{", "c", ".", "Image", "=", "i", ...
// WithImage sets the provided image as the base for the container
[ "WithImage", "sets", "the", "provided", "image", "as", "the", "base", "for", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container_opts.go#L67-L72
130,218
containerd/containerd
container_opts.go
WithContainerLabels
func WithContainerLabels(labels map[string]string) NewContainerOpts { return func(_ context.Context, _ *Client, c *containers.Container) error { c.Labels = labels return nil } }
go
func WithContainerLabels(labels map[string]string) NewContainerOpts { return func(_ context.Context, _ *Client, c *containers.Container) error { c.Labels = labels return nil } }
[ "func", "WithContainerLabels", "(", "labels", "map", "[", "string", "]", "string", ")", "NewContainerOpts", "{", "return", "func", "(", "_", "context", ".", "Context", ",", "_", "*", "Client", ",", "c", "*", "containers", ".", "Container", ")", "error", ...
// WithContainerLabels adds the provided labels to the container
[ "WithContainerLabels", "adds", "the", "provided", "labels", "to", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container_opts.go#L75-L80
130,219
containerd/containerd
container_opts.go
WithSnapshotter
func WithSnapshotter(name string) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { c.Snapshotter = name return nil } }
go
func WithSnapshotter(name string) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { c.Snapshotter = name return nil } }
[ "func", "WithSnapshotter", "(", "name", "string", ")", "NewContainerOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "client", "*", "Client", ",", "c", "*", "containers", ".", "Container", ")", "error", "{", "c", ".", "Snapshotter"...
// WithSnapshotter sets the provided snapshotter for use by the container // // This option must appear before other snapshotter options to have an effect.
[ "WithSnapshotter", "sets", "the", "provided", "snapshotter", "for", "use", "by", "the", "container", "This", "option", "must", "appear", "before", "other", "snapshotter", "options", "to", "have", "an", "effect", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container_opts.go#L102-L107
130,220
containerd/containerd
container_opts.go
WithSnapshot
func WithSnapshot(id string) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { setSnapshotterIfEmpty(ctx, client, c) // check that the snapshot exists, if not, fail on creation if _, err := client.SnapshotService(c.Snapshotter).Mounts(ctx, id); err != nil { r...
go
func WithSnapshot(id string) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { setSnapshotterIfEmpty(ctx, client, c) // check that the snapshot exists, if not, fail on creation if _, err := client.SnapshotService(c.Snapshotter).Mounts(ctx, id); err != nil { r...
[ "func", "WithSnapshot", "(", "id", "string", ")", "NewContainerOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "client", "*", "Client", ",", "c", "*", "containers", ".", "Container", ")", "error", "{", "setSnapshotterIfEmpty", "(", ...
// WithSnapshot uses an existing root filesystem for the container
[ "WithSnapshot", "uses", "an", "existing", "root", "filesystem", "for", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container_opts.go#L110-L120
130,221
containerd/containerd
container_opts.go
WithNewSnapshot
func WithNewSnapshot(id string, i Image, opts ...snapshots.Opt) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { diffIDs, err := i.(*image).i.RootFS(ctx, client.ContentStore(), platforms.Default()) if err != nil { return err } setSnapshotterIfEmpty(ctx, cl...
go
func WithNewSnapshot(id string, i Image, opts ...snapshots.Opt) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { diffIDs, err := i.(*image).i.RootFS(ctx, client.ContentStore(), platforms.Default()) if err != nil { return err } setSnapshotterIfEmpty(ctx, cl...
[ "func", "WithNewSnapshot", "(", "id", "string", ",", "i", "Image", ",", "opts", "...", "snapshots", ".", "Opt", ")", "NewContainerOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "client", "*", "Client", ",", "c", "*", "container...
// WithNewSnapshot allocates a new snapshot to be used by the container as the // root filesystem in read-write mode
[ "WithNewSnapshot", "allocates", "a", "new", "snapshot", "to", "be", "used", "by", "the", "container", "as", "the", "root", "filesystem", "in", "read", "-", "write", "mode" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container_opts.go#L124-L139
130,222
containerd/containerd
container_opts.go
WithSnapshotCleanup
func WithSnapshotCleanup(ctx context.Context, client *Client, c containers.Container) error { if c.SnapshotKey != "" { if c.Snapshotter == "" { return errors.Wrapf(errdefs.ErrInvalidArgument, "container.Snapshotter must be set to cleanup rootfs snapshot") } return client.SnapshotService(c.Snapshotter).Remove(...
go
func WithSnapshotCleanup(ctx context.Context, client *Client, c containers.Container) error { if c.SnapshotKey != "" { if c.Snapshotter == "" { return errors.Wrapf(errdefs.ErrInvalidArgument, "container.Snapshotter must be set to cleanup rootfs snapshot") } return client.SnapshotService(c.Snapshotter).Remove(...
[ "func", "WithSnapshotCleanup", "(", "ctx", "context", ".", "Context", ",", "client", "*", "Client", ",", "c", "containers", ".", "Container", ")", "error", "{", "if", "c", ".", "SnapshotKey", "!=", "\"", "\"", "{", "if", "c", ".", "Snapshotter", "==", ...
// WithSnapshotCleanup deletes the rootfs snapshot allocated for the container
[ "WithSnapshotCleanup", "deletes", "the", "rootfs", "snapshot", "allocated", "for", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container_opts.go#L142-L150
130,223
containerd/containerd
container_opts.go
WithContainerExtension
func WithContainerExtension(name string, extension interface{}) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { if name == "" { return errors.Wrapf(errdefs.ErrInvalidArgument, "extension key must not be zero-length") } any, err := typeurl.MarshalAny(extens...
go
func WithContainerExtension(name string, extension interface{}) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { if name == "" { return errors.Wrapf(errdefs.ErrInvalidArgument, "extension key must not be zero-length") } any, err := typeurl.MarshalAny(extens...
[ "func", "WithContainerExtension", "(", "name", "string", ",", "extension", "interface", "{", "}", ")", "NewContainerOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "client", "*", "Client", ",", "c", "*", "containers", ".", "Containe...
// WithContainerExtension appends extension data to the container object. // Use this to decorate the container object with additional data for the client // integration. // // Make sure to register the type of `extension` in the typeurl package via // `typeurl.Register` or container creation may fail.
[ "WithContainerExtension", "appends", "extension", "data", "to", "the", "container", "object", ".", "Use", "this", "to", "decorate", "the", "container", "object", "with", "additional", "data", "for", "the", "client", "integration", ".", "Make", "sure", "to", "reg...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container_opts.go#L192-L212
130,224
containerd/containerd
container_opts.go
WithNewSpec
func WithNewSpec(opts ...oci.SpecOpts) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { s, err := oci.GenerateSpec(ctx, client, c, opts...) if err != nil { return err } c.Spec, err = typeurl.MarshalAny(s) return err } }
go
func WithNewSpec(opts ...oci.SpecOpts) NewContainerOpts { return func(ctx context.Context, client *Client, c *containers.Container) error { s, err := oci.GenerateSpec(ctx, client, c, opts...) if err != nil { return err } c.Spec, err = typeurl.MarshalAny(s) return err } }
[ "func", "WithNewSpec", "(", "opts", "...", "oci", ".", "SpecOpts", ")", "NewContainerOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "client", "*", "Client", ",", "c", "*", "containers", ".", "Container", ")", "error", "{", "s",...
// WithNewSpec generates a new spec for a new container
[ "WithNewSpec", "generates", "a", "new", "spec", "for", "a", "new", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container_opts.go#L215-L224
130,225
containerd/containerd
snapshots/devmapper/dmsetup/dmsetup.go
makeThinPoolMapping
func makeThinPoolMapping(dataFile, metaFile string, blockSizeSectors uint32) (string, error) { dataDeviceSizeBytes, err := BlockDeviceSize(dataFile) if err != nil { return "", errors.Wrapf(err, "failed to get block device size: %s", dataFile) } // Thin-pool mapping target has the following format: // start - st...
go
func makeThinPoolMapping(dataFile, metaFile string, blockSizeSectors uint32) (string, error) { dataDeviceSizeBytes, err := BlockDeviceSize(dataFile) if err != nil { return "", errors.Wrapf(err, "failed to get block device size: %s", dataFile) } // Thin-pool mapping target has the following format: // start - st...
[ "func", "makeThinPoolMapping", "(", "dataFile", ",", "metaFile", "string", ",", "blockSizeSectors", "uint32", ")", "(", "string", ",", "error", ")", "{", "dataDeviceSizeBytes", ",", "err", ":=", "BlockDeviceSize", "(", "dataFile", ")", "\n", "if", "err", "!=",...
// makeThinPoolMapping makes thin-pool table entry
[ "makeThinPoolMapping", "makes", "thin", "-", "pool", "table", "entry" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/dmsetup/dmsetup.go#L92-L117
130,226
containerd/containerd
snapshots/devmapper/dmsetup/dmsetup.go
ActivateDevice
func ActivateDevice(poolName string, deviceName string, deviceID uint32, size uint64, external string) error { mapping := makeThinMapping(poolName, deviceID, size, external) _, err := dmsetup("create", deviceName, "--table", mapping) return err }
go
func ActivateDevice(poolName string, deviceName string, deviceID uint32, size uint64, external string) error { mapping := makeThinMapping(poolName, deviceID, size, external) _, err := dmsetup("create", deviceName, "--table", mapping) return err }
[ "func", "ActivateDevice", "(", "poolName", "string", ",", "deviceName", "string", ",", "deviceID", "uint32", ",", "size", "uint64", ",", "external", "string", ")", "error", "{", "mapping", ":=", "makeThinMapping", "(", "poolName", ",", "deviceID", ",", "size",...
// ActivateDevice activates the given thin-device using the 'thin' target
[ "ActivateDevice", "activates", "the", "given", "thin", "-", "device", "using", "the", "thin", "target" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/dmsetup/dmsetup.go#L126-L130
130,227
containerd/containerd
snapshots/devmapper/dmsetup/dmsetup.go
makeThinMapping
func makeThinMapping(poolName string, deviceID uint32, sizeBytes uint64, externalOriginDevice string) string { lengthSectors := sizeBytes / SectorSize // Thin target has the following format: // start - starting block in virtual device // length - length of this segment // pool_dev - the thin-pool device, can be ...
go
func makeThinMapping(poolName string, deviceID uint32, sizeBytes uint64, externalOriginDevice string) string { lengthSectors := sizeBytes / SectorSize // Thin target has the following format: // start - starting block in virtual device // length - length of this segment // pool_dev - the thin-pool device, can be ...
[ "func", "makeThinMapping", "(", "poolName", "string", ",", "deviceID", "uint32", ",", "sizeBytes", "uint64", ",", "externalOriginDevice", "string", ")", "string", "{", "lengthSectors", ":=", "sizeBytes", "/", "SectorSize", "\n\n", "// Thin target has the following forma...
// makeThinMapping makes thin target table entry
[ "makeThinMapping", "makes", "thin", "target", "table", "entry" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/dmsetup/dmsetup.go#L133-L144
130,228
containerd/containerd
snapshots/devmapper/dmsetup/dmsetup.go
CreateSnapshot
func CreateSnapshot(poolName string, deviceID uint32, baseDeviceID uint32) error { _, err := dmsetup("message", poolName, "0", fmt.Sprintf("create_snap %d %d", deviceID, baseDeviceID)) return err }
go
func CreateSnapshot(poolName string, deviceID uint32, baseDeviceID uint32) error { _, err := dmsetup("message", poolName, "0", fmt.Sprintf("create_snap %d %d", deviceID, baseDeviceID)) return err }
[ "func", "CreateSnapshot", "(", "poolName", "string", ",", "deviceID", "uint32", ",", "baseDeviceID", "uint32", ")", "error", "{", "_", ",", "err", ":=", "dmsetup", "(", "\"", "\"", ",", "poolName", ",", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\""...
// CreateSnapshot sends "create_snap" message to the given thin-pool. // Caller needs to suspend and resume device if it is active.
[ "CreateSnapshot", "sends", "create_snap", "message", "to", "the", "given", "thin", "-", "pool", ".", "Caller", "needs", "to", "suspend", "and", "resume", "device", "if", "it", "is", "active", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/dmsetup/dmsetup.go#L165-L168
130,229
containerd/containerd
snapshots/devmapper/dmsetup/dmsetup.go
Status
func Status(deviceName string) (*DeviceStatus, error) { var ( err error status DeviceStatus ) output, err := dmsetup("status", deviceName) if err != nil { return nil, err } // Status output format: // Offset (int64) // Length (int64) // Target type (string) // Params (Array of strings) const M...
go
func Status(deviceName string) (*DeviceStatus, error) { var ( err error status DeviceStatus ) output, err := dmsetup("status", deviceName) if err != nil { return nil, err } // Status output format: // Offset (int64) // Length (int64) // Target type (string) // Params (Array of strings) const M...
[ "func", "Status", "(", "deviceName", "string", ")", "(", "*", "DeviceStatus", ",", "error", ")", "{", "var", "(", "err", "error", "\n", "status", "DeviceStatus", "\n", ")", "\n\n", "output", ",", "err", ":=", "dmsetup", "(", "\"", "\"", ",", "deviceNam...
// Status provides status information for devmapper device
[ "Status", "provides", "status", "information", "for", "devmapper", "device" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/dmsetup/dmsetup.go#L275-L311
130,230
containerd/containerd
snapshots/devmapper/dmsetup/dmsetup.go
BlockDeviceSize
func BlockDeviceSize(devicePath string) (uint64, error) { data, err := exec.Command("blockdev", "--getsize64", "-q", devicePath).CombinedOutput() output := string(data) if err != nil { return 0, errors.Wrapf(err, output) } output = strings.TrimSuffix(output, "\n") return strconv.ParseUint(output, 10, 64) }
go
func BlockDeviceSize(devicePath string) (uint64, error) { data, err := exec.Command("blockdev", "--getsize64", "-q", devicePath).CombinedOutput() output := string(data) if err != nil { return 0, errors.Wrapf(err, output) } output = strings.TrimSuffix(output, "\n") return strconv.ParseUint(output, 10, 64) }
[ "func", "BlockDeviceSize", "(", "devicePath", "string", ")", "(", "uint64", ",", "error", ")", "{", "data", ",", "err", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "devicePath", ")", ".", "CombinedOutput", "(...
// BlockDeviceSize returns size of block device in bytes
[ "BlockDeviceSize", "returns", "size", "of", "block", "device", "in", "bytes" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/dmsetup/dmsetup.go#L323-L332
130,231
containerd/containerd
snapshots/devmapper/dmsetup/dmsetup.go
tryGetUnixError
func tryGetUnixError(output string) (unix.Errno, bool) { // It's useful to have Linux error codes like EBUSY, EPERM, ..., instead of just text. // Unfortunately there is no better way than extracting/comparing error text. text := parseDmsetupError(output) if text == "" { return 0, false } err, ok := errTable[t...
go
func tryGetUnixError(output string) (unix.Errno, bool) { // It's useful to have Linux error codes like EBUSY, EPERM, ..., instead of just text. // Unfortunately there is no better way than extracting/comparing error text. text := parseDmsetupError(output) if text == "" { return 0, false } err, ok := errTable[t...
[ "func", "tryGetUnixError", "(", "output", "string", ")", "(", "unix", ".", "Errno", ",", "bool", ")", "{", "// It's useful to have Linux error codes like EBUSY, EPERM, ..., instead of just text.", "// Unfortunately there is no better way than extracting/comparing error text.", "text"...
// tryGetUnixError tries to find Linux error code from dmsetup output
[ "tryGetUnixError", "tries", "to", "find", "Linux", "error", "code", "from", "dmsetup", "output" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/dmsetup/dmsetup.go#L353-L363
130,232
containerd/containerd
remotes/docker/schema1/converter.go
NewConverter
func NewConverter(contentStore content.Store, fetcher remotes.Fetcher) *Converter { return &Converter{ contentStore: contentStore, fetcher: fetcher, blobMap: map[digest.Digest]blobState{}, layerBlobs: map[digest.Digest]ocispec.Descriptor{}, } }
go
func NewConverter(contentStore content.Store, fetcher remotes.Fetcher) *Converter { return &Converter{ contentStore: contentStore, fetcher: fetcher, blobMap: map[digest.Digest]blobState{}, layerBlobs: map[digest.Digest]ocispec.Descriptor{}, } }
[ "func", "NewConverter", "(", "contentStore", "content", ".", "Store", ",", "fetcher", "remotes", ".", "Fetcher", ")", "*", "Converter", "{", "return", "&", "Converter", "{", "contentStore", ":", "contentStore", ",", "fetcher", ":", "fetcher", ",", "blobMap", ...
// NewConverter returns a new converter
[ "NewConverter", "returns", "a", "new", "converter" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/docker/schema1/converter.go#L69-L76
130,233
containerd/containerd
remotes/docker/schema1/converter.go
Handle
func (c *Converter) Handle(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { switch desc.MediaType { case images.MediaTypeDockerSchema1Manifest: if err := c.fetchManifest(ctx, desc); err != nil { return nil, err } m := c.pulledManifest if len(m.FSLayers) != len(m.History) { ...
go
func (c *Converter) Handle(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { switch desc.MediaType { case images.MediaTypeDockerSchema1Manifest: if err := c.fetchManifest(ctx, desc); err != nil { return nil, err } m := c.pulledManifest if len(m.FSLayers) != len(m.History) { ...
[ "func", "(", "c", "*", "Converter", ")", "Handle", "(", "ctx", "context", ".", "Context", ",", "desc", "ocispec", ".", "Descriptor", ")", "(", "[", "]", "ocispec", ".", "Descriptor", ",", "error", ")", "{", "switch", "desc", ".", "MediaType", "{", "c...
// Handle fetching descriptors for a docker media type
[ "Handle", "fetching", "descriptors", "for", "a", "docker", "media", "type" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/docker/schema1/converter.go#L79-L123
130,234
containerd/containerd
remotes/docker/schema1/converter.go
UseDockerSchema2
func UseDockerSchema2() ConvertOpt { return func(ctx context.Context, o *ConvertOptions) error { o.ManifestMediaType = images.MediaTypeDockerSchema2Manifest o.ConfigMediaType = images.MediaTypeDockerSchema2Config return nil } }
go
func UseDockerSchema2() ConvertOpt { return func(ctx context.Context, o *ConvertOptions) error { o.ManifestMediaType = images.MediaTypeDockerSchema2Manifest o.ConfigMediaType = images.MediaTypeDockerSchema2Config return nil } }
[ "func", "UseDockerSchema2", "(", ")", "ConvertOpt", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "o", "*", "ConvertOptions", ")", "error", "{", "o", ".", "ManifestMediaType", "=", "images", ".", "MediaTypeDockerSchema2Manifest", "\n", "o"...
// UseDockerSchema2 is used to indicate that a schema1 manifest should be // converted into the media types for a docker schema2 manifest.
[ "UseDockerSchema2", "is", "used", "to", "indicate", "that", "a", "schema1", "manifest", "should", "be", "converted", "into", "the", "media", "types", "for", "a", "docker", "schema2", "manifest", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/docker/schema1/converter.go#L140-L146
130,235
containerd/containerd
remotes/docker/schema1/converter.go
isEmptyLayer
func isEmptyLayer(compatHistory []byte) (bool, error) { var h v1History if err := json.Unmarshal(compatHistory, &h); err != nil { return false, err } if h.ThrowAway != nil { return *h.ThrowAway, nil } if h.Size != nil { return *h.Size == 0, nil } // If no `Size` or `throwaway` field is given, then // i...
go
func isEmptyLayer(compatHistory []byte) (bool, error) { var h v1History if err := json.Unmarshal(compatHistory, &h); err != nil { return false, err } if h.ThrowAway != nil { return *h.ThrowAway, nil } if h.Size != nil { return *h.Size == 0, nil } // If no `Size` or `throwaway` field is given, then // i...
[ "func", "isEmptyLayer", "(", "compatHistory", "[", "]", "byte", ")", "(", "bool", ",", "error", ")", "{", "var", "h", "v1History", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "compatHistory", ",", "&", "h", ")", ";", "err", "!=", "nil", ...
// isEmptyLayer returns whether the v1 compatibility history describes an // empty layer. A return value of true indicates the layer is empty, // however false does not indicate non-empty.
[ "isEmptyLayer", "returns", "whether", "the", "v1", "compatibility", "history", "describes", "an", "empty", "layer", ".", "A", "return", "value", "of", "true", "indicates", "the", "layer", "is", "empty", "however", "false", "does", "not", "indicate", "non", "-"...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/docker/schema1/converter.go#L487-L504
130,236
containerd/containerd
metadata/content.go
newContentStore
func newContentStore(db *DB, shared bool, cs content.Store) *contentStore { return &contentStore{ Store: cs, db: db, shared: shared, } }
go
func newContentStore(db *DB, shared bool, cs content.Store) *contentStore { return &contentStore{ Store: cs, db: db, shared: shared, } }
[ "func", "newContentStore", "(", "db", "*", "DB", ",", "shared", "bool", ",", "cs", "content", ".", "Store", ")", "*", "contentStore", "{", "return", "&", "contentStore", "{", "Store", ":", "cs", ",", "db", ":", "db", ",", "shared", ":", "shared", ","...
// newContentStore returns a namespaced content store using an existing // content store interface. // policy defines the sharing behavior for content between namespaces. Both // modes will result in shared storage in the backend for committed. Choose // "shared" to prevent separate namespaces from having to pull the s...
[ "newContentStore", "returns", "a", "namespaced", "content", "store", "using", "an", "existing", "content", "store", "interface", ".", "policy", "defines", "the", "sharing", "behavior", "for", "content", "between", "namespaces", ".", "Both", "modes", "will", "resul...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/metadata/content.go#L61-L67
130,237
containerd/containerd
container.go
Spec
func (c *container) Spec(ctx context.Context) (*oci.Spec, error) { r, err := c.get(ctx) if err != nil { return nil, err } var s oci.Spec if err := json.Unmarshal(r.Spec.Value, &s); err != nil { return nil, err } return &s, nil }
go
func (c *container) Spec(ctx context.Context) (*oci.Spec, error) { r, err := c.get(ctx) if err != nil { return nil, err } var s oci.Spec if err := json.Unmarshal(r.Spec.Value, &s); err != nil { return nil, err } return &s, nil }
[ "func", "(", "c", "*", "container", ")", "Spec", "(", "ctx", "context", ".", "Context", ")", "(", "*", "oci", ".", "Spec", ",", "error", ")", "{", "r", ",", "err", ":=", "c", ".", "get", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", ...
// Spec returns the current OCI specification for the container
[ "Spec", "returns", "the", "current", "OCI", "specification", "for", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container.go#L141-L151
130,238
containerd/containerd
container.go
Delete
func (c *container) Delete(ctx context.Context, opts ...DeleteOpts) error { if _, err := c.loadTask(ctx, nil); err == nil { return errors.Wrapf(errdefs.ErrFailedPrecondition, "cannot delete running task %v", c.id) } r, err := c.get(ctx) if err != nil { return err } for _, o := range opts { if err := o(ctx, ...
go
func (c *container) Delete(ctx context.Context, opts ...DeleteOpts) error { if _, err := c.loadTask(ctx, nil); err == nil { return errors.Wrapf(errdefs.ErrFailedPrecondition, "cannot delete running task %v", c.id) } r, err := c.get(ctx) if err != nil { return err } for _, o := range opts { if err := o(ctx, ...
[ "func", "(", "c", "*", "container", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "opts", "...", "DeleteOpts", ")", "error", "{", "if", "_", ",", "err", ":=", "c", ".", "loadTask", "(", "ctx", ",", "nil", ")", ";", "err", "==", "nil"...
// Delete deletes an existing container // an error is returned if the container has running tasks
[ "Delete", "deletes", "an", "existing", "container", "an", "error", "is", "returned", "if", "the", "container", "has", "running", "tasks" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container.go#L155-L169
130,239
containerd/containerd
container.go
Image
func (c *container) Image(ctx context.Context) (Image, error) { r, err := c.get(ctx) if err != nil { return nil, err } if r.Image == "" { return nil, errors.Wrap(errdefs.ErrNotFound, "container not created from an image") } i, err := c.client.ImageService().Get(ctx, r.Image) if err != nil { return nil, err...
go
func (c *container) Image(ctx context.Context) (Image, error) { r, err := c.get(ctx) if err != nil { return nil, err } if r.Image == "" { return nil, errors.Wrap(errdefs.ErrNotFound, "container not created from an image") } i, err := c.client.ImageService().Get(ctx, r.Image) if err != nil { return nil, err...
[ "func", "(", "c", "*", "container", ")", "Image", "(", "ctx", "context", ".", "Context", ")", "(", "Image", ",", "error", ")", "{", "r", ",", "err", ":=", "c", ".", "get", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ...
// Image returns the image that the container is based on
[ "Image", "returns", "the", "image", "that", "the", "container", "is", "based", "on" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container.go#L176-L189
130,240
containerd/containerd
container.go
attachExistingIO
func attachExistingIO(response *tasks.GetResponse, ioAttach cio.Attach) (cio.IO, error) { fifoSet := loadFifos(response) return ioAttach(fifoSet) }
go
func attachExistingIO(response *tasks.GetResponse, ioAttach cio.Attach) (cio.IO, error) { fifoSet := loadFifos(response) return ioAttach(fifoSet) }
[ "func", "attachExistingIO", "(", "response", "*", "tasks", ".", "GetResponse", ",", "ioAttach", "cio", ".", "Attach", ")", "(", "cio", ".", "IO", ",", "error", ")", "{", "fifoSet", ":=", "loadFifos", "(", "response", ")", "\n", "return", "ioAttach", "(",...
// get the existing fifo paths from the task information stored by the daemon
[ "get", "the", "existing", "fifo", "paths", "from", "the", "task", "information", "stored", "by", "the", "daemon" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container.go#L384-L387
130,241
containerd/containerd
container.go
loadFifos
func loadFifos(response *tasks.GetResponse) *cio.FIFOSet { path := getFifoDir([]string{ response.Process.Stdin, response.Process.Stdout, response.Process.Stderr, }) closer := func() error { return os.RemoveAll(path) } return cio.NewFIFOSet(cio.Config{ Stdin: response.Process.Stdin, Stdout: respons...
go
func loadFifos(response *tasks.GetResponse) *cio.FIFOSet { path := getFifoDir([]string{ response.Process.Stdin, response.Process.Stdout, response.Process.Stderr, }) closer := func() error { return os.RemoveAll(path) } return cio.NewFIFOSet(cio.Config{ Stdin: response.Process.Stdin, Stdout: respons...
[ "func", "loadFifos", "(", "response", "*", "tasks", ".", "GetResponse", ")", "*", "cio", ".", "FIFOSet", "{", "path", ":=", "getFifoDir", "(", "[", "]", "string", "{", "response", ".", "Process", ".", "Stdin", ",", "response", ".", "Process", ".", "Std...
// loadFifos loads the containers fifos
[ "loadFifos", "loads", "the", "containers", "fifos" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container.go#L390-L405
130,242
containerd/containerd
container.go
getFifoDir
func getFifoDir(paths []string) string { for _, p := range paths { if p != "" { return filepath.Dir(p) } } return "" }
go
func getFifoDir(paths []string) string { for _, p := range paths { if p != "" { return filepath.Dir(p) } } return "" }
[ "func", "getFifoDir", "(", "paths", "[", "]", "string", ")", "string", "{", "for", "_", ",", "p", ":=", "range", "paths", "{", "if", "p", "!=", "\"", "\"", "{", "return", "filepath", ".", "Dir", "(", "p", ")", "\n", "}", "\n", "}", "\n", "retur...
// getFifoDir looks for any non-empty path for a stdio fifo // and returns the dir for where it is located
[ "getFifoDir", "looks", "for", "any", "non", "-", "empty", "path", "for", "a", "stdio", "fifo", "and", "returns", "the", "dir", "for", "where", "it", "is", "located" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/container.go#L409-L416
130,243
containerd/containerd
contrib/apparmor/apparmor.go
WithProfile
func WithProfile(profile string) oci.SpecOpts { return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error { s.Process.ApparmorProfile = profile return nil } }
go
func WithProfile(profile string) oci.SpecOpts { return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error { s.Process.ApparmorProfile = profile return nil } }
[ "func", "WithProfile", "(", "profile", "string", ")", "oci", ".", "SpecOpts", "{", "return", "func", "(", "_", "context", ".", "Context", ",", "_", "oci", ".", "Client", ",", "_", "*", "containers", ".", "Container", ",", "s", "*", "specs", ".", "Spe...
// WithProfile sets the provided apparmor profile to the spec
[ "WithProfile", "sets", "the", "provided", "apparmor", "profile", "to", "the", "spec" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/contrib/apparmor/apparmor.go#L33-L38
130,244
containerd/containerd
contrib/apparmor/apparmor.go
WithDefaultProfile
func WithDefaultProfile(name string) oci.SpecOpts { return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error { yes, err := isLoaded(name) if err != nil { return err } if yes { s.Process.ApparmorProfile = name return nil } p, err := loadData(name) if err != nil {...
go
func WithDefaultProfile(name string) oci.SpecOpts { return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error { yes, err := isLoaded(name) if err != nil { return err } if yes { s.Process.ApparmorProfile = name return nil } p, err := loadData(name) if err != nil {...
[ "func", "WithDefaultProfile", "(", "name", "string", ")", "oci", ".", "SpecOpts", "{", "return", "func", "(", "_", "context", ".", "Context", ",", "_", "oci", ".", "Client", ",", "_", "*", "containers", ".", "Container", ",", "s", "*", "specs", ".", ...
// WithDefaultProfile will generate a default apparmor profile under the provided name // for the container. It is only generated if a profile under that name does not exist.
[ "WithDefaultProfile", "will", "generate", "a", "default", "apparmor", "profile", "under", "the", "provided", "name", "for", "the", "container", ".", "It", "is", "only", "generated", "if", "a", "profile", "under", "that", "name", "does", "not", "exist", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/contrib/apparmor/apparmor.go#L42-L73
130,245
containerd/containerd
protobuf/plugin/helpers.go
FieldpathEnabled
func FieldpathEnabled(file *descriptor.FileDescriptorProto, message *descriptor.DescriptorProto) bool { return proto.GetBoolExtension(message.Options, E_Fieldpath, proto.GetBoolExtension(file.Options, E_FieldpathAll, false)) }
go
func FieldpathEnabled(file *descriptor.FileDescriptorProto, message *descriptor.DescriptorProto) bool { return proto.GetBoolExtension(message.Options, E_Fieldpath, proto.GetBoolExtension(file.Options, E_FieldpathAll, false)) }
[ "func", "FieldpathEnabled", "(", "file", "*", "descriptor", ".", "FileDescriptorProto", ",", "message", "*", "descriptor", ".", "DescriptorProto", ")", "bool", "{", "return", "proto", ".", "GetBoolExtension", "(", "message", ".", "Options", ",", "E_Fieldpath", "...
// FieldpathEnabled returns true if E_Fieldpath is enabled
[ "FieldpathEnabled", "returns", "true", "if", "E_Fieldpath", "is", "enabled" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/protobuf/plugin/helpers.go#L25-L27
130,246
containerd/containerd
services.go
WithContentStore
func WithContentStore(contentStore content.Store) ServicesOpt { return func(s *services) { s.contentStore = contentStore } }
go
func WithContentStore(contentStore content.Store) ServicesOpt { return func(s *services) { s.contentStore = contentStore } }
[ "func", "WithContentStore", "(", "contentStore", "content", ".", "Store", ")", "ServicesOpt", "{", "return", "func", "(", "s", "*", "services", ")", "{", "s", ".", "contentStore", "=", "contentStore", "\n", "}", "\n", "}" ]
// WithContentStore sets the content store.
[ "WithContentStore", "sets", "the", "content", "store", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services.go#L49-L53
130,247
containerd/containerd
services.go
WithImageService
func WithImageService(imageService imagesapi.ImagesClient) ServicesOpt { return func(s *services) { s.imageStore = NewImageStoreFromClient(imageService) } }
go
func WithImageService(imageService imagesapi.ImagesClient) ServicesOpt { return func(s *services) { s.imageStore = NewImageStoreFromClient(imageService) } }
[ "func", "WithImageService", "(", "imageService", "imagesapi", ".", "ImagesClient", ")", "ServicesOpt", "{", "return", "func", "(", "s", "*", "services", ")", "{", "s", ".", "imageStore", "=", "NewImageStoreFromClient", "(", "imageService", ")", "\n", "}", "\n"...
// WithImageService sets the image service.
[ "WithImageService", "sets", "the", "image", "service", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services.go#L56-L60
130,248
containerd/containerd
services.go
WithSnapshotters
func WithSnapshotters(snapshotters map[string]snapshots.Snapshotter) ServicesOpt { return func(s *services) { s.snapshotters = make(map[string]snapshots.Snapshotter) for n, sn := range snapshotters { s.snapshotters[n] = sn } } }
go
func WithSnapshotters(snapshotters map[string]snapshots.Snapshotter) ServicesOpt { return func(s *services) { s.snapshotters = make(map[string]snapshots.Snapshotter) for n, sn := range snapshotters { s.snapshotters[n] = sn } } }
[ "func", "WithSnapshotters", "(", "snapshotters", "map", "[", "string", "]", "snapshots", ".", "Snapshotter", ")", "ServicesOpt", "{", "return", "func", "(", "s", "*", "services", ")", "{", "s", ".", "snapshotters", "=", "make", "(", "map", "[", "string", ...
// WithSnapshotters sets the snapshotters.
[ "WithSnapshotters", "sets", "the", "snapshotters", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services.go#L63-L70
130,249
containerd/containerd
services.go
WithContainerService
func WithContainerService(containerService containersapi.ContainersClient) ServicesOpt { return func(s *services) { s.containerStore = NewRemoteContainerStore(containerService) } }
go
func WithContainerService(containerService containersapi.ContainersClient) ServicesOpt { return func(s *services) { s.containerStore = NewRemoteContainerStore(containerService) } }
[ "func", "WithContainerService", "(", "containerService", "containersapi", ".", "ContainersClient", ")", "ServicesOpt", "{", "return", "func", "(", "s", "*", "services", ")", "{", "s", ".", "containerStore", "=", "NewRemoteContainerStore", "(", "containerService", ")...
// WithContainerService sets the container service.
[ "WithContainerService", "sets", "the", "container", "service", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services.go#L73-L77
130,250
containerd/containerd
services.go
WithTaskService
func WithTaskService(taskService tasks.TasksClient) ServicesOpt { return func(s *services) { s.taskService = taskService } }
go
func WithTaskService(taskService tasks.TasksClient) ServicesOpt { return func(s *services) { s.taskService = taskService } }
[ "func", "WithTaskService", "(", "taskService", "tasks", ".", "TasksClient", ")", "ServicesOpt", "{", "return", "func", "(", "s", "*", "services", ")", "{", "s", ".", "taskService", "=", "taskService", "\n", "}", "\n", "}" ]
// WithTaskService sets the task service.
[ "WithTaskService", "sets", "the", "task", "service", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services.go#L80-L84
130,251
containerd/containerd
services.go
WithDiffService
func WithDiffService(diffService diff.DiffClient) ServicesOpt { return func(s *services) { s.diffService = NewDiffServiceFromClient(diffService) } }
go
func WithDiffService(diffService diff.DiffClient) ServicesOpt { return func(s *services) { s.diffService = NewDiffServiceFromClient(diffService) } }
[ "func", "WithDiffService", "(", "diffService", "diff", ".", "DiffClient", ")", "ServicesOpt", "{", "return", "func", "(", "s", "*", "services", ")", "{", "s", ".", "diffService", "=", "NewDiffServiceFromClient", "(", "diffService", ")", "\n", "}", "\n", "}" ...
// WithDiffService sets the diff service.
[ "WithDiffService", "sets", "the", "diff", "service", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services.go#L87-L91
130,252
containerd/containerd
services.go
WithNamespaceService
func WithNamespaceService(namespaceService namespacesapi.NamespacesClient) ServicesOpt { return func(s *services) { s.namespaceStore = NewNamespaceStoreFromClient(namespaceService) } }
go
func WithNamespaceService(namespaceService namespacesapi.NamespacesClient) ServicesOpt { return func(s *services) { s.namespaceStore = NewNamespaceStoreFromClient(namespaceService) } }
[ "func", "WithNamespaceService", "(", "namespaceService", "namespacesapi", ".", "NamespacesClient", ")", "ServicesOpt", "{", "return", "func", "(", "s", "*", "services", ")", "{", "s", ".", "namespaceStore", "=", "NewNamespaceStoreFromClient", "(", "namespaceService", ...
// WithNamespaceService sets the namespace service.
[ "WithNamespaceService", "sets", "the", "namespace", "service", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services.go#L101-L105
130,253
containerd/containerd
services.go
WithLeasesService
func WithLeasesService(leasesService leases.Manager) ServicesOpt { return func(s *services) { s.leasesService = leasesService } }
go
func WithLeasesService(leasesService leases.Manager) ServicesOpt { return func(s *services) { s.leasesService = leasesService } }
[ "func", "WithLeasesService", "(", "leasesService", "leases", ".", "Manager", ")", "ServicesOpt", "{", "return", "func", "(", "s", "*", "services", ")", "{", "s", ".", "leasesService", "=", "leasesService", "\n", "}", "\n", "}" ]
// WithLeasesService sets the lease service.
[ "WithLeasesService", "sets", "the", "lease", "service", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services.go#L108-L112
130,254
containerd/containerd
snapshots/devmapper/config.go
LoadConfig
func LoadConfig(path string) (*Config, error) { if _, err := os.Stat(path); err != nil { if os.IsNotExist(err) { return nil, os.ErrNotExist } return nil, err } config := Config{} if _, err := toml.DecodeFile(path, &config); err != nil { return nil, errors.Wrapf(err, "failed to unmarshal data at '%s'", ...
go
func LoadConfig(path string) (*Config, error) { if _, err := os.Stat(path); err != nil { if os.IsNotExist(err) { return nil, os.ErrNotExist } return nil, err } config := Config{} if _, err := toml.DecodeFile(path, &config); err != nil { return nil, errors.Wrapf(err, "failed to unmarshal data at '%s'", ...
[ "func", "LoadConfig", "(", "path", "string", ")", "(", "*", "Config", ",", "error", ")", "{", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "path", ")", ";", "err", "!=", "nil", "{", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", ...
// LoadConfig reads devmapper configuration file from disk in TOML format
[ "LoadConfig", "reads", "devmapper", "configuration", "file", "from", "disk", "in", "TOML", "format" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/config.go#L46-L69
130,255
containerd/containerd
snapshots/devmapper/config.go
Validate
func (c *Config) Validate() error { var result *multierror.Error if c.PoolName == "" { result = multierror.Append(result, fmt.Errorf("pool_name is required")) } if c.RootPath == "" { result = multierror.Append(result, fmt.Errorf("root_path is required")) } if c.BaseImageSize == "" { result = multierror.A...
go
func (c *Config) Validate() error { var result *multierror.Error if c.PoolName == "" { result = multierror.Append(result, fmt.Errorf("pool_name is required")) } if c.RootPath == "" { result = multierror.Append(result, fmt.Errorf("root_path is required")) } if c.BaseImageSize == "" { result = multierror.A...
[ "func", "(", "c", "*", "Config", ")", "Validate", "(", ")", "error", "{", "var", "result", "*", "multierror", ".", "Error", "\n\n", "if", "c", ".", "PoolName", "==", "\"", "\"", "{", "result", "=", "multierror", ".", "Append", "(", "result", ",", "...
// Validate makes sure configuration fields are valid
[ "Validate", "makes", "sure", "configuration", "fields", "are", "valid" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/config.go#L82-L98
130,256
containerd/containerd
snapshots/lcow/lcow.go
NewSnapshotter
func NewSnapshotter(root string) (snapshots.Snapshotter, error) { fsType, err := getFileSystemType(root) if err != nil { return nil, err } if strings.ToLower(fsType) != "ntfs" { return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "%s is not on an NTFS volume - only NTFS volumes are supported", root) } if er...
go
func NewSnapshotter(root string) (snapshots.Snapshotter, error) { fsType, err := getFileSystemType(root) if err != nil { return nil, err } if strings.ToLower(fsType) != "ntfs" { return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "%s is not on an NTFS volume - only NTFS volumes are supported", root) } if er...
[ "func", "NewSnapshotter", "(", "root", "string", ")", "(", "snapshots", ".", "Snapshotter", ",", "error", ")", "{", "fsType", ",", "err", ":=", "getFileSystemType", "(", "root", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n...
// NewSnapshotter returns a new windows snapshotter
[ "NewSnapshotter", "returns", "a", "new", "windows", "snapshotter" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/lcow/lcow.go#L70-L95
130,257
containerd/containerd
runtime/v2/shim/shim_windows.go
setupSignals
func setupSignals(config Config) (chan os.Signal, error) { signals := make(chan os.Signal, 32) return signals, nil }
go
func setupSignals(config Config) (chan os.Signal, error) { signals := make(chan os.Signal, 32) return signals, nil }
[ "func", "setupSignals", "(", "config", "Config", ")", "(", "chan", "os", ".", "Signal", ",", "error", ")", "{", "signals", ":=", "make", "(", "chan", "os", ".", "Signal", ",", "32", ")", "\n", "return", "signals", ",", "nil", "\n", "}" ]
// setupSignals creates a new signal handler for all signals
[ "setupSignals", "creates", "a", "new", "signal", "handler", "for", "all", "signals" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/shim/shim_windows.go#L41-L44
130,258
containerd/containerd
runtime/v2/shim/shim_windows.go
beginAccept
func (dswl *deferredShimWriteLogger) beginAccept() { dswl.mu.Lock() if dswl.connected { return } dswl.mu.Unlock() c, err := dswl.l.Accept() if err == winio.ErrPipeListenerClosed { dswl.mu.Lock() dswl.aborted = true dswl.l.Close() dswl.conerr = errors.New("connection closed") dswl.mu.Unlock() return...
go
func (dswl *deferredShimWriteLogger) beginAccept() { dswl.mu.Lock() if dswl.connected { return } dswl.mu.Unlock() c, err := dswl.l.Accept() if err == winio.ErrPipeListenerClosed { dswl.mu.Lock() dswl.aborted = true dswl.l.Close() dswl.conerr = errors.New("connection closed") dswl.mu.Unlock() return...
[ "func", "(", "dswl", "*", "deferredShimWriteLogger", ")", "beginAccept", "(", ")", "{", "dswl", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "dswl", ".", "connected", "{", "return", "\n", "}", "\n", "dswl", ".", "mu", ".", "Unlock", "(", ")", "\n\...
// beginAccept issues an accept to wait for a connection. Once a connection // occurs drains any outstanding buffer. While draining the buffer any writes // are blocked. If the buffer fails to fully drain due to a connection drop a // call to `beginAccept` is re-issued waiting for another connection from // containerd.
[ "beginAccept", "issues", "an", "accept", "to", "wait", "for", "a", "connection", ".", "Once", "a", "connection", "occurs", "drains", "any", "outstanding", "buffer", ".", "While", "draining", "the", "buffer", "any", "writes", "are", "blocked", ".", "If", "the...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/shim/shim_windows.go#L200-L231
130,259
containerd/containerd
runtime/v2/shim/shim_windows.go
openLog
func openLog(ctx context.Context, id string) (io.Writer, error) { ns, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } dswl := &deferredShimWriteLogger{ ctx: ctx, buffer: newBlockingBuffer(64 * 1024), // 64KB, } l, err := winio.ListenPipe(fmt.Sprintf("\\\\.\\pipe\\containerd-sh...
go
func openLog(ctx context.Context, id string) (io.Writer, error) { ns, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } dswl := &deferredShimWriteLogger{ ctx: ctx, buffer: newBlockingBuffer(64 * 1024), // 64KB, } l, err := winio.ListenPipe(fmt.Sprintf("\\\\.\\pipe\\containerd-sh...
[ "func", "openLog", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "io", ".", "Writer", ",", "error", ")", "{", "ns", ",", "err", ":=", "namespaces", ".", "NamespaceRequired", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "...
// openLog on Windows acts as the server of the log pipe. This allows the // containerd daemon to independently restart and reconnect to the logs.
[ "openLog", "on", "Windows", "acts", "as", "the", "server", "of", "the", "log", "pipe", ".", "This", "allows", "the", "containerd", "daemon", "to", "independently", "restart", "and", "reconnect", "to", "the", "logs", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/shim/shim_windows.go#L271-L288
130,260
containerd/containerd
snapshots/devmapper/pool_device.go
NewPoolDevice
func NewPoolDevice(ctx context.Context, config *Config) (*PoolDevice, error) { log.G(ctx).Infof("initializing pool device %q", config.PoolName) version, err := dmsetup.Version() if err != nil { log.G(ctx).Errorf("dmsetup not available") return nil, err } log.G(ctx).Infof("using dmsetup:\n%s", version) dbpa...
go
func NewPoolDevice(ctx context.Context, config *Config) (*PoolDevice, error) { log.G(ctx).Infof("initializing pool device %q", config.PoolName) version, err := dmsetup.Version() if err != nil { log.G(ctx).Errorf("dmsetup not available") return nil, err } log.G(ctx).Infof("using dmsetup:\n%s", version) dbpa...
[ "func", "NewPoolDevice", "(", "ctx", "context", ".", "Context", ",", "config", "*", "Config", ")", "(", "*", "PoolDevice", ",", "error", ")", "{", "log", ".", "G", "(", "ctx", ")", ".", "Infof", "(", "\"", "\"", ",", "config", ".", "PoolName", ")",...
// NewPoolDevice creates new thin-pool from existing data and metadata volumes. // If pool 'poolName' already exists, it'll be reloaded with new parameters.
[ "NewPoolDevice", "creates", "new", "thin", "-", "pool", "from", "existing", "data", "and", "metadata", "volumes", ".", "If", "pool", "poolName", "already", "exists", "it", "ll", "be", "reloaded", "with", "new", "parameters", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/pool_device.go#L41-L68
130,261
containerd/containerd
snapshots/devmapper/pool_device.go
createDevice
func (p *PoolDevice) createDevice(ctx context.Context, info *DeviceInfo) error { if err := p.transition(ctx, info.Name, Creating, Created, func() error { return dmsetup.CreateDevice(p.poolName, info.DeviceID) }); err != nil { return errors.Wrapf(err, "failed to create new thin device %q (dev: %d)", info.Name, inf...
go
func (p *PoolDevice) createDevice(ctx context.Context, info *DeviceInfo) error { if err := p.transition(ctx, info.Name, Creating, Created, func() error { return dmsetup.CreateDevice(p.poolName, info.DeviceID) }); err != nil { return errors.Wrapf(err, "failed to create new thin device %q (dev: %d)", info.Name, inf...
[ "func", "(", "p", "*", "PoolDevice", ")", "createDevice", "(", "ctx", "context", ".", "Context", ",", "info", "*", "DeviceInfo", ")", "error", "{", "if", "err", ":=", "p", ".", "transition", "(", "ctx", ",", "info", ".", "Name", ",", "Creating", ",",...
// createDevice creates thin device
[ "createDevice", "creates", "thin", "device" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/pool_device.go#L153-L161
130,262
containerd/containerd
snapshots/devmapper/pool_device.go
activateDevice
func (p *PoolDevice) activateDevice(ctx context.Context, info *DeviceInfo) error { if err := p.transition(ctx, info.Name, Activating, Activated, func() error { return dmsetup.ActivateDevice(p.poolName, info.Name, info.DeviceID, info.Size, "") }); err != nil { return errors.Wrapf(err, "failed to activate new thin ...
go
func (p *PoolDevice) activateDevice(ctx context.Context, info *DeviceInfo) error { if err := p.transition(ctx, info.Name, Activating, Activated, func() error { return dmsetup.ActivateDevice(p.poolName, info.Name, info.DeviceID, info.Size, "") }); err != nil { return errors.Wrapf(err, "failed to activate new thin ...
[ "func", "(", "p", "*", "PoolDevice", ")", "activateDevice", "(", "ctx", "context", ".", "Context", ",", "info", "*", "DeviceInfo", ")", "error", "{", "if", "err", ":=", "p", ".", "transition", "(", "ctx", ",", "info", ".", "Name", ",", "Activating", ...
// activateDevice activates thin device
[ "activateDevice", "activates", "thin", "device" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/pool_device.go#L164-L172
130,263
containerd/containerd
snapshots/devmapper/pool_device.go
DeactivateDevice
func (p *PoolDevice) DeactivateDevice(ctx context.Context, deviceName string, deferred bool) error { if !p.IsActivated(deviceName) { return nil } opts := []dmsetup.RemoveDeviceOpt{dmsetup.RemoveWithForce, dmsetup.RemoveWithRetries} if deferred { opts = append(opts, dmsetup.RemoveDeferred) } if err := p.tran...
go
func (p *PoolDevice) DeactivateDevice(ctx context.Context, deviceName string, deferred bool) error { if !p.IsActivated(deviceName) { return nil } opts := []dmsetup.RemoveDeviceOpt{dmsetup.RemoveWithForce, dmsetup.RemoveWithRetries} if deferred { opts = append(opts, dmsetup.RemoveDeferred) } if err := p.tran...
[ "func", "(", "p", "*", "PoolDevice", ")", "DeactivateDevice", "(", "ctx", "context", ".", "Context", ",", "deviceName", "string", ",", "deferred", "bool", ")", "error", "{", "if", "!", "p", ".", "IsActivated", "(", "deviceName", ")", "{", "return", "nil"...
// DeactivateDevice deactivates thin device
[ "DeactivateDevice", "deactivates", "thin", "device" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/pool_device.go#L269-L286
130,264
containerd/containerd
snapshots/devmapper/pool_device.go
IsActivated
func (p *PoolDevice) IsActivated(deviceName string) bool { infos, err := dmsetup.Info(deviceName) if err != nil || len(infos) != 1 { // Couldn't query device info, device not active return false } if devInfo := infos[0]; devInfo.Suspended { return false } return true }
go
func (p *PoolDevice) IsActivated(deviceName string) bool { infos, err := dmsetup.Info(deviceName) if err != nil || len(infos) != 1 { // Couldn't query device info, device not active return false } if devInfo := infos[0]; devInfo.Suspended { return false } return true }
[ "func", "(", "p", "*", "PoolDevice", ")", "IsActivated", "(", "deviceName", "string", ")", "bool", "{", "infos", ",", "err", ":=", "dmsetup", ".", "Info", "(", "deviceName", ")", "\n", "if", "err", "!=", "nil", "||", "len", "(", "infos", ")", "!=", ...
// IsActivated returns true if thin-device is activated and not suspended
[ "IsActivated", "returns", "true", "if", "thin", "-", "device", "is", "activated", "and", "not", "suspended" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/pool_device.go#L289-L301
130,265
containerd/containerd
snapshots/devmapper/pool_device.go
RemoveDevice
func (p *PoolDevice) RemoveDevice(ctx context.Context, deviceName string) error { info, err := p.metadata.GetDevice(ctx, deviceName) if err != nil { return errors.Wrapf(err, "can't query metadata for device %q", deviceName) } if err := p.DeactivateDevice(ctx, deviceName, true); err != nil { return err } if ...
go
func (p *PoolDevice) RemoveDevice(ctx context.Context, deviceName string) error { info, err := p.metadata.GetDevice(ctx, deviceName) if err != nil { return errors.Wrapf(err, "can't query metadata for device %q", deviceName) } if err := p.DeactivateDevice(ctx, deviceName, true); err != nil { return err } if ...
[ "func", "(", "p", "*", "PoolDevice", ")", "RemoveDevice", "(", "ctx", "context", ".", "Context", ",", "deviceName", "string", ")", "error", "{", "info", ",", "err", ":=", "p", ".", "metadata", ".", "GetDevice", "(", "ctx", ",", "deviceName", ")", "\n",...
// RemoveDevice completely wipes out thin device from thin-pool and frees it's device ID
[ "RemoveDevice", "completely", "wipes", "out", "thin", "device", "from", "thin", "-", "pool", "and", "frees", "it", "s", "device", "ID" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/pool_device.go#L327-L347
130,266
containerd/containerd
snapshots/devmapper/pool_device.go
RemovePool
func (p *PoolDevice) RemovePool(ctx context.Context) error { deviceNames, err := p.metadata.GetDeviceNames(ctx) if err != nil { return errors.Wrap(err, "can't query device names") } var result *multierror.Error // Deactivate devices if any for _, name := range deviceNames { if err := p.DeactivateDevice(ctx,...
go
func (p *PoolDevice) RemovePool(ctx context.Context) error { deviceNames, err := p.metadata.GetDeviceNames(ctx) if err != nil { return errors.Wrap(err, "can't query device names") } var result *multierror.Error // Deactivate devices if any for _, name := range deviceNames { if err := p.DeactivateDevice(ctx,...
[ "func", "(", "p", "*", "PoolDevice", ")", "RemovePool", "(", "ctx", "context", ".", "Context", ")", "error", "{", "deviceNames", ",", "err", ":=", "p", ".", "metadata", ".", "GetDeviceNames", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "ret...
// RemovePool deactivates all child thin-devices and removes thin-pool device
[ "RemovePool", "deactivates", "all", "child", "thin", "-", "devices", "and", "removes", "thin", "-", "pool", "device" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/pool_device.go#L361-L381
130,267
containerd/containerd
cmd/ctr/commands/tasks/checkpoint.go
withCheckpointOpts
func withCheckpointOpts(rt string, context *cli.Context) containerd.CheckpointTaskOpts { return func(r *containerd.CheckpointTaskInfo) error { imagePath := context.String("image-path") workPath := context.String("work-path") switch rt { case plugin.RuntimeRuncV1, plugin.RuntimeRuncV2: if r.Options == nil {...
go
func withCheckpointOpts(rt string, context *cli.Context) containerd.CheckpointTaskOpts { return func(r *containerd.CheckpointTaskInfo) error { imagePath := context.String("image-path") workPath := context.String("work-path") switch rt { case plugin.RuntimeRuncV1, plugin.RuntimeRuncV2: if r.Options == nil {...
[ "func", "withCheckpointOpts", "(", "rt", "string", ",", "context", "*", "cli", ".", "Context", ")", "containerd", ".", "CheckpointTaskOpts", "{", "return", "func", "(", "r", "*", "containerd", ".", "CheckpointTaskInfo", ")", "error", "{", "imagePath", ":=", ...
// withCheckpointOpts only suitable for runc runtime now
[ "withCheckpointOpts", "only", "suitable", "for", "runc", "runtime", "now" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cmd/ctr/commands/tasks/checkpoint.go#L84-L123
130,268
containerd/containerd
import.go
WithImageRefTranslator
func WithImageRefTranslator(f func(string) string) ImportOpt { return func(c *importOpts) error { c.imageRefT = f return nil } }
go
func WithImageRefTranslator(f func(string) string) ImportOpt { return func(c *importOpts) error { c.imageRefT = f return nil } }
[ "func", "WithImageRefTranslator", "(", "f", "func", "(", "string", ")", "string", ")", "ImportOpt", "{", "return", "func", "(", "c", "*", "importOpts", ")", "error", "{", "c", ".", "imageRefT", "=", "f", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithImageRefTranslator is used to translate the index reference // to an image reference for the image store.
[ "WithImageRefTranslator", "is", "used", "to", "translate", "the", "index", "reference", "to", "an", "image", "reference", "for", "the", "image", "store", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/import.go#L45-L50
130,269
containerd/containerd
import.go
WithDigestRef
func WithDigestRef(f func(digest.Digest) string) ImportOpt { return func(c *importOpts) error { c.dgstRefT = f return nil } }
go
func WithDigestRef(f func(digest.Digest) string) ImportOpt { return func(c *importOpts) error { c.dgstRefT = f return nil } }
[ "func", "WithDigestRef", "(", "f", "func", "(", "digest", ".", "Digest", ")", "string", ")", "ImportOpt", "{", "return", "func", "(", "c", "*", "importOpts", ")", "error", "{", "c", ".", "dgstRefT", "=", "f", "\n", "return", "nil", "\n", "}", "\n", ...
// WithDigestRef is used to create digest images for each // manifest in the index.
[ "WithDigestRef", "is", "used", "to", "create", "digest", "images", "for", "each", "manifest", "in", "the", "index", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/import.go#L54-L59
130,270
containerd/containerd
import.go
WithIndexName
func WithIndexName(name string) ImportOpt { return func(c *importOpts) error { c.indexName = name return nil } }
go
func WithIndexName(name string) ImportOpt { return func(c *importOpts) error { c.indexName = name return nil } }
[ "func", "WithIndexName", "(", "name", "string", ")", "ImportOpt", "{", "return", "func", "(", "c", "*", "importOpts", ")", "error", "{", "c", ".", "indexName", "=", "name", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithIndexName creates a tag pointing to the imported index
[ "WithIndexName", "creates", "a", "tag", "pointing", "to", "the", "imported", "index" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/import.go#L62-L67
130,271
containerd/containerd
import.go
WithAllPlatforms
func WithAllPlatforms(allPlatforms bool) ImportOpt { return func(c *importOpts) error { c.allPlatforms = allPlatforms return nil } }
go
func WithAllPlatforms(allPlatforms bool) ImportOpt { return func(c *importOpts) error { c.allPlatforms = allPlatforms return nil } }
[ "func", "WithAllPlatforms", "(", "allPlatforms", "bool", ")", "ImportOpt", "{", "return", "func", "(", "c", "*", "importOpts", ")", "error", "{", "c", ".", "allPlatforms", "=", "allPlatforms", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithAllPlatforms is used to import content for all platforms.
[ "WithAllPlatforms", "is", "used", "to", "import", "content", "for", "all", "platforms", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/import.go#L70-L75
130,272
containerd/containerd
filters/filter.go
Match
func (m Any) Match(adaptor Adaptor) bool { for _, m := range m { if m.Match(adaptor) { return true } } return false }
go
func (m Any) Match(adaptor Adaptor) bool { for _, m := range m { if m.Match(adaptor) { return true } } return false }
[ "func", "(", "m", "Any", ")", "Match", "(", "adaptor", "Adaptor", ")", "bool", "{", "for", "_", ",", "m", ":=", "range", "m", "{", "if", "m", ".", "Match", "(", "adaptor", ")", "{", "return", "true", "\n", "}", "\n", "}", "\n\n", "return", "fal...
// Match returns true if any of the provided filters are true
[ "Match", "returns", "true", "if", "any", "of", "the", "provided", "filters", "are", "true" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/filters/filter.go#L99-L107
130,273
containerd/containerd
content/local/store.go
ReaderAt
func (s *store) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error) { p := s.blobPath(desc.Digest) fi, err := os.Stat(p) if err != nil { if !os.IsNotExist(err) { return nil, err } return nil, errors.Wrapf(errdefs.ErrNotFound, "blob %s expected at %s", desc.Digest, p) } fp, e...
go
func (s *store) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error) { p := s.blobPath(desc.Digest) fi, err := os.Stat(p) if err != nil { if !os.IsNotExist(err) { return nil, err } return nil, errors.Wrapf(errdefs.ErrNotFound, "blob %s expected at %s", desc.Digest, p) } fp, e...
[ "func", "(", "s", "*", "store", ")", "ReaderAt", "(", "ctx", "context", ".", "Context", ",", "desc", "ocispec", ".", "Descriptor", ")", "(", "content", ".", "ReaderAt", ",", "error", ")", "{", "p", ":=", "s", ".", "blobPath", "(", "desc", ".", "Dig...
// ReaderAt returns an io.ReaderAt for the blob.
[ "ReaderAt", "returns", "an", "io", ".", "ReaderAt", "for", "the", "blob", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/store.go#L126-L147
130,274
containerd/containerd
content/local/store.go
Delete
func (s *store) Delete(ctx context.Context, dgst digest.Digest) error { if err := os.RemoveAll(s.blobPath(dgst)); err != nil { if !os.IsNotExist(err) { return err } return errors.Wrapf(errdefs.ErrNotFound, "content %v", dgst) } return nil }
go
func (s *store) Delete(ctx context.Context, dgst digest.Digest) error { if err := os.RemoveAll(s.blobPath(dgst)); err != nil { if !os.IsNotExist(err) { return err } return errors.Wrapf(errdefs.ErrNotFound, "content %v", dgst) } return nil }
[ "func", "(", "s", "*", "store", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "dgst", "digest", ".", "Digest", ")", "error", "{", "if", "err", ":=", "os", ".", "RemoveAll", "(", "s", ".", "blobPath", "(", "dgst", ")", ")", ";", "err"...
// Delete removes a blob by its digest. // // While this is safe to do concurrently, safe exist-removal logic must hold // some global lock on the store.
[ "Delete", "removes", "a", "blob", "by", "its", "digest", ".", "While", "this", "is", "safe", "to", "do", "concurrently", "safe", "exist", "-", "removal", "logic", "must", "hold", "some", "global", "lock", "on", "the", "store", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/store.go#L153-L163
130,275
containerd/containerd
content/local/store.go
WalkStatusRefs
func (s *store) WalkStatusRefs(ctx context.Context, fn func(string) error) error { fp, err := os.Open(filepath.Join(s.root, "ingest")) if err != nil { return err } defer fp.Close() fis, err := fp.Readdir(-1) if err != nil { return err } for _, fi := range fis { rf := filepath.Join(s.root, "ingest", fi....
go
func (s *store) WalkStatusRefs(ctx context.Context, fn func(string) error) error { fp, err := os.Open(filepath.Join(s.root, "ingest")) if err != nil { return err } defer fp.Close() fis, err := fp.Readdir(-1) if err != nil { return err } for _, fi := range fis { rf := filepath.Join(s.root, "ingest", fi....
[ "func", "(", "s", "*", "store", ")", "WalkStatusRefs", "(", "ctx", "context", ".", "Context", ",", "fn", "func", "(", "string", ")", "error", ")", "error", "{", "fp", ",", "err", ":=", "os", ".", "Open", "(", "filepath", ".", "Join", "(", "s", "....
// WalkStatusRefs is used to walk all status references // Failed status reads will be logged and ignored, if // this function is called while references are being altered, // these error messages may be produced.
[ "WalkStatusRefs", "is", "used", "to", "walk", "all", "status", "references", "Failed", "status", "reads", "will", "be", "logged", "and", "ignored", "if", "this", "function", "is", "called", "while", "references", "are", "being", "altered", "these", "error", "m...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/store.go#L332-L360
130,276
containerd/containerd
content/local/store.go
status
func (s *store) status(ingestPath string) (content.Status, error) { dp := filepath.Join(ingestPath, "data") fi, err := os.Stat(dp) if err != nil { if os.IsNotExist(err) { err = errors.Wrap(errdefs.ErrNotFound, err.Error()) } return content.Status{}, err } ref, err := readFileString(filepath.Join(ingestPa...
go
func (s *store) status(ingestPath string) (content.Status, error) { dp := filepath.Join(ingestPath, "data") fi, err := os.Stat(dp) if err != nil { if os.IsNotExist(err) { err = errors.Wrap(errdefs.ErrNotFound, err.Error()) } return content.Status{}, err } ref, err := readFileString(filepath.Join(ingestPa...
[ "func", "(", "s", "*", "store", ")", "status", "(", "ingestPath", "string", ")", "(", "content", ".", "Status", ",", "error", ")", "{", "dp", ":=", "filepath", ".", "Join", "(", "ingestPath", ",", "\"", "\"", ")", "\n", "fi", ",", "err", ":=", "o...
// status works like stat above except uses the path to the ingest.
[ "status", "works", "like", "stat", "above", "except", "uses", "the", "path", "to", "the", "ingest", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/store.go#L363-L404
130,277
containerd/containerd
content/local/store.go
total
func (s *store) total(ingestPath string) int64 { totalS, err := readFileString(filepath.Join(ingestPath, "total")) if err != nil { return 0 } total, err := strconv.ParseInt(totalS, 10, 64) if err != nil { // represents a corrupted file, should probably remove. return 0 } return total }
go
func (s *store) total(ingestPath string) int64 { totalS, err := readFileString(filepath.Join(ingestPath, "total")) if err != nil { return 0 } total, err := strconv.ParseInt(totalS, 10, 64) if err != nil { // represents a corrupted file, should probably remove. return 0 } return total }
[ "func", "(", "s", "*", "store", ")", "total", "(", "ingestPath", "string", ")", "int64", "{", "totalS", ",", "err", ":=", "readFileString", "(", "filepath", ".", "Join", "(", "ingestPath", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", ...
// total attempts to resolve the total expected size for the write.
[ "total", "attempts", "to", "resolve", "the", "total", "expected", "size", "for", "the", "write", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/store.go#L421-L434
130,278
containerd/containerd
content/local/store.go
Writer
func (s *store) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) { var wOpts content.WriterOpts for _, opt := range opts { if err := opt(&wOpts); err != nil { return nil, err } } // TODO(AkihiroSuda): we could create a random string or one calculated based on the context // htt...
go
func (s *store) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) { var wOpts content.WriterOpts for _, opt := range opts { if err := opt(&wOpts); err != nil { return nil, err } } // TODO(AkihiroSuda): we could create a random string or one calculated based on the context // htt...
[ "func", "(", "s", "*", "store", ")", "Writer", "(", "ctx", "context", ".", "Context", ",", "opts", "...", "content", ".", "WriterOpt", ")", "(", "content", ".", "Writer", ",", "error", ")", "{", "var", "wOpts", "content", ".", "WriterOpts", "\n", "fo...
// Writer begins or resumes the active writer identified by ref. If the writer // is already in use, an error is returned. Only one writer may be in use per // ref at a time. // // The argument `ref` is used to uniquely identify a long-lived writer transaction.
[ "Writer", "begins", "or", "resumes", "the", "active", "writer", "identified", "by", "ref", ".", "If", "the", "writer", "is", "already", "in", "use", "an", "error", "is", "returned", ".", "Only", "one", "writer", "may", "be", "in", "use", "per", "ref", ...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/store.go#L441-L479
130,279
containerd/containerd
content/local/store.go
writer
func (s *store) writer(ctx context.Context, ref string, total int64, expected digest.Digest) (content.Writer, error) { // TODO(stevvooe): Need to actually store expected here. We have // code in the service that shouldn't be dealing with this. if expected != "" { p := s.blobPath(expected) if _, err := os.Stat(p)...
go
func (s *store) writer(ctx context.Context, ref string, total int64, expected digest.Digest) (content.Writer, error) { // TODO(stevvooe): Need to actually store expected here. We have // code in the service that shouldn't be dealing with this. if expected != "" { p := s.blobPath(expected) if _, err := os.Stat(p)...
[ "func", "(", "s", "*", "store", ")", "writer", "(", "ctx", "context", ".", "Context", ",", "ref", "string", ",", "total", "int64", ",", "expected", "digest", ".", "Digest", ")", "(", "content", ".", "Writer", ",", "error", ")", "{", "// TODO(stevvooe):...
// writer provides the main implementation of the Writer method. The caller // must hold the lock correctly and release on error if there is a problem.
[ "writer", "provides", "the", "main", "implementation", "of", "the", "Writer", "method", ".", "The", "caller", "must", "hold", "the", "lock", "correctly", "and", "release", "on", "error", "if", "there", "is", "a", "problem", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/store.go#L512-L594
130,280
containerd/containerd
content/local/store.go
Abort
func (s *store) Abort(ctx context.Context, ref string) error { root := s.ingestRoot(ref) if err := os.RemoveAll(root); err != nil { if os.IsNotExist(err) { return errors.Wrapf(errdefs.ErrNotFound, "ingest ref %q", ref) } return err } return nil }
go
func (s *store) Abort(ctx context.Context, ref string) error { root := s.ingestRoot(ref) if err := os.RemoveAll(root); err != nil { if os.IsNotExist(err) { return errors.Wrapf(errdefs.ErrNotFound, "ingest ref %q", ref) } return err } return nil }
[ "func", "(", "s", "*", "store", ")", "Abort", "(", "ctx", "context", ".", "Context", ",", "ref", "string", ")", "error", "{", "root", ":=", "s", ".", "ingestRoot", "(", "ref", ")", "\n", "if", "err", ":=", "os", ".", "RemoveAll", "(", "root", ")"...
// Abort an active transaction keyed by ref. If the ingest is active, it will // be cancelled. Any resources associated with the ingest will be cleaned.
[ "Abort", "an", "active", "transaction", "keyed", "by", "ref", ".", "If", "the", "ingest", "is", "active", "it", "will", "be", "cancelled", ".", "Any", "resources", "associated", "with", "the", "ingest", "will", "be", "cleaned", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/store.go#L598-L609
130,281
containerd/containerd
content/local/store.go
readFileTimestamp
func readFileTimestamp(p string) (time.Time, error) { b, err := ioutil.ReadFile(p) if err != nil { if os.IsNotExist(err) { err = errors.Wrap(errdefs.ErrNotFound, err.Error()) } return time.Time{}, err } var t time.Time if err := t.UnmarshalText(b); err != nil { return time.Time{}, errors.Wrapf(err, "co...
go
func readFileTimestamp(p string) (time.Time, error) { b, err := ioutil.ReadFile(p) if err != nil { if os.IsNotExist(err) { err = errors.Wrap(errdefs.ErrNotFound, err.Error()) } return time.Time{}, err } var t time.Time if err := t.UnmarshalText(b); err != nil { return time.Time{}, errors.Wrapf(err, "co...
[ "func", "readFileTimestamp", "(", "p", "string", ")", "(", "time", ".", "Time", ",", "error", ")", "{", "b", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "p", ")", "\n", "if", "err", "!=", "nil", "{", "if", "os", ".", "IsNotExist", "(", "err...
// readFileTimestamp reads a file with just a timestamp present.
[ "readFileTimestamp", "reads", "a", "file", "with", "just", "a", "timestamp", "present", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/store.go#L642-L657
130,282
containerd/containerd
pkg/progress/humaans.go
NewBytesPerSecond
func NewBytesPerSecond(n int64, duration time.Duration) BytesPerSecond { return BytesPerSecond(float64(n) / duration.Seconds()) }
go
func NewBytesPerSecond(n int64, duration time.Duration) BytesPerSecond { return BytesPerSecond(float64(n) / duration.Seconds()) }
[ "func", "NewBytesPerSecond", "(", "n", "int64", ",", "duration", "time", ".", "Duration", ")", "BytesPerSecond", "{", "return", "BytesPerSecond", "(", "float64", "(", "n", ")", "/", "duration", ".", "Seconds", "(", ")", ")", "\n", "}" ]
// NewBytesPerSecond returns the rate that n bytes were written in the provided duration
[ "NewBytesPerSecond", "returns", "the", "rate", "that", "n", "bytes", "were", "written", "in", "the", "provided", "duration" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/pkg/progress/humaans.go#L38-L40
130,283
containerd/containerd
runtime/task_list.go
Get
func (l *TaskList) Get(ctx context.Context, id string) (Task, error) { l.mu.Lock() defer l.mu.Unlock() namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } tasks, ok := l.tasks[namespace] if !ok { return nil, ErrTaskNotExists } t, ok := tasks[id] if !ok { return nil, Err...
go
func (l *TaskList) Get(ctx context.Context, id string) (Task, error) { l.mu.Lock() defer l.mu.Unlock() namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } tasks, ok := l.tasks[namespace] if !ok { return nil, ErrTaskNotExists } t, ok := tasks[id] if !ok { return nil, Err...
[ "func", "(", "l", "*", "TaskList", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "Task", ",", "error", ")", "{", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "mu", ".", "Unlock", "(", ")"...
// Get a task
[ "Get", "a", "task" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/task_list.go#L48-L64
130,284
containerd/containerd
runtime/task_list.go
GetAll
func (l *TaskList) GetAll(ctx context.Context, noNS bool) ([]Task, error) { l.mu.Lock() defer l.mu.Unlock() var o []Task if noNS { for ns := range l.tasks { for _, t := range l.tasks[ns] { o = append(o, t) } } return o, nil } namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { r...
go
func (l *TaskList) GetAll(ctx context.Context, noNS bool) ([]Task, error) { l.mu.Lock() defer l.mu.Unlock() var o []Task if noNS { for ns := range l.tasks { for _, t := range l.tasks[ns] { o = append(o, t) } } return o, nil } namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { r...
[ "func", "(", "l", "*", "TaskList", ")", "GetAll", "(", "ctx", "context", ".", "Context", ",", "noNS", "bool", ")", "(", "[", "]", "Task", ",", "error", ")", "{", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "mu", ".", "Unlo...
// GetAll tasks under a namespace
[ "GetAll", "tasks", "under", "a", "namespace" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/task_list.go#L67-L91
130,285
containerd/containerd
runtime/task_list.go
Add
func (l *TaskList) Add(ctx context.Context, t Task) error { namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return err } return l.AddWithNamespace(namespace, t) }
go
func (l *TaskList) Add(ctx context.Context, t Task) error { namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return err } return l.AddWithNamespace(namespace, t) }
[ "func", "(", "l", "*", "TaskList", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "t", "Task", ")", "error", "{", "namespace", ",", "err", ":=", "namespaces", ".", "NamespaceRequired", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", ...
// Add a task
[ "Add", "a", "task" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/task_list.go#L94-L100
130,286
containerd/containerd
runtime/task_list.go
AddWithNamespace
func (l *TaskList) AddWithNamespace(namespace string, t Task) error { l.mu.Lock() defer l.mu.Unlock() id := t.ID() if _, ok := l.tasks[namespace]; !ok { l.tasks[namespace] = make(map[string]Task) } if _, ok := l.tasks[namespace][id]; ok { return errors.Wrap(ErrTaskAlreadyExists, id) } l.tasks[namespace][id...
go
func (l *TaskList) AddWithNamespace(namespace string, t Task) error { l.mu.Lock() defer l.mu.Unlock() id := t.ID() if _, ok := l.tasks[namespace]; !ok { l.tasks[namespace] = make(map[string]Task) } if _, ok := l.tasks[namespace][id]; ok { return errors.Wrap(ErrTaskAlreadyExists, id) } l.tasks[namespace][id...
[ "func", "(", "l", "*", "TaskList", ")", "AddWithNamespace", "(", "namespace", "string", ",", "t", "Task", ")", "error", "{", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "id", ":=", "t", ...
// AddWithNamespace adds a task with the provided namespace
[ "AddWithNamespace", "adds", "a", "task", "with", "the", "provided", "namespace" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/task_list.go#L103-L116
130,287
containerd/containerd
runtime/task_list.go
Delete
func (l *TaskList) Delete(ctx context.Context, id string) { l.mu.Lock() defer l.mu.Unlock() namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return } tasks, ok := l.tasks[namespace] if ok { delete(tasks, id) } }
go
func (l *TaskList) Delete(ctx context.Context, id string) { l.mu.Lock() defer l.mu.Unlock() namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return } tasks, ok := l.tasks[namespace] if ok { delete(tasks, id) } }
[ "func", "(", "l", "*", "TaskList", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "{", "l", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "mu", ".", "Unlock", "(", ")", "\n", "namespace", ",", "err"...
// Delete a task
[ "Delete", "a", "task" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/task_list.go#L119-L130
130,288
containerd/containerd
mount/mountinfo_unsupported.go
PID
func PID(pid int) ([]Info, error) { return nil, fmt.Errorf("mountinfo.PID is not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) }
go
func PID(pid int) ([]Info, error) { return nil, fmt.Errorf("mountinfo.PID is not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) }
[ "func", "PID", "(", "pid", "int", ")", "(", "[", "]", "Info", ",", "error", ")", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "runtime", ".", "GOOS", ",", "runtime", ".", "GOARCH", ")", "\n", "}" ]
// PID collects the mounts for a specific process ID.
[ "PID", "collects", "the", "mounts", "for", "a", "specific", "process", "ID", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/mount/mountinfo_unsupported.go#L32-L34
130,289
containerd/containerd
archive/time_windows.go
chtimes
func chtimes(path string, atime, mtime time.Time) error { ctimespec := windows.NsecToTimespec(mtime.UnixNano()) pathp, e := windows.UTF16PtrFromString(path) if e != nil { return e } h, e := windows.CreateFile(pathp, windows.FILE_WRITE_ATTRIBUTES, windows.FILE_SHARE_WRITE, nil, windows.OPEN_EXISTING, windows....
go
func chtimes(path string, atime, mtime time.Time) error { ctimespec := windows.NsecToTimespec(mtime.UnixNano()) pathp, e := windows.UTF16PtrFromString(path) if e != nil { return e } h, e := windows.CreateFile(pathp, windows.FILE_WRITE_ATTRIBUTES, windows.FILE_SHARE_WRITE, nil, windows.OPEN_EXISTING, windows....
[ "func", "chtimes", "(", "path", "string", ",", "atime", ",", "mtime", "time", ".", "Time", ")", "error", "{", "ctimespec", ":=", "windows", ".", "NsecToTimespec", "(", "mtime", ".", "UnixNano", "(", ")", ")", "\n", "pathp", ",", "e", ":=", "windows", ...
// chtimes will set the create time on a file using the given modtime. // This requires calling SetFileTime and explicitly including the create time.
[ "chtimes", "will", "set", "the", "create", "time", "on", "a", "file", "using", "the", "given", "modtime", ".", "This", "requires", "calling", "SetFileTime", "and", "explicitly", "including", "the", "create", "time", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/archive/time_windows.go#L27-L42
130,290
containerd/containerd
snapshots/btrfs/btrfs.go
NewSnapshotter
func NewSnapshotter(root string) (snapshots.Snapshotter, error) { // If directory does not exist, create it if _, err := os.Stat(root); err != nil { if !os.IsNotExist(err) { return nil, err } if err := os.Mkdir(root, 0755); err != nil { return nil, err } } mnt, err := mount.Lookup(root) if err != ni...
go
func NewSnapshotter(root string) (snapshots.Snapshotter, error) { // If directory does not exist, create it if _, err := os.Stat(root); err != nil { if !os.IsNotExist(err) { return nil, err } if err := os.Mkdir(root, 0755); err != nil { return nil, err } } mnt, err := mount.Lookup(root) if err != ni...
[ "func", "NewSnapshotter", "(", "root", "string", ")", "(", "snapshots", ".", "Snapshotter", ",", "error", ")", "{", "// If directory does not exist, create it", "if", "_", ",", "err", ":=", "os", ".", "Stat", "(", "root", ")", ";", "err", "!=", "nil", "{",...
// NewSnapshotter returns a Snapshotter using btrfs. Uses the provided // root directory for snapshots and stores the metadata in // a file in the provided root. // root needs to be a mount point of btrfs.
[ "NewSnapshotter", "returns", "a", "Snapshotter", "using", "btrfs", ".", "Uses", "the", "provided", "root", "directory", "for", "snapshots", "and", "stores", "the", "metadata", "in", "a", "file", "in", "the", "provided", "root", ".", "root", "needs", "to", "b...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/btrfs/btrfs.go#L64-L107
130,291
containerd/containerd
snapshots/btrfs/btrfs.go
Stat
func (b *snapshotter) Stat(ctx context.Context, key string) (snapshots.Info, error) { ctx, t, err := b.ms.TransactionContext(ctx, false) if err != nil { return snapshots.Info{}, err } defer t.Rollback() _, info, _, err := storage.GetInfo(ctx, key) if err != nil { return snapshots.Info{}, err } return info,...
go
func (b *snapshotter) Stat(ctx context.Context, key string) (snapshots.Info, error) { ctx, t, err := b.ms.TransactionContext(ctx, false) if err != nil { return snapshots.Info{}, err } defer t.Rollback() _, info, _, err := storage.GetInfo(ctx, key) if err != nil { return snapshots.Info{}, err } return info,...
[ "func", "(", "b", "*", "snapshotter", ")", "Stat", "(", "ctx", "context", ".", "Context", ",", "key", "string", ")", "(", "snapshots", ".", "Info", ",", "error", ")", "{", "ctx", ",", "t", ",", "err", ":=", "b", ".", "ms", ".", "TransactionContext"...
// Stat returns the info for an active or committed snapshot by name or // key. // // Should be used for parent resolution, existence checks and to discern // the kind of snapshot.
[ "Stat", "returns", "the", "info", "for", "an", "active", "or", "committed", "snapshot", "by", "name", "or", "key", ".", "Should", "be", "used", "for", "parent", "resolution", "existence", "checks", "and", "to", "discern", "the", "kind", "of", "snapshot", "...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/btrfs/btrfs.go#L114-L126
130,292
containerd/containerd
snapshots/btrfs/btrfs.go
Usage
func (b *snapshotter) Usage(ctx context.Context, key string) (snapshots.Usage, error) { return b.usage(ctx, key) }
go
func (b *snapshotter) Usage(ctx context.Context, key string) (snapshots.Usage, error) { return b.usage(ctx, key) }
[ "func", "(", "b", "*", "snapshotter", ")", "Usage", "(", "ctx", "context", ".", "Context", ",", "key", "string", ")", "(", "snapshots", ".", "Usage", ",", "error", ")", "{", "return", "b", ".", "usage", "(", "ctx", ",", "key", ")", "\n", "}" ]
// Usage retrieves the disk usage of the top-level snapshot.
[ "Usage", "retrieves", "the", "disk", "usage", "of", "the", "top", "-", "level", "snapshot", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/btrfs/btrfs.go#L148-L150
130,293
containerd/containerd
snapshots/btrfs/btrfs.go
Walk
func (b *snapshotter) Walk(ctx context.Context, fn func(context.Context, snapshots.Info) error) error { ctx, t, err := b.ms.TransactionContext(ctx, false) if err != nil { return err } defer t.Rollback() return storage.WalkInfo(ctx, fn) }
go
func (b *snapshotter) Walk(ctx context.Context, fn func(context.Context, snapshots.Info) error) error { ctx, t, err := b.ms.TransactionContext(ctx, false) if err != nil { return err } defer t.Rollback() return storage.WalkInfo(ctx, fn) }
[ "func", "(", "b", "*", "snapshotter", ")", "Walk", "(", "ctx", "context", ".", "Context", ",", "fn", "func", "(", "context", ".", "Context", ",", "snapshots", ".", "Info", ")", "error", ")", "error", "{", "ctx", ",", "t", ",", "err", ":=", "b", "...
// Walk the committed snapshots.
[ "Walk", "the", "committed", "snapshots", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/btrfs/btrfs.go#L189-L196
130,294
containerd/containerd
snapshots/overlay/overlay.go
NewSnapshotter
func NewSnapshotter(root string, opts ...Opt) (snapshots.Snapshotter, error) { var config SnapshotterConfig for _, opt := range opts { if err := opt(&config); err != nil { return nil, err } } if err := os.MkdirAll(root, 0700); err != nil { return nil, err } supportsDType, err := fs.SupportsDType(root) ...
go
func NewSnapshotter(root string, opts ...Opt) (snapshots.Snapshotter, error) { var config SnapshotterConfig for _, opt := range opts { if err := opt(&config); err != nil { return nil, err } } if err := os.MkdirAll(root, 0700); err != nil { return nil, err } supportsDType, err := fs.SupportsDType(root) ...
[ "func", "NewSnapshotter", "(", "root", "string", ",", "opts", "...", "Opt", ")", "(", "snapshots", ".", "Snapshotter", ",", "error", ")", "{", "var", "config", "SnapshotterConfig", "\n", "for", "_", ",", "opt", ":=", "range", "opts", "{", "if", "err", ...
// NewSnapshotter returns a Snapshotter which uses overlayfs. The overlayfs // diffs are stored under the provided root. A metadata file is stored under // the root.
[ "NewSnapshotter", "returns", "a", "Snapshotter", "which", "uses", "overlayfs", ".", "The", "overlayfs", "diffs", "are", "stored", "under", "the", "provided", "root", ".", "A", "metadata", "file", "is", "stored", "under", "the", "root", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/overlay/overlay.go#L78-L110
130,295
containerd/containerd
snapshots/overlay/overlay.go
Remove
func (o *snapshotter) Remove(ctx context.Context, key string) (err error) { ctx, t, err := o.ms.TransactionContext(ctx, true) if err != nil { return err } defer func() { if err != nil { if rerr := t.Rollback(); rerr != nil { log.G(ctx).WithError(rerr).Warn("failed to rollback transaction") } } }() ...
go
func (o *snapshotter) Remove(ctx context.Context, key string) (err error) { ctx, t, err := o.ms.TransactionContext(ctx, true) if err != nil { return err } defer func() { if err != nil { if rerr := t.Rollback(); rerr != nil { log.G(ctx).WithError(rerr).Warn("failed to rollback transaction") } } }() ...
[ "func", "(", "o", "*", "snapshotter", ")", "Remove", "(", "ctx", "context", ".", "Context", ",", "key", "string", ")", "(", "err", "error", ")", "{", "ctx", ",", "t", ",", "err", ":=", "o", ".", "ms", ".", "TransactionContext", "(", "ctx", ",", "...
// Remove abandons the snapshot identified by key. The snapshot will // immediately become unavailable and unrecoverable. Disk space will // be freed up on the next call to `Cleanup`.
[ "Remove", "abandons", "the", "snapshot", "identified", "by", "key", ".", "The", "snapshot", "will", "immediately", "become", "unavailable", "and", "unrecoverable", ".", "Disk", "space", "will", "be", "freed", "up", "on", "the", "next", "call", "to", "Cleanup",...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/overlay/overlay.go#L242-L283
130,296
containerd/containerd
snapshots/overlay/overlay.go
Cleanup
func (o *snapshotter) Cleanup(ctx context.Context) error { cleanup, err := o.cleanupDirectories(ctx) if err != nil { return err } for _, dir := range cleanup { if err := os.RemoveAll(dir); err != nil { log.G(ctx).WithError(err).WithField("path", dir).Warn("failed to remove directory") } } return nil }
go
func (o *snapshotter) Cleanup(ctx context.Context) error { cleanup, err := o.cleanupDirectories(ctx) if err != nil { return err } for _, dir := range cleanup { if err := os.RemoveAll(dir); err != nil { log.G(ctx).WithError(err).WithField("path", dir).Warn("failed to remove directory") } } return nil }
[ "func", "(", "o", "*", "snapshotter", ")", "Cleanup", "(", "ctx", "context", ".", "Context", ")", "error", "{", "cleanup", ",", "err", ":=", "o", ".", "cleanupDirectories", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", ...
// Cleanup cleans up disk resources from removed or abandoned snapshots
[ "Cleanup", "cleans", "up", "disk", "resources", "from", "removed", "or", "abandoned", "snapshots" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/overlay/overlay.go#L296-L309
130,297
containerd/containerd
oci/spec_opts_windows.go
WithWindowsCPUCount
func WithWindowsCPUCount(count uint64) SpecOpts { return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error { if s.Windows.Resources == nil { s.Windows.Resources = &specs.WindowsResources{} } if s.Windows.Resources.CPU == nil { s.Windows.Resources.CPU = &specs.WindowsCPUResources{} ...
go
func WithWindowsCPUCount(count uint64) SpecOpts { return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error { if s.Windows.Resources == nil { s.Windows.Resources = &specs.WindowsResources{} } if s.Windows.Resources.CPU == nil { s.Windows.Resources.CPU = &specs.WindowsCPUResources{} ...
[ "func", "WithWindowsCPUCount", "(", "count", "uint64", ")", "SpecOpts", "{", "return", "func", "(", "_", "context", ".", "Context", ",", "_", "Client", ",", "_", "*", "containers", ".", "Container", ",", "s", "*", "Spec", ")", "error", "{", "if", "s", ...
// WithWindowsCPUCount sets the `Windows.Resources.CPU.Count` section to the // `count` specified.
[ "WithWindowsCPUCount", "sets", "the", "Windows", ".", "Resources", ".", "CPU", ".", "Count", "section", "to", "the", "count", "specified", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/oci/spec_opts_windows.go#L30-L41
130,298
containerd/containerd
oci/spec_opts_windows.go
WithWindowsIgnoreFlushesDuringBoot
func WithWindowsIgnoreFlushesDuringBoot() SpecOpts { return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error { if s.Windows == nil { s.Windows = &specs.Windows{} } s.Windows.IgnoreFlushesDuringBoot = true return nil } }
go
func WithWindowsIgnoreFlushesDuringBoot() SpecOpts { return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error { if s.Windows == nil { s.Windows = &specs.Windows{} } s.Windows.IgnoreFlushesDuringBoot = true return nil } }
[ "func", "WithWindowsIgnoreFlushesDuringBoot", "(", ")", "SpecOpts", "{", "return", "func", "(", "_", "context", ".", "Context", ",", "_", "Client", ",", "_", "*", "containers", ".", "Container", ",", "s", "*", "Spec", ")", "error", "{", "if", "s", ".", ...
// WithWindowsIgnoreFlushesDuringBoot sets `Windows.IgnoreFlushesDuringBoot`.
[ "WithWindowsIgnoreFlushesDuringBoot", "sets", "Windows", ".", "IgnoreFlushesDuringBoot", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/oci/spec_opts_windows.go#L44-L52
130,299
containerd/containerd
oci/spec_opts_windows.go
WithWindowNetworksAllowUnqualifiedDNSQuery
func WithWindowNetworksAllowUnqualifiedDNSQuery() SpecOpts { return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error { if s.Windows == nil { s.Windows = &specs.Windows{} } if s.Windows.Network == nil { s.Windows.Network = &specs.WindowsNetwork{} } s.Windows.Network.AllowUnqual...
go
func WithWindowNetworksAllowUnqualifiedDNSQuery() SpecOpts { return func(_ context.Context, _ Client, _ *containers.Container, s *Spec) error { if s.Windows == nil { s.Windows = &specs.Windows{} } if s.Windows.Network == nil { s.Windows.Network = &specs.WindowsNetwork{} } s.Windows.Network.AllowUnqual...
[ "func", "WithWindowNetworksAllowUnqualifiedDNSQuery", "(", ")", "SpecOpts", "{", "return", "func", "(", "_", "context", ".", "Context", ",", "_", "Client", ",", "_", "*", "containers", ".", "Container", ",", "s", "*", "Spec", ")", "error", "{", "if", "s", ...
// WithWindowNetworksAllowUnqualifiedDNSQuery sets `Windows.IgnoreFlushesDuringBoot`.
[ "WithWindowNetworksAllowUnqualifiedDNSQuery", "sets", "Windows", ".", "IgnoreFlushesDuringBoot", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/oci/spec_opts_windows.go#L55-L67