Dobby
3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Stores the start state of the container. More...
#include <DobbyStartState.h>
Public Member Functions | |
DobbyStartState (const std::shared_ptr< DobbyConfig > &config, const std::list< int > &files) | |
bool | isValid () const |
int | addFileDescriptor (const std::string &pluginName, int fd) override |
Adds another file descriptor to be passed into the container. More... | |
bool | addEnvironmentVariable (const std::string &envVar) override |
Adds an environment variable to the container. More... | |
bool | addMount (const std::string &source, const std::string &target, const std::string &fsType, unsigned long mountFlags, const std::list< std::string > &mountOptions) override |
Adds a new mount to the container. More... | |
std::list< int > | files () const override |
Gets all file descriptor registered by any client. More... | |
std::list< int > | files (const std::string &pluginName) const override |
Gets all file descriptor registered by concrete client. More... | |
Private Attributes | |
const std::shared_ptr< DobbyConfig > | mConfig |
std::list< std::pair< std::string, int > > | mFiles |
bool | mValid |
std::mutex | mLock |
Stores the start state of the container.
One of these objects is created when a container is first initialised, it stores some state and is passed to the postConstruction hook so plugins can add extra file descriptors or environment variables to the container.
This class is thrown away once the container is launched.
|
overridevirtual |
Adds an environment variable to the container.
Simple appends another environment variable to the container
[in] | envVar | The environment variable to set |
Implements IDobbyStartState.
|
overridevirtual |
Adds another file descriptor to be passed into the container.
The number of the file descriptor in the container namespace is returned, unless there was an error in which case a negative value is returned. File descriptors start at 3.
The method dups the supplied file descriptor so it can be closed immmediatly after the call. The file descriptor will be closed after the container is started and handed over.
File descriptors are recorded per client (plugin name).
Lastly to help find issues, this function will log an error and reject the file descriptor if it doesn't have the FD_CLOEXEC bit set.
[in] | pluginName | The plugin name for which fd will be recorded |
[in] | fd | The file descriptor to pass to the container |
Implements IDobbyStartState.
|
overridevirtual |
Adds a new mount to the container.
Adds a mount entry to the config.json for the container.
[in] | source | The source of the mount |
[in] | target | The target mount point |
[in] | fsType | The filesystem type of the mount |
[in] | mountFlags | The mount flags (i.e. MS_BIND, MS_??) |
[in] | mountOptions | Any additional mount options. |
Implements IDobbyStartState.
|
overridevirtual |
Gets all file descriptor registered by any client.
Implements IDobbyStartState.
|
overridevirtual |
Gets all file descriptor registered by concrete client.
[in] | pluginName | RDK plugin name |
Implements IDobbyStartState.