@@ -34,10 +34,10 @@ import (
3434 specs "github.com/opencontainers/runtime-spec/specs-go"
3535)
3636
37- // Format is the type of log formatting options avaliable
37+ // Format is the type of log formatting options available
3838type Format string
3939
40- // TopBody represents the structured data of the full ps output
40+ // TopResults represents the structured data of the full ps output
4141type TopResults struct {
4242 // Processes running in the container, where each is process is an array of values corresponding to the headers
4343 Processes [][]string `json:"Processes"`
@@ -48,7 +48,9 @@ type TopResults struct {
4848
4949const (
5050 none Format = ""
51+ // JSON represents the JSON format
5152 JSON Format = "json"
53+ // Text represents plain text format
5254 Text Format = "text"
5355 // DefaultCommand is the default command for Runc
5456 DefaultCommand = "runc"
@@ -82,10 +84,12 @@ func (r *Runc) State(context context.Context, id string) (*Container, error) {
8284 return & c , nil
8385}
8486
87+ // ConsoleSocket handles the path of the socket for console access
8588type ConsoleSocket interface {
8689 Path () string
8790}
8891
92+ // CreateOpts holds all the options information for calling runc with supported options
8993type CreateOpts struct {
9094 IO
9195 // PidFile is a path to where a pid file should be created
@@ -171,6 +175,7 @@ func (r *Runc) Start(context context.Context, id string) error {
171175 return r .runOrError (r .command (context , "start" , id ))
172176}
173177
178+ // ExecOpts holds optional settings when starting an exec process with runc
174179type ExecOpts struct {
175180 IO
176181 PidFile string
@@ -285,6 +290,7 @@ func (r *Runc) Run(context context.Context, id, bundle string, opts *CreateOpts)
285290 return status , err
286291}
287292
293+ // DeleteOpts holds the deletion options for calling `runc delete`
288294type DeleteOpts struct {
289295 Force bool
290296}
@@ -428,6 +434,7 @@ func (r *Runc) Top(context context.Context, id string, psOptions string) (*TopRe
428434 return topResults , nil
429435}
430436
437+ // CheckpointOpts holds the options for performing a criu checkpoint using runc
431438type CheckpointOpts struct {
432439 // ImagePath is the path for saving the criu image file
433440 ImagePath string
@@ -456,11 +463,15 @@ type CheckpointOpts struct {
456463 StatusFile * os.File
457464}
458465
466+ // CgroupMode defines the cgroup mode used for checkpointing
459467type CgroupMode string
460468
461469const (
462- Soft CgroupMode = "soft"
463- Full CgroupMode = "full"
470+ // Soft is the "soft" cgroup mode
471+ Soft CgroupMode = "soft"
472+ // Full is the "full" cgroup mode
473+ Full CgroupMode = "full"
474+ // Strict is the "strict" cgroup mode
464475 Strict CgroupMode = "strict"
465476)
466477
@@ -501,6 +512,7 @@ func (o *CheckpointOpts) args() (out []string) {
501512 return out
502513}
503514
515+ // CheckpointAction represents specific actions executed during checkpoint/restore
504516type CheckpointAction func ([]string ) []string
505517
506518// LeaveRunning keeps the container running after the checkpoint has been completed
@@ -535,6 +547,7 @@ func (r *Runc) Checkpoint(context context.Context, id string, opts *CheckpointOp
535547 return r .runOrError (cmd )
536548}
537549
550+ // RestoreOpts holds the options for performing a criu restore using runc
538551type RestoreOpts struct {
539552 CheckpointOpts
540553 IO
@@ -617,8 +630,10 @@ func (r *Runc) Update(context context.Context, id string, resources *specs.Linux
617630 return r .runOrError (cmd )
618631}
619632
633+ // ErrParseRuncVersion is used when the runc version can't be parsed
620634var ErrParseRuncVersion = errors .New ("unable to parse runc version" )
621635
636+ // Version represents the runc version information
622637type Version struct {
623638 Runc string
624639 Commit string
@@ -732,6 +747,7 @@ func cmdOutput(cmd *exec.Cmd, combined bool, started chan<- int) (*bytes.Buffer,
732747 return b , err
733748}
734749
750+ // ExitError holds the status return code when a process exits with an error code
735751type ExitError struct {
736752 Status int
737753}
0 commit comments