Dobby
3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Wrapper object used to store container resources. More...
#include <DobbyContainer.h>
Public Types | |
enum class | State { Starting , Running , Stopping , Paused , Hibernating , Hibernated , Awakening , Unknown } |
Public Member Functions | |
DobbyContainer (DobbyContainer &)=delete | |
DobbyContainer (DobbyContainer &&)=delete | |
void | setRestartOnCrash (const std::list< int > &files) |
void | clearRestartOnCrash () |
bool | shouldRestart (int statusCode) |
const std::list< int > & | files () const |
Public Attributes | |
const int32_t | descriptor |
const std::shared_ptr< const DobbyBundle > | bundle |
const std::shared_ptr< const DobbyConfig > | config |
const std::shared_ptr< const DobbyRootfs > | rootfs |
const std::shared_ptr< const DobbyRdkPluginManager > | rdkPluginManager |
pid_t | containerPid |
bool | hasCurseOfDeath |
enum DobbyContainer::State | state |
std::string | customConfigFilePath |
Private Member Functions | |
DobbyContainer (const std::shared_ptr< const DobbyBundle > &_bundle, const std::shared_ptr< const DobbyConfig > &_config, const std::shared_ptr< const DobbyRootfs > &_rootfs) | |
DobbyContainer (const std::shared_ptr< const DobbyBundle > &_bundle, const std::shared_ptr< const DobbyConfig > &_config, const std::shared_ptr< const DobbyRootfs > &_rootfs, const std::shared_ptr< const DobbyRdkPluginManager > &_rdkPluginManager) | |
Static Private Member Functions | |
static int32_t | allocDescriptor () |
Alloc a unique descriptor from the pool. More... | |
static void | freeDescriptor (int32_t cd) |
Frees a descriptor created with allocDescriptor. More... | |
Private Attributes | |
bool | mRestartOnCrash |
std::list< int > | mFiles |
unsigned | mRestartCount |
std::chrono::time_point< std::chrono::steady_clock > | mLastRestartAttempt |
Static Private Attributes | |
static std::mutex | mIdsLock |
static std::bitset< 1024 > | mUsedIds |
Friends | |
class | DobbyManager |
Wrapper object used to store container resources.
This class stores the state of the container, along with it's config, bundle directory, rootfs and console resources.
In addition it stores the pid of the controller runc process managing the container, we need this to detect when the container has finially shutdown.
Lastly we also store a unique descriptor for the container, this is used alongside the container id string to identify events from a container.
|
staticprivate |
Alloc a unique descriptor from the pool.
The descriptor will be a number between 1 and 1024, it will be unique in the sense that no existing Container object will have the same descriptor.
The descriptors themselves are created in a pseudo random repeating sequence, which should hopefully avoid getting the same descriptor number close together.
|
staticprivate |
Frees a descriptor created with allocDescriptor.
This puts the given descriptor back in the pool for use again.
[in] | cd | the descriptor to release. |