diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-07-27 12:17:21 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-07-27 12:27:42 +0900 |
| commit | a1e5f020f48a65138c900961f856cf6b04833770 (patch) | |
| tree | 42d6e0a6d592463890c51639cacbcf014336b31b /container/container.go | |
| parent | bd3fa53a552242b9d45a6743f16c31a8a2dca8ef (diff) | |
container: improve doc comments
Putting them on the builder methods is more useful.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/container.go')
| -rw-r--r-- | container/container.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/container/container.go b/container/container.go index a10e610f..0b6891b9 100644 --- a/container/container.go +++ b/container/container.go @@ -91,12 +91,13 @@ type ( } ) +// Start starts the container init. The init process blocks until Serve is called. func (p *Container) Start() error { if p.cmd != nil { - return errors.New("sandbox: already started") + return errors.New("container: already started") } if p.Ops == nil || len(*p.Ops) == 0 { - return errors.New("sandbox: starting an empty container") + return errors.New("container: starting an empty container") } ctx, cancel := context.WithCancel(p.ctx) @@ -160,6 +161,8 @@ func (p *Container) Start() error { return nil } +// Serve serves [Container.Params] to the container init. +// Serve must only be called once. func (p *Container) Serve() error { if p.setup == nil { panic("invalid serve") @@ -213,6 +216,7 @@ func (p *Container) Serve() error { return err } +// Wait waits for the container init process to exit. func (p *Container) Wait() error { defer p.cancel(); return p.cmd.Wait() } func (p *Container) String() string { |
