Documentation ¶
Overview ¶
package pod contains the data structure for the pod and functions to get information of the pod. It is shared by other packages, including the CLI implementation, api service, and the library.
Index ¶
- Constants
- func ReadUUIDFromFile(path string) (string, error)
- func WalkPods(dataDir string, include IncludeMask, f func(*Pod)) error
- func WriteUUIDToFile(uuid *types.UUID, path string) error
- type ErrChildNotReady
- type IncludeMask
- type Pod
- func (p *Pod) AfterRun() bool
- func (p *Pod) AppExitCode(appName string) (int, error)
- func (p *Pod) AppImageManifest(appName string) (*schema.ImageManifest, error)
- func (p *Pod) ContainerPid1() (pid int, err error)
- func (p *Pod) CreationTime() (time.Time, error)
- func (p *Pod) ExclusiveManifestLock() error
- func (p *Pod) GCMarkedTime() (time.Time, error)
- func (p *Pod) GetAppTreeStoreID(app types.ACName) (string, error)
- func (p *Pod) GetAppsTreeStoreIDs() ([]string, error)
- func (p *Pod) GetStage1TreeStoreID() (string, error)
- func (p *Pod) IsSupervisorReady() bool
- func (p *Pod) JournalLogPath() (string, error)
- func (p *Pod) ManifestUnlock() error
- func (p *Pod) Path() string
- func (p *Pod) Pid() (int, error)
- func (p *Pod) PodManifest() ([]byte, *schema.PodManifest, error)
- func (p *Pod) PodManifestAvailable() bool
- func (p *Pod) Stage1RootfsPath() (string, error)
- func (p *Pod) StartTime() (time.Time, error)
- func (p *Pod) State() string
- func (p *Pod) Sync() error
- func (p *Pod) ToExitedGarbage() error
- func (p *Pod) ToGarbage() error
- func (p *Pod) ToPrepared() error
- func (p *Pod) ToPreparing() error
- func (p *Pod) ToRun() error
- func (p *Pod) UsesOverlay() bool
- func (p *Pod) WaitExited() error
Constants ¶
const ( Embryo = "embryo" Preparing = "preparing" AbortedPrepare = "aborted prepare" Prepared = "prepared" Running = "running" Deleting = "deleting" ExitedDeleting = "exited deleting" Exited = "exited" ExitedGarbage = "exited garbage" Garbage = "garbage" )
Exported state. See Documentation/devel/pod-lifecycle.md for some explanation
Variables ¶
This section is empty.
Functions ¶
func ReadUUIDFromFile ¶
ReadUUIDFromFile reads the uuid string from the given path.
Types ¶
type ErrChildNotReady ¶
type ErrChildNotReady struct { }
func (ErrChildNotReady) Error ¶
func (e ErrChildNotReady) Error() string
type IncludeMask ¶
type IncludeMask byte
const ( IncludeEmbryoDir IncludeMask = 1 << iota IncludePrepareDir IncludePreparedDir IncludeRunDir IncludeExitedGarbageDir IncludeGarbageDir IncludeMostDirs IncludeMask = (IncludeRunDir | IncludeExitedGarbageDir | IncludePrepareDir | IncludePreparedDir) IncludeAllDirs IncludeMask = (IncludeMostDirs | IncludeEmbryoDir | IncludeGarbageDir) )
type Pod ¶
type Pod struct { UUID *types.UUID Nets []netinfo.NetInfo // list of networks (name, IP, iface) this pod is using MountLabel string // Label to use for container image *lock.FileLock // contains filtered or unexported fields }
func NewPod ¶
NewPod creates a new pod directory in the "preparing" state, allocating a unique uuid for it in the process. The returned pod is always left in an exclusively locked state (preparing is locked in the prepared directory) The pod must be closed using pod.Close()
func PodFromUUIDString ¶
PodFromUUIDString attempts to resolve the supplied UUID and return a pod. The pod must be closed using pod.Close()
func (*Pod) AfterRun ¶
AfterRun returns true if the pod is in a post-running state, otherwise it returns false.
func (*Pod) AppExitCode ¶
AppExitCode returns the app's exit code. It returns an error if the exit code file doesn't exit or the content of the file is invalid.
func (*Pod) AppImageManifest ¶
func (p *Pod) AppImageManifest(appName string) (*schema.ImageManifest, error)
AppImageManifest returns an ImageManifest for the app.
func (*Pod) ContainerPid1 ¶
ContainerPid1 returns the pid of the process with pid 1 in the pod.
func (*Pod) CreationTime ¶
CreationTime returns the time when the pod was created. This happens at prepare time.
func (*Pod) ExclusiveManifestLock ¶ added in v1.21.0
ManifestExclusiveLock gets an exclusive lock on only the pod manifest. This is used in the app sandbox - since the pod is already running, we won't be able to get an exclusive lock on the pod itself.
func (*Pod) GCMarkedTime ¶
GCMarkedTime returns the time when the pod is marked by gc.
func (*Pod) GetAppTreeStoreID ¶
GetAppTreeStoreID returns the treeStoreID of the provided app. TODO(yifan): Maybe make this unexported.
func (*Pod) GetAppsTreeStoreIDs ¶
GetAppsTreeStoreIDs returns the treeStoreIDs of the apps images used in this pod. TODO(yifan): Maybe make this unexported.
func (*Pod) GetStage1TreeStoreID ¶
GetStage1TreeStoreID returns the treeStoreID of the stage1 image used in this pod TODO(yifan): Maybe make this unexported.
func (*Pod) IsSupervisorReady ¶ added in v1.21.0
IsSupervisorReady checks if the pod supervisor (typically systemd-pid1) has reached its ready state. All errors are handled as non-readiness.
func (*Pod) JournalLogPath ¶
JournalLogPath returns the path to the journal log dir of the pod.
func (*Pod) ManifestUnlock ¶ added in v1.21.0
ManifestUnlock unlocks the pod manifest lock.
func (*Pod) PodManifest ¶
func (p *Pod) PodManifest() ([]byte, *schema.PodManifest, error)
PodManifest reads the pod manifest, returns the raw bytes and the unmarshalled object.
func (*Pod) PodManifestAvailable ¶ added in v1.20.0
PodManifestAvailable returns whether the caller should reasonably expect PodManifest to function in the pod's current state. Namely, in Preparing, AbortedPrepare, and Deleting it's possible for the manifest to not be present
func (*Pod) Stage1RootfsPath ¶
Stage1RootfsPath returns the stage1 path of the pod.
func (*Pod) Sync ¶
Sync syncs the pod data. By now it calls a syncfs on the filesystem containing the pod's directory.
func (*Pod) ToExitedGarbage ¶
ToExitedGarbage transitions a pod from run -> exitedGarbage
func (*Pod) ToGarbage ¶
ToGarbage transitions a pod from abortedPrepared -> garbage or prepared -> garbage
func (*Pod) ToPrepared ¶
ToPrepared transitions a pod from preparing -> prepared, leaves the pod unlocked in the prepared directory. only the creator of the pod (via NewPod()) may do this, nobody to race with.
func (*Pod) ToPreparing ¶
ToPrepare transitions a pod from embryo -> preparing, leaves the pod locked in the prepare directory. only the creator of the pod (via NewPod()) may do this, nobody to race with.
func (*Pod) ToRun ¶
ToRun transitions a pod from prepared -> run, leaves the pod locked in the run directory. the creator of the pod (via NewPod()) may also jump directly from preparing -> run
func (*Pod) UsesOverlay ¶
UsesOverlay returns whether the pod Uses overlayfs. TODO(yifan): Maybe make this function unexported.
func (*Pod) WaitExited ¶
WaitExited waits for a pod to (run and) exit.