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,300
containerd/containerd
install.go
Install
func (c *Client) Install(ctx context.Context, image Image, opts ...InstallOpts) error { var config InstallConfig for _, o := range opts { o(&config) } path, err := c.getInstallPath(ctx, config) if err != nil { return err } var ( cs = image.ContentStore() platform = platforms.Default() ) manifest,...
go
func (c *Client) Install(ctx context.Context, image Image, opts ...InstallOpts) error { var config InstallConfig for _, o := range opts { o(&config) } path, err := c.getInstallPath(ctx, config) if err != nil { return err } var ( cs = image.ContentStore() platform = platforms.Default() ) manifest,...
[ "func", "(", "c", "*", "Client", ")", "Install", "(", "ctx", "context", ".", "Context", ",", "image", "Image", ",", "opts", "...", "InstallOpts", ")", "error", "{", "var", "config", "InstallConfig", "\n", "for", "_", ",", "o", ":=", "range", "opts", ...
// Install a binary image into the opt service
[ "Install", "a", "binary", "image", "into", "the", "opt", "service" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/install.go#L35-L81
130,301
containerd/containerd
runtime/v1/linux/process.go
Kill
func (p *Process) Kill(ctx context.Context, signal uint32, _ bool) error { _, err := p.t.shim.Kill(ctx, &shim.KillRequest{ Signal: signal, ID: p.id, }) if err != nil { return errdefs.FromGRPC(err) } return err }
go
func (p *Process) Kill(ctx context.Context, signal uint32, _ bool) error { _, err := p.t.shim.Kill(ctx, &shim.KillRequest{ Signal: signal, ID: p.id, }) if err != nil { return errdefs.FromGRPC(err) } return err }
[ "func", "(", "p", "*", "Process", ")", "Kill", "(", "ctx", "context", ".", "Context", ",", "signal", "uint32", ",", "_", "bool", ")", "error", "{", "_", ",", "err", ":=", "p", ".", "t", ".", "shim", ".", "Kill", "(", "ctx", ",", "&", "shim", ...
// Kill sends the provided signal to the underlying process // // Unable to kill all processes in the task using this method on a process
[ "Kill", "sends", "the", "provided", "signal", "to", "the", "underlying", "process", "Unable", "to", "kill", "all", "processes", "in", "the", "task", "using", "this", "method", "on", "a", "process" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v1/linux/process.go#L47-L56
130,302
containerd/containerd
runtime/v1/linux/process.go
State
func (p *Process) State(ctx context.Context) (runtime.State, error) { // use the container status for the status of the process response, err := p.t.shim.State(ctx, &shim.StateRequest{ ID: p.id, }) if err != nil { if errors.Cause(err) != ttrpc.ErrClosed { return runtime.State{}, errdefs.FromGRPC(err) } ...
go
func (p *Process) State(ctx context.Context) (runtime.State, error) { // use the container status for the status of the process response, err := p.t.shim.State(ctx, &shim.StateRequest{ ID: p.id, }) if err != nil { if errors.Cause(err) != ttrpc.ErrClosed { return runtime.State{}, errdefs.FromGRPC(err) } ...
[ "func", "(", "p", "*", "Process", ")", "State", "(", "ctx", "context", ".", "Context", ")", "(", "runtime", ".", "State", ",", "error", ")", "{", "// use the container status for the status of the process", "response", ",", "err", ":=", "p", ".", "t", ".", ...
// State of process
[ "State", "of", "process" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v1/linux/process.go#L59-L96
130,303
containerd/containerd
runtime/v1/linux/process.go
ResizePty
func (p *Process) ResizePty(ctx context.Context, size runtime.ConsoleSize) error { _, err := p.t.shim.ResizePty(ctx, &shim.ResizePtyRequest{ ID: p.id, Width: size.Width, Height: size.Height, }) if err != nil { err = errdefs.FromGRPC(err) } return err }
go
func (p *Process) ResizePty(ctx context.Context, size runtime.ConsoleSize) error { _, err := p.t.shim.ResizePty(ctx, &shim.ResizePtyRequest{ ID: p.id, Width: size.Width, Height: size.Height, }) if err != nil { err = errdefs.FromGRPC(err) } return err }
[ "func", "(", "p", "*", "Process", ")", "ResizePty", "(", "ctx", "context", ".", "Context", ",", "size", "runtime", ".", "ConsoleSize", ")", "error", "{", "_", ",", "err", ":=", "p", ".", "t", ".", "shim", ".", "ResizePty", "(", "ctx", ",", "&", "...
// ResizePty changes the side of the process's PTY to the provided width and height
[ "ResizePty", "changes", "the", "side", "of", "the", "process", "s", "PTY", "to", "the", "provided", "width", "and", "height" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v1/linux/process.go#L99-L109
130,304
containerd/containerd
runtime/v1/linux/process.go
Delete
func (p *Process) Delete(ctx context.Context) (*runtime.Exit, error) { r, err := p.t.shim.DeleteProcess(ctx, &shim.DeleteProcessRequest{ ID: p.id, }) if err != nil { return nil, errdefs.FromGRPC(err) } return &runtime.Exit{ Status: r.ExitStatus, Timestamp: r.ExitedAt, Pid: r.Pid, }, nil }
go
func (p *Process) Delete(ctx context.Context) (*runtime.Exit, error) { r, err := p.t.shim.DeleteProcess(ctx, &shim.DeleteProcessRequest{ ID: p.id, }) if err != nil { return nil, errdefs.FromGRPC(err) } return &runtime.Exit{ Status: r.ExitStatus, Timestamp: r.ExitedAt, Pid: r.Pid, }, nil }
[ "func", "(", "p", "*", "Process", ")", "Delete", "(", "ctx", "context", ".", "Context", ")", "(", "*", "runtime", ".", "Exit", ",", "error", ")", "{", "r", ",", "err", ":=", "p", ".", "t", ".", "shim", ".", "DeleteProcess", "(", "ctx", ",", "&"...
// Delete the process and return the exit status
[ "Delete", "the", "process", "and", "return", "the", "exit", "status" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v1/linux/process.go#L154-L166
130,305
containerd/containerd
services/tasks/local_windows.go
loadV1Runtimes
func loadV1Runtimes(ic *plugin.InitContext) (map[string]runtime.PlatformRuntime, error) { return make(map[string]runtime.PlatformRuntime), nil }
go
func loadV1Runtimes(ic *plugin.InitContext) (map[string]runtime.PlatformRuntime, error) { return make(map[string]runtime.PlatformRuntime), nil }
[ "func", "loadV1Runtimes", "(", "ic", "*", "plugin", ".", "InitContext", ")", "(", "map", "[", "string", "]", "runtime", ".", "PlatformRuntime", ",", "error", ")", "{", "return", "make", "(", "map", "[", "string", "]", "runtime", ".", "PlatformRuntime", "...
// loadV1Runtimes on Windows V2 returns an empty map. There are no v1 runtimes
[ "loadV1Runtimes", "on", "Windows", "V2", "returns", "an", "empty", "map", ".", "There", "are", "no", "v1", "runtimes" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/tasks/local_windows.go#L35-L37
130,306
containerd/containerd
rootfs/init.go
InitRootFS
func InitRootFS(ctx context.Context, name string, parent digest.Digest, readonly bool, snapshotter snapshots.Snapshotter, mounter Mounter) ([]mount.Mount, error) { _, err := snapshotter.Stat(ctx, name) if err == nil { return nil, errors.Errorf("rootfs already exists") } // TODO: ensure not exist error once added ...
go
func InitRootFS(ctx context.Context, name string, parent digest.Digest, readonly bool, snapshotter snapshots.Snapshotter, mounter Mounter) ([]mount.Mount, error) { _, err := snapshotter.Stat(ctx, name) if err == nil { return nil, errors.Errorf("rootfs already exists") } // TODO: ensure not exist error once added ...
[ "func", "InitRootFS", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "parent", "digest", ".", "Digest", ",", "readonly", "bool", ",", "snapshotter", "snapshots", ".", "Snapshotter", ",", "mounter", "Mounter", ")", "(", "[", "]", "mount"...
// InitRootFS initializes the snapshot for use as a rootfs
[ "InitRootFS", "initializes", "the", "snapshot", "for", "use", "as", "a", "rootfs" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/rootfs/init.go#L45-L68
130,307
containerd/containerd
task_opts.go
WithRootFS
func WithRootFS(mounts []mount.Mount) NewTaskOpts { return func(ctx context.Context, c *Client, ti *TaskInfo) error { ti.RootFS = mounts return nil } }
go
func WithRootFS(mounts []mount.Mount) NewTaskOpts { return func(ctx context.Context, c *Client, ti *TaskInfo) error { ti.RootFS = mounts return nil } }
[ "func", "WithRootFS", "(", "mounts", "[", "]", "mount", ".", "Mount", ")", "NewTaskOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "c", "*", "Client", ",", "ti", "*", "TaskInfo", ")", "error", "{", "ti", ".", "RootFS", "=", ...
// WithRootFS allows a task to be created without a snapshot being allocated to its container
[ "WithRootFS", "allows", "a", "task", "to", "be", "created", "without", "a", "snapshot", "being", "allocated", "to", "its", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/task_opts.go#L41-L46
130,308
containerd/containerd
task_opts.go
WithTaskCheckpoint
func WithTaskCheckpoint(im Image) NewTaskOpts { return func(ctx context.Context, c *Client, info *TaskInfo) error { desc := im.Target() id := desc.Digest index, err := decodeIndex(ctx, c.ContentStore(), desc) if err != nil { return err } for _, m := range index.Manifests { if m.MediaType == images.Me...
go
func WithTaskCheckpoint(im Image) NewTaskOpts { return func(ctx context.Context, c *Client, info *TaskInfo) error { desc := im.Target() id := desc.Digest index, err := decodeIndex(ctx, c.ContentStore(), desc) if err != nil { return err } for _, m := range index.Manifests { if m.MediaType == images.Me...
[ "func", "WithTaskCheckpoint", "(", "im", "Image", ")", "NewTaskOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "c", "*", "Client", ",", "info", "*", "TaskInfo", ")", "error", "{", "desc", ":=", "im", ".", "Target", "(", ")", ...
// WithTaskCheckpoint allows a task to be created with live runtime and memory data from a // previous checkpoint. Additional software such as CRIU may be required to // restore a task from a checkpoint
[ "WithTaskCheckpoint", "allows", "a", "task", "to", "be", "created", "with", "live", "runtime", "and", "memory", "data", "from", "a", "previous", "checkpoint", ".", "Additional", "software", "such", "as", "CRIU", "may", "be", "required", "to", "restore", "a", ...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/task_opts.go#L51-L72
130,309
containerd/containerd
task_opts.go
WithCheckpointName
func WithCheckpointName(name string) CheckpointTaskOpts { return func(r *CheckpointTaskInfo) error { r.Name = name return nil } }
go
func WithCheckpointName(name string) CheckpointTaskOpts { return func(r *CheckpointTaskInfo) error { r.Name = name return nil } }
[ "func", "WithCheckpointName", "(", "name", "string", ")", "CheckpointTaskOpts", "{", "return", "func", "(", "r", "*", "CheckpointTaskInfo", ")", "error", "{", "r", ".", "Name", "=", "name", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithCheckpointName sets the image name for the checkpoint
[ "WithCheckpointName", "sets", "the", "image", "name", "for", "the", "checkpoint" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/task_opts.go#L88-L93
130,310
containerd/containerd
task_opts.go
WithCheckpointImagePath
func WithCheckpointImagePath(path string) CheckpointTaskOpts { return func(r *CheckpointTaskInfo) error { if CheckRuntime(r.Runtime(), "io.containerd.runc") { if r.Options == nil { r.Options = &options.CheckpointOptions{} } opts, ok := r.Options.(*options.CheckpointOptions) if !ok { return errors...
go
func WithCheckpointImagePath(path string) CheckpointTaskOpts { return func(r *CheckpointTaskInfo) error { if CheckRuntime(r.Runtime(), "io.containerd.runc") { if r.Options == nil { r.Options = &options.CheckpointOptions{} } opts, ok := r.Options.(*options.CheckpointOptions) if !ok { return errors...
[ "func", "WithCheckpointImagePath", "(", "path", "string", ")", "CheckpointTaskOpts", "{", "return", "func", "(", "r", "*", "CheckpointTaskInfo", ")", "error", "{", "if", "CheckRuntime", "(", "r", ".", "Runtime", "(", ")", ",", "\"", "\"", ")", "{", "if", ...
// WithCheckpointImagePath sets image path for checkpoint option
[ "WithCheckpointImagePath", "sets", "image", "path", "for", "checkpoint", "option" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/task_opts.go#L96-L119
130,311
containerd/containerd
task_opts.go
WithRestoreImagePath
func WithRestoreImagePath(path string) NewTaskOpts { return func(ctx context.Context, c *Client, ti *TaskInfo) error { if CheckRuntime(ti.Runtime(), "io.containerd.runc") { if ti.Options == nil { ti.Options = &options.Options{} } opts, ok := ti.Options.(*options.Options) if !ok { return errors.Ne...
go
func WithRestoreImagePath(path string) NewTaskOpts { return func(ctx context.Context, c *Client, ti *TaskInfo) error { if CheckRuntime(ti.Runtime(), "io.containerd.runc") { if ti.Options == nil { ti.Options = &options.Options{} } opts, ok := ti.Options.(*options.Options) if !ok { return errors.Ne...
[ "func", "WithRestoreImagePath", "(", "path", "string", ")", "NewTaskOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "c", "*", "Client", ",", "ti", "*", "TaskInfo", ")", "error", "{", "if", "CheckRuntime", "(", "ti", ".", "Runtim...
// WithRestoreImagePath sets image path for create option
[ "WithRestoreImagePath", "sets", "image", "path", "for", "create", "option" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/task_opts.go#L122-L145
130,312
containerd/containerd
task_opts.go
WithProcessKill
func WithProcessKill(ctx context.Context, p Process) error { ctx, cancel := context.WithCancel(ctx) defer cancel() // ignore errors to wait and kill as we are forcefully killing // the process and don't care about the exit status s, err := p.Wait(ctx) if err != nil { return err } if err := p.Kill(ctx, syscall...
go
func WithProcessKill(ctx context.Context, p Process) error { ctx, cancel := context.WithCancel(ctx) defer cancel() // ignore errors to wait and kill as we are forcefully killing // the process and don't care about the exit status s, err := p.Wait(ctx) if err != nil { return err } if err := p.Kill(ctx, syscall...
[ "func", "WithProcessKill", "(", "ctx", "context", ".", "Context", ",", "p", "Process", ")", "error", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "ctx", ")", "\n", "defer", "cancel", "(", ")", "\n", "// ignore errors to wait and kill a...
// WithProcessKill will forcefully kill and delete a process
[ "WithProcessKill", "will", "forcefully", "kill", "and", "delete", "a", "process" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/task_opts.go#L151-L169
130,313
containerd/containerd
task_opts.go
WithKillAll
func WithKillAll(ctx context.Context, i *KillInfo) error { i.All = true return nil }
go
func WithKillAll(ctx context.Context, i *KillInfo) error { i.All = true return nil }
[ "func", "WithKillAll", "(", "ctx", "context", ".", "Context", ",", "i", "*", "KillInfo", ")", "error", "{", "i", ".", "All", "=", "true", "\n", "return", "nil", "\n", "}" ]
// WithKillAll kills all processes for a task
[ "WithKillAll", "kills", "all", "processes", "for", "a", "task" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/task_opts.go#L184-L187
130,314
containerd/containerd
task_opts.go
WithKillExecID
func WithKillExecID(execID string) KillOpts { return func(ctx context.Context, i *KillInfo) error { i.ExecID = execID return nil } }
go
func WithKillExecID(execID string) KillOpts { return func(ctx context.Context, i *KillInfo) error { i.ExecID = execID return nil } }
[ "func", "WithKillExecID", "(", "execID", "string", ")", "KillOpts", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "i", "*", "KillInfo", ")", "error", "{", "i", ".", "ExecID", "=", "execID", "\n", "return", "nil", "\n", "}", "\n", ...
// WithKillExecID specifies the process ID
[ "WithKillExecID", "specifies", "the", "process", "ID" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/task_opts.go#L190-L195
130,315
containerd/containerd
snapshots/devmapper/metadata.go
NewPoolMetadata
func NewPoolMetadata(dbfile string) (*PoolMetadata, error) { db, err := bolt.Open(dbfile, 0600, nil) if err != nil { return nil, err } metadata := &PoolMetadata{db: db} if err := metadata.ensureDatabaseInitialized(); err != nil { return nil, errors.Wrap(err, "failed to initialize database") } return metada...
go
func NewPoolMetadata(dbfile string) (*PoolMetadata, error) { db, err := bolt.Open(dbfile, 0600, nil) if err != nil { return nil, err } metadata := &PoolMetadata{db: db} if err := metadata.ensureDatabaseInitialized(); err != nil { return nil, errors.Wrap(err, "failed to initialize database") } return metada...
[ "func", "NewPoolMetadata", "(", "dbfile", "string", ")", "(", "*", "PoolMetadata", ",", "error", ")", "{", "db", ",", "err", ":=", "bolt", ".", "Open", "(", "dbfile", ",", "0600", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil...
// NewPoolMetadata creates new or open existing pool metadata database
[ "NewPoolMetadata", "creates", "new", "or", "open", "existing", "pool", "metadata", "database" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/metadata.go#L63-L75
130,316
containerd/containerd
snapshots/devmapper/metadata.go
ensureDatabaseInitialized
func (m *PoolMetadata) ensureDatabaseInitialized() error { return m.db.Update(func(tx *bolt.Tx) error { if _, err := tx.CreateBucketIfNotExists(devicesBucketName); err != nil { return err } if _, err := tx.CreateBucketIfNotExists(deviceIDBucketName); err != nil { return err } return nil }) }
go
func (m *PoolMetadata) ensureDatabaseInitialized() error { return m.db.Update(func(tx *bolt.Tx) error { if _, err := tx.CreateBucketIfNotExists(devicesBucketName); err != nil { return err } if _, err := tx.CreateBucketIfNotExists(deviceIDBucketName); err != nil { return err } return nil }) }
[ "func", "(", "m", "*", "PoolMetadata", ")", "ensureDatabaseInitialized", "(", ")", "error", "{", "return", "m", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error", "{", "if", "_", ",", "err", ":=", "tx", ".", "...
// ensureDatabaseInitialized creates buckets required for metadata store in order // to avoid bucket existence checks across the code
[ "ensureDatabaseInitialized", "creates", "buckets", "required", "for", "metadata", "store", "in", "order", "to", "avoid", "bucket", "existence", "checks", "across", "the", "code" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/metadata.go#L79-L91
130,317
containerd/containerd
snapshots/devmapper/metadata.go
AddDevice
func (m *PoolMetadata) AddDevice(ctx context.Context, info *DeviceInfo) error { return m.db.Update(func(tx *bolt.Tx) error { devicesBucket := tx.Bucket(devicesBucketName) // Make sure device name is unique if err := getObject(devicesBucket, info.Name, nil); err == nil { return ErrAlreadyExists } // Find...
go
func (m *PoolMetadata) AddDevice(ctx context.Context, info *DeviceInfo) error { return m.db.Update(func(tx *bolt.Tx) error { devicesBucket := tx.Bucket(devicesBucketName) // Make sure device name is unique if err := getObject(devicesBucket, info.Name, nil); err == nil { return ErrAlreadyExists } // Find...
[ "func", "(", "m", "*", "PoolMetadata", ")", "AddDevice", "(", "ctx", "context", ".", "Context", ",", "info", "*", "DeviceInfo", ")", "error", "{", "return", "m", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error"...
// AddDevice saves device info to database.
[ "AddDevice", "saves", "device", "info", "to", "database", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/metadata.go#L94-L113
130,318
containerd/containerd
snapshots/devmapper/metadata.go
getNextDeviceID
func getNextDeviceID(tx *bolt.Tx) (uint32, error) { bucket := tx.Bucket(deviceIDBucketName) cursor := bucket.Cursor() // Check if any device id can be reused. // Bolt stores its keys in byte-sorted order within a bucket. // This makes sequential iteration extremely fast. for key, taken := cursor.First(); key != ...
go
func getNextDeviceID(tx *bolt.Tx) (uint32, error) { bucket := tx.Bucket(deviceIDBucketName) cursor := bucket.Cursor() // Check if any device id can be reused. // Bolt stores its keys in byte-sorted order within a bucket. // This makes sequential iteration extremely fast. for key, taken := cursor.First(); key != ...
[ "func", "getNextDeviceID", "(", "tx", "*", "bolt", ".", "Tx", ")", "(", "uint32", ",", "error", ")", "{", "bucket", ":=", "tx", ".", "Bucket", "(", "deviceIDBucketName", ")", "\n", "cursor", ":=", "bucket", ".", "Cursor", "(", ")", "\n\n", "// Check if...
// getNextDeviceID finds the next free device ID by taking a cursor // through the deviceIDBucketName bucket and finding the next sequentially // unassigned ID. Device ID state is marked by a byte deviceFree or // deviceTaken. Low device IDs will be reused sooner.
[ "getNextDeviceID", "finds", "the", "next", "free", "device", "ID", "by", "taking", "a", "cursor", "through", "the", "deviceIDBucketName", "bucket", "and", "finding", "the", "next", "sequentially", "unassigned", "ID", ".", "Device", "ID", "state", "is", "marked",...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/metadata.go#L119-L161
130,319
containerd/containerd
snapshots/devmapper/metadata.go
markDeviceID
func markDeviceID(tx *bolt.Tx, deviceID uint32, state deviceIDState) error { var ( bucket = tx.Bucket(deviceIDBucketName) key = strconv.FormatUint(uint64(deviceID), 10) value = []byte{byte(state)} ) if err := bucket.Put([]byte(key), value); err != nil { return errors.Wrapf(err, "failed to free device id...
go
func markDeviceID(tx *bolt.Tx, deviceID uint32, state deviceIDState) error { var ( bucket = tx.Bucket(deviceIDBucketName) key = strconv.FormatUint(uint64(deviceID), 10) value = []byte{byte(state)} ) if err := bucket.Put([]byte(key), value); err != nil { return errors.Wrapf(err, "failed to free device id...
[ "func", "markDeviceID", "(", "tx", "*", "bolt", ".", "Tx", ",", "deviceID", "uint32", ",", "state", "deviceIDState", ")", "error", "{", "var", "(", "bucket", "=", "tx", ".", "Bucket", "(", "deviceIDBucketName", ")", "\n", "key", "=", "strconv", ".", "F...
// markDeviceID marks a device as deviceFree or deviceTaken
[ "markDeviceID", "marks", "a", "device", "as", "deviceFree", "or", "deviceTaken" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/metadata.go#L164-L176
130,320
containerd/containerd
snapshots/devmapper/metadata.go
UpdateDevice
func (m *PoolMetadata) UpdateDevice(ctx context.Context, name string, fn DeviceInfoCallback) error { return m.db.Update(func(tx *bolt.Tx) error { var ( device = &DeviceInfo{} bucket = tx.Bucket(devicesBucketName) ) if err := getObject(bucket, name, device); err != nil { return err } // Don't allow...
go
func (m *PoolMetadata) UpdateDevice(ctx context.Context, name string, fn DeviceInfoCallback) error { return m.db.Update(func(tx *bolt.Tx) error { var ( device = &DeviceInfo{} bucket = tx.Bucket(devicesBucketName) ) if err := getObject(bucket, name, device); err != nil { return err } // Don't allow...
[ "func", "(", "m", "*", "PoolMetadata", ")", "UpdateDevice", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "fn", "DeviceInfoCallback", ")", "error", "{", "return", "m", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bolt", ...
// UpdateDevice updates device info in metadata store. // The callback should be used to indicate whether device info update was successful or not. // An error returned from the callback will rollback the update transaction in the database. // Name and Device ID are not allowed to change.
[ "UpdateDevice", "updates", "device", "info", "in", "metadata", "store", ".", "The", "callback", "should", "be", "used", "to", "indicate", "whether", "device", "info", "update", "was", "successful", "or", "not", ".", "An", "error", "returned", "from", "the", ...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/metadata.go#L182-L211
130,321
containerd/containerd
snapshots/devmapper/metadata.go
GetDevice
func (m *PoolMetadata) GetDevice(ctx context.Context, name string) (*DeviceInfo, error) { var ( dev DeviceInfo err error ) err = m.db.View(func(tx *bolt.Tx) error { bucket := tx.Bucket(devicesBucketName) return getObject(bucket, name, &dev) }) return &dev, err }
go
func (m *PoolMetadata) GetDevice(ctx context.Context, name string) (*DeviceInfo, error) { var ( dev DeviceInfo err error ) err = m.db.View(func(tx *bolt.Tx) error { bucket := tx.Bucket(devicesBucketName) return getObject(bucket, name, &dev) }) return &dev, err }
[ "func", "(", "m", "*", "PoolMetadata", ")", "GetDevice", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "(", "*", "DeviceInfo", ",", "error", ")", "{", "var", "(", "dev", "DeviceInfo", "\n", "err", "error", "\n", ")", "\n\n", "err...
// GetDevice retrieves device info by name from database
[ "GetDevice", "retrieves", "device", "info", "by", "name", "from", "database" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/metadata.go#L214-L226
130,322
containerd/containerd
snapshots/devmapper/metadata.go
RemoveDevice
func (m *PoolMetadata) RemoveDevice(ctx context.Context, name string) error { return m.db.Update(func(tx *bolt.Tx) error { var ( device = &DeviceInfo{} bucket = tx.Bucket(devicesBucketName) ) if err := getObject(bucket, name, device); err != nil { return err } if err := bucket.Delete([]byte(name))...
go
func (m *PoolMetadata) RemoveDevice(ctx context.Context, name string) error { return m.db.Update(func(tx *bolt.Tx) error { var ( device = &DeviceInfo{} bucket = tx.Bucket(devicesBucketName) ) if err := getObject(bucket, name, device); err != nil { return err } if err := bucket.Delete([]byte(name))...
[ "func", "(", "m", "*", "PoolMetadata", ")", "RemoveDevice", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "error", "{", "return", "m", ".", "db", ".", "Update", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error", "{",...
// RemoveDevice removes device info from store.
[ "RemoveDevice", "removes", "device", "info", "from", "store", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/metadata.go#L229-L250
130,323
containerd/containerd
snapshots/devmapper/metadata.go
GetDeviceNames
func (m *PoolMetadata) GetDeviceNames(ctx context.Context) ([]string, error) { var ( names []string err error ) err = m.db.View(func(tx *bolt.Tx) error { bucket := tx.Bucket(devicesBucketName) return bucket.ForEach(func(k, _ []byte) error { names = append(names, string(k)) return nil }) }) if e...
go
func (m *PoolMetadata) GetDeviceNames(ctx context.Context) ([]string, error) { var ( names []string err error ) err = m.db.View(func(tx *bolt.Tx) error { bucket := tx.Bucket(devicesBucketName) return bucket.ForEach(func(k, _ []byte) error { names = append(names, string(k)) return nil }) }) if e...
[ "func", "(", "m", "*", "PoolMetadata", ")", "GetDeviceNames", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "(", "names", "[", "]", "string", "\n", "err", "error", "\n", ")", "\n\n", "err", "=",...
// GetDeviceNames retrieves the list of device names currently stored in database
[ "GetDeviceNames", "retrieves", "the", "list", "of", "device", "names", "currently", "stored", "in", "database" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/metadata.go#L253-L272
130,324
containerd/containerd
snapshots/devmapper/metadata.go
Close
func (m *PoolMetadata) Close() error { if err := m.db.Close(); err != nil && err != bolt.ErrDatabaseNotOpen { return err } return nil }
go
func (m *PoolMetadata) Close() error { if err := m.db.Close(); err != nil && err != bolt.ErrDatabaseNotOpen { return err } return nil }
[ "func", "(", "m", "*", "PoolMetadata", ")", "Close", "(", ")", "error", "{", "if", "err", ":=", "m", ".", "db", ".", "Close", "(", ")", ";", "err", "!=", "nil", "&&", "err", "!=", "bolt", ".", "ErrDatabaseNotOpen", "{", "return", "err", "\n", "}"...
// Close closes metadata store
[ "Close", "closes", "metadata", "store" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/metadata.go#L275-L281
130,325
containerd/containerd
runtime/v2/runc/v1/service.go
Connect
func (s *service) Connect(ctx context.Context, r *taskAPI.ConnectRequest) (*taskAPI.ConnectResponse, error) { var pid int if s.container != nil { pid = s.container.Pid() } return &taskAPI.ConnectResponse{ ShimPid: uint32(os.Getpid()), TaskPid: uint32(pid), }, nil }
go
func (s *service) Connect(ctx context.Context, r *taskAPI.ConnectRequest) (*taskAPI.ConnectResponse, error) { var pid int if s.container != nil { pid = s.container.Pid() } return &taskAPI.ConnectResponse{ ShimPid: uint32(os.Getpid()), TaskPid: uint32(pid), }, nil }
[ "func", "(", "s", "*", "service", ")", "Connect", "(", "ctx", "context", ".", "Context", ",", "r", "*", "taskAPI", ".", "ConnectRequest", ")", "(", "*", "taskAPI", ".", "ConnectResponse", ",", "error", ")", "{", "var", "pid", "int", "\n", "if", "s", ...
// Connect returns shim information such as the shim's pid
[ "Connect", "returns", "shim", "information", "such", "as", "the", "shim", "s", "pid" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/v1/service.go#L499-L508
130,326
containerd/containerd
contrib/nvidia/nvidia.go
WithGPUs
func WithGPUs(opts ...Opts) oci.SpecOpts { return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error { c := &config{} for _, o := range opts { if err := o(c); err != nil { return err } } if c.OCIHookPath == "" { path, err := exec.LookPath("containerd") if err !=...
go
func WithGPUs(opts ...Opts) oci.SpecOpts { return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error { c := &config{} for _, o := range opts { if err := o(c); err != nil { return err } } if c.OCIHookPath == "" { path, err := exec.LookPath("containerd") if err !=...
[ "func", "WithGPUs", "(", "opts", "...", "Opts", ")", "oci", ".", "SpecOpts", "{", "return", "func", "(", "_", "context", ".", "Context", ",", "_", "oci", ".", "Client", ",", "_", "*", "containers", ".", "Container", ",", "s", "*", "specs", ".", "Sp...
// WithGPUs adds NVIDIA gpu support to a container
[ "WithGPUs", "adds", "NVIDIA", "gpu", "support", "to", "a", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/contrib/nvidia/nvidia.go#L68-L104
130,327
containerd/containerd
contrib/nvidia/nvidia.go
WithDevices
func WithDevices(ids ...int) Opts { return func(c *config) error { for _, i := range ids { c.Devices = append(c.Devices, strconv.Itoa(i)) } return nil } }
go
func WithDevices(ids ...int) Opts { return func(c *config) error { for _, i := range ids { c.Devices = append(c.Devices, strconv.Itoa(i)) } return nil } }
[ "func", "WithDevices", "(", "ids", "...", "int", ")", "Opts", "{", "return", "func", "(", "c", "*", "config", ")", "error", "{", "for", "_", ",", "i", ":=", "range", "ids", "{", "c", ".", "Devices", "=", "append", "(", "c", ".", "Devices", ",", ...
// WithDevices adds the provided device indexes to the container
[ "WithDevices", "adds", "the", "provided", "device", "indexes", "to", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/contrib/nvidia/nvidia.go#L148-L155
130,328
containerd/containerd
contrib/nvidia/nvidia.go
WithDeviceUUIDs
func WithDeviceUUIDs(uuids ...string) Opts { return func(c *config) error { c.Devices = append(c.Devices, uuids...) return nil } }
go
func WithDeviceUUIDs(uuids ...string) Opts { return func(c *config) error { c.Devices = append(c.Devices, uuids...) return nil } }
[ "func", "WithDeviceUUIDs", "(", "uuids", "...", "string", ")", "Opts", "{", "return", "func", "(", "c", "*", "config", ")", "error", "{", "c", ".", "Devices", "=", "append", "(", "c", ".", "Devices", ",", "uuids", "...", ")", "\n", "return", "nil", ...
// WithDeviceUUIDs adds the specific device UUID to the container
[ "WithDeviceUUIDs", "adds", "the", "specific", "device", "UUID", "to", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/contrib/nvidia/nvidia.go#L158-L163
130,329
containerd/containerd
contrib/nvidia/nvidia.go
WithCapabilities
func WithCapabilities(caps ...Capability) Opts { return func(c *config) error { c.Capabilities = append(c.Capabilities, caps...) return nil } }
go
func WithCapabilities(caps ...Capability) Opts { return func(c *config) error { c.Capabilities = append(c.Capabilities, caps...) return nil } }
[ "func", "WithCapabilities", "(", "caps", "...", "Capability", ")", "Opts", "{", "return", "func", "(", "c", "*", "config", ")", "error", "{", "c", ".", "Capabilities", "=", "append", "(", "c", ".", "Capabilities", ",", "caps", "...", ")", "\n", "return...
// WithCapabilities adds the specified capabilities to the container for the gpus
[ "WithCapabilities", "adds", "the", "specified", "capabilities", "to", "the", "container", "for", "the", "gpus" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/contrib/nvidia/nvidia.go#L178-L183
130,330
containerd/containerd
contrib/nvidia/nvidia.go
WithRequiredCUDAVersion
func WithRequiredCUDAVersion(major, minor int) Opts { return func(c *config) error { c.Requirements = append(c.Requirements, fmt.Sprintf("cuda>=%d.%d", major, minor)) return nil } }
go
func WithRequiredCUDAVersion(major, minor int) Opts { return func(c *config) error { c.Requirements = append(c.Requirements, fmt.Sprintf("cuda>=%d.%d", major, minor)) return nil } }
[ "func", "WithRequiredCUDAVersion", "(", "major", ",", "minor", "int", ")", "Opts", "{", "return", "func", "(", "c", "*", "config", ")", "error", "{", "c", ".", "Requirements", "=", "append", "(", "c", ".", "Requirements", ",", "fmt", ".", "Sprintf", "(...
// WithRequiredCUDAVersion sets the required cuda version
[ "WithRequiredCUDAVersion", "sets", "the", "required", "cuda", "version" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/contrib/nvidia/nvidia.go#L186-L191
130,331
containerd/containerd
contrib/nvidia/nvidia.go
WithOCIHookPath
func WithOCIHookPath(path string) Opts { return func(c *config) error { c.OCIHookPath = path return nil } }
go
func WithOCIHookPath(path string) Opts { return func(c *config) error { c.OCIHookPath = path return nil } }
[ "func", "WithOCIHookPath", "(", "path", "string", ")", "Opts", "{", "return", "func", "(", "c", "*", "config", ")", "error", "{", "c", ".", "OCIHookPath", "=", "path", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithOCIHookPath sets the hook path for the binary
[ "WithOCIHookPath", "sets", "the", "hook", "path", "for", "the", "binary" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/contrib/nvidia/nvidia.go#L194-L199
130,332
containerd/containerd
contrib/nvidia/nvidia.go
WithLookupOCIHookPath
func WithLookupOCIHookPath(name string) Opts { return func(c *config) error { path, err := exec.LookPath(name) if err != nil { return err } c.OCIHookPath = path return nil } }
go
func WithLookupOCIHookPath(name string) Opts { return func(c *config) error { path, err := exec.LookPath(name) if err != nil { return err } c.OCIHookPath = path return nil } }
[ "func", "WithLookupOCIHookPath", "(", "name", "string", ")", "Opts", "{", "return", "func", "(", "c", "*", "config", ")", "error", "{", "path", ",", "err", ":=", "exec", ".", "LookPath", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return"...
// WithLookupOCIHookPath sets the hook path for the binary via a binary name
[ "WithLookupOCIHookPath", "sets", "the", "hook", "path", "for", "the", "binary", "via", "a", "binary", "name" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/contrib/nvidia/nvidia.go#L202-L211
130,333
containerd/containerd
events/exchange/exchange.go
Forward
func (e *Exchange) Forward(ctx context.Context, envelope *events.Envelope) (err error) { if err := validateEnvelope(envelope); err != nil { return err } defer func() { logger := log.G(ctx).WithFields(logrus.Fields{ "topic": envelope.Topic, "ns": envelope.Namespace, "type": envelope.Event.TypeUrl, ...
go
func (e *Exchange) Forward(ctx context.Context, envelope *events.Envelope) (err error) { if err := validateEnvelope(envelope); err != nil { return err } defer func() { logger := log.G(ctx).WithFields(logrus.Fields{ "topic": envelope.Topic, "ns": envelope.Namespace, "type": envelope.Event.TypeUrl, ...
[ "func", "(", "e", "*", "Exchange", ")", "Forward", "(", "ctx", "context", ".", "Context", ",", "envelope", "*", "events", ".", "Envelope", ")", "(", "err", "error", ")", "{", "if", "err", ":=", "validateEnvelope", "(", "envelope", ")", ";", "err", "!...
// Forward accepts an envelope to be direcly distributed on the exchange. // // This is useful when an event is forwarded on behalf of another namespace or // when the event is propagated on behalf of another publisher.
[ "Forward", "accepts", "an", "envelope", "to", "be", "direcly", "distributed", "on", "the", "exchange", ".", "This", "is", "useful", "when", "an", "event", "is", "forwarded", "on", "behalf", "of", "another", "namespace", "or", "when", "the", "event", "is", ...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/events/exchange/exchange.go#L57-L77
130,334
containerd/containerd
events/exchange/exchange.go
Publish
func (e *Exchange) Publish(ctx context.Context, topic string, event events.Event) (err error) { var ( namespace string encoded *types.Any envelope events.Envelope ) namespace, err = namespaces.NamespaceRequired(ctx) if err != nil { return errors.Wrapf(err, "failed publishing event") } if err := valida...
go
func (e *Exchange) Publish(ctx context.Context, topic string, event events.Event) (err error) { var ( namespace string encoded *types.Any envelope events.Envelope ) namespace, err = namespaces.NamespaceRequired(ctx) if err != nil { return errors.Wrapf(err, "failed publishing event") } if err := valida...
[ "func", "(", "e", "*", "Exchange", ")", "Publish", "(", "ctx", "context", ".", "Context", ",", "topic", "string", ",", "event", "events", ".", "Event", ")", "(", "err", "error", ")", "{", "var", "(", "namespace", "string", "\n", "encoded", "*", "type...
// Publish packages and sends an event. The caller will be considered the // initial publisher of the event. This means the timestamp will be calculated // at this point and this method may read from the calling context.
[ "Publish", "packages", "and", "sends", "an", "event", ".", "The", "caller", "will", "be", "considered", "the", "initial", "publisher", "of", "the", "event", ".", "This", "means", "the", "timestamp", "will", "be", "calculated", "at", "this", "point", "and", ...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/events/exchange/exchange.go#L82-L122
130,335
containerd/containerd
metadata/bolt.go
WithTransactionContext
func WithTransactionContext(ctx context.Context, tx *bolt.Tx) context.Context { return context.WithValue(ctx, transactionKey{}, tx) }
go
func WithTransactionContext(ctx context.Context, tx *bolt.Tx) context.Context { return context.WithValue(ctx, transactionKey{}, tx) }
[ "func", "WithTransactionContext", "(", "ctx", "context", ".", "Context", ",", "tx", "*", "bolt", ".", "Tx", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "transactionKey", "{", "}", ",", "tx", ")", "\n", "...
// WithTransactionContext returns a new context holding the provided // bolt transaction. Functions which require a bolt transaction will // first check to see if a transaction is already created on the // context before creating their own.
[ "WithTransactionContext", "returns", "a", "new", "context", "holding", "the", "provided", "bolt", "transaction", ".", "Functions", "which", "require", "a", "bolt", "transaction", "will", "first", "check", "to", "see", "if", "a", "transaction", "is", "already", "...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/metadata/bolt.go#L32-L34
130,336
containerd/containerd
metadata/bolt.go
view
func view(ctx context.Context, db transactor, fn func(*bolt.Tx) error) error { tx, ok := ctx.Value(transactionKey{}).(*bolt.Tx) if !ok { return db.View(fn) } return fn(tx) }
go
func view(ctx context.Context, db transactor, fn func(*bolt.Tx) error) error { tx, ok := ctx.Value(transactionKey{}).(*bolt.Tx) if !ok { return db.View(fn) } return fn(tx) }
[ "func", "view", "(", "ctx", "context", ".", "Context", ",", "db", "transactor", ",", "fn", "func", "(", "*", "bolt", ".", "Tx", ")", "error", ")", "error", "{", "tx", ",", "ok", ":=", "ctx", ".", "Value", "(", "transactionKey", "{", "}", ")", "."...
// view gets a bolt db transaction either from the context // or starts a new one with the provided bolt database.
[ "view", "gets", "a", "bolt", "db", "transaction", "either", "from", "the", "context", "or", "starts", "a", "new", "one", "with", "the", "provided", "bolt", "database", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/metadata/bolt.go#L43-L49
130,337
containerd/containerd
metadata/bolt.go
update
func update(ctx context.Context, db transactor, fn func(*bolt.Tx) error) error { tx, ok := ctx.Value(transactionKey{}).(*bolt.Tx) if !ok { return db.Update(fn) } else if !tx.Writable() { return errors.Wrap(bolt.ErrTxNotWritable, "unable to use transaction from context") } return fn(tx) }
go
func update(ctx context.Context, db transactor, fn func(*bolt.Tx) error) error { tx, ok := ctx.Value(transactionKey{}).(*bolt.Tx) if !ok { return db.Update(fn) } else if !tx.Writable() { return errors.Wrap(bolt.ErrTxNotWritable, "unable to use transaction from context") } return fn(tx) }
[ "func", "update", "(", "ctx", "context", ".", "Context", ",", "db", "transactor", ",", "fn", "func", "(", "*", "bolt", ".", "Tx", ")", "error", ")", "error", "{", "tx", ",", "ok", ":=", "ctx", ".", "Value", "(", "transactionKey", "{", "}", ")", "...
// update gets a writable bolt db transaction either from the context // or starts a new one with the provided bolt database.
[ "update", "gets", "a", "writable", "bolt", "db", "transaction", "either", "from", "the", "context", "or", "starts", "a", "new", "one", "with", "the", "provided", "bolt", "database", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/metadata/bolt.go#L53-L61
130,338
containerd/containerd
pull.go
Pull
func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (Image, error) { pullCtx := defaultRemoteContext() for _, o := range opts { if err := o(c, pullCtx); err != nil { return nil, err } } if pullCtx.PlatformMatcher == nil { if len(pullCtx.Platforms) > 1 { return nil, errors.New("can...
go
func (c *Client) Pull(ctx context.Context, ref string, opts ...RemoteOpt) (Image, error) { pullCtx := defaultRemoteContext() for _, o := range opts { if err := o(c, pullCtx); err != nil { return nil, err } } if pullCtx.PlatformMatcher == nil { if len(pullCtx.Platforms) > 1 { return nil, errors.New("can...
[ "func", "(", "c", "*", "Client", ")", "Pull", "(", "ctx", "context", ".", "Context", ",", "ref", "string", ",", "opts", "...", "RemoteOpt", ")", "(", "Image", ",", "error", ")", "{", "pullCtx", ":=", "defaultRemoteContext", "(", ")", "\n", "for", "_"...
// Pull downloads the provided content into containerd's content store // and returns a platform specific image object
[ "Pull", "downloads", "the", "provided", "content", "into", "containerd", "s", "content", "store", "and", "returns", "a", "platform", "specific", "image", "object" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/pull.go#L35-L78
130,339
containerd/containerd
rootfs/apply.go
ApplyLayers
func ApplyLayers(ctx context.Context, layers []Layer, sn snapshots.Snapshotter, a diff.Applier) (digest.Digest, error) { chain := make([]digest.Digest, len(layers)) for i, layer := range layers { chain[i] = layer.Diff.Digest } chainID := identity.ChainID(chain) // Just stat top layer, remaining layers will have...
go
func ApplyLayers(ctx context.Context, layers []Layer, sn snapshots.Snapshotter, a diff.Applier) (digest.Digest, error) { chain := make([]digest.Digest, len(layers)) for i, layer := range layers { chain[i] = layer.Diff.Digest } chainID := identity.ChainID(chain) // Just stat top layer, remaining layers will have...
[ "func", "ApplyLayers", "(", "ctx", "context", ".", "Context", ",", "layers", "[", "]", "Layer", ",", "sn", "snapshots", ".", "Snapshotter", ",", "a", "diff", ".", "Applier", ")", "(", "digest", ".", "Digest", ",", "error", ")", "{", "chain", ":=", "m...
// ApplyLayers applies all the layers using the given snapshotter and applier. // The returned result is a chain id digest representing all the applied layers. // Layers are applied in order they are given, making the first layer the // bottom-most layer in the layer chain.
[ "ApplyLayers", "applies", "all", "the", "layers", "using", "the", "given", "snapshotter", "and", "applier", ".", "The", "returned", "result", "is", "a", "chain", "id", "digest", "representing", "all", "the", "applied", "layers", ".", "Layers", "are", "applied"...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/rootfs/apply.go#L50-L72
130,340
containerd/containerd
rootfs/apply.go
ApplyLayer
func ApplyLayer(ctx context.Context, layer Layer, chain []digest.Digest, sn snapshots.Snapshotter, a diff.Applier, opts ...snapshots.Opt) (bool, error) { var ( chainID = identity.ChainID(append(chain, layer.Diff.Digest)).String() applied bool ) if _, err := sn.Stat(ctx, chainID); err != nil { if !errdefs.IsNot...
go
func ApplyLayer(ctx context.Context, layer Layer, chain []digest.Digest, sn snapshots.Snapshotter, a diff.Applier, opts ...snapshots.Opt) (bool, error) { var ( chainID = identity.ChainID(append(chain, layer.Diff.Digest)).String() applied bool ) if _, err := sn.Stat(ctx, chainID); err != nil { if !errdefs.IsNot...
[ "func", "ApplyLayer", "(", "ctx", "context", ".", "Context", ",", "layer", "Layer", ",", "chain", "[", "]", "digest", ".", "Digest", ",", "sn", "snapshots", ".", "Snapshotter", ",", "a", "diff", ".", "Applier", ",", "opts", "...", "snapshots", ".", "Op...
// ApplyLayer applies a single layer on top of the given provided layer chain, // using the provided snapshotter and applier. If the layer was unpacked true // is returned, if the layer already exists false is returned.
[ "ApplyLayer", "applies", "a", "single", "layer", "on", "top", "of", "the", "given", "provided", "layer", "chain", "using", "the", "provided", "snapshotter", "and", "applier", ".", "If", "the", "layer", "was", "unpacked", "true", "is", "returned", "if", "the"...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/rootfs/apply.go#L77-L96
130,341
containerd/containerd
leases/id.go
WithRandomID
func WithRandomID() Opt { return func(l *Lease) error { t := time.Now() var b [3]byte rand.Read(b[:]) l.ID = fmt.Sprintf("%d-%s", t.Nanosecond(), base64.URLEncoding.EncodeToString(b[:])) return nil } }
go
func WithRandomID() Opt { return func(l *Lease) error { t := time.Now() var b [3]byte rand.Read(b[:]) l.ID = fmt.Sprintf("%d-%s", t.Nanosecond(), base64.URLEncoding.EncodeToString(b[:])) return nil } }
[ "func", "WithRandomID", "(", ")", "Opt", "{", "return", "func", "(", "l", "*", "Lease", ")", "error", "{", "t", ":=", "time", ".", "Now", "(", ")", "\n", "var", "b", "[", "3", "]", "byte", "\n", "rand", ".", "Read", "(", "b", "[", ":", "]", ...
// WithRandomID sets the lease ID to a random unique value
[ "WithRandomID", "sets", "the", "lease", "ID", "to", "a", "random", "unique", "value" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/leases/id.go#L27-L35
130,342
containerd/containerd
leases/id.go
WithID
func WithID(id string) Opt { return func(l *Lease) error { l.ID = id return nil } }
go
func WithID(id string) Opt { return func(l *Lease) error { l.ID = id return nil } }
[ "func", "WithID", "(", "id", "string", ")", "Opt", "{", "return", "func", "(", "l", "*", "Lease", ")", "error", "{", "l", ".", "ID", "=", "id", "\n", "return", "nil", "\n", "}", "\n", "}" ]
// WithID sets the ID for the lease
[ "WithID", "sets", "the", "ID", "for", "the", "lease" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/leases/id.go#L38-L43
130,343
containerd/containerd
snapshots/devmapper/snapshotter.go
Stat
func (s *Snapshotter) Stat(ctx context.Context, key string) (snapshots.Info, error) { log.G(ctx).WithField("key", key).Debug("stat") var ( info snapshots.Info err error ) err = s.withTransaction(ctx, false, func(ctx context.Context) error { _, info, _, err = storage.GetInfo(ctx, key) return err }) ret...
go
func (s *Snapshotter) Stat(ctx context.Context, key string) (snapshots.Info, error) { log.G(ctx).WithField("key", key).Debug("stat") var ( info snapshots.Info err error ) err = s.withTransaction(ctx, false, func(ctx context.Context) error { _, info, _, err = storage.GetInfo(ctx, key) return err }) ret...
[ "func", "(", "s", "*", "Snapshotter", ")", "Stat", "(", "ctx", "context", ".", "Context", ",", "key", "string", ")", "(", "snapshots", ".", "Info", ",", "error", ")", "{", "log", ".", "G", "(", "ctx", ")", ".", "WithField", "(", "\"", "\"", ",", ...
// Stat returns the info for an active or committed snapshot from store
[ "Stat", "returns", "the", "info", "for", "an", "active", "or", "committed", "snapshot", "from", "store" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L130-L144
130,344
containerd/containerd
snapshots/devmapper/snapshotter.go
Update
func (s *Snapshotter) Update(ctx context.Context, info snapshots.Info, fieldpaths ...string) (snapshots.Info, error) { log.G(ctx).Debugf("update: %s", strings.Join(fieldpaths, ", ")) var err error err = s.withTransaction(ctx, true, func(ctx context.Context) error { info, err = storage.UpdateInfo(ctx, info, fieldp...
go
func (s *Snapshotter) Update(ctx context.Context, info snapshots.Info, fieldpaths ...string) (snapshots.Info, error) { log.G(ctx).Debugf("update: %s", strings.Join(fieldpaths, ", ")) var err error err = s.withTransaction(ctx, true, func(ctx context.Context) error { info, err = storage.UpdateInfo(ctx, info, fieldp...
[ "func", "(", "s", "*", "Snapshotter", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "info", "snapshots", ".", "Info", ",", "fieldpaths", "...", "string", ")", "(", "snapshots", ".", "Info", ",", "error", ")", "{", "log", ".", "G", "(", ...
// Update updates an existing snapshot info's data
[ "Update", "updates", "an", "existing", "snapshot", "info", "s", "data" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L147-L157
130,345
containerd/containerd
snapshots/devmapper/snapshotter.go
Usage
func (s *Snapshotter) Usage(ctx context.Context, key string) (snapshots.Usage, error) { log.G(ctx).WithField("key", key).Debug("usage") var ( id string err error info snapshots.Info usage snapshots.Usage ) err = s.withTransaction(ctx, false, func(ctx context.Context) error { id, info, usage, err =...
go
func (s *Snapshotter) Usage(ctx context.Context, key string) (snapshots.Usage, error) { log.G(ctx).WithField("key", key).Debug("usage") var ( id string err error info snapshots.Info usage snapshots.Usage ) err = s.withTransaction(ctx, false, func(ctx context.Context) error { id, info, usage, err =...
[ "func", "(", "s", "*", "Snapshotter", ")", "Usage", "(", "ctx", "context", ".", "Context", ",", "key", "string", ")", "(", "snapshots", ".", "Usage", ",", "error", ")", "{", "log", ".", "G", "(", "ctx", ")", ".", "WithField", "(", "\"", "\"", ","...
// Usage returns the resource usage of an active or committed snapshot excluding the usage of parent snapshots.
[ "Usage", "returns", "the", "resource", "usage", "of", "an", "active", "or", "committed", "snapshot", "excluding", "the", "usage", "of", "parent", "snapshots", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L160-L199
130,346
containerd/containerd
snapshots/devmapper/snapshotter.go
Mounts
func (s *Snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, error) { log.G(ctx).WithField("key", key).Debug("mounts") var ( snap storage.Snapshot err error ) err = s.withTransaction(ctx, false, func(ctx context.Context) error { snap, err = storage.GetSnapshot(ctx, key) return err }) ...
go
func (s *Snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, error) { log.G(ctx).WithField("key", key).Debug("mounts") var ( snap storage.Snapshot err error ) err = s.withTransaction(ctx, false, func(ctx context.Context) error { snap, err = storage.GetSnapshot(ctx, key) return err }) ...
[ "func", "(", "s", "*", "Snapshotter", ")", "Mounts", "(", "ctx", "context", ".", "Context", ",", "key", "string", ")", "(", "[", "]", "mount", ".", "Mount", ",", "error", ")", "{", "log", ".", "G", "(", "ctx", ")", ".", "WithField", "(", "\"", ...
// Mounts return the list of mounts for the active or view snapshot
[ "Mounts", "return", "the", "list", "of", "mounts", "for", "the", "active", "or", "view", "snapshot" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L202-L216
130,347
containerd/containerd
snapshots/devmapper/snapshotter.go
Prepare
func (s *Snapshotter) Prepare(ctx context.Context, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error) { log.G(ctx).WithFields(logrus.Fields{"key": key, "parent": parent}).Debug("prepare") var ( mounts []mount.Mount err error ) err = s.withTransaction(ctx, true, func(ctx context.Context) erro...
go
func (s *Snapshotter) Prepare(ctx context.Context, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error) { log.G(ctx).WithFields(logrus.Fields{"key": key, "parent": parent}).Debug("prepare") var ( mounts []mount.Mount err error ) err = s.withTransaction(ctx, true, func(ctx context.Context) erro...
[ "func", "(", "s", "*", "Snapshotter", ")", "Prepare", "(", "ctx", "context", ".", "Context", ",", "key", ",", "parent", "string", ",", "opts", "...", "snapshots", ".", "Opt", ")", "(", "[", "]", "mount", ".", "Mount", ",", "error", ")", "{", "log",...
// Prepare creates thin device for an active snapshot identified by key
[ "Prepare", "creates", "thin", "device", "for", "an", "active", "snapshot", "identified", "by", "key" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L219-L233
130,348
containerd/containerd
snapshots/devmapper/snapshotter.go
Commit
func (s *Snapshotter) Commit(ctx context.Context, name, key string, opts ...snapshots.Opt) error { log.G(ctx).WithFields(logrus.Fields{"name": name, "key": key}).Debug("commit") return s.withTransaction(ctx, true, func(ctx context.Context) error { id, _, _, err := storage.GetInfo(ctx, key) if err != nil { ret...
go
func (s *Snapshotter) Commit(ctx context.Context, name, key string, opts ...snapshots.Opt) error { log.G(ctx).WithFields(logrus.Fields{"name": name, "key": key}).Debug("commit") return s.withTransaction(ctx, true, func(ctx context.Context) error { id, _, _, err := storage.GetInfo(ctx, key) if err != nil { ret...
[ "func", "(", "s", "*", "Snapshotter", ")", "Commit", "(", "ctx", "context", ".", "Context", ",", "name", ",", "key", "string", ",", "opts", "...", "snapshots", ".", "Opt", ")", "error", "{", "log", ".", "G", "(", "ctx", ")", ".", "WithFields", "(",...
// Commit marks an active snapshot as committed in meta store. // Block device unmount operation captures snapshot changes by itself, so no // additional actions needed within Commit operation.
[ "Commit", "marks", "an", "active", "snapshot", "as", "committed", "in", "meta", "store", ".", "Block", "device", "unmount", "operation", "captures", "snapshot", "changes", "by", "itself", "so", "no", "additional", "actions", "needed", "within", "Commit", "operat...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L255-L277
130,349
containerd/containerd
snapshots/devmapper/snapshotter.go
Remove
func (s *Snapshotter) Remove(ctx context.Context, key string) error { log.G(ctx).WithField("key", key).Debug("remove") return s.withTransaction(ctx, true, func(ctx context.Context) error { return s.removeDevice(ctx, key) }) }
go
func (s *Snapshotter) Remove(ctx context.Context, key string) error { log.G(ctx).WithField("key", key).Debug("remove") return s.withTransaction(ctx, true, func(ctx context.Context) error { return s.removeDevice(ctx, key) }) }
[ "func", "(", "s", "*", "Snapshotter", ")", "Remove", "(", "ctx", "context", ".", "Context", ",", "key", "string", ")", "error", "{", "log", ".", "G", "(", "ctx", ")", ".", "WithField", "(", "\"", "\"", ",", "key", ")", ".", "Debug", "(", "\"", ...
// Remove removes thin device and snapshot metadata by key
[ "Remove", "removes", "thin", "device", "and", "snapshot", "metadata", "by", "key" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L280-L286
130,350
containerd/containerd
snapshots/devmapper/snapshotter.go
Walk
func (s *Snapshotter) Walk(ctx context.Context, fn func(context.Context, snapshots.Info) error) error { log.G(ctx).Debug("walk") return s.withTransaction(ctx, false, func(ctx context.Context) error { return storage.WalkInfo(ctx, fn) }) }
go
func (s *Snapshotter) Walk(ctx context.Context, fn func(context.Context, snapshots.Info) error) error { log.G(ctx).Debug("walk") return s.withTransaction(ctx, false, func(ctx context.Context) error { return storage.WalkInfo(ctx, fn) }) }
[ "func", "(", "s", "*", "Snapshotter", ")", "Walk", "(", "ctx", "context", ".", "Context", ",", "fn", "func", "(", "context", ".", "Context", ",", "snapshots", ".", "Info", ")", "error", ")", "error", "{", "log", ".", "G", "(", "ctx", ")", ".", "D...
// Walk iterates through all metadata Info for the stored snapshots and calls the provided function for each.
[ "Walk", "iterates", "through", "all", "metadata", "Info", "for", "the", "stored", "snapshots", "and", "calls", "the", "provided", "function", "for", "each", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L304-L309
130,351
containerd/containerd
snapshots/devmapper/snapshotter.go
ResetPool
func (s *Snapshotter) ResetPool(ctx context.Context) error { names, err := s.pool.metadata.GetDeviceNames(ctx) if err != nil { return err } var result *multierror.Error for _, name := range names { if err := s.pool.RemoveDevice(ctx, name); err != nil { result = multierror.Append(result, err) } } retur...
go
func (s *Snapshotter) ResetPool(ctx context.Context) error { names, err := s.pool.metadata.GetDeviceNames(ctx) if err != nil { return err } var result *multierror.Error for _, name := range names { if err := s.pool.RemoveDevice(ctx, name); err != nil { result = multierror.Append(result, err) } } retur...
[ "func", "(", "s", "*", "Snapshotter", ")", "ResetPool", "(", "ctx", "context", ".", "Context", ")", "error", "{", "names", ",", "err", ":=", "s", ".", "pool", ".", "metadata", ".", "GetDeviceNames", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", ...
// ResetPool deactivates and deletes all thin devices in thin-pool. // Used for cleaning pool after benchmarking.
[ "ResetPool", "deactivates", "and", "deletes", "all", "thin", "devices", "in", "thin", "-", "pool", ".", "Used", "for", "cleaning", "pool", "after", "benchmarking", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L313-L327
130,352
containerd/containerd
snapshots/devmapper/snapshotter.go
Close
func (s *Snapshotter) Close() error { log.L.Debug("close") var result *multierror.Error s.closeOnce.Do(func() { for _, fn := range s.cleanupFn { if err := fn(); err != nil { result = multierror.Append(result, err) } } }) return result.ErrorOrNil() }
go
func (s *Snapshotter) Close() error { log.L.Debug("close") var result *multierror.Error s.closeOnce.Do(func() { for _, fn := range s.cleanupFn { if err := fn(); err != nil { result = multierror.Append(result, err) } } }) return result.ErrorOrNil() }
[ "func", "(", "s", "*", "Snapshotter", ")", "Close", "(", ")", "error", "{", "log", ".", "L", ".", "Debug", "(", "\"", "\"", ")", "\n\n", "var", "result", "*", "multierror", ".", "Error", "\n", "s", ".", "closeOnce", ".", "Do", "(", "func", "(", ...
// Close releases devmapper snapshotter resources. // All subsequent Close calls will be ignored.
[ "Close", "releases", "devmapper", "snapshotter", "resources", ".", "All", "subsequent", "Close", "calls", "will", "be", "ignored", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L331-L344
130,353
containerd/containerd
snapshots/devmapper/snapshotter.go
mkfs
func (s *Snapshotter) mkfs(ctx context.Context, deviceName string) error { args := []string{ "-E", // We don't want any zeroing in advance when running mkfs on thin devices (see "man mkfs.ext4") "nodiscard,lazy_itable_init=0,lazy_journal_init=0", dmsetup.GetFullDevicePath(deviceName), } log.G(ctx).Debugf("m...
go
func (s *Snapshotter) mkfs(ctx context.Context, deviceName string) error { args := []string{ "-E", // We don't want any zeroing in advance when running mkfs on thin devices (see "man mkfs.ext4") "nodiscard,lazy_itable_init=0,lazy_journal_init=0", dmsetup.GetFullDevicePath(deviceName), } log.G(ctx).Debugf("m...
[ "func", "(", "s", "*", "Snapshotter", ")", "mkfs", "(", "ctx", "context", ".", "Context", ",", "deviceName", "string", ")", "error", "{", "args", ":=", "[", "]", "string", "{", "\"", "\"", ",", "// We don't want any zeroing in advance when running mkfs on thin d...
// mkfs creates ext4 filesystem on the given devmapper device
[ "mkfs", "creates", "ext4", "filesystem", "on", "the", "given", "devmapper", "device" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L390-L407
130,354
containerd/containerd
snapshots/devmapper/snapshotter.go
withTransaction
func (s *Snapshotter) withTransaction(ctx context.Context, writable bool, fn func(ctx context.Context) error) error { ctx, trans, err := s.store.TransactionContext(ctx, writable) if err != nil { return err } var result *multierror.Error err = fn(ctx) if err != nil { result = multierror.Append(result, err) ...
go
func (s *Snapshotter) withTransaction(ctx context.Context, writable bool, fn func(ctx context.Context) error) error { ctx, trans, err := s.store.TransactionContext(ctx, writable) if err != nil { return err } var result *multierror.Error err = fn(ctx) if err != nil { result = multierror.Append(result, err) ...
[ "func", "(", "s", "*", "Snapshotter", ")", "withTransaction", "(", "ctx", "context", ".", "Context", ",", "writable", "bool", ",", "fn", "func", "(", "ctx", "context", ".", "Context", ")", "error", ")", "error", "{", "ctx", ",", "trans", ",", "err", ...
// withTransaction wraps fn callback with containerd's meta store transaction. // If callback returns an error or transaction is not writable, database transaction will be discarded.
[ "withTransaction", "wraps", "fn", "callback", "with", "containerd", "s", "meta", "store", "transaction", ".", "If", "callback", "returns", "an", "error", "or", "transaction", "is", "not", "writable", "database", "transaction", "will", "be", "discarded", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/devmapper/snapshotter.go#L439-L477
130,355
containerd/containerd
snapshots/overlay/check.go
Supported
func Supported(root string) error { if err := os.MkdirAll(root, 0700); err != nil { return err } supportsDType, err := fs.SupportsDType(root) if err != nil { return err } if !supportsDType { return fmt.Errorf("%s does not support d_type. If the backing filesystem is xfs, please reformat with ftype=1 to enab...
go
func Supported(root string) error { if err := os.MkdirAll(root, 0700); err != nil { return err } supportsDType, err := fs.SupportsDType(root) if err != nil { return err } if !supportsDType { return fmt.Errorf("%s does not support d_type. If the backing filesystem is xfs, please reformat with ftype=1 to enab...
[ "func", "Supported", "(", "root", "string", ")", "error", "{", "if", "err", ":=", "os", ".", "MkdirAll", "(", "root", ",", "0700", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "supportsDType", ",", "err", ":=", "fs", ".", ...
// Supported returns nil when the overlayfs is functional on the system with the root directory. // Supported is not called during plugin initialization, but exposed for downstream projects which uses // this snapshotter as a library.
[ "Supported", "returns", "nil", "when", "the", "overlayfs", "is", "functional", "on", "the", "system", "with", "the", "root", "directory", ".", "Supported", "is", "not", "called", "during", "plugin", "initialization", "but", "exposed", "for", "downstream", "proje...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/snapshots/overlay/check.go#L76-L88
130,356
containerd/containerd
services/tasks/local.go
getCheckpointPath
func getCheckpointPath(runtime string, option *ptypes.Any) (string, error) { if option == nil { return "", nil } var checkpointPath string switch { case checkRuntime(runtime, "io.containerd.runc"): v, err := typeurl.UnmarshalAny(option) if err != nil { return "", err } opts, ok := v.(*options.Checkpo...
go
func getCheckpointPath(runtime string, option *ptypes.Any) (string, error) { if option == nil { return "", nil } var checkpointPath string switch { case checkRuntime(runtime, "io.containerd.runc"): v, err := typeurl.UnmarshalAny(option) if err != nil { return "", err } opts, ok := v.(*options.Checkpo...
[ "func", "getCheckpointPath", "(", "runtime", "string", ",", "option", "*", "ptypes", ".", "Any", ")", "(", "string", ",", "error", ")", "{", "if", "option", "==", "nil", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "var", "checkpointPath",...
// getCheckpointPath only suitable for runc runtime now
[ "getCheckpointPath", "only", "suitable", "for", "runc", "runtime", "now" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/tasks/local.go#L687-L718
130,357
containerd/containerd
services/tasks/local.go
getRestorePath
func getRestorePath(runtime string, option *ptypes.Any) (string, error) { if option == nil { return "", nil } var restorePath string switch { case checkRuntime(runtime, "io.containerd.runc"): v, err := typeurl.UnmarshalAny(option) if err != nil { return "", err } opts, ok := v.(*options.Options) if...
go
func getRestorePath(runtime string, option *ptypes.Any) (string, error) { if option == nil { return "", nil } var restorePath string switch { case checkRuntime(runtime, "io.containerd.runc"): v, err := typeurl.UnmarshalAny(option) if err != nil { return "", err } opts, ok := v.(*options.Options) if...
[ "func", "getRestorePath", "(", "runtime", "string", ",", "option", "*", "ptypes", ".", "Any", ")", "(", "string", ",", "error", ")", "{", "if", "option", "==", "nil", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n\n", "var", "restorePath", "st...
// getRestorePath only suitable for runc runtime now
[ "getRestorePath", "only", "suitable", "for", "runc", "runtime", "now" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/tasks/local.go#L721-L751
130,358
containerd/containerd
cmd/ctr/commands/client.go
AppContext
func AppContext(context *cli.Context) (gocontext.Context, gocontext.CancelFunc) { var ( ctx = gocontext.Background() timeout = context.GlobalDuration("timeout") namespace = context.GlobalString("namespace") cancel gocontext.CancelFunc ) ctx = namespaces.WithNamespace(ctx, namespace) if timeout > ...
go
func AppContext(context *cli.Context) (gocontext.Context, gocontext.CancelFunc) { var ( ctx = gocontext.Background() timeout = context.GlobalDuration("timeout") namespace = context.GlobalString("namespace") cancel gocontext.CancelFunc ) ctx = namespaces.WithNamespace(ctx, namespace) if timeout > ...
[ "func", "AppContext", "(", "context", "*", "cli", ".", "Context", ")", "(", "gocontext", ".", "Context", ",", "gocontext", ".", "CancelFunc", ")", "{", "var", "(", "ctx", "=", "gocontext", ".", "Background", "(", ")", "\n", "timeout", "=", "context", "...
// AppContext returns the context for a command. Should only be called once per // command, near the start. // // This will ensure the namespace is picked up and set the timeout, if one is // defined.
[ "AppContext", "returns", "the", "context", "for", "a", "command", ".", "Should", "only", "be", "called", "once", "per", "command", "near", "the", "start", ".", "This", "will", "ensure", "the", "namespace", "is", "picked", "up", "and", "set", "the", "timeou...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cmd/ctr/commands/client.go#L32-L46
130,359
containerd/containerd
cmd/ctr/commands/client.go
NewClient
func NewClient(context *cli.Context, opts ...containerd.ClientOpt) (*containerd.Client, gocontext.Context, gocontext.CancelFunc, error) { client, err := containerd.New(context.GlobalString("address"), opts...) if err != nil { return nil, nil, nil, err } ctx, cancel := AppContext(context) return client, ctx, canc...
go
func NewClient(context *cli.Context, opts ...containerd.ClientOpt) (*containerd.Client, gocontext.Context, gocontext.CancelFunc, error) { client, err := containerd.New(context.GlobalString("address"), opts...) if err != nil { return nil, nil, nil, err } ctx, cancel := AppContext(context) return client, ctx, canc...
[ "func", "NewClient", "(", "context", "*", "cli", ".", "Context", ",", "opts", "...", "containerd", ".", "ClientOpt", ")", "(", "*", "containerd", ".", "Client", ",", "gocontext", ".", "Context", ",", "gocontext", ".", "CancelFunc", ",", "error", ")", "{"...
// NewClient returns a new containerd client
[ "NewClient", "returns", "a", "new", "containerd", "client" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/cmd/ctr/commands/client.go#L49-L56
130,360
containerd/containerd
runtime/v2/runc/container.go
ReadRuntime
func ReadRuntime(path string) (string, error) { data, err := ioutil.ReadFile(filepath.Join(path, "runtime")) if err != nil { return "", err } return string(data), nil }
go
func ReadRuntime(path string) (string, error) { data, err := ioutil.ReadFile(filepath.Join(path, "runtime")) if err != nil { return "", err } return string(data), nil }
[ "func", "ReadRuntime", "(", "path", "string", ")", "(", "string", ",", "error", ")", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "filepath", ".", "Join", "(", "path", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "...
// ReadRuntime reads the runtime information from the path
[ "ReadRuntime", "reads", "the", "runtime", "information", "from", "the", "path" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L135-L141
130,361
containerd/containerd
runtime/v2/runc/container.go
WriteRuntime
func WriteRuntime(path, runtime string) error { return ioutil.WriteFile(filepath.Join(path, "runtime"), []byte(runtime), 0600) }
go
func WriteRuntime(path, runtime string) error { return ioutil.WriteFile(filepath.Join(path, "runtime"), []byte(runtime), 0600) }
[ "func", "WriteRuntime", "(", "path", ",", "runtime", "string", ")", "error", "{", "return", "ioutil", ".", "WriteFile", "(", "filepath", ".", "Join", "(", "path", ",", "\"", "\"", ")", ",", "[", "]", "byte", "(", "runtime", ")", ",", "0600", ")", "...
// WriteRuntime writes the runtime information into the path
[ "WriteRuntime", "writes", "the", "runtime", "information", "into", "the", "path" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L144-L146
130,362
containerd/containerd
runtime/v2/runc/container.go
All
func (c *Container) All() (o []rproc.Process) { c.mu.Lock() defer c.mu.Unlock() for _, p := range c.processes { o = append(o, p) } if c.process != nil { o = append(o, c.process) } return o }
go
func (c *Container) All() (o []rproc.Process) { c.mu.Lock() defer c.mu.Unlock() for _, p := range c.processes { o = append(o, p) } if c.process != nil { o = append(o, c.process) } return o }
[ "func", "(", "c", "*", "Container", ")", "All", "(", ")", "(", "o", "[", "]", "rproc", ".", "Process", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "for", "_", ",", "p", ...
// All processes in the container
[ "All", "processes", "in", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L189-L200
130,363
containerd/containerd
runtime/v2/runc/container.go
ExecdProcesses
func (c *Container) ExecdProcesses() (o []rproc.Process) { c.mu.Lock() defer c.mu.Unlock() for _, p := range c.processes { o = append(o, p) } return o }
go
func (c *Container) ExecdProcesses() (o []rproc.Process) { c.mu.Lock() defer c.mu.Unlock() for _, p := range c.processes { o = append(o, p) } return o }
[ "func", "(", "c", "*", "Container", ")", "ExecdProcesses", "(", ")", "(", "o", "[", "]", "rproc", ".", "Process", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "for", "_", ",", ...
// ExecdProcesses added to the container
[ "ExecdProcesses", "added", "to", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L203-L210
130,364
containerd/containerd
runtime/v2/runc/container.go
Pid
func (c *Container) Pid() int { c.mu.Lock() defer c.mu.Unlock() return c.process.Pid() }
go
func (c *Container) Pid() int { c.mu.Lock() defer c.mu.Unlock() return c.process.Pid() }
[ "func", "(", "c", "*", "Container", ")", "Pid", "(", ")", "int", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "c", ".", "process", ".", "Pid", "(", ")", "\n", "}" ]
// Pid of the main process of a container
[ "Pid", "of", "the", "main", "process", "of", "a", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L213-L217
130,365
containerd/containerd
runtime/v2/runc/container.go
CgroupSet
func (c *Container) CgroupSet(cg cgroups.Cgroup) { c.mu.Lock() c.cgroup = cg c.mu.Unlock() }
go
func (c *Container) CgroupSet(cg cgroups.Cgroup) { c.mu.Lock() c.cgroup = cg c.mu.Unlock() }
[ "func", "(", "c", "*", "Container", ")", "CgroupSet", "(", "cg", "cgroups", ".", "Cgroup", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "c", ".", "cgroup", "=", "cg", "\n", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
// CgroupSet sets the cgroup to the container
[ "CgroupSet", "sets", "the", "cgroup", "to", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L227-L231
130,366
containerd/containerd
runtime/v2/runc/container.go
Process
func (c *Container) Process(id string) (rproc.Process, error) { c.mu.Lock() defer c.mu.Unlock() if id == "" { if c.process == nil { return nil, errors.Wrapf(errdefs.ErrFailedPrecondition, "container must be created") } return c.process, nil } p, ok := c.processes[id] if !ok { return nil, errors.Wrapf(e...
go
func (c *Container) Process(id string) (rproc.Process, error) { c.mu.Lock() defer c.mu.Unlock() if id == "" { if c.process == nil { return nil, errors.Wrapf(errdefs.ErrFailedPrecondition, "container must be created") } return c.process, nil } p, ok := c.processes[id] if !ok { return nil, errors.Wrapf(e...
[ "func", "(", "c", "*", "Container", ")", "Process", "(", "id", "string", ")", "(", "rproc", ".", "Process", ",", "error", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "if", "id...
// Process returns the process by id
[ "Process", "returns", "the", "process", "by", "id" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L234-L248
130,367
containerd/containerd
runtime/v2/runc/container.go
ProcessExists
func (c *Container) ProcessExists(id string) bool { c.mu.Lock() defer c.mu.Unlock() _, ok := c.processes[id] return ok }
go
func (c *Container) ProcessExists(id string) bool { c.mu.Lock() defer c.mu.Unlock() _, ok := c.processes[id] return ok }
[ "func", "(", "c", "*", "Container", ")", "ProcessExists", "(", "id", "string", ")", "bool", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "_", ",", "ok", ":=", "c", ".", "processes", ...
// ProcessExists returns true if the process by id exists
[ "ProcessExists", "returns", "true", "if", "the", "process", "by", "id", "exists" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L251-L256
130,368
containerd/containerd
runtime/v2/runc/container.go
ProcessAdd
func (c *Container) ProcessAdd(process rproc.Process) { c.mu.Lock() defer c.mu.Unlock() c.processes[process.ID()] = process }
go
func (c *Container) ProcessAdd(process rproc.Process) { c.mu.Lock() defer c.mu.Unlock() c.processes[process.ID()] = process }
[ "func", "(", "c", "*", "Container", ")", "ProcessAdd", "(", "process", "rproc", ".", "Process", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "c", ".", "processes", "[", "process", ...
// ProcessAdd adds a new process to the container
[ "ProcessAdd", "adds", "a", "new", "process", "to", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L259-L263
130,369
containerd/containerd
runtime/v2/runc/container.go
ProcessRemove
func (c *Container) ProcessRemove(id string) { c.mu.Lock() defer c.mu.Unlock() delete(c.processes, id) }
go
func (c *Container) ProcessRemove(id string) { c.mu.Lock() defer c.mu.Unlock() delete(c.processes, id) }
[ "func", "(", "c", "*", "Container", ")", "ProcessRemove", "(", "id", "string", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "mu", ".", "Unlock", "(", ")", "\n", "delete", "(", "c", ".", "processes", ",", "id", ")", ...
// ProcessRemove removes the process by id from the container
[ "ProcessRemove", "removes", "the", "process", "by", "id", "from", "the", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L266-L270
130,370
containerd/containerd
runtime/v2/runc/container.go
Start
func (c *Container) Start(ctx context.Context, r *task.StartRequest) (rproc.Process, error) { p, err := c.Process(r.ExecID) if err != nil { return nil, err } if err := p.Start(ctx); err != nil { return nil, err } if c.Cgroup() == nil && p.Pid() > 0 { cg, err := cgroups.Load(cgroups.V1, cgroups.PidPath(p.Pid...
go
func (c *Container) Start(ctx context.Context, r *task.StartRequest) (rproc.Process, error) { p, err := c.Process(r.ExecID) if err != nil { return nil, err } if err := p.Start(ctx); err != nil { return nil, err } if c.Cgroup() == nil && p.Pid() > 0 { cg, err := cgroups.Load(cgroups.V1, cgroups.PidPath(p.Pid...
[ "func", "(", "c", "*", "Container", ")", "Start", "(", "ctx", "context", ".", "Context", ",", "r", "*", "task", ".", "StartRequest", ")", "(", "rproc", ".", "Process", ",", "error", ")", "{", "p", ",", "err", ":=", "c", ".", "Process", "(", "r", ...
// Start a container process
[ "Start", "a", "container", "process" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L273-L289
130,371
containerd/containerd
runtime/v2/runc/container.go
Delete
func (c *Container) Delete(ctx context.Context, r *task.DeleteRequest) (rproc.Process, error) { p, err := c.Process(r.ExecID) if err != nil { return nil, err } if err := p.Delete(ctx); err != nil { return nil, err } if r.ExecID != "" { c.ProcessRemove(r.ExecID) } return p, nil }
go
func (c *Container) Delete(ctx context.Context, r *task.DeleteRequest) (rproc.Process, error) { p, err := c.Process(r.ExecID) if err != nil { return nil, err } if err := p.Delete(ctx); err != nil { return nil, err } if r.ExecID != "" { c.ProcessRemove(r.ExecID) } return p, nil }
[ "func", "(", "c", "*", "Container", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "r", "*", "task", ".", "DeleteRequest", ")", "(", "rproc", ".", "Process", ",", "error", ")", "{", "p", ",", "err", ":=", "c", ".", "Process", "(", "r"...
// Delete the container or a process by id
[ "Delete", "the", "container", "or", "a", "process", "by", "id" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L292-L304
130,372
containerd/containerd
runtime/v2/runc/container.go
Exec
func (c *Container) Exec(ctx context.Context, r *task.ExecProcessRequest) (rproc.Process, error) { process, err := c.process.(*proc.Init).Exec(ctx, c.Bundle, &proc.ExecConfig{ ID: r.ExecID, Terminal: r.Terminal, Stdin: r.Stdin, Stdout: r.Stdout, Stderr: r.Stderr, Spec: r.Spec, }) if err ...
go
func (c *Container) Exec(ctx context.Context, r *task.ExecProcessRequest) (rproc.Process, error) { process, err := c.process.(*proc.Init).Exec(ctx, c.Bundle, &proc.ExecConfig{ ID: r.ExecID, Terminal: r.Terminal, Stdin: r.Stdin, Stdout: r.Stdout, Stderr: r.Stderr, Spec: r.Spec, }) if err ...
[ "func", "(", "c", "*", "Container", ")", "Exec", "(", "ctx", "context", ".", "Context", ",", "r", "*", "task", ".", "ExecProcessRequest", ")", "(", "rproc", ".", "Process", ",", "error", ")", "{", "process", ",", "err", ":=", "c", ".", "process", "...
// Exec an additional process
[ "Exec", "an", "additional", "process" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L307-L321
130,373
containerd/containerd
runtime/v2/runc/container.go
Update
func (c *Container) Update(ctx context.Context, r *task.UpdateTaskRequest) error { p, err := c.Process("") if err != nil { return err } return p.(*proc.Init).Update(ctx, r.Resources) }
go
func (c *Container) Update(ctx context.Context, r *task.UpdateTaskRequest) error { p, err := c.Process("") if err != nil { return err } return p.(*proc.Init).Update(ctx, r.Resources) }
[ "func", "(", "c", "*", "Container", ")", "Update", "(", "ctx", "context", ".", "Context", ",", "r", "*", "task", ".", "UpdateTaskRequest", ")", "error", "{", "p", ",", "err", ":=", "c", ".", "Process", "(", "\"", "\"", ")", "\n", "if", "err", "!=...
// Update the resource information of a running container
[ "Update", "the", "resource", "information", "of", "a", "running", "container" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L396-L402
130,374
containerd/containerd
runtime/v2/runc/container.go
HasPid
func (c *Container) HasPid(pid int) bool { if c.Pid() == pid { return true } for _, p := range c.All() { if p.Pid() == pid { return true } } return false }
go
func (c *Container) HasPid(pid int) bool { if c.Pid() == pid { return true } for _, p := range c.All() { if p.Pid() == pid { return true } } return false }
[ "func", "(", "c", "*", "Container", ")", "HasPid", "(", "pid", "int", ")", "bool", "{", "if", "c", ".", "Pid", "(", ")", "==", "pid", "{", "return", "true", "\n", "}", "\n", "for", "_", ",", "p", ":=", "range", "c", ".", "All", "(", ")", "{...
// HasPid returns true if the container owns a specific pid
[ "HasPid", "returns", "true", "if", "the", "container", "owns", "a", "specific", "pid" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/container.go#L405-L415
130,375
containerd/containerd
metadata/gc.go
sendLabelRefs
func sendLabelRefs(ns string, bkt *bolt.Bucket, fn func(gc.Node)) error { lbkt := bkt.Bucket(bucketKeyObjectLabels) if lbkt != nil { lc := lbkt.Cursor() labelRef := string(labelGCContentRef) for k, v := lc.Seek(labelGCContentRef); k != nil && strings.HasPrefix(string(k), labelRef); k, v = lc.Next() { if ks ...
go
func sendLabelRefs(ns string, bkt *bolt.Bucket, fn func(gc.Node)) error { lbkt := bkt.Bucket(bucketKeyObjectLabels) if lbkt != nil { lc := lbkt.Cursor() labelRef := string(labelGCContentRef) for k, v := lc.Seek(labelGCContentRef); k != nil && strings.HasPrefix(string(k), labelRef); k, v = lc.Next() { if ks ...
[ "func", "sendLabelRefs", "(", "ns", "string", ",", "bkt", "*", "bolt", ".", "Bucket", ",", "fn", "func", "(", "gc", ".", "Node", ")", ")", "error", "{", "lbkt", ":=", "bkt", ".", "Bucket", "(", "bucketKeyObjectLabels", ")", "\n", "if", "lbkt", "!=", ...
// sendLabelRefs sends all snapshot and content references referred to by the labels in the bkt
[ "sendLabelRefs", "sends", "all", "snapshot", "and", "content", "references", "referred", "to", "by", "the", "labels", "in", "the", "bkt" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/metadata/gc.go#L439-L466
130,376
containerd/containerd
metadata/leases.go
Create
func (lm *LeaseManager) Create(ctx context.Context, opts ...leases.Opt) (leases.Lease, error) { var l leases.Lease for _, opt := range opts { if err := opt(&l); err != nil { return leases.Lease{}, err } } if l.ID == "" { return leases.Lease{}, errors.New("lease id must be provided") } namespace, err := ...
go
func (lm *LeaseManager) Create(ctx context.Context, opts ...leases.Opt) (leases.Lease, error) { var l leases.Lease for _, opt := range opts { if err := opt(&l); err != nil { return leases.Lease{}, err } } if l.ID == "" { return leases.Lease{}, errors.New("lease id must be provided") } namespace, err := ...
[ "func", "(", "lm", "*", "LeaseManager", ")", "Create", "(", "ctx", "context", ".", "Context", ",", "opts", "...", "leases", ".", "Opt", ")", "(", "leases", ".", "Lease", ",", "error", ")", "{", "var", "l", "leases", ".", "Lease", "\n", "for", "_", ...
// Create creates a new lease using the provided lease
[ "Create", "creates", "a", "new", "lease", "using", "the", "provided", "lease" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/metadata/leases.go#L48-L94
130,377
containerd/containerd
metadata/leases.go
Delete
func (lm *LeaseManager) Delete(ctx context.Context, lease leases.Lease, _ ...leases.DeleteOpt) error { namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return err } topbkt := getBucket(lm.tx, bucketKeyVersion, []byte(namespace), bucketKeyObjectLeases) if topbkt == nil { return errors.Wrapf(...
go
func (lm *LeaseManager) Delete(ctx context.Context, lease leases.Lease, _ ...leases.DeleteOpt) error { namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return err } topbkt := getBucket(lm.tx, bucketKeyVersion, []byte(namespace), bucketKeyObjectLeases) if topbkt == nil { return errors.Wrapf(...
[ "func", "(", "lm", "*", "LeaseManager", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "lease", "leases", ".", "Lease", ",", "_", "...", "leases", ".", "DeleteOpt", ")", "error", "{", "namespace", ",", "err", ":=", "namespaces", ".", "Names...
// Delete delets the lease with the provided lease ID
[ "Delete", "delets", "the", "lease", "with", "the", "provided", "lease", "ID" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/metadata/leases.go#L97-L114
130,378
containerd/containerd
metadata/leases.go
List
func (lm *LeaseManager) List(ctx context.Context, fs ...string) ([]leases.Lease, error) { namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } filter, err := filters.ParseAll(fs...) if err != nil { return nil, errors.Wrap(errdefs.ErrInvalidArgument, err.Error()) } var ll []...
go
func (lm *LeaseManager) List(ctx context.Context, fs ...string) ([]leases.Lease, error) { namespace, err := namespaces.NamespaceRequired(ctx) if err != nil { return nil, err } filter, err := filters.ParseAll(fs...) if err != nil { return nil, errors.Wrap(errdefs.ErrInvalidArgument, err.Error()) } var ll []...
[ "func", "(", "lm", "*", "LeaseManager", ")", "List", "(", "ctx", "context", ".", "Context", ",", "fs", "...", "string", ")", "(", "[", "]", "leases", ".", "Lease", ",", "error", ")", "{", "namespace", ",", "err", ":=", "namespaces", ".", "NamespaceRe...
// List lists all active leases
[ "List", "lists", "all", "active", "leases" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/metadata/leases.go#L117-L168
130,379
containerd/containerd
remotes/handlers.go
MakeRefKey
func MakeRefKey(ctx context.Context, desc ocispec.Descriptor) string { // TODO(stevvooe): Need better remote key selection here. Should be a // product of the context, which may include information about the ongoing // fetch process. switch desc.MediaType { case images.MediaTypeDockerSchema2Manifest, ocispec.Media...
go
func MakeRefKey(ctx context.Context, desc ocispec.Descriptor) string { // TODO(stevvooe): Need better remote key selection here. Should be a // product of the context, which may include information about the ongoing // fetch process. switch desc.MediaType { case images.MediaTypeDockerSchema2Manifest, ocispec.Media...
[ "func", "MakeRefKey", "(", "ctx", "context", ".", "Context", ",", "desc", "ocispec", ".", "Descriptor", ")", "string", "{", "// TODO(stevvooe): Need better remote key selection here. Should be a", "// product of the context, which may include information about the ongoing", "// fet...
// MakeRefKey returns a unique reference for the descriptor. This reference can be // used to lookup ongoing processes related to the descriptor. This function // may look to the context to namespace the reference appropriately.
[ "MakeRefKey", "returns", "a", "unique", "reference", "for", "the", "descriptor", ".", "This", "reference", "can", "be", "used", "to", "lookup", "ongoing", "processes", "related", "to", "the", "descriptor", ".", "This", "function", "may", "look", "to", "the", ...
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/handlers.go#L39-L59
130,380
containerd/containerd
remotes/handlers.go
FetchHandler
func FetchHandler(ingester content.Ingester, fetcher Fetcher) images.HandlerFunc { return func(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error) { ctx = log.WithLogger(ctx, log.G(ctx).WithFields(logrus.Fields{ "digest": desc.Digest, "mediatype": desc.MediaType, "siz...
go
func FetchHandler(ingester content.Ingester, fetcher Fetcher) images.HandlerFunc { return func(ctx context.Context, desc ocispec.Descriptor) (subdescs []ocispec.Descriptor, err error) { ctx = log.WithLogger(ctx, log.G(ctx).WithFields(logrus.Fields{ "digest": desc.Digest, "mediatype": desc.MediaType, "siz...
[ "func", "FetchHandler", "(", "ingester", "content", ".", "Ingester", ",", "fetcher", "Fetcher", ")", "images", ".", "HandlerFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "desc", "ocispec", ".", "Descriptor", ")", "(", "subdescs", ...
// FetchHandler returns a handler that will fetch all content into the ingester // discovered in a call to Dispatch. Use with ChildrenHandler to do a full // recursive fetch.
[ "FetchHandler", "returns", "a", "handler", "that", "will", "fetch", "all", "content", "into", "the", "ingester", "discovered", "in", "a", "call", "to", "Dispatch", ".", "Use", "with", "ChildrenHandler", "to", "do", "a", "full", "recursive", "fetch", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/handlers.go#L64-L80
130,381
containerd/containerd
remotes/handlers.go
PushHandler
func PushHandler(pusher Pusher, provider content.Provider) images.HandlerFunc { return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { ctx = log.WithLogger(ctx, log.G(ctx).WithFields(logrus.Fields{ "digest": desc.Digest, "mediatype": desc.MediaType, "size": desc.Si...
go
func PushHandler(pusher Pusher, provider content.Provider) images.HandlerFunc { return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { ctx = log.WithLogger(ctx, log.G(ctx).WithFields(logrus.Fields{ "digest": desc.Digest, "mediatype": desc.MediaType, "size": desc.Si...
[ "func", "PushHandler", "(", "pusher", "Pusher", ",", "provider", "content", ".", "Provider", ")", "images", ".", "HandlerFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "desc", "ocispec", ".", "Descriptor", ")", "(", "[", "]", "...
// PushHandler returns a handler that will push all content from the provider // using a writer from the pusher.
[ "PushHandler", "returns", "a", "handler", "that", "will", "push", "all", "content", "from", "the", "provider", "using", "a", "writer", "from", "the", "pusher", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/handlers.go#L119-L130
130,382
containerd/containerd
remotes/handlers.go
PushContent
func PushContent(ctx context.Context, pusher Pusher, desc ocispec.Descriptor, provider content.Provider, platform platforms.MatchComparer, wrapper func(h images.Handler) images.Handler) error { var m sync.Mutex manifestStack := []ocispec.Descriptor{} filterHandler := images.HandlerFunc(func(ctx context.Context, des...
go
func PushContent(ctx context.Context, pusher Pusher, desc ocispec.Descriptor, provider content.Provider, platform platforms.MatchComparer, wrapper func(h images.Handler) images.Handler) error { var m sync.Mutex manifestStack := []ocispec.Descriptor{} filterHandler := images.HandlerFunc(func(ctx context.Context, des...
[ "func", "PushContent", "(", "ctx", "context", ".", "Context", ",", "pusher", "Pusher", ",", "desc", "ocispec", ".", "Descriptor", ",", "provider", "content", ".", "Provider", ",", "platform", "platforms", ".", "MatchComparer", ",", "wrapper", "func", "(", "h...
// PushContent pushes content specified by the descriptor from the provider. // // Base handlers can be provided which will be called before any push specific // handlers.
[ "PushContent", "pushes", "content", "specified", "by", "the", "descriptor", "from", "the", "provider", ".", "Base", "handlers", "can", "be", "provided", "which", "will", "be", "called", "before", "any", "push", "specific", "handlers", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/handlers.go#L159-L208
130,383
containerd/containerd
remotes/handlers.go
FilterManifestByPlatformHandler
func FilterManifestByPlatformHandler(f images.HandlerFunc, m platforms.Matcher) images.HandlerFunc { return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { children, err := f(ctx, desc) if err != nil { return nil, err } // no platform information if desc.Platform == nil...
go
func FilterManifestByPlatformHandler(f images.HandlerFunc, m platforms.Matcher) images.HandlerFunc { return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { children, err := f(ctx, desc) if err != nil { return nil, err } // no platform information if desc.Platform == nil...
[ "func", "FilterManifestByPlatformHandler", "(", "f", "images", ".", "HandlerFunc", ",", "m", "platforms", ".", "Matcher", ")", "images", ".", "HandlerFunc", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "desc", "ocispec", ".", "Descriptor"...
// FilterManifestByPlatformHandler allows Handler to handle non-target // platform's manifest and configuration data.
[ "FilterManifestByPlatformHandler", "allows", "Handler", "to", "handle", "non", "-", "target", "platform", "s", "manifest", "and", "configuration", "data", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/remotes/handlers.go#L212-L243
130,384
containerd/containerd
runtime/v2/shim/util_unix.go
SocketAddress
func SocketAddress(ctx context.Context, id string) (string, error) { ns, err := namespaces.NamespaceRequired(ctx) if err != nil { return "", err } d := sha256.Sum256([]byte(filepath.Join(ns, id))) return filepath.Join(string(filepath.Separator), "containerd-shim", fmt.Sprintf("%x.sock", d)), nil }
go
func SocketAddress(ctx context.Context, id string) (string, error) { ns, err := namespaces.NamespaceRequired(ctx) if err != nil { return "", err } d := sha256.Sum256([]byte(filepath.Join(ns, id))) return filepath.Join(string(filepath.Separator), "containerd-shim", fmt.Sprintf("%x.sock", d)), nil }
[ "func", "SocketAddress", "(", "ctx", "context", ".", "Context", ",", "id", "string", ")", "(", "string", ",", "error", ")", "{", "ns", ",", "err", ":=", "namespaces", ".", "NamespaceRequired", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "re...
// SocketAddress returns an abstract socket address
[ "SocketAddress", "returns", "an", "abstract", "socket", "address" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/shim/util_unix.go#L50-L57
130,385
containerd/containerd
runtime/v2/shim/util_unix.go
AnonDialer
func AnonDialer(address string, timeout time.Duration) (net.Conn, error) { address = strings.TrimPrefix(address, "unix://") return net.DialTimeout("unix", "\x00"+address, timeout) }
go
func AnonDialer(address string, timeout time.Duration) (net.Conn, error) { address = strings.TrimPrefix(address, "unix://") return net.DialTimeout("unix", "\x00"+address, timeout) }
[ "func", "AnonDialer", "(", "address", "string", ",", "timeout", "time", ".", "Duration", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "address", "=", "strings", ".", "TrimPrefix", "(", "address", ",", "\"", "\"", ")", "\n", "return", "net", ...
// AnonDialer returns a dialer for an abstract socket
[ "AnonDialer", "returns", "a", "dialer", "for", "an", "abstract", "socket" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/shim/util_unix.go#L60-L63
130,386
containerd/containerd
runtime/v2/shim/util_unix.go
NewSocket
func NewSocket(address string) (*net.UnixListener, error) { if len(address) > 106 { return nil, errors.Errorf("%q: unix socket path too long (> 106)", address) } l, err := net.Listen("unix", "\x00"+address) if err != nil { return nil, errors.Wrapf(err, "failed to listen to abstract unix socket %q", address) } ...
go
func NewSocket(address string) (*net.UnixListener, error) { if len(address) > 106 { return nil, errors.Errorf("%q: unix socket path too long (> 106)", address) } l, err := net.Listen("unix", "\x00"+address) if err != nil { return nil, errors.Wrapf(err, "failed to listen to abstract unix socket %q", address) } ...
[ "func", "NewSocket", "(", "address", "string", ")", "(", "*", "net", ".", "UnixListener", ",", "error", ")", "{", "if", "len", "(", "address", ")", ">", "106", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "address", ")"...
// NewSocket returns a new socket
[ "NewSocket", "returns", "a", "new", "socket" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/shim/util_unix.go#L66-L75
130,387
containerd/containerd
services/events/service.go
NewService
func NewService(events *exchange.Exchange) api.EventsServer { return &service{ ttService: &ttrpcService{ events: events, }, events: events, } }
go
func NewService(events *exchange.Exchange) api.EventsServer { return &service{ ttService: &ttrpcService{ events: events, }, events: events, } }
[ "func", "NewService", "(", "events", "*", "exchange", ".", "Exchange", ")", "api", ".", "EventsServer", "{", "return", "&", "service", "{", "ttService", ":", "&", "ttrpcService", "{", "events", ":", "events", ",", "}", ",", "events", ":", "events", ",", ...
// NewService returns the GRPC events server
[ "NewService", "returns", "the", "GRPC", "events", "server" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/services/events/service.go#L50-L57
130,388
containerd/containerd
runtime/v2/runc/epoll.go
NewOOMEpoller
func NewOOMEpoller(publisher shim.Publisher) (*Epoller, error) { fd, err := unix.EpollCreate1(unix.EPOLL_CLOEXEC) if err != nil { return nil, err } return &Epoller{ fd: fd, publisher: publisher, set: make(map[uintptr]*item), }, nil }
go
func NewOOMEpoller(publisher shim.Publisher) (*Epoller, error) { fd, err := unix.EpollCreate1(unix.EPOLL_CLOEXEC) if err != nil { return nil, err } return &Epoller{ fd: fd, publisher: publisher, set: make(map[uintptr]*item), }, nil }
[ "func", "NewOOMEpoller", "(", "publisher", "shim", ".", "Publisher", ")", "(", "*", "Epoller", ",", "error", ")", "{", "fd", ",", "err", ":=", "unix", ".", "EpollCreate1", "(", "unix", ".", "EPOLL_CLOEXEC", ")", "\n", "if", "err", "!=", "nil", "{", "...
// NewOOMEpoller returns an epoll implementation that listens to OOM events // from a container's cgroups.
[ "NewOOMEpoller", "returns", "an", "epoll", "implementation", "that", "listens", "to", "OOM", "events", "from", "a", "container", "s", "cgroups", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/epoll.go#L35-L45
130,389
containerd/containerd
runtime/v2/runc/epoll.go
Run
func (e *Epoller) Run(ctx context.Context) { var events [128]unix.EpollEvent for { select { case <-ctx.Done(): e.Close() return default: n, err := unix.EpollWait(e.fd, events[:], -1) if err != nil { if err == unix.EINTR { continue } logrus.WithError(err).Error("cgroups: epoll wait")...
go
func (e *Epoller) Run(ctx context.Context) { var events [128]unix.EpollEvent for { select { case <-ctx.Done(): e.Close() return default: n, err := unix.EpollWait(e.fd, events[:], -1) if err != nil { if err == unix.EINTR { continue } logrus.WithError(err).Error("cgroups: epoll wait")...
[ "func", "(", "e", "*", "Epoller", ")", "Run", "(", "ctx", "context", ".", "Context", ")", "{", "var", "events", "[", "128", "]", "unix", ".", "EpollEvent", "\n", "for", "{", "select", "{", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "e", "...
// Run the epoll loop
[ "Run", "the", "epoll", "loop" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/epoll.go#L67-L87
130,390
containerd/containerd
runtime/v2/runc/epoll.go
Add
func (e *Epoller) Add(id string, cg cgroups.Cgroup) error { e.mu.Lock() defer e.mu.Unlock() fd, err := cg.OOMEventFD() if err != nil { return err } e.set[fd] = &item{ id: id, cg: cg, } event := unix.EpollEvent{ Fd: int32(fd), Events: unix.EPOLLHUP | unix.EPOLLIN | unix.EPOLLERR, } return unix.Ep...
go
func (e *Epoller) Add(id string, cg cgroups.Cgroup) error { e.mu.Lock() defer e.mu.Unlock() fd, err := cg.OOMEventFD() if err != nil { return err } e.set[fd] = &item{ id: id, cg: cg, } event := unix.EpollEvent{ Fd: int32(fd), Events: unix.EPOLLHUP | unix.EPOLLIN | unix.EPOLLERR, } return unix.Ep...
[ "func", "(", "e", "*", "Epoller", ")", "Add", "(", "id", "string", ",", "cg", "cgroups", ".", "Cgroup", ")", "error", "{", "e", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "e", ".", "mu", ".", "Unlock", "(", ")", "\n", "fd", ",", "err", ...
// Add the cgroup to the epoll monitor
[ "Add", "the", "cgroup", "to", "the", "epoll", "monitor" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runc/epoll.go#L90-L106
130,391
containerd/containerd
archive/tar_opts_windows.go
WithParentLayers
func WithParentLayers(parentPaths []string) ApplyOpt { return func(options *ApplyOptions) error { options.ParentLayerPaths = parentPaths return nil } }
go
func WithParentLayers(parentPaths []string) ApplyOpt { return func(options *ApplyOptions) error { options.ParentLayerPaths = parentPaths return nil } }
[ "func", "WithParentLayers", "(", "parentPaths", "[", "]", "string", ")", "ApplyOpt", "{", "return", "func", "(", "options", "*", "ApplyOptions", ")", "error", "{", "options", ".", "ParentLayerPaths", "=", "parentPaths", "\n", "return", "nil", "\n", "}", "\n"...
// WithParentLayers adds parent layers to the apply process this is required // for all Windows layers except the base layer.
[ "WithParentLayers", "adds", "parent", "layers", "to", "the", "apply", "process", "this", "is", "required", "for", "all", "Windows", "layers", "except", "the", "base", "layer", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/archive/tar_opts_windows.go#L30-L35
130,392
containerd/containerd
diff/lcow/lcow.go
NewWindowsLcowDiff
func NewWindowsLcowDiff(store content.Store) (CompareApplier, error) { return windowsLcowDiff{ store: store, }, nil }
go
func NewWindowsLcowDiff(store content.Store) (CompareApplier, error) { return windowsLcowDiff{ store: store, }, nil }
[ "func", "NewWindowsLcowDiff", "(", "store", "content", ".", "Store", ")", "(", "CompareApplier", ",", "error", ")", "{", "return", "windowsLcowDiff", "{", "store", ":", "store", ",", "}", ",", "nil", "\n", "}" ]
// NewWindowsLcowDiff is the Windows LCOW container layer implementation // for comparing and applying Linux filesystem layers on Windows
[ "NewWindowsLcowDiff", "is", "the", "Windows", "LCOW", "container", "layer", "implementation", "for", "comparing", "and", "applying", "Linux", "filesystem", "layers", "on", "Windows" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/diff/lcow/lcow.go#L89-L93
130,393
containerd/containerd
image.go
NewImage
func NewImage(client *Client, i images.Image) Image { return &image{ client: client, i: i, platform: platforms.Default(), } }
go
func NewImage(client *Client, i images.Image) Image { return &image{ client: client, i: i, platform: platforms.Default(), } }
[ "func", "NewImage", "(", "client", "*", "Client", ",", "i", "images", ".", "Image", ")", "Image", "{", "return", "&", "image", "{", "client", ":", "client", ",", "i", ":", "i", ",", "platform", ":", "platforms", ".", "Default", "(", ")", ",", "}", ...
// NewImage returns a client image object from the metadata image
[ "NewImage", "returns", "a", "client", "image", "object", "from", "the", "metadata", "image" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/image.go#L59-L65
130,394
containerd/containerd
image.go
NewImageWithPlatform
func NewImageWithPlatform(client *Client, i images.Image, platform platforms.MatchComparer) Image { return &image{ client: client, i: i, platform: platform, } }
go
func NewImageWithPlatform(client *Client, i images.Image, platform platforms.MatchComparer) Image { return &image{ client: client, i: i, platform: platform, } }
[ "func", "NewImageWithPlatform", "(", "client", "*", "Client", ",", "i", "images", ".", "Image", ",", "platform", "platforms", ".", "MatchComparer", ")", "Image", "{", "return", "&", "image", "{", "client", ":", "client", ",", "i", ":", "i", ",", "platfor...
// NewImageWithPlatform returns a client image object from the metadata image
[ "NewImageWithPlatform", "returns", "a", "client", "image", "object", "from", "the", "metadata", "image" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/image.go#L68-L74
130,395
containerd/containerd
content/proxy/content_store.go
ReaderAt
func (pcs *proxyContentStore) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error) { i, err := pcs.Info(ctx, desc.Digest) if err != nil { return nil, err } return &remoteReaderAt{ ctx: ctx, digest: desc.Digest, size: i.Size, client: pcs.client, }, nil }
go
func (pcs *proxyContentStore) ReaderAt(ctx context.Context, desc ocispec.Descriptor) (content.ReaderAt, error) { i, err := pcs.Info(ctx, desc.Digest) if err != nil { return nil, err } return &remoteReaderAt{ ctx: ctx, digest: desc.Digest, size: i.Size, client: pcs.client, }, nil }
[ "func", "(", "pcs", "*", "proxyContentStore", ")", "ReaderAt", "(", "ctx", "context", ".", "Context", ",", "desc", "ocispec", ".", "Descriptor", ")", "(", "content", ".", "ReaderAt", ",", "error", ")", "{", "i", ",", "err", ":=", "pcs", ".", "Info", ...
// ReaderAt ignores MediaType.
[ "ReaderAt", "ignores", "MediaType", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/proxy/content_store.go#L93-L105
130,396
containerd/containerd
content/proxy/content_store.go
Writer
func (pcs *proxyContentStore) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) { var wOpts content.WriterOpts for _, opt := range opts { if err := opt(&wOpts); err != nil { return nil, err } } wrclient, offset, err := pcs.negotiate(ctx, wOpts.Ref, wOpts.Desc.Size, wOpts.Desc.Dig...
go
func (pcs *proxyContentStore) Writer(ctx context.Context, opts ...content.WriterOpt) (content.Writer, error) { var wOpts content.WriterOpts for _, opt := range opts { if err := opt(&wOpts); err != nil { return nil, err } } wrclient, offset, err := pcs.negotiate(ctx, wOpts.Ref, wOpts.Desc.Size, wOpts.Desc.Dig...
[ "func", "(", "pcs", "*", "proxyContentStore", ")", "Writer", "(", "ctx", "context", ".", "Context", ",", "opts", "...", "content", ".", "WriterOpt", ")", "(", "content", ".", "Writer", ",", "error", ")", "{", "var", "wOpts", "content", ".", "WriterOpts",...
// Writer ignores MediaType.
[ "Writer", "ignores", "MediaType", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/proxy/content_store.go#L163-L180
130,397
containerd/containerd
content/proxy/content_store.go
Abort
func (pcs *proxyContentStore) Abort(ctx context.Context, ref string) error { if _, err := pcs.client.Abort(ctx, &contentapi.AbortRequest{ Ref: ref, }); err != nil { return errdefs.FromGRPC(err) } return nil }
go
func (pcs *proxyContentStore) Abort(ctx context.Context, ref string) error { if _, err := pcs.client.Abort(ctx, &contentapi.AbortRequest{ Ref: ref, }); err != nil { return errdefs.FromGRPC(err) } return nil }
[ "func", "(", "pcs", "*", "proxyContentStore", ")", "Abort", "(", "ctx", "context", ".", "Context", ",", "ref", "string", ")", "error", "{", "if", "_", ",", "err", ":=", "pcs", ".", "client", ".", "Abort", "(", "ctx", ",", "&", "contentapi", ".", "A...
// Abort implements asynchronous abort. It starts a new write session on the ref l
[ "Abort", "implements", "asynchronous", "abort", ".", "It", "starts", "a", "new", "write", "session", "on", "the", "ref", "l" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/content/proxy/content_store.go#L183-L191
130,398
containerd/containerd
runtime/v2/runhcs/service.go
forwardRunhcsLogs
func forwardRunhcsLogs(ctx context.Context, c net.Conn, fields logrus.Fields) { defer c.Close() j := json.NewDecoder(c) for { e := logrus.Entry{} err := j.Decode(&e.Data) if err == io.EOF || err == errorConnectionAborted { break } if err != nil { // Likely the last message wasn't complete at closure...
go
func forwardRunhcsLogs(ctx context.Context, c net.Conn, fields logrus.Fields) { defer c.Close() j := json.NewDecoder(c) for { e := logrus.Entry{} err := j.Decode(&e.Data) if err == io.EOF || err == errorConnectionAborted { break } if err != nil { // Likely the last message wasn't complete at closure...
[ "func", "forwardRunhcsLogs", "(", "ctx", "context", ".", "Context", ",", "c", "net", ".", "Conn", ",", "fields", "logrus", ".", "Fields", ")", "{", "defer", "c", ".", "Close", "(", ")", "\n", "j", ":=", "json", ".", "NewDecoder", "(", "c", ")", "\n...
// forwardRunhcsLogs copies logs from c and writes them to the ctx logger // upstream.
[ "forwardRunhcsLogs", "copies", "logs", "from", "c", "and", "writes", "them", "to", "the", "ctx", "logger", "upstream", "." ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runhcs/service.go#L72-L128
130,399
containerd/containerd
runtime/v2/runhcs/service.go
New
func New(ctx context.Context, id string, publisher shim.Publisher, shutdown func()) (shim.Shim, error) { return &service{ context: ctx, id: id, processes: make(map[string]*process), publisher: publisher, shutdown: shutdown, }, nil }
go
func New(ctx context.Context, id string, publisher shim.Publisher, shutdown func()) (shim.Shim, error) { return &service{ context: ctx, id: id, processes: make(map[string]*process), publisher: publisher, shutdown: shutdown, }, nil }
[ "func", "New", "(", "ctx", "context", ".", "Context", ",", "id", "string", ",", "publisher", "shim", ".", "Publisher", ",", "shutdown", "func", "(", ")", ")", "(", "shim", ".", "Shim", ",", "error", ")", "{", "return", "&", "service", "{", "context",...
// New returns a new runhcs shim service that can be used via GRPC
[ "New", "returns", "a", "new", "runhcs", "shim", "service", "that", "can", "be", "used", "via", "GRPC" ]
a17c8095716415cebb1157a27db5fccace56b0fc
https://github.com/containerd/containerd/blob/a17c8095716415cebb1157a27db5fccace56b0fc/runtime/v2/runhcs/service.go#L131-L139