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,000
containerd/containerd
images/oci/exporter.go
Export
func (oe *V1Exporter) Export(ctx context.Context, store content.Provider, desc ocispec.Descriptor, writer io.Writer) error { tw := tar.NewWriter(writer) defer tw.Close() records := []tarRecord{ ociLayoutFile(""), ociIndexRecord(desc), } algorithms := map[string]struct{}{} exportHandler := func(ctx context.C...
go
func (oe *V1Exporter) Export(ctx context.Context, store content.Provider, desc ocispec.Descriptor, writer io.Writer) error { tw := tar.NewWriter(writer) defer tw.Close() records := []tarRecord{ ociLayoutFile(""), ociIndexRecord(desc), } algorithms := map[string]struct{}{} exportHandler := func(ctx context.C...
[ "func", "(", "oe", "*", "V1Exporter", ")", "Export", "(", "ctx", "context", ".", "Context", ",", "store", "content", ".", "Provider", ",", "desc", "ocispec", ".", "Descriptor", ",", "writer", "io", ".", "Writer", ")", "error", "{", "tw", ":=", "tar", ...
// Export implements Exporter.
[ "Export", "implements", "Exporter", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/images/oci/exporter.go#L74-L116
130,001
containerd/containerd
runtime/v2/runc/v2/service.go
New
func New(ctx context.Context, id string, publisher shim.Publisher, shutdown func()) (shim.Shim, error) { ep, err := runc.NewOOMEpoller(publisher) if err != nil { return nil, err } go ep.Run(ctx) s := &service{ id: id, context: ctx, events: make(chan interface{}, 128), ec: shim.Defa...
go
func New(ctx context.Context, id string, publisher shim.Publisher, shutdown func()) (shim.Shim, error) { ep, err := runc.NewOOMEpoller(publisher) if err != nil { return nil, err } go ep.Run(ctx) s := &service{ id: id, context: ctx, events: make(chan interface{}, 128), ec: shim.Defa...
[ "func", "New", "(", "ctx", "context", ".", "Context", ",", "id", "string", ",", "publisher", "shim", ".", "Publisher", ",", "shutdown", "func", "(", ")", ")", "(", "shim", ".", "Shim", ",", "error", ")", "{", "ep", ",", "err", ":=", "runc", ".", ...
// New returns a new shim service that can be used via GRPC
[ "New", "returns", "a", "new", "shim", "service", "that", "can", "be", "used", "via", "GRPC" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/v2/service.go#L73-L96
130,002
containerd/containerd
leases/context.go
WithLease
func WithLease(ctx context.Context, lid string) context.Context { ctx = context.WithValue(ctx, leaseKey{}, lid) // also store on the grpc headers so it gets picked up by any clients that // are using this. return withGRPCLeaseHeader(ctx, lid) }
go
func WithLease(ctx context.Context, lid string) context.Context { ctx = context.WithValue(ctx, leaseKey{}, lid) // also store on the grpc headers so it gets picked up by any clients that // are using this. return withGRPCLeaseHeader(ctx, lid) }
[ "func", "WithLease", "(", "ctx", "context", ".", "Context", ",", "lid", "string", ")", "context", ".", "Context", "{", "ctx", "=", "context", ".", "WithValue", "(", "ctx", ",", "leaseKey", "{", "}", ",", "lid", ")", "\n\n", "// also store on the grpc heade...
// WithLease sets a given lease on the context
[ "WithLease", "sets", "a", "given", "lease", "on", "the", "context" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/leases/context.go#L24-L30
130,003
containerd/containerd
leases/context.go
FromContext
func FromContext(ctx context.Context) (string, bool) { lid, ok := ctx.Value(leaseKey{}).(string) if !ok { return fromGRPCHeader(ctx) } return lid, ok }
go
func FromContext(ctx context.Context) (string, bool) { lid, ok := ctx.Value(leaseKey{}).(string) if !ok { return fromGRPCHeader(ctx) } return lid, ok }
[ "func", "FromContext", "(", "ctx", "context", ".", "Context", ")", "(", "string", ",", "bool", ")", "{", "lid", ",", "ok", ":=", "ctx", ".", "Value", "(", "leaseKey", "{", "}", ")", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", ...
// FromContext returns the lease from the context.
[ "FromContext", "returns", "the", "lease", "from", "the", "context", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/leases/context.go#L33-L40
130,004
containerd/containerd
remotes/docker/fetcher.go
getV2URLPaths
func (r *dockerFetcher) getV2URLPaths(ctx context.Context, desc ocispec.Descriptor) ([]string, error) { var urls []string if len(desc.URLs) > 0 { // handle fetch via external urls. for _, u := range desc.URLs { log.G(ctx).WithField("url", u).Debug("adding alternative url") urls = append(urls, u) } } s...
go
func (r *dockerFetcher) getV2URLPaths(ctx context.Context, desc ocispec.Descriptor) ([]string, error) { var urls []string if len(desc.URLs) > 0 { // handle fetch via external urls. for _, u := range desc.URLs { log.G(ctx).WithField("url", u).Debug("adding alternative url") urls = append(urls, u) } } s...
[ "func", "(", "r", "*", "dockerFetcher", ")", "getV2URLPaths", "(", "ctx", "context", ".", "Context", ",", "desc", "ocispec", ".", "Descriptor", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "urls", "[", "]", "string", "\n\n", "if", "le...
// getV2URLPaths generates the candidate urls paths for the object based on the // set of hints and the provided object id. URLs are returned in the order of // most to least likely succeed.
[ "getV2URLPaths", "generates", "the", "candidate", "urls", "paths", "for", "the", "object", "based", "on", "the", "set", "of", "hints", "and", "the", "provided", "object", "id", ".", "URLs", "are", "returned", "in", "the", "order", "of", "most", "to", "leas...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/docker/fetcher.go#L148-L170
130,005
containerd/containerd
archive/tar_opts.go
WithFilter
func WithFilter(f Filter) ApplyOpt { return func(options *ApplyOptions) error { options.Filter = f return nil } }
go
func WithFilter(f Filter) ApplyOpt { return func(options *ApplyOptions) error { options.Filter = f return nil } }
[ "func", "WithFilter", "(", "f", "Filter", ")", "ApplyOpt", "{", "return", "func", "(", "options", "*", "ApplyOptions", ")", "error", "{", "options", ".", "Filter", "=", "f", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithFilter uses the filter to select which files are to be extracted.
[ "WithFilter", "uses", "the", "filter", "to", "select", "which", "files", "are", "to", "be", "extracted", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/archive/tar_opts.go#L33-L38
130,006
containerd/containerd
cmd/containerd-stress/main.go
cleanup
func cleanup(ctx context.Context, client *containerd.Client) error { containers, err := client.Containers(ctx) if err != nil { return err } for _, c := range containers { task, err := c.Task(ctx, nil) if err == nil { task.Delete(ctx, containerd.WithProcessKill) } if err := c.Delete(ctx, containerd.With...
go
func cleanup(ctx context.Context, client *containerd.Client) error { containers, err := client.Containers(ctx) if err != nil { return err } for _, c := range containers { task, err := c.Task(ctx, nil) if err == nil { task.Delete(ctx, containerd.WithProcessKill) } if err := c.Delete(ctx, containerd.With...
[ "func", "cleanup", "(", "ctx", "context", ".", "Context", ",", "client", "*", "containerd", ".", "Client", ")", "error", "{", "containers", ",", "err", ":=", "client", ".", "Containers", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", ...
// cleanup cleans up any containers in the "stress" namespace before the test run
[ "cleanup", "cleans", "up", "any", "containers", "in", "the", "stress", "namespace", "before", "the", "test", "run" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cmd/containerd-stress/main.go#L305-L323
130,007
containerd/containerd
content/local/writer.go
Write
func (w *writer) Write(p []byte) (n int, err error) { n, err = w.fp.Write(p) w.digester.Hash().Write(p[:n]) w.offset += int64(len(p)) w.updatedAt = time.Now() return n, err }
go
func (w *writer) Write(p []byte) (n int, err error) { n, err = w.fp.Write(p) w.digester.Hash().Write(p[:n]) w.offset += int64(len(p)) w.updatedAt = time.Now() return n, err }
[ "func", "(", "w", "*", "writer", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "n", ",", "err", "=", "w", ".", "fp", ".", "Write", "(", "p", ")", "\n", "w", ".", "digester", ".", "Hash", "(...
// Write p to the transaction. // // Note that writes are unbuffered to the backing file. When writing, it is // recommended to wrap in a bufio.Writer or, preferably, use io.CopyBuffer.
[ "Write", "p", "to", "the", "transaction", ".", "Note", "that", "writes", "are", "unbuffered", "to", "the", "backing", "file", ".", "When", "writing", "it", "is", "recommended", "to", "wrap", "in", "a", "bufio", ".", "Writer", "or", "preferably", "use", "...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/writer.go#L68-L74
130,008
containerd/containerd
content/local/writer.go
Close
func (w *writer) Close() (err error) { if w.fp != nil { w.fp.Sync() err = w.fp.Close() writeTimestampFile(filepath.Join(w.path, "updatedat"), w.updatedAt) w.fp = nil unlock(w.ref) return } return nil }
go
func (w *writer) Close() (err error) { if w.fp != nil { w.fp.Sync() err = w.fp.Close() writeTimestampFile(filepath.Join(w.path, "updatedat"), w.updatedAt) w.fp = nil unlock(w.ref) return } return nil }
[ "func", "(", "w", "*", "writer", ")", "Close", "(", ")", "(", "err", "error", ")", "{", "if", "w", ".", "fp", "!=", "nil", "{", "w", ".", "fp", ".", "Sync", "(", ")", "\n", "err", "=", "w", ".", "fp", ".", "Close", "(", ")", "\n", "writeT...
// Close the writer, flushing any unwritten data and leaving the progress in // tact. // // If one needs to resume the transaction, a new writer can be obtained from // `Ingester.Writer` using the same key. The write can then be continued // from it was left off. // // To abandon a transaction completely, first call cl...
[ "Close", "the", "writer", "flushing", "any", "unwritten", "data", "and", "leaving", "the", "progress", "in", "tact", ".", "If", "one", "needs", "to", "resume", "the", "transaction", "a", "new", "writer", "can", "be", "obtained", "from", "Ingester", ".", "W...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/local/writer.go#L184-L195
130,009
containerd/containerd
metadata/snapshot.go
newSnapshotter
func newSnapshotter(db *DB, name string, sn snapshots.Snapshotter) *snapshotter { return &snapshotter{ Snapshotter: sn, name: name, db: db, } }
go
func newSnapshotter(db *DB, name string, sn snapshots.Snapshotter) *snapshotter { return &snapshotter{ Snapshotter: sn, name: name, db: db, } }
[ "func", "newSnapshotter", "(", "db", "*", "DB", ",", "name", "string", ",", "sn", "snapshots", ".", "Snapshotter", ")", "*", "snapshotter", "{", "return", "&", "snapshotter", "{", "Snapshotter", ":", "sn", ",", "name", ":", "name", ",", "db", ":", "db"...
// newSnapshotter returns a new Snapshotter which namespaces the given snapshot // using the provided name and database.
[ "newSnapshotter", "returns", "a", "new", "Snapshotter", "which", "namespaces", "the", "given", "snapshot", "using", "the", "provided", "name", "and", "database", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/metadata/snapshot.go#L46-L52
130,010
containerd/containerd
runtime/v2/manager.go
New
func New(ctx context.Context, root, state, containerdAddress string, events *exchange.Exchange, db *metadata.DB) (*TaskManager, error) { for _, d := range []string{root, state} { if err := os.MkdirAll(d, 0711); err != nil { return nil, err } } m := &TaskManager{ root: root, state: ...
go
func New(ctx context.Context, root, state, containerdAddress string, events *exchange.Exchange, db *metadata.DB) (*TaskManager, error) { for _, d := range []string{root, state} { if err := os.MkdirAll(d, 0711); err != nil { return nil, err } } m := &TaskManager{ root: root, state: ...
[ "func", "New", "(", "ctx", "context", ".", "Context", ",", "root", ",", "state", ",", "containerdAddress", "string", ",", "events", "*", "exchange", ".", "Exchange", ",", "db", "*", "metadata", ".", "DB", ")", "(", "*", "TaskManager", ",", "error", ")"...
// New task manager for v2 shims
[ "New", "task", "manager", "for", "v2", "shims" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/manager.go#L78-L96
130,011
containerd/containerd
runtime/v2/manager.go
Get
func (m *TaskManager) Get(ctx context.Context, id string) (runtime.Task, error) { return m.tasks.Get(ctx, id) }
go
func (m *TaskManager) Get(ctx context.Context, id string) (runtime.Task, error) { return m.tasks.Get(ctx, id) }
[ "func", "(", "m", "*", "TaskManager", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "runtime", ".", "Task", ",", "error", ")", "{", "return", "m", ".", "tasks", ".", "Get", "(", "ctx", ",", "id", ")", "\n", "...
// Get a specific task
[ "Get", "a", "specific", "task" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/manager.go#L145-L147
130,012
containerd/containerd
runtime/v2/manager.go
Tasks
func (m *TaskManager) Tasks(ctx context.Context, all bool) ([]runtime.Task, error) { return m.tasks.GetAll(ctx, all) }
go
func (m *TaskManager) Tasks(ctx context.Context, all bool) ([]runtime.Task, error) { return m.tasks.GetAll(ctx, all) }
[ "func", "(", "m", "*", "TaskManager", ")", "Tasks", "(", "ctx", "context", ".", "Context", ",", "all", "bool", ")", "(", "[", "]", "runtime", ".", "Task", ",", "error", ")", "{", "return", "m", ".", "tasks", ".", "GetAll", "(", "ctx", ",", "all",...
// Tasks lists all tasks
[ "Tasks", "lists", "all", "tasks" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/manager.go#L160-L162
130,013
containerd/containerd
sys/filesys_windows.go
MkdirAll
func MkdirAll(path string, _ os.FileMode) error { return mkdirall(path, false) }
go
func MkdirAll(path string, _ os.FileMode) error { return mkdirall(path, false) }
[ "func", "MkdirAll", "(", "path", "string", ",", "_", "os", ".", "FileMode", ")", "error", "{", "return", "mkdirall", "(", "path", ",", "false", ")", "\n", "}" ]
// MkdirAll implementation that is volume path aware for Windows.
[ "MkdirAll", "implementation", "that", "is", "volume", "path", "aware", "for", "Windows", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/sys/filesys_windows.go#L45-L47
130,014
containerd/containerd
sys/filesys_windows.go
ForceRemoveAll
func ForceRemoveAll(path string) error { info := hcsshim.DriverInfo{ HomeDir: filepath.Dir(path), } return hcsshim.DestroyLayer(info, filepath.Base(path)) }
go
func ForceRemoveAll(path string) error { info := hcsshim.DriverInfo{ HomeDir: filepath.Dir(path), } return hcsshim.DestroyLayer(info, filepath.Base(path)) }
[ "func", "ForceRemoveAll", "(", "path", "string", ")", "error", "{", "info", ":=", "hcsshim", ".", "DriverInfo", "{", "HomeDir", ":", "filepath", ".", "Dir", "(", "path", ")", ",", "}", "\n\n", "return", "hcsshim", ".", "DestroyLayer", "(", "info", ",", ...
// ForceRemoveAll is the same as os.RemoveAll, but uses hcsshim.DestroyLayer in order // to delete container layers.
[ "ForceRemoveAll", "is", "the", "same", "as", "os", ".", "RemoveAll", "but", "uses", "hcsshim", ".", "DestroyLayer", "in", "order", "to", "delete", "container", "layers", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/sys/filesys_windows.go#L261-L267
130,015
containerd/containerd
runtime/v2/process.go
Wait
func (p *process) Wait(ctx context.Context) (*runtime.Exit, error) { response, err := p.shim.task.Wait(ctx, &task.WaitRequest{ ID: p.shim.ID(), ExecID: p.id, }) if err != nil { return nil, errdefs.FromGRPC(err) } return &runtime.Exit{ Timestamp: response.ExitedAt, Status: response.ExitStatus, }, ...
go
func (p *process) Wait(ctx context.Context) (*runtime.Exit, error) { response, err := p.shim.task.Wait(ctx, &task.WaitRequest{ ID: p.shim.ID(), ExecID: p.id, }) if err != nil { return nil, errdefs.FromGRPC(err) } return &runtime.Exit{ Timestamp: response.ExitedAt, Status: response.ExitStatus, }, ...
[ "func", "(", "p", "*", "process", ")", "Wait", "(", "ctx", "context", ".", "Context", ")", "(", "*", "runtime", ".", "Exit", ",", "error", ")", "{", "response", ",", "err", ":=", "p", ".", "shim", ".", "task", ".", "Wait", "(", "ctx", ",", "&",...
// Wait on the process to exit and return the exit status and timestamp
[ "Wait", "on", "the", "process", "to", "exit", "and", "return", "the", "exit", "status", "and", "timestamp" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/process.go#L127-L139
130,016
containerd/containerd
windows/runtime.go
New
func New(ic *plugin.InitContext) (interface{}, error) { ic.Meta.Platforms = []imagespec.Platform{platforms.DefaultSpec()} if err := os.MkdirAll(ic.Root, 0700); err != nil { return nil, errors.Wrapf(err, "could not create state directory at %s", ic.Root) } r := &windowsRuntime{ root: ic.Root, pidPool: newP...
go
func New(ic *plugin.InitContext) (interface{}, error) { ic.Meta.Platforms = []imagespec.Platform{platforms.DefaultSpec()} if err := os.MkdirAll(ic.Root, 0700); err != nil { return nil, errors.Wrapf(err, "could not create state directory at %s", ic.Root) } r := &windowsRuntime{ root: ic.Root, pidPool: newP...
[ "func", "New", "(", "ic", "*", "plugin", ".", "InitContext", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "ic", ".", "Meta", ".", "Platforms", "=", "[", "]", "imagespec", ".", "Platform", "{", "platforms", ".", "DefaultSpec", "(", ")", ...
// New returns a new Windows runtime
[ "New", "returns", "a", "new", "Windows", "runtime" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/windows/runtime.go#L70-L90
130,017
containerd/containerd
diff/diff.go
WithMediaType
func WithMediaType(m string) Opt { return func(c *Config) error { c.MediaType = m return nil } }
go
func WithMediaType(m string) Opt { return func(c *Config) error { c.MediaType = m return nil } }
[ "func", "WithMediaType", "(", "m", "string", ")", "Opt", "{", "return", "func", "(", "c", "*", "Config", ")", "error", "{", "c", ".", "MediaType", "=", "m", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithMediaType sets the media type to use for creating the diff, without // specifying the differ will choose a default.
[ "WithMediaType", "sets", "the", "media", "type", "to", "use", "for", "creating", "the", "diff", "without", "specifying", "the", "differ", "will", "choose", "a", "default", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/diff/diff.go#L66-L71
130,018
containerd/containerd
diff/diff.go
WithReference
func WithReference(ref string) Opt { return func(c *Config) error { c.Reference = ref return nil } }
go
func WithReference(ref string) Opt { return func(c *Config) error { c.Reference = ref return nil } }
[ "func", "WithReference", "(", "ref", "string", ")", "Opt", "{", "return", "func", "(", "c", "*", "Config", ")", "error", "{", "c", ".", "Reference", "=", "ref", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithReference is used to set the content upload reference used by // the diff operation. This allows the caller to track the upload through // the content store.
[ "WithReference", "is", "used", "to", "set", "the", "content", "upload", "reference", "used", "by", "the", "diff", "operation", ".", "This", "allows", "the", "caller", "to", "track", "the", "upload", "through", "the", "content", "store", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/diff/diff.go#L76-L81
130,019
containerd/containerd
diff/diff.go
WithLabels
func WithLabels(labels map[string]string) Opt { return func(c *Config) error { c.Labels = labels return nil } }
go
func WithLabels(labels map[string]string) Opt { return func(c *Config) error { c.Labels = labels return nil } }
[ "func", "WithLabels", "(", "labels", "map", "[", "string", "]", "string", ")", "Opt", "{", "return", "func", "(", "c", "*", "Config", ")", "error", "{", "c", ".", "Labels", "=", "labels", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithLabels is used to set content labels on the created diff content.
[ "WithLabels", "is", "used", "to", "set", "content", "labels", "on", "the", "created", "diff", "content", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/diff/diff.go#L84-L89
130,020
containerd/containerd
plugin/context.go
NewContext
func NewContext(ctx context.Context, r *Registration, plugins *Set, root, state string) *InitContext { return &InitContext{ Context: ctx, Root: filepath.Join(root, r.URI()), State: filepath.Join(state, r.URI()), Meta: &Meta{ Exports: map[string]string{}, }, plugins: plugins, } }
go
func NewContext(ctx context.Context, r *Registration, plugins *Set, root, state string) *InitContext { return &InitContext{ Context: ctx, Root: filepath.Join(root, r.URI()), State: filepath.Join(state, r.URI()), Meta: &Meta{ Exports: map[string]string{}, }, plugins: plugins, } }
[ "func", "NewContext", "(", "ctx", "context", ".", "Context", ",", "r", "*", "Registration", ",", "plugins", "*", "Set", ",", "root", ",", "state", "string", ")", "*", "InitContext", "{", "return", "&", "InitContext", "{", "Context", ":", "ctx", ",", "R...
// NewContext returns a new plugin InitContext
[ "NewContext", "returns", "a", "new", "plugin", "InitContext" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/plugin/context.go#L44-L54
130,021
containerd/containerd
plugin/context.go
Add
func (ps *Set) Add(p *Plugin) error { if byID, typeok := ps.byTypeAndID[p.Registration.Type]; !typeok { ps.byTypeAndID[p.Registration.Type] = map[string]*Plugin{ p.Registration.ID: p, } } else if _, idok := byID[p.Registration.ID]; !idok { byID[p.Registration.ID] = p } else { return errors.Wrapf(errdefs.E...
go
func (ps *Set) Add(p *Plugin) error { if byID, typeok := ps.byTypeAndID[p.Registration.Type]; !typeok { ps.byTypeAndID[p.Registration.Type] = map[string]*Plugin{ p.Registration.ID: p, } } else if _, idok := byID[p.Registration.ID]; !idok { byID[p.Registration.ID] = p } else { return errors.Wrapf(errdefs.E...
[ "func", "(", "ps", "*", "Set", ")", "Add", "(", "p", "*", "Plugin", ")", "error", "{", "if", "byID", ",", "typeok", ":=", "ps", ".", "byTypeAndID", "[", "p", ".", "Registration", ".", "Type", "]", ";", "!", "typeok", "{", "ps", ".", "byTypeAndID"...
// Add a plugin to the set
[ "Add", "a", "plugin", "to", "the", "set" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/plugin/context.go#L109-L122
130,022
containerd/containerd
plugin/context.go
GetByType
func (i *InitContext) GetByType(t Type) (map[string]*Plugin, error) { p, ok := i.plugins.byTypeAndID[t] if !ok { return nil, errors.Wrapf(errdefs.ErrNotFound, "no plugins registered for %s", t) } return p, nil }
go
func (i *InitContext) GetByType(t Type) (map[string]*Plugin, error) { p, ok := i.plugins.byTypeAndID[t] if !ok { return nil, errors.Wrapf(errdefs.ErrNotFound, "no plugins registered for %s", t) } return p, nil }
[ "func", "(", "i", "*", "InitContext", ")", "GetByType", "(", "t", "Type", ")", "(", "map", "[", "string", "]", "*", "Plugin", ",", "error", ")", "{", "p", ",", "ok", ":=", "i", ".", "plugins", ".", "byTypeAndID", "[", "t", "]", "\n", "if", "!",...
// GetByType returns all plugins with the specific type.
[ "GetByType", "returns", "all", "plugins", "with", "the", "specific", "type", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/plugin/context.go#L138-L145
130,023
containerd/containerd
runtime/v2/shim/util_windows.go
SocketAddress
func SocketAddress(ctx context.Context, id string) (string, error) { ns, err := namespaces.NamespaceRequired(ctx) if err != nil { return "", err } return fmt.Sprintf("\\\\.\\pipe\\containerd-shim-%s-%s-pipe", ns, id), nil }
go
func SocketAddress(ctx context.Context, id string) (string, error) { ns, err := namespaces.NamespaceRequired(ctx) if err != nil { return "", err } return fmt.Sprintf("\\\\.\\pipe\\containerd-shim-%s-%s-pipe", ns, id), nil }
[ "func", "SocketAddress", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "string", ",", "error", ")", "{", "ns", ",", "err", ":=", "namespaces", ".", "NamespaceRequired", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "re...
// SocketAddress returns a npipe address
[ "SocketAddress", "returns", "a", "npipe", "address" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/shim/util_windows.go#L44-L50
130,024
containerd/containerd
runtime/v2/shim/util_windows.go
NewSocket
func NewSocket(address string) (net.Listener, error) { l, err := winio.ListenPipe(address, nil) if err != nil { return nil, errors.Wrapf(err, "failed to listen to npipe %s", address) } return l, nil }
go
func NewSocket(address string) (net.Listener, error) { l, err := winio.ListenPipe(address, nil) if err != nil { return nil, errors.Wrapf(err, "failed to listen to npipe %s", address) } return l, nil }
[ "func", "NewSocket", "(", "address", "string", ")", "(", "net", ".", "Listener", ",", "error", ")", "{", "l", ",", "err", ":=", "winio", ".", "ListenPipe", "(", "address", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", ...
// NewSocket returns a new npipe listener
[ "NewSocket", "returns", "a", "new", "npipe", "listener" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/shim/util_windows.go#L86-L92
130,025
containerd/containerd
content/proxy/content_writer.go
send
func (rw *remoteWriter) send(req *contentapi.WriteContentRequest) (*contentapi.WriteContentResponse, error) { if err := rw.client.Send(req); err != nil { return nil, err } resp, err := rw.client.Recv() if err == nil { // try to keep these in sync if resp.Digest != "" { rw.digest = resp.Digest } } re...
go
func (rw *remoteWriter) send(req *contentapi.WriteContentRequest) (*contentapi.WriteContentResponse, error) { if err := rw.client.Send(req); err != nil { return nil, err } resp, err := rw.client.Recv() if err == nil { // try to keep these in sync if resp.Digest != "" { rw.digest = resp.Digest } } re...
[ "func", "(", "rw", "*", "remoteWriter", ")", "send", "(", "req", "*", "contentapi", ".", "WriteContentRequest", ")", "(", "*", "contentapi", ".", "WriteContentResponse", ",", "error", ")", "{", "if", "err", ":=", "rw", ".", "client", ".", "Send", "(", ...
// send performs a synchronous req-resp cycle on the client.
[ "send", "performs", "a", "synchronous", "req", "-", "resp", "cycle", "on", "the", "client", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/proxy/content_writer.go#L38-L53
130,026
containerd/containerd
services/server/server.go
CreateTopLevelDirectories
func CreateTopLevelDirectories(config *srvconfig.Config) error { switch { case config.Root == "": return errors.New("root must be specified") case config.State == "": return errors.New("state must be specified") case config.Root == config.State: return errors.New("root and state must be different paths") } ...
go
func CreateTopLevelDirectories(config *srvconfig.Config) error { switch { case config.Root == "": return errors.New("root must be specified") case config.State == "": return errors.New("state must be specified") case config.Root == config.State: return errors.New("root and state must be different paths") } ...
[ "func", "CreateTopLevelDirectories", "(", "config", "*", "srvconfig", ".", "Config", ")", "error", "{", "switch", "{", "case", "config", ".", "Root", "==", "\"", "\"", ":", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "case", "config", "...
// CreateTopLevelDirectories creates the top-level root and state directories.
[ "CreateTopLevelDirectories", "creates", "the", "top", "-", "level", "root", "and", "state", "directories", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/server/server.go#L57-L74
130,027
containerd/containerd
services/server/server.go
ServeGRPC
func (s *Server) ServeGRPC(l net.Listener) error { if s.config.Metrics.GRPCHistogram { // enable grpc time histograms to measure rpc latencies grpc_prometheus.EnableHandlingTimeHistogram() } // before we start serving the grpc API register the grpc_prometheus metrics // handler. This needs to be the last servi...
go
func (s *Server) ServeGRPC(l net.Listener) error { if s.config.Metrics.GRPCHistogram { // enable grpc time histograms to measure rpc latencies grpc_prometheus.EnableHandlingTimeHistogram() } // before we start serving the grpc API register the grpc_prometheus metrics // handler. This needs to be the last servi...
[ "func", "(", "s", "*", "Server", ")", "ServeGRPC", "(", "l", "net", ".", "Listener", ")", "error", "{", "if", "s", ".", "config", ".", "Metrics", ".", "GRPCHistogram", "{", "// enable grpc time histograms to measure rpc latencies", "grpc_prometheus", ".", "Enabl...
// ServeGRPC provides the containerd grpc APIs on the provided listener
[ "ServeGRPC", "provides", "the", "containerd", "grpc", "APIs", "on", "the", "provided", "listener" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/server/server.go#L220-L230
130,028
containerd/containerd
services/server/server.go
ServeTTRPC
func (s *Server) ServeTTRPC(l net.Listener) error { return trapClosedConnErr(s.ttrpcServer.Serve(context.Background(), l)) }
go
func (s *Server) ServeTTRPC(l net.Listener) error { return trapClosedConnErr(s.ttrpcServer.Serve(context.Background(), l)) }
[ "func", "(", "s", "*", "Server", ")", "ServeTTRPC", "(", "l", "net", ".", "Listener", ")", "error", "{", "return", "trapClosedConnErr", "(", "s", ".", "ttrpcServer", ".", "Serve", "(", "context", ".", "Background", "(", ")", ",", "l", ")", ")", "\n",...
// ServeTTRPC provides the containerd ttrpc APIs on the provided listener
[ "ServeTTRPC", "provides", "the", "containerd", "ttrpc", "APIs", "on", "the", "provided", "listener" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/server/server.go#L233-L235
130,029
containerd/containerd
services/server/server.go
ServeMetrics
func (s *Server) ServeMetrics(l net.Listener) error { m := http.NewServeMux() m.Handle("/v1/metrics", metrics.Handler()) return trapClosedConnErr(http.Serve(l, m)) }
go
func (s *Server) ServeMetrics(l net.Listener) error { m := http.NewServeMux() m.Handle("/v1/metrics", metrics.Handler()) return trapClosedConnErr(http.Serve(l, m)) }
[ "func", "(", "s", "*", "Server", ")", "ServeMetrics", "(", "l", "net", ".", "Listener", ")", "error", "{", "m", ":=", "http", ".", "NewServeMux", "(", ")", "\n", "m", ".", "Handle", "(", "\"", "\"", ",", "metrics", ".", "Handler", "(", ")", ")", ...
// ServeMetrics provides a prometheus endpoint for exposing metrics
[ "ServeMetrics", "provides", "a", "prometheus", "endpoint", "for", "exposing", "metrics" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/server/server.go#L238-L242
130,030
containerd/containerd
services/server/server.go
ServeTCP
func (s *Server) ServeTCP(l net.Listener) error { grpc_prometheus.Register(s.tcpServer) return trapClosedConnErr(s.tcpServer.Serve(l)) }
go
func (s *Server) ServeTCP(l net.Listener) error { grpc_prometheus.Register(s.tcpServer) return trapClosedConnErr(s.tcpServer.Serve(l)) }
[ "func", "(", "s", "*", "Server", ")", "ServeTCP", "(", "l", "net", ".", "Listener", ")", "error", "{", "grpc_prometheus", ".", "Register", "(", "s", ".", "tcpServer", ")", "\n", "return", "trapClosedConnErr", "(", "s", ".", "tcpServer", ".", "Serve", "...
// ServeTCP allows services to serve over tcp
[ "ServeTCP", "allows", "services", "to", "serve", "over", "tcp" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/server/server.go#L245-L248
130,031
containerd/containerd
services/server/server.go
ServeDebug
func (s *Server) ServeDebug(l net.Listener) error { // don't use the default http server mux to make sure nothing gets registered // that we don't want to expose via containerd m := http.NewServeMux() m.Handle("/debug/vars", expvar.Handler()) m.Handle("/debug/pprof/", http.HandlerFunc(pprof.Index)) m.Handle("/deb...
go
func (s *Server) ServeDebug(l net.Listener) error { // don't use the default http server mux to make sure nothing gets registered // that we don't want to expose via containerd m := http.NewServeMux() m.Handle("/debug/vars", expvar.Handler()) m.Handle("/debug/pprof/", http.HandlerFunc(pprof.Index)) m.Handle("/deb...
[ "func", "(", "s", "*", "Server", ")", "ServeDebug", "(", "l", "net", ".", "Listener", ")", "error", "{", "// don't use the default http server mux to make sure nothing gets registered", "// that we don't want to expose via containerd", "m", ":=", "http", ".", "NewServeMux",...
// ServeDebug provides a debug endpoint
[ "ServeDebug", "provides", "a", "debug", "endpoint" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/server/server.go#L251-L262
130,032
containerd/containerd
services/server/server.go
Stop
func (s *Server) Stop() { s.grpcServer.Stop() for i := len(s.plugins) - 1; i >= 0; i-- { p := s.plugins[i] instance, err := p.Instance() if err != nil { log.L.WithError(err).WithField("id", p.Registration.ID). Errorf("could not get plugin instance") continue } closer, ok := instance.(io.Closer) ...
go
func (s *Server) Stop() { s.grpcServer.Stop() for i := len(s.plugins) - 1; i >= 0; i-- { p := s.plugins[i] instance, err := p.Instance() if err != nil { log.L.WithError(err).WithField("id", p.Registration.ID). Errorf("could not get plugin instance") continue } closer, ok := instance.(io.Closer) ...
[ "func", "(", "s", "*", "Server", ")", "Stop", "(", ")", "{", "s", ".", "grpcServer", ".", "Stop", "(", ")", "\n", "for", "i", ":=", "len", "(", "s", ".", "plugins", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "p", ":=", "s", ...
// Stop the containerd server canceling any open connections
[ "Stop", "the", "containerd", "server", "canceling", "any", "open", "connections" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/server/server.go#L265-L284
130,033
containerd/containerd
cmd/containerd-stress/size.go
checkBinarySizes
func checkBinarySizes() { for _, name := range binaries { fi, err := os.Stat(filepath.Join("/usr/local/bin", name)) if err != nil { logrus.WithError(err).Error("stat binary") continue } binarySizeGauge.WithValues(name).Set(float64(fi.Size())) } }
go
func checkBinarySizes() { for _, name := range binaries { fi, err := os.Stat(filepath.Join("/usr/local/bin", name)) if err != nil { logrus.WithError(err).Error("stat binary") continue } binarySizeGauge.WithValues(name).Set(float64(fi.Size())) } }
[ "func", "checkBinarySizes", "(", ")", "{", "for", "_", ",", "name", ":=", "range", "binaries", "{", "fi", ",", "err", ":=", "os", ".", "Stat", "(", "filepath", ".", "Join", "(", "\"", "\"", ",", "name", ")", ")", "\n", "if", "err", "!=", "nil", ...
// checkBinarySizes checks and reports the binary sizes for the containerd compiled binaries to prometheus
[ "checkBinarySizes", "checks", "and", "reports", "the", "binary", "sizes", "for", "the", "containerd", "compiled", "binaries", "to", "prometheus" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cmd/containerd-stress/size.go#L33-L42
130,034
containerd/containerd
sys/fds.go
GetOpenFds
func GetOpenFds(pid int) (int, error) { dirs, err := ioutil.ReadDir(filepath.Join("/proc", strconv.Itoa(pid), "fd")) if err != nil { return -1, err } return len(dirs), nil }
go
func GetOpenFds(pid int) (int, error) { dirs, err := ioutil.ReadDir(filepath.Join("/proc", strconv.Itoa(pid), "fd")) if err != nil { return -1, err } return len(dirs), nil }
[ "func", "GetOpenFds", "(", "pid", "int", ")", "(", "int", ",", "error", ")", "{", "dirs", ",", "err", ":=", "ioutil", ".", "ReadDir", "(", "filepath", ".", "Join", "(", "\"", "\"", ",", "strconv", ".", "Itoa", "(", "pid", ")", ",", "\"", "\"", ...
// GetOpenFds returns the number of open fds for the process provided by pid
[ "GetOpenFds", "returns", "the", "number", "of", "open", "fds", "for", "the", "process", "provided", "by", "pid" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/sys/fds.go#L28-L34
130,035
containerd/containerd
runtime/v2/bundle.go
LoadBundle
func LoadBundle(ctx context.Context, root, id string) (*Bundle, error) { ns, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } return &Bundle{ ID: id, Path: filepath.Join(root, ns, id), Namespace: ns, }, nil }
go
func LoadBundle(ctx context.Context, root, id string) (*Bundle, error) { ns, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } return &Bundle{ ID: id, Path: filepath.Join(root, ns, id), Namespace: ns, }, nil }
[ "func", "LoadBundle", "(", "ctx", "context", ".", "Context", ",", "root", ",", "id", "string", ")", "(", "*", "Bundle", ",", "error", ")", "{", "ns", ",", "err", ":=", "namespaces", ".", "NamespaceRequired", "(", "ctx", ")", "\n", "if", "err", "!=", ...
// LoadBundle loads an existing bundle from disk
[ "LoadBundle", "loads", "an", "existing", "bundle", "from", "disk" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/bundle.go#L34-L44
130,036
containerd/containerd
runtime/v2/bundle.go
NewBundle
func NewBundle(ctx context.Context, root, state, id string, spec []byte) (b *Bundle, err error) { if err := identifiers.Validate(id); err != nil { return nil, errors.Wrapf(err, "invalid task id %s", id) } ns, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } work := filepath.Join(roo...
go
func NewBundle(ctx context.Context, root, state, id string, spec []byte) (b *Bundle, err error) { if err := identifiers.Validate(id); err != nil { return nil, errors.Wrapf(err, "invalid task id %s", id) } ns, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } work := filepath.Join(roo...
[ "func", "NewBundle", "(", "ctx", "context", ".", "Context", ",", "root", ",", "state", ",", "id", "string", ",", "spec", "[", "]", "byte", ")", "(", "b", "*", "Bundle", ",", "err", "error", ")", "{", "if", "err", ":=", "identifiers", ".", "Validate...
// NewBundle returns a new bundle on disk
[ "NewBundle", "returns", "a", "new", "bundle", "on", "disk" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/bundle.go#L47-L103
130,037
containerd/containerd
runtime/v2/bundle.go
Delete
func (b *Bundle) Delete() error { work, werr := os.Readlink(filepath.Join(b.Path, "work")) err := atomicDelete(b.Path) if err == nil { if werr == nil { return atomicDelete(work) } return nil } // error removing the bundle path; still attempt removing work dir var err2 error if werr == nil { err2 = ato...
go
func (b *Bundle) Delete() error { work, werr := os.Readlink(filepath.Join(b.Path, "work")) err := atomicDelete(b.Path) if err == nil { if werr == nil { return atomicDelete(work) } return nil } // error removing the bundle path; still attempt removing work dir var err2 error if werr == nil { err2 = ato...
[ "func", "(", "b", "*", "Bundle", ")", "Delete", "(", ")", "error", "{", "work", ",", "werr", ":=", "os", ".", "Readlink", "(", "filepath", ".", "Join", "(", "b", ".", "Path", ",", "\"", "\"", ")", ")", "\n", "err", ":=", "atomicDelete", "(", "b...
// Delete a bundle atomically
[ "Delete", "a", "bundle", "atomically" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/bundle.go#L116-L134
130,038
containerd/containerd
runtime/v2/bundle.go
atomicDelete
func atomicDelete(path string) error { // create a hidden dir for an atomic removal atomicPath := filepath.Join(filepath.Dir(path), fmt.Sprintf(".%s", filepath.Base(path))) if err := os.Rename(path, atomicPath); err != nil { return err } return os.RemoveAll(atomicPath) }
go
func atomicDelete(path string) error { // create a hidden dir for an atomic removal atomicPath := filepath.Join(filepath.Dir(path), fmt.Sprintf(".%s", filepath.Base(path))) if err := os.Rename(path, atomicPath); err != nil { return err } return os.RemoveAll(atomicPath) }
[ "func", "atomicDelete", "(", "path", "string", ")", "error", "{", "// create a hidden dir for an atomic removal", "atomicPath", ":=", "filepath", ".", "Join", "(", "filepath", ".", "Dir", "(", "path", ")", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f...
// atomicDelete renames the path to a hidden file before removal
[ "atomicDelete", "renames", "the", "path", "to", "a", "hidden", "file", "before", "removal" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/bundle.go#L137-L144
130,039
containerd/containerd
client.go
New
func New(address string, opts ...ClientOpt) (*Client, error) { var copts clientOpts for _, o := range opts { if err := o(&copts); err != nil { return nil, err } } if copts.timeout == 0 { copts.timeout = 10 * time.Second } rt := fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtime.GOOS) if copts.defaultRun...
go
func New(address string, opts ...ClientOpt) (*Client, error) { var copts clientOpts for _, o := range opts { if err := o(&copts); err != nil { return nil, err } } if copts.timeout == 0 { copts.timeout = 10 * time.Second } rt := fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtime.GOOS) if copts.defaultRun...
[ "func", "New", "(", "address", "string", ",", "opts", "...", "ClientOpt", ")", "(", "*", "Client", ",", "error", ")", "{", "var", "copts", "clientOpts", "\n", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "err", ":=", "o", "(", "&", "co...
// New returns a new containerd client that is connected to the containerd // instance provided by address
[ "New", "returns", "a", "new", "containerd", "client", "that", "is", "connected", "to", "the", "containerd", "instance", "provided", "by", "address" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L79-L154
130,040
containerd/containerd
client.go
NewWithConn
func NewWithConn(conn *grpc.ClientConn, opts ...ClientOpt) (*Client, error) { var copts clientOpts for _, o := range opts { if err := o(&copts); err != nil { return nil, err } } c := &Client{ conn: conn, runtime: fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtime.GOOS), } // check namespace labels ...
go
func NewWithConn(conn *grpc.ClientConn, opts ...ClientOpt) (*Client, error) { var copts clientOpts for _, o := range opts { if err := o(&copts); err != nil { return nil, err } } c := &Client{ conn: conn, runtime: fmt.Sprintf("%s.%s", plugin.RuntimePlugin, runtime.GOOS), } // check namespace labels ...
[ "func", "NewWithConn", "(", "conn", "*", "grpc", ".", "ClientConn", ",", "opts", "...", "ClientOpt", ")", "(", "*", "Client", ",", "error", ")", "{", "var", "copts", "clientOpts", "\n", "for", "_", ",", "o", ":=", "range", "opts", "{", "if", "err", ...
// NewWithConn returns a new containerd client that is connected to the containerd // instance provided by the connection
[ "NewWithConn", "returns", "a", "new", "containerd", "client", "that", "is", "connected", "to", "the", "containerd", "instance", "provided", "by", "the", "connection" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L158-L187
130,041
containerd/containerd
client.go
Reconnect
func (c *Client) Reconnect() error { if c.connector == nil { return errors.New("unable to reconnect to containerd, no connector available") } c.connMu.Lock() defer c.connMu.Unlock() c.conn.Close() conn, err := c.connector() if err != nil { return err } c.conn = conn return nil }
go
func (c *Client) Reconnect() error { if c.connector == nil { return errors.New("unable to reconnect to containerd, no connector available") } c.connMu.Lock() defer c.connMu.Unlock() c.conn.Close() conn, err := c.connector() if err != nil { return err } c.conn = conn return nil }
[ "func", "(", "c", "*", "Client", ")", "Reconnect", "(", ")", "error", "{", "if", "c", ".", "connector", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", ...
// Reconnect re-establishes the GRPC connection to the containerd daemon
[ "Reconnect", "re", "-", "establishes", "the", "GRPC", "connection", "to", "the", "containerd", "daemon" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L200-L213
130,042
containerd/containerd
client.go
IsServing
func (c *Client) IsServing(ctx context.Context) (bool, error) { c.connMu.Lock() if c.conn == nil { c.connMu.Unlock() return false, errors.New("no grpc connection available") } c.connMu.Unlock() r, err := c.HealthService().Check(ctx, &grpc_health_v1.HealthCheckRequest{}, grpc.FailFast(false)) if err != nil { ...
go
func (c *Client) IsServing(ctx context.Context) (bool, error) { c.connMu.Lock() if c.conn == nil { c.connMu.Unlock() return false, errors.New("no grpc connection available") } c.connMu.Unlock() r, err := c.HealthService().Check(ctx, &grpc_health_v1.HealthCheckRequest{}, grpc.FailFast(false)) if err != nil { ...
[ "func", "(", "c", "*", "Client", ")", "IsServing", "(", "ctx", "context", ".", "Context", ")", "(", "bool", ",", "error", ")", "{", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", "if", "c", ".", "conn", "==", "nil", "{", "c", ".", "connMu", ...
// IsServing returns true if the client can successfully connect to the // containerd daemon and the healthcheck service returns the SERVING // response. // This call will block if a transient error is encountered during // connection. A timeout can be set in the context to ensure it returns // early.
[ "IsServing", "returns", "true", "if", "the", "client", "can", "successfully", "connect", "to", "the", "containerd", "daemon", "and", "the", "healthcheck", "service", "returns", "the", "SERVING", "response", ".", "This", "call", "will", "block", "if", "a", "tra...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L221-L233
130,043
containerd/containerd
client.go
Containers
func (c *Client) Containers(ctx context.Context, filters ...string) ([]Container, error) { r, err := c.ContainerService().List(ctx, filters...) if err != nil { return nil, err } var out []Container for _, container := range r { out = append(out, containerFromRecord(c, container)) } return out, nil }
go
func (c *Client) Containers(ctx context.Context, filters ...string) ([]Container, error) { r, err := c.ContainerService().List(ctx, filters...) if err != nil { return nil, err } var out []Container for _, container := range r { out = append(out, containerFromRecord(c, container)) } return out, nil }
[ "func", "(", "c", "*", "Client", ")", "Containers", "(", "ctx", "context", ".", "Context", ",", "filters", "...", "string", ")", "(", "[", "]", "Container", ",", "error", ")", "{", "r", ",", "err", ":=", "c", ".", "ContainerService", "(", ")", ".",...
// Containers returns all containers created in containerd
[ "Containers", "returns", "all", "containers", "created", "in", "containerd" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L236-L246
130,044
containerd/containerd
client.go
NewContainer
func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) { ctx, done, err := c.WithLease(ctx) if err != nil { return nil, err } defer done(ctx) container := containers.Container{ ID: id, Runtime: containers.RuntimeInfo{ Name: c.runtime, }, } for _, o ...
go
func (c *Client) NewContainer(ctx context.Context, id string, opts ...NewContainerOpts) (Container, error) { ctx, done, err := c.WithLease(ctx) if err != nil { return nil, err } defer done(ctx) container := containers.Container{ ID: id, Runtime: containers.RuntimeInfo{ Name: c.runtime, }, } for _, o ...
[ "func", "(", "c", "*", "Client", ")", "NewContainer", "(", "ctx", "context", ".", "Context", ",", "id", "string", ",", "opts", "...", "NewContainerOpts", ")", "(", "Container", ",", "error", ")", "{", "ctx", ",", "done", ",", "err", ":=", "c", ".", ...
// NewContainer will create a new container in container with the provided id // the id must be unique within the namespace
[ "NewContainer", "will", "create", "a", "new", "container", "in", "container", "with", "the", "provided", "id", "the", "id", "must", "be", "unique", "within", "the", "namespace" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L250-L273
130,045
containerd/containerd
client.go
LoadContainer
func (c *Client) LoadContainer(ctx context.Context, id string) (Container, error) { r, err := c.ContainerService().Get(ctx, id) if err != nil { return nil, err } return containerFromRecord(c, r), nil }
go
func (c *Client) LoadContainer(ctx context.Context, id string) (Container, error) { r, err := c.ContainerService().Get(ctx, id) if err != nil { return nil, err } return containerFromRecord(c, r), nil }
[ "func", "(", "c", "*", "Client", ")", "LoadContainer", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "Container", ",", "error", ")", "{", "r", ",", "err", ":=", "c", ".", "ContainerService", "(", ")", ".", "Get", "(", "ctx",...
// LoadContainer loads an existing container from metadata
[ "LoadContainer", "loads", "an", "existing", "container", "from", "metadata" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L276-L282
130,046
containerd/containerd
client.go
Fetch
func (c *Client) Fetch(ctx context.Context, ref string, opts ...RemoteOpt) (images.Image, error) { fetchCtx := defaultRemoteContext() for _, o := range opts { if err := o(c, fetchCtx); err != nil { return images.Image{}, err } } if fetchCtx.Unpack { return images.Image{}, errors.New("unpack on fetch not s...
go
func (c *Client) Fetch(ctx context.Context, ref string, opts ...RemoteOpt) (images.Image, error) { fetchCtx := defaultRemoteContext() for _, o := range opts { if err := o(c, fetchCtx); err != nil { return images.Image{}, err } } if fetchCtx.Unpack { return images.Image{}, errors.New("unpack on fetch not s...
[ "func", "(", "c", "*", "Client", ")", "Fetch", "(", "ctx", "context", ".", "Context", ",", "ref", "string", ",", "opts", "...", "RemoteOpt", ")", "(", "images", ".", "Image", ",", "error", ")", "{", "fetchCtx", ":=", "defaultRemoteContext", "(", ")", ...
// Fetch downloads the provided content into containerd's content store // and returns a non-platform specific image reference
[ "Fetch", "downloads", "the", "provided", "content", "into", "containerd", "s", "content", "store", "and", "returns", "a", "non", "-", "platform", "specific", "image", "reference" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L348-L384
130,047
containerd/containerd
client.go
Push
func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor, opts ...RemoteOpt) error { pushCtx := defaultRemoteContext() for _, o := range opts { if err := o(c, pushCtx); err != nil { return err } } if pushCtx.PlatformMatcher == nil { if len(pushCtx.Platforms) > 0 { var ps []ocispec....
go
func (c *Client) Push(ctx context.Context, ref string, desc ocispec.Descriptor, opts ...RemoteOpt) error { pushCtx := defaultRemoteContext() for _, o := range opts { if err := o(c, pushCtx); err != nil { return err } } if pushCtx.PlatformMatcher == nil { if len(pushCtx.Platforms) > 0 { var ps []ocispec....
[ "func", "(", "c", "*", "Client", ")", "Push", "(", "ctx", "context", ".", "Context", ",", "ref", "string", ",", "desc", "ocispec", ".", "Descriptor", ",", "opts", "...", "RemoteOpt", ")", "error", "{", "pushCtx", ":=", "defaultRemoteContext", "(", ")", ...
// Push uploads the provided content to a remote resource
[ "Push", "uploads", "the", "provided", "content", "to", "a", "remote", "resource" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L387-L430
130,048
containerd/containerd
client.go
GetImage
func (c *Client) GetImage(ctx context.Context, ref string) (Image, error) { i, err := c.ImageService().Get(ctx, ref) if err != nil { return nil, err } return NewImage(c, i), nil }
go
func (c *Client) GetImage(ctx context.Context, ref string) (Image, error) { i, err := c.ImageService().Get(ctx, ref) if err != nil { return nil, err } return NewImage(c, i), nil }
[ "func", "(", "c", "*", "Client", ")", "GetImage", "(", "ctx", "context", ".", "Context", ",", "ref", "string", ")", "(", "Image", ",", "error", ")", "{", "i", ",", "err", ":=", "c", ".", "ImageService", "(", ")", ".", "Get", "(", "ctx", ",", "r...
// GetImage returns an existing image
[ "GetImage", "returns", "an", "existing", "image" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L433-L439
130,049
containerd/containerd
client.go
ListImages
func (c *Client) ListImages(ctx context.Context, filters ...string) ([]Image, error) { imgs, err := c.ImageService().List(ctx, filters...) if err != nil { return nil, err } images := make([]Image, len(imgs)) for i, img := range imgs { images[i] = NewImage(c, img) } return images, nil }
go
func (c *Client) ListImages(ctx context.Context, filters ...string) ([]Image, error) { imgs, err := c.ImageService().List(ctx, filters...) if err != nil { return nil, err } images := make([]Image, len(imgs)) for i, img := range imgs { images[i] = NewImage(c, img) } return images, nil }
[ "func", "(", "c", "*", "Client", ")", "ListImages", "(", "ctx", "context", ".", "Context", ",", "filters", "...", "string", ")", "(", "[", "]", "Image", ",", "error", ")", "{", "imgs", ",", "err", ":=", "c", ".", "ImageService", "(", ")", ".", "L...
// ListImages returns all existing images
[ "ListImages", "returns", "all", "existing", "images" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L442-L452
130,050
containerd/containerd
client.go
Restore
func (c *Client) Restore(ctx context.Context, id string, checkpoint Image, opts ...RestoreOpts) (Container, error) { store := c.ContentStore() index, err := decodeIndex(ctx, store, checkpoint.Target()) if err != nil { return nil, err } ctx, done, err := c.WithLease(ctx) if err != nil { return nil, err } de...
go
func (c *Client) Restore(ctx context.Context, id string, checkpoint Image, opts ...RestoreOpts) (Container, error) { store := c.ContentStore() index, err := decodeIndex(ctx, store, checkpoint.Target()) if err != nil { return nil, err } ctx, done, err := c.WithLease(ctx) if err != nil { return nil, err } de...
[ "func", "(", "c", "*", "Client", ")", "Restore", "(", "ctx", "context", ".", "Context", ",", "id", "string", ",", "checkpoint", "Image", ",", "opts", "...", "RestoreOpts", ")", "(", "Container", ",", "error", ")", "{", "store", ":=", "c", ".", "Conte...
// Restore restores a container from a checkpoint
[ "Restore", "restores", "a", "container", "from", "a", "checkpoint" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L455-L479
130,051
containerd/containerd
client.go
Subscribe
func (c *Client) Subscribe(ctx context.Context, filters ...string) (ch <-chan *events.Envelope, errs <-chan error) { return c.EventService().Subscribe(ctx, filters...) }
go
func (c *Client) Subscribe(ctx context.Context, filters ...string) (ch <-chan *events.Envelope, errs <-chan error) { return c.EventService().Subscribe(ctx, filters...) }
[ "func", "(", "c", "*", "Client", ")", "Subscribe", "(", "ctx", "context", ".", "Context", ",", "filters", "...", "string", ")", "(", "ch", "<-", "chan", "*", "events", ".", "Envelope", ",", "errs", "<-", "chan", "error", ")", "{", "return", "c", "....
// Subscribe to events that match one or more of the provided filters. // // Callers should listen on both the envelope and errs channels. If the errs // channel returns nil or an error, the subscriber should terminate. // // The subscriber can stop receiving events by canceling the provided context. // The errs channe...
[ "Subscribe", "to", "events", "that", "match", "one", "or", "more", "of", "the", "provided", "filters", ".", "Callers", "should", "listen", "on", "both", "the", "envelope", "and", "errs", "channels", ".", "If", "the", "errs", "channel", "returns", "nil", "o...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L500-L502
130,052
containerd/containerd
client.go
Close
func (c *Client) Close() error { c.connMu.Lock() defer c.connMu.Unlock() if c.conn != nil { return c.conn.Close() } return nil }
go
func (c *Client) Close() error { c.connMu.Lock() defer c.connMu.Unlock() if c.conn != nil { return c.conn.Close() } return nil }
[ "func", "(", "c", "*", "Client", ")", "Close", "(", ")", "error", "{", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "connMu", ".", "Unlock", "(", ")", "\n", "if", "c", ".", "conn", "!=", "nil", "{", "return", "c", ".", ...
// Close closes the clients connection to containerd
[ "Close", "closes", "the", "clients", "connection", "to", "containerd" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L505-L512
130,053
containerd/containerd
client.go
NamespaceService
func (c *Client) NamespaceService() namespaces.Store { if c.namespaceStore != nil { return c.namespaceStore } c.connMu.Lock() defer c.connMu.Unlock() return NewNamespaceStoreFromClient(namespacesapi.NewNamespacesClient(c.conn)) }
go
func (c *Client) NamespaceService() namespaces.Store { if c.namespaceStore != nil { return c.namespaceStore } c.connMu.Lock() defer c.connMu.Unlock() return NewNamespaceStoreFromClient(namespacesapi.NewNamespacesClient(c.conn)) }
[ "func", "(", "c", "*", "Client", ")", "NamespaceService", "(", ")", "namespaces", ".", "Store", "{", "if", "c", ".", "namespaceStore", "!=", "nil", "{", "return", "c", ".", "namespaceStore", "\n", "}", "\n", "c", ".", "connMu", ".", "Lock", "(", ")",...
// NamespaceService returns the underlying Namespaces Store
[ "NamespaceService", "returns", "the", "underlying", "Namespaces", "Store" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L515-L522
130,054
containerd/containerd
client.go
ContainerService
func (c *Client) ContainerService() containers.Store { if c.containerStore != nil { return c.containerStore } c.connMu.Lock() defer c.connMu.Unlock() return NewRemoteContainerStore(containersapi.NewContainersClient(c.conn)) }
go
func (c *Client) ContainerService() containers.Store { if c.containerStore != nil { return c.containerStore } c.connMu.Lock() defer c.connMu.Unlock() return NewRemoteContainerStore(containersapi.NewContainersClient(c.conn)) }
[ "func", "(", "c", "*", "Client", ")", "ContainerService", "(", ")", "containers", ".", "Store", "{", "if", "c", ".", "containerStore", "!=", "nil", "{", "return", "c", ".", "containerStore", "\n", "}", "\n", "c", ".", "connMu", ".", "Lock", "(", ")",...
// ContainerService returns the underlying container Store
[ "ContainerService", "returns", "the", "underlying", "container", "Store" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L525-L532
130,055
containerd/containerd
client.go
ContentStore
func (c *Client) ContentStore() content.Store { if c.contentStore != nil { return c.contentStore } c.connMu.Lock() defer c.connMu.Unlock() return contentproxy.NewContentStore(contentapi.NewContentClient(c.conn)) }
go
func (c *Client) ContentStore() content.Store { if c.contentStore != nil { return c.contentStore } c.connMu.Lock() defer c.connMu.Unlock() return contentproxy.NewContentStore(contentapi.NewContentClient(c.conn)) }
[ "func", "(", "c", "*", "Client", ")", "ContentStore", "(", ")", "content", ".", "Store", "{", "if", "c", ".", "contentStore", "!=", "nil", "{", "return", "c", ".", "contentStore", "\n", "}", "\n", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", ...
// ContentStore returns the underlying content Store
[ "ContentStore", "returns", "the", "underlying", "content", "Store" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L535-L542
130,056
containerd/containerd
client.go
SnapshotService
func (c *Client) SnapshotService(snapshotterName string) snapshots.Snapshotter { if c.snapshotters != nil { return c.snapshotters[snapshotterName] } c.connMu.Lock() defer c.connMu.Unlock() return snproxy.NewSnapshotter(snapshotsapi.NewSnapshotsClient(c.conn), snapshotterName) }
go
func (c *Client) SnapshotService(snapshotterName string) snapshots.Snapshotter { if c.snapshotters != nil { return c.snapshotters[snapshotterName] } c.connMu.Lock() defer c.connMu.Unlock() return snproxy.NewSnapshotter(snapshotsapi.NewSnapshotsClient(c.conn), snapshotterName) }
[ "func", "(", "c", "*", "Client", ")", "SnapshotService", "(", "snapshotterName", "string", ")", "snapshots", ".", "Snapshotter", "{", "if", "c", ".", "snapshotters", "!=", "nil", "{", "return", "c", ".", "snapshotters", "[", "snapshotterName", "]", "\n", "...
// SnapshotService returns the underlying snapshotter for the provided snapshotter name
[ "SnapshotService", "returns", "the", "underlying", "snapshotter", "for", "the", "provided", "snapshotter", "name" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L545-L552
130,057
containerd/containerd
client.go
TaskService
func (c *Client) TaskService() tasks.TasksClient { if c.taskService != nil { return c.taskService } c.connMu.Lock() defer c.connMu.Unlock() return tasks.NewTasksClient(c.conn) }
go
func (c *Client) TaskService() tasks.TasksClient { if c.taskService != nil { return c.taskService } c.connMu.Lock() defer c.connMu.Unlock() return tasks.NewTasksClient(c.conn) }
[ "func", "(", "c", "*", "Client", ")", "TaskService", "(", ")", "tasks", ".", "TasksClient", "{", "if", "c", ".", "taskService", "!=", "nil", "{", "return", "c", ".", "taskService", "\n", "}", "\n", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", ...
// TaskService returns the underlying TasksClient
[ "TaskService", "returns", "the", "underlying", "TasksClient" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L555-L562
130,058
containerd/containerd
client.go
ImageService
func (c *Client) ImageService() images.Store { if c.imageStore != nil { return c.imageStore } c.connMu.Lock() defer c.connMu.Unlock() return NewImageStoreFromClient(imagesapi.NewImagesClient(c.conn)) }
go
func (c *Client) ImageService() images.Store { if c.imageStore != nil { return c.imageStore } c.connMu.Lock() defer c.connMu.Unlock() return NewImageStoreFromClient(imagesapi.NewImagesClient(c.conn)) }
[ "func", "(", "c", "*", "Client", ")", "ImageService", "(", ")", "images", ".", "Store", "{", "if", "c", ".", "imageStore", "!=", "nil", "{", "return", "c", ".", "imageStore", "\n", "}", "\n", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", "defe...
// ImageService returns the underlying image Store
[ "ImageService", "returns", "the", "underlying", "image", "Store" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L565-L572
130,059
containerd/containerd
client.go
DiffService
func (c *Client) DiffService() DiffService { if c.diffService != nil { return c.diffService } c.connMu.Lock() defer c.connMu.Unlock() return NewDiffServiceFromClient(diffapi.NewDiffClient(c.conn)) }
go
func (c *Client) DiffService() DiffService { if c.diffService != nil { return c.diffService } c.connMu.Lock() defer c.connMu.Unlock() return NewDiffServiceFromClient(diffapi.NewDiffClient(c.conn)) }
[ "func", "(", "c", "*", "Client", ")", "DiffService", "(", ")", "DiffService", "{", "if", "c", ".", "diffService", "!=", "nil", "{", "return", "c", ".", "diffService", "\n", "}", "\n", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", "defer", "c", ...
// DiffService returns the underlying Differ
[ "DiffService", "returns", "the", "underlying", "Differ" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L575-L582
130,060
containerd/containerd
client.go
IntrospectionService
func (c *Client) IntrospectionService() introspectionapi.IntrospectionClient { c.connMu.Lock() defer c.connMu.Unlock() return introspectionapi.NewIntrospectionClient(c.conn) }
go
func (c *Client) IntrospectionService() introspectionapi.IntrospectionClient { c.connMu.Lock() defer c.connMu.Unlock() return introspectionapi.NewIntrospectionClient(c.conn) }
[ "func", "(", "c", "*", "Client", ")", "IntrospectionService", "(", ")", "introspectionapi", ".", "IntrospectionClient", "{", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "connMu", ".", "Unlock", "(", ")", "\n", "return", "introspec...
// IntrospectionService returns the underlying Introspection Client
[ "IntrospectionService", "returns", "the", "underlying", "Introspection", "Client" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L585-L589
130,061
containerd/containerd
client.go
LeasesService
func (c *Client) LeasesService() leases.Manager { if c.leasesService != nil { return c.leasesService } c.connMu.Lock() defer c.connMu.Unlock() return leasesproxy.NewLeaseManager(leasesapi.NewLeasesClient(c.conn)) }
go
func (c *Client) LeasesService() leases.Manager { if c.leasesService != nil { return c.leasesService } c.connMu.Lock() defer c.connMu.Unlock() return leasesproxy.NewLeaseManager(leasesapi.NewLeasesClient(c.conn)) }
[ "func", "(", "c", "*", "Client", ")", "LeasesService", "(", ")", "leases", ".", "Manager", "{", "if", "c", ".", "leasesService", "!=", "nil", "{", "return", "c", ".", "leasesService", "\n", "}", "\n", "c", ".", "connMu", ".", "Lock", "(", ")", "\n"...
// LeasesService returns the underlying Leases Client
[ "LeasesService", "returns", "the", "underlying", "Leases", "Client" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L592-L599
130,062
containerd/containerd
client.go
HealthService
func (c *Client) HealthService() grpc_health_v1.HealthClient { c.connMu.Lock() defer c.connMu.Unlock() return grpc_health_v1.NewHealthClient(c.conn) }
go
func (c *Client) HealthService() grpc_health_v1.HealthClient { c.connMu.Lock() defer c.connMu.Unlock() return grpc_health_v1.NewHealthClient(c.conn) }
[ "func", "(", "c", "*", "Client", ")", "HealthService", "(", ")", "grpc_health_v1", ".", "HealthClient", "{", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "connMu", ".", "Unlock", "(", ")", "\n", "return", "grpc_health_v1", ".", ...
// HealthService returns the underlying GRPC HealthClient
[ "HealthService", "returns", "the", "underlying", "GRPC", "HealthClient" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L602-L606
130,063
containerd/containerd
client.go
EventService
func (c *Client) EventService() EventService { if c.eventService != nil { return c.eventService } c.connMu.Lock() defer c.connMu.Unlock() return NewEventServiceFromClient(eventsapi.NewEventsClient(c.conn)) }
go
func (c *Client) EventService() EventService { if c.eventService != nil { return c.eventService } c.connMu.Lock() defer c.connMu.Unlock() return NewEventServiceFromClient(eventsapi.NewEventsClient(c.conn)) }
[ "func", "(", "c", "*", "Client", ")", "EventService", "(", ")", "EventService", "{", "if", "c", ".", "eventService", "!=", "nil", "{", "return", "c", ".", "eventService", "\n", "}", "\n", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", "defer", "c...
// EventService returns the underlying event service
[ "EventService", "returns", "the", "underlying", "event", "service" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L609-L616
130,064
containerd/containerd
client.go
VersionService
func (c *Client) VersionService() versionservice.VersionClient { c.connMu.Lock() defer c.connMu.Unlock() return versionservice.NewVersionClient(c.conn) }
go
func (c *Client) VersionService() versionservice.VersionClient { c.connMu.Lock() defer c.connMu.Unlock() return versionservice.NewVersionClient(c.conn) }
[ "func", "(", "c", "*", "Client", ")", "VersionService", "(", ")", "versionservice", ".", "VersionClient", "{", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "connMu", ".", "Unlock", "(", ")", "\n", "return", "versionservice", ".",...
// VersionService returns the underlying VersionClient
[ "VersionService", "returns", "the", "underlying", "VersionClient" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L619-L623
130,065
containerd/containerd
client.go
Conn
func (c *Client) Conn() *grpc.ClientConn { c.connMu.Lock() defer c.connMu.Unlock() return c.conn }
go
func (c *Client) Conn() *grpc.ClientConn { c.connMu.Lock() defer c.connMu.Unlock() return c.conn }
[ "func", "(", "c", "*", "Client", ")", "Conn", "(", ")", "*", "grpc", ".", "ClientConn", "{", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "connMu", ".", "Unlock", "(", ")", "\n", "return", "c", ".", "conn", "\n", "}" ]
// Conn returns the underlying GRPC connection object
[ "Conn", "returns", "the", "underlying", "GRPC", "connection", "object" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L626-L630
130,066
containerd/containerd
client.go
Version
func (c *Client) Version(ctx context.Context) (Version, error) { c.connMu.Lock() if c.conn == nil { c.connMu.Unlock() return Version{}, errors.New("no grpc connection available") } c.connMu.Unlock() response, err := c.VersionService().Version(ctx, &ptypes.Empty{}) if err != nil { return Version{}, err } r...
go
func (c *Client) Version(ctx context.Context) (Version, error) { c.connMu.Lock() if c.conn == nil { c.connMu.Unlock() return Version{}, errors.New("no grpc connection available") } c.connMu.Unlock() response, err := c.VersionService().Version(ctx, &ptypes.Empty{}) if err != nil { return Version{}, err } r...
[ "func", "(", "c", "*", "Client", ")", "Version", "(", "ctx", "context", ".", "Context", ")", "(", "Version", ",", "error", ")", "{", "c", ".", "connMu", ".", "Lock", "(", ")", "\n", "if", "c", ".", "conn", "==", "nil", "{", "c", ".", "connMu", ...
// Version returns the version of containerd that the client is connected to
[ "Version", "returns", "the", "version", "of", "containerd", "that", "the", "client", "is", "connected", "to" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L641-L656
130,067
containerd/containerd
client.go
CheckRuntime
func CheckRuntime(current, expected string) bool { cp := strings.Split(current, ".") l := len(cp) for i, p := range strings.Split(expected, ".") { if i > l { return false } if p != cp[i] { return false } } return true }
go
func CheckRuntime(current, expected string) bool { cp := strings.Split(current, ".") l := len(cp) for i, p := range strings.Split(expected, ".") { if i > l { return false } if p != cp[i] { return false } } return true }
[ "func", "CheckRuntime", "(", "current", ",", "expected", "string", ")", "bool", "{", "cp", ":=", "strings", ".", "Split", "(", "current", ",", "\"", "\"", ")", "\n", "l", ":=", "len", "(", "cp", ")", "\n", "for", "i", ",", "p", ":=", "range", "st...
// CheckRuntime returns true if the current runtime matches the expected // runtime. Providing various parts of the runtime schema will match those // parts of the expected runtime
[ "CheckRuntime", "returns", "true", "if", "the", "current", "runtime", "matches", "the", "expected", "runtime", ".", "Providing", "various", "parts", "of", "the", "runtime", "schema", "will", "match", "those", "parts", "of", "the", "expected", "runtime" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/client.go#L661-L673
130,068
containerd/containerd
windows/hcsshim.go
newContainerConfig
func newContainerConfig(ctx context.Context, owner, id string, spec *specs.Spec) (*hcsshim.ContainerConfig, error) { var ( conf = &hcsshim.ContainerConfig{ SystemType: "Container", Name: id, Owner: owner, HostName: spec.Hostname, } ) if spec.Windows.Network != nil { conf.AllowUnqualif...
go
func newContainerConfig(ctx context.Context, owner, id string, spec *specs.Spec) (*hcsshim.ContainerConfig, error) { var ( conf = &hcsshim.ContainerConfig{ SystemType: "Container", Name: id, Owner: owner, HostName: spec.Hostname, } ) if spec.Windows.Network != nil { conf.AllowUnqualif...
[ "func", "newContainerConfig", "(", "ctx", "context", ".", "Context", ",", "owner", ",", "id", "string", ",", "spec", "*", "specs", ".", "Spec", ")", "(", "*", "hcsshim", ".", "ContainerConfig", ",", "error", ")", "{", "var", "(", "conf", "=", "&", "h...
// newContainerConfig generates a hcsshim container configuration from the // provided OCI Spec
[ "newContainerConfig", "generates", "a", "hcsshim", "container", "configuration", "from", "the", "provided", "OCI", "Spec" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/windows/hcsshim.go#L35-L55
130,069
containerd/containerd
windows/hcsshim.go
newWindowsContainerConfig
func newWindowsContainerConfig(ctx context.Context, owner, id string, spec *specs.Spec) (*hcsshim.ContainerConfig, error) { conf, err := newContainerConfig(ctx, owner, id, spec) if err != nil { return nil, err } conf.IgnoreFlushesDuringBoot = spec.Windows.IgnoreFlushesDuringBoot if len(spec.Windows.LayerFolders...
go
func newWindowsContainerConfig(ctx context.Context, owner, id string, spec *specs.Spec) (*hcsshim.ContainerConfig, error) { conf, err := newContainerConfig(ctx, owner, id, spec) if err != nil { return nil, err } conf.IgnoreFlushesDuringBoot = spec.Windows.IgnoreFlushesDuringBoot if len(spec.Windows.LayerFolders...
[ "func", "newWindowsContainerConfig", "(", "ctx", "context", ".", "Context", ",", "owner", ",", "id", "string", ",", "spec", "*", "specs", ".", "Spec", ")", "(", "*", "hcsshim", ".", "ContainerConfig", ",", "error", ")", "{", "conf", ",", "err", ":=", "...
// newWindowsContainerConfig generates a hcsshim Windows container // configuration from the provided OCI Spec
[ "newWindowsContainerConfig", "generates", "a", "hcsshim", "Windows", "container", "configuration", "from", "the", "provided", "OCI", "Spec" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/windows/hcsshim.go#L59-L134
130,070
containerd/containerd
content/helpers.go
NewReader
func NewReader(ra ReaderAt) io.Reader { rd := io.NewSectionReader(ra, 0, ra.Size()) return rd }
go
func NewReader(ra ReaderAt) io.Reader { rd := io.NewSectionReader(ra, 0, ra.Size()) return rd }
[ "func", "NewReader", "(", "ra", "ReaderAt", ")", "io", ".", "Reader", "{", "rd", ":=", "io", ".", "NewSectionReader", "(", "ra", ",", "0", ",", "ra", ".", "Size", "(", ")", ")", "\n", "return", "rd", "\n", "}" ]
// NewReader returns a io.Reader from a ReaderAt
[ "NewReader", "returns", "a", "io", ".", "Reader", "from", "a", "ReaderAt" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/helpers.go#L41-L44
130,071
containerd/containerd
content/helpers.go
ReadBlob
func ReadBlob(ctx context.Context, provider Provider, desc ocispec.Descriptor) ([]byte, error) { ra, err := provider.ReaderAt(ctx, desc) if err != nil { return nil, err } defer ra.Close() p := make([]byte, ra.Size()) _, err = ra.ReadAt(p, 0) return p, err }
go
func ReadBlob(ctx context.Context, provider Provider, desc ocispec.Descriptor) ([]byte, error) { ra, err := provider.ReaderAt(ctx, desc) if err != nil { return nil, err } defer ra.Close() p := make([]byte, ra.Size()) _, err = ra.ReadAt(p, 0) return p, err }
[ "func", "ReadBlob", "(", "ctx", "context", ".", "Context", ",", "provider", "Provider", ",", "desc", "ocispec", ".", "Descriptor", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "ra", ",", "err", ":=", "provider", ".", "ReaderAt", "(", "ctx", ",...
// ReadBlob retrieves the entire contents of the blob from the provider. // // Avoid using this for large blobs, such as layers.
[ "ReadBlob", "retrieves", "the", "entire", "contents", "of", "the", "blob", "from", "the", "provider", ".", "Avoid", "using", "this", "for", "large", "blobs", "such", "as", "layers", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/helpers.go#L49-L60
130,072
containerd/containerd
content/helpers.go
WriteBlob
func WriteBlob(ctx context.Context, cs Ingester, ref string, r io.Reader, desc ocispec.Descriptor, opts ...Opt) error { cw, err := OpenWriter(ctx, cs, WithRef(ref), WithDescriptor(desc)) if err != nil { if !errdefs.IsAlreadyExists(err) { return errors.Wrap(err, "failed to open writer") } return nil // all r...
go
func WriteBlob(ctx context.Context, cs Ingester, ref string, r io.Reader, desc ocispec.Descriptor, opts ...Opt) error { cw, err := OpenWriter(ctx, cs, WithRef(ref), WithDescriptor(desc)) if err != nil { if !errdefs.IsAlreadyExists(err) { return errors.Wrap(err, "failed to open writer") } return nil // all r...
[ "func", "WriteBlob", "(", "ctx", "context", ".", "Context", ",", "cs", "Ingester", ",", "ref", "string", ",", "r", "io", ".", "Reader", ",", "desc", "ocispec", ".", "Descriptor", ",", "opts", "...", "Opt", ")", "error", "{", "cw", ",", "err", ":=", ...
// WriteBlob writes data with the expected digest into the content store. If // expected already exists, the method returns immediately and the reader will // not be consumed. // // This is useful when the digest and size are known beforehand. // // Copy is buffered, so no need to wrap reader in buffered io.
[ "WriteBlob", "writes", "data", "with", "the", "expected", "digest", "into", "the", "content", "store", ".", "If", "expected", "already", "exists", "the", "method", "returns", "immediately", "and", "the", "reader", "will", "not", "be", "consumed", ".", "This", ...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/helpers.go#L69-L81
130,073
containerd/containerd
content/helpers.go
OpenWriter
func OpenWriter(ctx context.Context, cs Ingester, opts ...WriterOpt) (Writer, error) { var ( cw Writer err error retry = 16 ) for { cw, err = cs.Writer(ctx, opts...) if err != nil { if !errdefs.IsUnavailable(err) { return nil, err } // TODO: Check status to determine if the writer is act...
go
func OpenWriter(ctx context.Context, cs Ingester, opts ...WriterOpt) (Writer, error) { var ( cw Writer err error retry = 16 ) for { cw, err = cs.Writer(ctx, opts...) if err != nil { if !errdefs.IsUnavailable(err) { return nil, err } // TODO: Check status to determine if the writer is act...
[ "func", "OpenWriter", "(", "ctx", "context", ".", "Context", ",", "cs", "Ingester", ",", "opts", "...", "WriterOpt", ")", "(", "Writer", ",", "error", ")", "{", "var", "(", "cw", "Writer", "\n", "err", "error", "\n", "retry", "=", "16", "\n", ")", ...
// OpenWriter opens a new writer for the given reference, retrying if the writer // is locked until the reference is available or returns an error.
[ "OpenWriter", "opens", "a", "new", "writer", "for", "the", "given", "reference", "retrying", "if", "the", "writer", "is", "locked", "until", "the", "reference", "is", "available", "or", "returns", "an", "error", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/helpers.go#L85-L118
130,074
containerd/containerd
content/helpers.go
Copy
func Copy(ctx context.Context, cw Writer, r io.Reader, size int64, expected digest.Digest, opts ...Opt) error { ws, err := cw.Status() if err != nil { return errors.Wrap(err, "failed to get status") } if ws.Offset > 0 { r, err = seekReader(r, ws.Offset, size) if err != nil { return errors.Wrapf(err, "unab...
go
func Copy(ctx context.Context, cw Writer, r io.Reader, size int64, expected digest.Digest, opts ...Opt) error { ws, err := cw.Status() if err != nil { return errors.Wrap(err, "failed to get status") } if ws.Offset > 0 { r, err = seekReader(r, ws.Offset, size) if err != nil { return errors.Wrapf(err, "unab...
[ "func", "Copy", "(", "ctx", "context", ".", "Context", ",", "cw", "Writer", ",", "r", "io", ".", "Reader", ",", "size", "int64", ",", "expected", "digest", ".", "Digest", ",", "opts", "...", "Opt", ")", "error", "{", "ws", ",", "err", ":=", "cw", ...
// Copy copies data with the expected digest from the reader into the // provided content store writer. This copy commits the writer. // // This is useful when the digest and size are known beforehand. When // the size or digest is unknown, these values may be empty. // // Copy is buffered, so no need to wrap reader in...
[ "Copy", "copies", "data", "with", "the", "expected", "digest", "from", "the", "reader", "into", "the", "provided", "content", "store", "writer", ".", "This", "copy", "commits", "the", "writer", ".", "This", "is", "useful", "when", "the", "digest", "and", "...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/helpers.go#L127-L151
130,075
containerd/containerd
content/helpers.go
CopyReaderAt
func CopyReaderAt(cw Writer, ra ReaderAt, n int64) error { ws, err := cw.Status() if err != nil { return err } _, err = copyWithBuffer(cw, io.NewSectionReader(ra, ws.Offset, n)) return err }
go
func CopyReaderAt(cw Writer, ra ReaderAt, n int64) error { ws, err := cw.Status() if err != nil { return err } _, err = copyWithBuffer(cw, io.NewSectionReader(ra, ws.Offset, n)) return err }
[ "func", "CopyReaderAt", "(", "cw", "Writer", ",", "ra", "ReaderAt", ",", "n", "int64", ")", "error", "{", "ws", ",", "err", ":=", "cw", ".", "Status", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "_", ",", ...
// CopyReaderAt copies to a writer from a given reader at for the given // number of bytes. This copy does not commit the writer.
[ "CopyReaderAt", "copies", "to", "a", "writer", "from", "a", "given", "reader", "at", "for", "the", "given", "number", "of", "bytes", ".", "This", "copy", "does", "not", "commit", "the", "writer", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/helpers.go#L155-L163
130,076
containerd/containerd
content/helpers.go
seekReader
func seekReader(r io.Reader, offset, size int64) (io.Reader, error) { // attempt to resolve r as a seeker and setup the offset. seeker, ok := r.(io.Seeker) if ok { nn, err := seeker.Seek(offset, io.SeekStart) if nn != offset { return nil, errors.Wrapf(err, "failed to seek to offset %v", offset) } if err ...
go
func seekReader(r io.Reader, offset, size int64) (io.Reader, error) { // attempt to resolve r as a seeker and setup the offset. seeker, ok := r.(io.Seeker) if ok { nn, err := seeker.Seek(offset, io.SeekStart) if nn != offset { return nil, errors.Wrapf(err, "failed to seek to offset %v", offset) } if err ...
[ "func", "seekReader", "(", "r", "io", ".", "Reader", ",", "offset", ",", "size", "int64", ")", "(", "io", ".", "Reader", ",", "error", ")", "{", "// attempt to resolve r as a seeker and setup the offset.", "seeker", ",", "ok", ":=", "r", ".", "(", "io", "....
// seekReader attempts to seek the reader to the given offset, either by // resolving `io.Seeker`, by detecting `io.ReaderAt`, or discarding // up to the given offset.
[ "seekReader", "attempts", "to", "seek", "the", "reader", "to", "the", "given", "offset", "either", "by", "resolving", "io", ".", "Seeker", "by", "detecting", "io", ".", "ReaderAt", "or", "discarding", "up", "to", "the", "given", "offset", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/helpers.go#L168-L201
130,077
containerd/containerd
gc/gc.go
Tricolor
func Tricolor(roots []Node, refs func(ref Node) ([]Node, error)) (map[Node]struct{}, error) { var ( grays []Node // maintain a gray "stack" seen = map[Node]struct{}{} // or not "white", basically "seen" reachable = map[Node]struct{}{} // or "black", in tri-color parlance ) grays = appe...
go
func Tricolor(roots []Node, refs func(ref Node) ([]Node, error)) (map[Node]struct{}, error) { var ( grays []Node // maintain a gray "stack" seen = map[Node]struct{}{} // or not "white", basically "seen" reachable = map[Node]struct{}{} // or "black", in tri-color parlance ) grays = appe...
[ "func", "Tricolor", "(", "roots", "[", "]", "Node", ",", "refs", "func", "(", "ref", "Node", ")", "(", "[", "]", "Node", ",", "error", ")", ")", "(", "map", "[", "Node", "]", "struct", "{", "}", ",", "error", ")", "{", "var", "(", "grays", "[...
// Tricolor implements basic, single-thread tri-color GC. Given the roots, the // complete set and a refs function, this function returns a map of all // reachable objects. // // Correct usage requires that the caller not allow the arguments to change // until the result is used to delete objects in the system. // // I...
[ "Tricolor", "implements", "basic", "single", "-", "thread", "tri", "-", "color", "GC", ".", "Given", "the", "roots", "the", "complete", "set", "and", "a", "refs", "function", "this", "function", "returns", "a", "map", "of", "all", "reachable", "objects", "...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/gc/gc.go#L57-L88
130,078
containerd/containerd
gc/gc.go
ConcurrentMark
func ConcurrentMark(ctx context.Context, root <-chan Node, refs func(context.Context, Node, func(Node)) error) (map[Node]struct{}, error) { ctx, cancel := context.WithCancel(ctx) defer cancel() var ( grays = make(chan Node) seen = map[Node]struct{}{} // or not "white", basically "seen" wg sync.WaitGroup ...
go
func ConcurrentMark(ctx context.Context, root <-chan Node, refs func(context.Context, Node, func(Node)) error) (map[Node]struct{}, error) { ctx, cancel := context.WithCancel(ctx) defer cancel() var ( grays = make(chan Node) seen = map[Node]struct{}{} // or not "white", basically "seen" wg sync.WaitGroup ...
[ "func", "ConcurrentMark", "(", "ctx", "context", ".", "Context", ",", "root", "<-", "chan", "Node", ",", "refs", "func", "(", "context", ".", "Context", ",", "Node", ",", "func", "(", "Node", ")", ")", "error", ")", "(", "map", "[", "Node", "]", "s...
// ConcurrentMark implements simple, concurrent GC. All the roots are scanned // and the complete set of references is formed by calling the refs function // for each seen object. This function returns a map of all object reachable // from a root. // // Correct usage requires that the caller not allow the arguments to ...
[ "ConcurrentMark", "implements", "simple", "concurrent", "GC", ".", "All", "the", "roots", "are", "scanned", "and", "the", "complete", "set", "of", "references", "is", "formed", "by", "calling", "the", "refs", "function", "for", "each", "seen", "object", ".", ...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/gc/gc.go#L99-L166
130,079
containerd/containerd
gc/gc.go
Sweep
func Sweep(reachable map[Node]struct{}, all []Node, remove func(Node) error) error { // All black objects are now reachable, and all white objects are // unreachable. Free those that are white! for _, node := range all { if _, ok := reachable[node]; !ok { if err := remove(node); err != nil { return err }...
go
func Sweep(reachable map[Node]struct{}, all []Node, remove func(Node) error) error { // All black objects are now reachable, and all white objects are // unreachable. Free those that are white! for _, node := range all { if _, ok := reachable[node]; !ok { if err := remove(node); err != nil { return err }...
[ "func", "Sweep", "(", "reachable", "map", "[", "Node", "]", "struct", "{", "}", ",", "all", "[", "]", "Node", ",", "remove", "func", "(", "Node", ")", "error", ")", "error", "{", "// All black objects are now reachable, and all white objects are", "// unreachabl...
// Sweep removes all nodes returned through the channel which are not in // the reachable set by calling the provided remove function.
[ "Sweep", "removes", "all", "nodes", "returned", "through", "the", "channel", "which", "are", "not", "in", "the", "reachable", "set", "by", "calling", "the", "provided", "remove", "function", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/gc/gc.go#L170-L182
130,080
containerd/containerd
windows/task.go
stop
func (t *task) stop(ctx context.Context) error { if err := t.hcsStop(ctx, t.hcsContainer.Shutdown); err != nil { return t.hcsStop(ctx, t.hcsContainer.Terminate) } t.hcsContainer.Close() return nil }
go
func (t *task) stop(ctx context.Context) error { if err := t.hcsStop(ctx, t.hcsContainer.Shutdown); err != nil { return t.hcsStop(ctx, t.hcsContainer.Terminate) } t.hcsContainer.Close() return nil }
[ "func", "(", "t", "*", "task", ")", "stop", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "err", ":=", "t", ".", "hcsStop", "(", "ctx", ",", "t", ".", "hcsContainer", ".", "Shutdown", ")", ";", "err", "!=", "nil", "{", "return",...
// stop tries to shutdown the task. // It will do so by first calling Shutdown on the hcsshim.Container and if // that fails, by resorting to caling Terminate
[ "stop", "tries", "to", "shutdown", "the", "task", ".", "It", "will", "do", "so", "by", "first", "calling", "Shutdown", "on", "the", "hcsshim", ".", "Container", "and", "if", "that", "fails", "by", "resorting", "to", "caling", "Terminate" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/windows/task.go#L439-L445
130,081
containerd/containerd
content/content.go
WithLabels
func WithLabels(labels map[string]string) Opt { return func(info *Info) error { info.Labels = labels return nil } }
go
func WithLabels(labels map[string]string) Opt { return func(info *Info) error { info.Labels = labels return nil } }
[ "func", "WithLabels", "(", "labels", "map", "[", "string", "]", "string", ")", "Opt", "{", "return", "func", "(", "info", "*", "Info", ")", "error", "{", "info", ".", "Labels", "=", "labels", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithLabels allows labels to be set on content
[ "WithLabels", "allows", "labels", "to", "be", "set", "on", "content" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/content.go#L147-L152
130,082
containerd/containerd
content/content.go
WithDescriptor
func WithDescriptor(desc ocispec.Descriptor) WriterOpt { return func(opts *WriterOpts) error { opts.Desc = desc return nil } }
go
func WithDescriptor(desc ocispec.Descriptor) WriterOpt { return func(opts *WriterOpts) error { opts.Desc = desc return nil } }
[ "func", "WithDescriptor", "(", "desc", "ocispec", ".", "Descriptor", ")", "WriterOpt", "{", "return", "func", "(", "opts", "*", "WriterOpts", ")", "error", "{", "opts", ".", "Desc", "=", "desc", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithDescriptor specifies an OCI descriptor. // Writer may optionally use the descriptor internally for resolving // the location of the actual data. // Write does not require any field of desc to be set. // If the data size is unknown, desc.Size should be set to 0. // Some implementations may also accept negative va...
[ "WithDescriptor", "specifies", "an", "OCI", "descriptor", ".", "Writer", "may", "optionally", "use", "the", "descriptor", "internally", "for", "resolving", "the", "location", "of", "the", "actual", "data", ".", "Write", "does", "not", "require", "any", "field", ...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/content.go#L169-L174
130,083
containerd/containerd
content/content.go
WithRef
func WithRef(ref string) WriterOpt { return func(opts *WriterOpts) error { opts.Ref = ref return nil } }
go
func WithRef(ref string) WriterOpt { return func(opts *WriterOpts) error { opts.Ref = ref return nil } }
[ "func", "WithRef", "(", "ref", "string", ")", "WriterOpt", "{", "return", "func", "(", "opts", "*", "WriterOpts", ")", "error", "{", "opts", ".", "Ref", "=", "ref", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithRef specifies a ref string.
[ "WithRef", "specifies", "a", "ref", "string", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/content.go#L177-L182
130,084
containerd/containerd
snapshots/proxy/proxy.go
NewSnapshotter
func NewSnapshotter(client snapshotsapi.SnapshotsClient, snapshotterName string) snapshots.Snapshotter { return &proxySnapshotter{ client: client, snapshotterName: snapshotterName, } }
go
func NewSnapshotter(client snapshotsapi.SnapshotsClient, snapshotterName string) snapshots.Snapshotter { return &proxySnapshotter{ client: client, snapshotterName: snapshotterName, } }
[ "func", "NewSnapshotter", "(", "client", "snapshotsapi", ".", "SnapshotsClient", ",", "snapshotterName", "string", ")", "snapshots", ".", "Snapshotter", "{", "return", "&", "proxySnapshotter", "{", "client", ":", "client", ",", "snapshotterName", ":", "snapshotterNa...
// NewSnapshotter returns a new Snapshotter which communicates over a GRPC // connection using the containerd snapshot GRPC API.
[ "NewSnapshotter", "returns", "a", "new", "Snapshotter", "which", "communicates", "over", "a", "GRPC", "connection", "using", "the", "containerd", "snapshot", "GRPC", "API", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/proxy/proxy.go#L33-L38
130,085
containerd/containerd
archive/tar_windows.go
tarName
func tarName(p string) (string, error) { // windows: convert windows style relative path with backslashes // into forward slashes. Since windows does not allow '/' or '\' // in file names, it is mostly safe to replace however we must // check just in case if strings.Contains(p, "/") { return "", fmt.Errorf("wind...
go
func tarName(p string) (string, error) { // windows: convert windows style relative path with backslashes // into forward slashes. Since windows does not allow '/' or '\' // in file names, it is mostly safe to replace however we must // check just in case if strings.Contains(p, "/") { return "", fmt.Errorf("wind...
[ "func", "tarName", "(", "p", "string", ")", "(", "string", ",", "error", ")", "{", "// windows: convert windows style relative path with backslashes", "// into forward slashes. Since windows does not allow '/' or '\\'", "// in file names, it is mostly safe to replace however we must", ...
// tarName returns platform-specific filepath // to canonical posix-style path for tar archival. p is relative // path.
[ "tarName", "returns", "platform", "-", "specific", "filepath", "to", "canonical", "posix", "-", "style", "path", "for", "tar", "archival", ".", "p", "is", "relative", "path", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/archive/tar_windows.go#L71-L81
130,086
containerd/containerd
archive/tar_windows.go
fileInfoFromHeader
func fileInfoFromHeader(hdr *tar.Header) (name string, size int64, fileInfo *winio.FileBasicInfo, err error) { name = hdr.Name if hdr.Typeflag == tar.TypeReg || hdr.Typeflag == tar.TypeRegA { size = hdr.Size } fileInfo = &winio.FileBasicInfo{ LastAccessTime: syscall.NsecToFiletime(hdr.AccessTime.UnixNano()), ...
go
func fileInfoFromHeader(hdr *tar.Header) (name string, size int64, fileInfo *winio.FileBasicInfo, err error) { name = hdr.Name if hdr.Typeflag == tar.TypeReg || hdr.Typeflag == tar.TypeRegA { size = hdr.Size } fileInfo = &winio.FileBasicInfo{ LastAccessTime: syscall.NsecToFiletime(hdr.AccessTime.UnixNano()), ...
[ "func", "fileInfoFromHeader", "(", "hdr", "*", "tar", ".", "Header", ")", "(", "name", "string", ",", "size", "int64", ",", "fileInfo", "*", "winio", ".", "FileBasicInfo", ",", "err", "error", ")", "{", "name", "=", "hdr", ".", "Name", "\n", "if", "h...
// fileInfoFromHeader retrieves basic Win32 file information from a tar header, using the additional metadata written by // WriteTarFileFromBackupStream.
[ "fileInfoFromHeader", "retrieves", "basic", "Win32", "file", "information", "from", "a", "tar", "header", "using", "the", "additional", "metadata", "written", "by", "WriteTarFileFromBackupStream", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/archive/tar_windows.go#L240-L272
130,087
containerd/containerd
mount/mount.go
All
func All(mounts []Mount, target string) error { for _, m := range mounts { if err := m.Mount(target); err != nil { return err } } return nil }
go
func All(mounts []Mount, target string) error { for _, m := range mounts { if err := m.Mount(target); err != nil { return err } } return nil }
[ "func", "All", "(", "mounts", "[", "]", "Mount", ",", "target", "string", ")", "error", "{", "for", "_", ",", "m", ":=", "range", "mounts", "{", "if", "err", ":=", "m", ".", "Mount", "(", "target", ")", ";", "err", "!=", "nil", "{", "return", "...
// All mounts all the provided mounts to the provided target
[ "All", "mounts", "all", "the", "provided", "mounts", "to", "the", "provided", "target" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/mount/mount.go#L33-L40
130,088
containerd/containerd
cio/io.go
Close
func (f *FIFOSet) Close() error { if f.close != nil { return f.close() } return nil }
go
func (f *FIFOSet) Close() error { if f.close != nil { return f.close() } return nil }
[ "func", "(", "f", "*", "FIFOSet", ")", "Close", "(", ")", "error", "{", "if", "f", ".", "close", "!=", "nil", "{", "return", "f", ".", "close", "(", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
// Close the FIFOSet
[ "Close", "the", "FIFOSet" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cio/io.go#L79-L84
130,089
containerd/containerd
cio/io.go
NewFIFOSet
func NewFIFOSet(config Config, close func() error) *FIFOSet { return &FIFOSet{Config: config, close: close} }
go
func NewFIFOSet(config Config, close func() error) *FIFOSet { return &FIFOSet{Config: config, close: close} }
[ "func", "NewFIFOSet", "(", "config", "Config", ",", "close", "func", "(", ")", "error", ")", "*", "FIFOSet", "{", "return", "&", "FIFOSet", "{", "Config", ":", "config", ",", "close", ":", "close", "}", "\n", "}" ]
// NewFIFOSet returns a new FIFOSet from a Config and a close function
[ "NewFIFOSet", "returns", "a", "new", "FIFOSet", "from", "a", "Config", "and", "a", "close", "function" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cio/io.go#L87-L89
130,090
containerd/containerd
cio/io.go
WithStreams
func WithStreams(stdin io.Reader, stdout, stderr io.Writer) Opt { return func(opt *Streams) { opt.Stdin = stdin opt.Stdout = stdout opt.Stderr = stderr } }
go
func WithStreams(stdin io.Reader, stdout, stderr io.Writer) Opt { return func(opt *Streams) { opt.Stdin = stdin opt.Stdout = stdout opt.Stderr = stderr } }
[ "func", "WithStreams", "(", "stdin", "io", ".", "Reader", ",", "stdout", ",", "stderr", "io", ".", "Writer", ")", "Opt", "{", "return", "func", "(", "opt", "*", "Streams", ")", "{", "opt", ".", "Stdin", "=", "stdin", "\n", "opt", ".", "Stdout", "="...
// WithStreams sets the stream options to the specified Reader and Writers
[ "WithStreams", "sets", "the", "stream", "options", "to", "the", "specified", "Reader", "and", "Writers" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cio/io.go#L114-L120
130,091
containerd/containerd
cio/io.go
NewCreator
func NewCreator(opts ...Opt) Creator { streams := &Streams{} for _, opt := range opts { opt(streams) } if streams.FIFODir == "" { streams.FIFODir = defaults.DefaultFIFODir } return func(id string) (IO, error) { fifos, err := NewFIFOSetInDir(streams.FIFODir, id, streams.Terminal) if err != nil { return ...
go
func NewCreator(opts ...Opt) Creator { streams := &Streams{} for _, opt := range opts { opt(streams) } if streams.FIFODir == "" { streams.FIFODir = defaults.DefaultFIFODir } return func(id string) (IO, error) { fifos, err := NewFIFOSetInDir(streams.FIFODir, id, streams.Terminal) if err != nil { return ...
[ "func", "NewCreator", "(", "opts", "...", "Opt", ")", "Creator", "{", "streams", ":=", "&", "Streams", "{", "}", "\n", "for", "_", ",", "opt", ":=", "range", "opts", "{", "opt", "(", "streams", ")", "\n", "}", "\n", "if", "streams", ".", "FIFODir",...
// NewCreator returns an IO creator from the options
[ "NewCreator", "returns", "an", "IO", "creator", "from", "the", "options" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cio/io.go#L131-L155
130,092
containerd/containerd
cio/io.go
LogURI
func LogURI(uri *url.URL) Creator { return func(_ string) (IO, error) { return &logURI{ config: Config{ Stdout: uri.String(), Stderr: uri.String(), }, }, nil } }
go
func LogURI(uri *url.URL) Creator { return func(_ string) (IO, error) { return &logURI{ config: Config{ Stdout: uri.String(), Stderr: uri.String(), }, }, nil } }
[ "func", "LogURI", "(", "uri", "*", "url", ".", "URL", ")", "Creator", "{", "return", "func", "(", "_", "string", ")", "(", "IO", ",", "error", ")", "{", "return", "&", "logURI", "{", "config", ":", "Config", "{", "Stdout", ":", "uri", ".", "Strin...
// LogURI provides the raw logging URI
[ "LogURI", "provides", "the", "raw", "logging", "URI" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cio/io.go#L231-L240
130,093
containerd/containerd
cio/io.go
BinaryIO
func BinaryIO(binary string, args map[string]string) Creator { return func(_ string) (IO, error) { uri := &url.URL{ Scheme: "binary", Host: binary, } for k, v := range args { uri.Query().Set(k, v) } return &logURI{ config: Config{ Stdout: uri.String(), Stderr: uri.String(), }, }, n...
go
func BinaryIO(binary string, args map[string]string) Creator { return func(_ string) (IO, error) { uri := &url.URL{ Scheme: "binary", Host: binary, } for k, v := range args { uri.Query().Set(k, v) } return &logURI{ config: Config{ Stdout: uri.String(), Stderr: uri.String(), }, }, n...
[ "func", "BinaryIO", "(", "binary", "string", ",", "args", "map", "[", "string", "]", "string", ")", "Creator", "{", "return", "func", "(", "_", "string", ")", "(", "IO", ",", "error", ")", "{", "uri", ":=", "&", "url", ".", "URL", "{", "Scheme", ...
// BinaryIO forwards container STDOUT|STDERR directly to a logging binary
[ "BinaryIO", "forwards", "container", "STDOUT|STDERR", "directly", "to", "a", "logging", "binary" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cio/io.go#L243-L259
130,094
containerd/containerd
cio/io.go
LogFile
func LogFile(path string) Creator { return func(_ string) (IO, error) { uri := &url.URL{ Scheme: "file", Host: path, } return &logURI{ config: Config{ Stdout: uri.String(), Stderr: uri.String(), }, }, nil } }
go
func LogFile(path string) Creator { return func(_ string) (IO, error) { uri := &url.URL{ Scheme: "file", Host: path, } return &logURI{ config: Config{ Stdout: uri.String(), Stderr: uri.String(), }, }, nil } }
[ "func", "LogFile", "(", "path", "string", ")", "Creator", "{", "return", "func", "(", "_", "string", ")", "(", "IO", ",", "error", ")", "{", "uri", ":=", "&", "url", ".", "URL", "{", "Scheme", ":", "\"", "\"", ",", "Host", ":", "path", ",", "}"...
// LogFile creates a file on disk that logs the task's STDOUT,STDERR. // If the log file already exists, the logs will be appended to the file.
[ "LogFile", "creates", "a", "file", "on", "disk", "that", "logs", "the", "task", "s", "STDOUT", "STDERR", ".", "If", "the", "log", "file", "already", "exists", "the", "logs", "will", "be", "appended", "to", "the", "file", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cio/io.go#L263-L276
130,095
containerd/containerd
cio/io.go
Load
func Load(set *FIFOSet) (IO, error) { return &cio{ config: set.Config, closers: []io.Closer{set}, }, nil }
go
func Load(set *FIFOSet) (IO, error) { return &cio{ config: set.Config, closers: []io.Closer{set}, }, nil }
[ "func", "Load", "(", "set", "*", "FIFOSet", ")", "(", "IO", ",", "error", ")", "{", "return", "&", "cio", "{", "config", ":", "set", ".", "Config", ",", "closers", ":", "[", "]", "io", ".", "Closer", "{", "set", "}", ",", "}", ",", "nil", "\n...
// Load the io for a container but do not attach // // Allows io to be loaded on the task for deletion without // starting copy routines
[ "Load", "the", "io", "for", "a", "container", "but", "do", "not", "attach", "Allows", "io", "to", "be", "loaded", "on", "the", "task", "for", "deletion", "without", "starting", "copy", "routines" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cio/io.go#L302-L307
130,096
containerd/containerd
snapshots/storage/bolt.go
parentKey
func parentKey(parent, child uint64) []byte { b := make([]byte, binary.Size([]uint64{parent, child})+1) i := binary.PutUvarint(b, parent) j := binary.PutUvarint(b[i+1:], child) return b[0 : i+j+1] }
go
func parentKey(parent, child uint64) []byte { b := make([]byte, binary.Size([]uint64{parent, child})+1) i := binary.PutUvarint(b, parent) j := binary.PutUvarint(b[i+1:], child) return b[0 : i+j+1] }
[ "func", "parentKey", "(", "parent", ",", "child", "uint64", ")", "[", "]", "byte", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "binary", ".", "Size", "(", "[", "]", "uint64", "{", "parent", ",", "child", "}", ")", "+", "1", ")", "\n", ...
// parentKey returns a composite key of the parent and child identifiers. The // parts of the key are separated by a zero byte.
[ "parentKey", "returns", "a", "composite", "key", "of", "the", "parent", "and", "child", "identifiers", ".", "The", "parts", "of", "the", "key", "are", "separated", "by", "a", "zero", "byte", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/storage/bolt.go#L51-L56
130,097
containerd/containerd
snapshots/storage/bolt.go
parentPrefixKey
func parentPrefixKey(parent uint64) []byte { b := make([]byte, binary.Size(parent)+1) i := binary.PutUvarint(b, parent) return b[0 : i+1] }
go
func parentPrefixKey(parent uint64) []byte { b := make([]byte, binary.Size(parent)+1) i := binary.PutUvarint(b, parent) return b[0 : i+1] }
[ "func", "parentPrefixKey", "(", "parent", "uint64", ")", "[", "]", "byte", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "binary", ".", "Size", "(", "parent", ")", "+", "1", ")", "\n", "i", ":=", "binary", ".", "PutUvarint", "(", "b", ",", ...
// parentPrefixKey returns the parent part of the composite key with the // zero byte separator.
[ "parentPrefixKey", "returns", "the", "parent", "part", "of", "the", "composite", "key", "with", "the", "zero", "byte", "separator", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/storage/bolt.go#L60-L64
130,098
containerd/containerd
snapshots/storage/bolt.go
getParentPrefix
func getParentPrefix(b []byte) uint64 { parent, _ := binary.Uvarint(b) return parent }
go
func getParentPrefix(b []byte) uint64 { parent, _ := binary.Uvarint(b) return parent }
[ "func", "getParentPrefix", "(", "b", "[", "]", "byte", ")", "uint64", "{", "parent", ",", "_", ":=", "binary", ".", "Uvarint", "(", "b", ")", "\n", "return", "parent", "\n", "}" ]
// getParentPrefix returns the first part of the composite key which // represents the parent identifier.
[ "getParentPrefix", "returns", "the", "first", "part", "of", "the", "composite", "key", "which", "represents", "the", "parent", "identifier", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/storage/bolt.go#L68-L71
130,099
containerd/containerd
snapshots/storage/bolt.go
GetInfo
func GetInfo(ctx context.Context, key string) (string, snapshots.Info, snapshots.Usage, error) { var ( id uint64 su snapshots.Usage si = snapshots.Info{ Name: key, } ) err := withSnapshotBucket(ctx, key, func(ctx context.Context, bkt, pbkt *bolt.Bucket) error { getUsage(bkt, &su) return readSnapshot(b...
go
func GetInfo(ctx context.Context, key string) (string, snapshots.Info, snapshots.Usage, error) { var ( id uint64 su snapshots.Usage si = snapshots.Info{ Name: key, } ) err := withSnapshotBucket(ctx, key, func(ctx context.Context, bkt, pbkt *bolt.Bucket) error { getUsage(bkt, &su) return readSnapshot(b...
[ "func", "GetInfo", "(", "ctx", "context", ".", "Context", ",", "key", "string", ")", "(", "string", ",", "snapshots", ".", "Info", ",", "snapshots", ".", "Usage", ",", "error", ")", "{", "var", "(", "id", "uint64", "\n", "su", "snapshots", ".", "Usag...
// GetInfo returns the snapshot Info directly from the metadata. Requires a // context with a storage transaction.
[ "GetInfo", "returns", "the", "snapshot", "Info", "directly", "from", "the", "metadata", ".", "Requires", "a", "context", "with", "a", "storage", "transaction", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/storage/bolt.go#L75-L92