Dobby
3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Interface that plugin libraries have to implement. More...
#include <IDobbyPlugin.h>
Public Types | |
enum | HintFlags : unsigned { PostConstructionSync = (1 << 0) , PreStartSync = (1 << 1) , PostStartSync = (1 << 2) , PostStopSync = (1 << 3) , PreDestructionSync = (1 << 4) , PostConstructionAsync = (1 << 16) , PreStartAsync = (1 << 17) , PostStartAsync = (1 << 18) , PostStopAsync = (1 << 19) , PreDestructionAsync = (1 << 20) } |
Bit flags that should be returned by hookHints. More... | |
Public Member Functions | |
virtual std::string | name () const =0 |
Should return the name of the plugin, this is used to match against the json spec file used to create the container. More... | |
virtual unsigned | hookHints () const =0 |
Should return a bitfield of the hook points implemented by the plugin. More... | |
virtual bool | postConstruction (const ContainerId &id, const std::shared_ptr< IDobbyStartState > &startupState, const std::string &rootfsPath, const Json::Value &jsonData)=0 |
Hook function called after the rootfs has been created, but before the container is launched. More... | |
virtual bool | preStart (const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData)=0 |
Hook function called after the container is setup, but before the init process is executed. More... | |
virtual bool | postStart (const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData)=0 |
Hook function called after the container is started and the init process is now running. More... | |
virtual bool | postStop (const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData)=0 |
Hook function called after the container has stopped. More... | |
virtual bool | preDestruction (const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData)=0 |
Hook function called just before the rootfs is deleted, this is called even if there was an error starting the container. More... | |
Interface that plugin libraries have to implement.
enum IDobbyPlugin::HintFlags : unsigned |
Bit flags that should be returned by hookHints.
The flags are fairly self explanatory.
|
pure virtual |
Should return a bitfield of the hook points implemented by the plugin.
Only bits that are set will be called as hooks. This is to optimise the implementation of the hook code in the daemon and means threads aren't spawned for null hook points.
The value returned should be constant for the lifetime of the class, as the value may be cached by the daemon at startup.
Implemented in PerfettoPlugin, OpenCDMPlugin, MulticastSocketPlugin, and EthanLogPlugin.
|
pure virtual |
Should return the name of the plugin, this is used to match against the json spec file used to create the container.
The value returned should be constant for the lifetime of the class, as the value may be cached by the daemon at startup.
Implemented in PerfettoPlugin, OpenCDMPlugin, MulticastSocketPlugin, and EthanLogPlugin.
|
pure virtual |
Hook function called after the rootfs has been created, but before the container is launched.
At this point you can setup mounts that the container will see as it hasn't yet created the namespaces. This is typically used to mount something that wouldn't be allowed inside a userns, then once mounted you can hook the prestart phase to move mount it into the container's namespace.
You can also hook this point to allow you to add extra environment variables or pass in additional file descriptors via the startupState class.
[in] | id | The string id of the container. |
[in] | startupState | A utility object with methods that allow you to tweak the parameters of the container before it is launched. |
[in] | rootfsPath | The absolute path to the rootfs of the container. |
[in] | jsonData | The json data from the spec file. |
Implemented in PluginBase, PerfettoPlugin, OpenCDMPlugin, MulticastSocketPlugin, and EthanLogPlugin.
|
pure virtual |
Hook function called after the container is started and the init process is now running.
This hook is not particularly useful, although it can be used to inform clients that a container has started successifully.
[in] | id | The id of the container (string) |
[in] | pid | The pid of the init process in the container. |
[in] | rootfsPath | The absolute path to the rootfs. |
[in] | jsonData | The json data for the hook specified in the container spec file. |
Implemented in PluginBase.
|
pure virtual |
Hook function called after the container has stopped.
[in] | id | The id of the container (string) |
[in] | rootfsPath | The absolute path to the rootfs. |
[in] | jsonData | The json data for the hook specified in the container spec file. |
Implemented in PluginBase.
|
pure virtual |
Hook function called just before the rootfs is deleted, this is called even if there was an error starting the container.
This hook is called at a very similar place to postStop, but it will be called even if the container failed to start (but as long as postConstruction was called).
[in] | id | The string id of the container. |
[in] | rootfsPath | The absolute path to the rootfs of the container. |
[in] | jsonData | The json data from the spec file. |
Implemented in PluginBase.
|
pure virtual |
Hook function called after the container is setup, but before the init process is executed.
The hooks are run after the mounts are setup, but before we switch to the new root, so that the old root is still available in the hooks for any mount manipulations.
[in] | id | The string id of the container. |
[in] | pid | The pid owner of the namespace to enter, typically the pid of the process in the container. |
[in] | nsType | The type of the namespace to enter, see above. |
[in] | func | The actual function to execute. |
Implemented in PluginBase, and EthanLogPlugin.