Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Public Member Functions | List of all members
IDobbyStartState Class Referenceabstract

Utility interface passed in at the post-construction phase, to allow some final tweaking of the container before it's launched. More...

#include <IDobbyStartState.h>

Inheritance diagram for IDobbyStartState:
Inheritance graph
[legend]

Public Member Functions

virtual int addFileDescriptor (const std::string &pluginName, int fd)=0
 Adds another file descriptor to be passed into the container. More...
 
virtual bool addEnvironmentVariable (const std::string &envVar)=0
 Adds an environment variable to the container. More...
 
virtual bool addMount (const std::string &source, const std::string &target, const std::string &fsType, unsigned long mountFlags=0, const std::list< std::string > &mountOptions=std::list< std::string >())=0
 Adds a new mount to the container. More...
 
virtual std::list< int > files () const =0
 Gets all file descriptor registered by any client. More...
 
virtual std::list< int > files (const std::string &pluginName) const =0
 Gets all file descriptor registered by concrete client. More...
 

Detailed Description

Utility interface passed in at the post-construction phase, to allow some final tweaking of the container before it's launched.

Member Function Documentation

◆ addEnvironmentVariable()

virtual bool IDobbyStartState::addEnvironmentVariable ( const std::string &  envVar)
pure virtual

Adds an environment variable to the container.

Simple appends another environment variable to the container

Parameters
[in]envVarThe environment variable to set
Returns
true on success, false on failure

Implemented in DobbyStartState.

◆ addFileDescriptor()

virtual int IDobbyStartState::addFileDescriptor ( const std::string &  pluginName,
int  fd 
)
pure virtual

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.

Parameters
[in]pluginNameThe plugin name for which fd will be recorded
[in]fdThe file descriptor to pass to the container
Returns
the number of the file descriptor inside the container on success, on failure -1

Implemented in DobbyStartState.

◆ addMount()

virtual bool IDobbyStartState::addMount ( const std::string &  source,
const std::string &  target,
const std::string &  fsType,
unsigned long  mountFlags = 0,
const std::list< std::string > &  mountOptions = std::list< std::string >() 
)
pure virtual

Adds a new mount to the container.

Adds a mount entry to the config.json for the container.

Warning
this can't be used to add loopback mounts, only standard /dev mounts or bind mounts of directories and files.
Parameters
[in]sourceThe source of the mount
[in]targetThe target mount point
[in]fsTypeThe filesystem type of the mount
[in]mountFlagsThe mount flags (i.e. MS_BIND, MS_??)
[in]mountOptionsAny additional mount options.
Returns
true on success, false on failure

Implemented in DobbyStartState.

◆ files() [1/2]

virtual std::list<int> IDobbyStartState::files ( ) const
pure virtual

Gets all file descriptor registered by any client.

Returns
List of all file descriptors

Implemented in DobbyStartState.

◆ files() [2/2]

virtual std::list<int> IDobbyStartState::files ( const std::string &  pluginName) const
pure virtual

Gets all file descriptor registered by concrete client.

Parameters
[in]pluginNameRDK plugin name
Returns
List of file descriptors assiociated with given plugin name

Implemented in DobbyStartState.


The documentation for this class was generated from the following file: