gitee.com/leisunstar/runtime@v0.0.0-20200521203717-5cef3e7b53f9/virtcontainers/types/container.go (about)

     1  // Copyright (c) 2019 hyper.sh
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  //
     5  
     6  package types
     7  
     8  // ContainerState is a sandbox state structure.
     9  type ContainerState struct {
    10  	State StateString `json:"state"`
    11  
    12  	BlockDeviceID string
    13  
    14  	// File system of the rootfs incase it is block device
    15  	Fstype string `json:"fstype"`
    16  
    17  	// CgroupPath is the cgroup hierarchy where sandbox's processes
    18  	// including the hypervisor are placed.
    19  	CgroupPath string `json:"cgroupPath,omitempty"`
    20  }
    21  
    22  // Valid checks that the container state is valid.
    23  func (state *ContainerState) Valid() bool {
    24  	return state.State.valid()
    25  }
    26  
    27  // ValidTransition returns an error if we want to move to
    28  // an unreachable state.
    29  func (state *ContainerState) ValidTransition(oldState StateString, newState StateString) error {
    30  	return state.State.validTransition(oldState, newState)
    31  }