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

Dobby RDK Storage Plugin. More...

#include <Storage.h>

Inheritance diagram for Storage:
Inheritance graph
[legend]
Collaboration diagram for Storage:
Collaboration graph
[legend]

Public Member Functions

 Storage (std::shared_ptr< rt_dobby_schema > &containerConfig, const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::string &rootfsPath)
 Constructor - called when plugin is loaded by PluginLauncher. More...
 
std::string name () const override
 Should return the name of the plugin. More...
 
unsigned hookHints () const override
 Set the bit flags for which hooks we're going to use.
 
bool preCreation () override
 OCI Hook - Run in host namespace.
 
bool createRuntime () override
 OCI Hook - Run in host namespace.
 
bool createContainer () override
 OCI Hook - Run in container namespace. Paths resolve to host namespace.
 
bool postStart () override
 OCI Hook - Run in container namespace. More...
 
bool postStop () override
 OCI Hook - Run in host namespace. Confusing name - is run when a container is DELETED.
 
std::vector< std::string > getDependencies () const override
 Should return the names of the plugins this plugin depends on. More...
 
- Public Member Functions inherited from RdkPluginBase
virtual bool postInstallation ()
 
virtual bool postHalt ()
 

Private Member Functions

std::vector< LoopMountPropertiesgetLoopMounts () const
 Reads container config and creates all loop mounts in LoopMountProperties type objects. More...
 
std::vector< std::unique_ptr< LoopMountDetails > > getLoopMountDetails () const
 Create loop mount details vector from all loopback mounts in config. More...
 
std::vector< DynamicMountPropertiesgetDynamicMounts () const
 Reads container config and creates all dynamic mounts in DynamicMountProperties type objects. More...
 
std::vector< std::unique_ptr< DynamicMountDetails > > getDynamicMountDetails () const
 Create dynamic mount details vector from all dynamic mounts in config. More...
 
std::vector< MountOwnerPropertiesgetMountOwners () const
 Reads container config to obtain source path on host, userId, groupId and recursive options. These will be used later to change ownership of the source path based on userId and groupId within the host namespace. More...
 
std::vector< std::unique_ptr< MountOwnerDetails > > getMountOwnerDetails () const
 Create mount owner details vector from all mount owners in config. More...
 
void setupOwnerIds (uid_t &uid, gid_t &gid) const
 Gets userId and groupId. More...
 
uint32_t getMappedId (uint32_t id, rt_defs_id_mapping **mapping, size_t mapping_len) const
 Gets userId or groupId based on mappings. More...
 

Private Attributes

const std::string mName
 
std::shared_ptr< rt_dobby_schema > mContainerConfig
 
const std::string mRootfsPath
 
const std::shared_ptr< DobbyRdkPluginUtilsmUtils
 
std::string mMountPointInsideContainer
 
std::string mTempMountPointOutsideContainer
 

Additional Inherited Members

- Public Types inherited from IDobbyRdkPlugin
enum  HintFlags : unsigned {
  PostInstallationFlag = (1 << 0) , PreCreationFlag = (1 << 1) , CreateRuntimeFlag = (1 << 2) , CreateContainerFlag = (1 << 3) ,
  PostStartFlag = (1 << 5) , PostHaltFlag = (1 << 6) , PostStopFlag = (1 << 7) , Unknown = 0
}
 Bit flags that should be returned by hookHints. More...
 

Detailed Description

Dobby RDK Storage Plugin.

Manages loop mount devices for containers

Constructor & Destructor Documentation

◆ Storage()

Storage::Storage ( std::shared_ptr< rt_dobby_schema > &  containerSpec,
const std::shared_ptr< DobbyRdkPluginUtils > &  utils,
const std::string &  rootfsPath 
)

Constructor - called when plugin is loaded by PluginLauncher.

Do not change the parameters for this constructor - must match C methods created by REGISTER_RDK_PLUGIN macro

Note plugin name is not case sensitive

Member Function Documentation

◆ getDependencies()

std::vector< std::string > Storage::getDependencies ( ) const
overridevirtual

Should return the names of the plugins this plugin depends on.

This can be used to determine the order in which the plugins should be processed when running hooks.

Returns
Names of the plugins this plugin depends on.

Reimplemented from RdkPluginBase.

◆ getDynamicMountDetails()

std::vector< std::unique_ptr< DynamicMountDetails > > Storage::getDynamicMountDetails ( ) const
private

Create dynamic mount details vector from all dynamic mounts in config.

Returns
vector of DynamicMountDetails that were in the config

◆ getDynamicMounts()

std::vector< DynamicMountProperties > Storage::getDynamicMounts ( ) const
private

Reads container config and creates all dynamic mounts in DynamicMountProperties type objects.

Returns
vector of DynamicMountProperties that were in the config

◆ getLoopMountDetails()

std::vector< std::unique_ptr< LoopMountDetails > > Storage::getLoopMountDetails ( ) const
private

Create loop mount details vector from all loopback mounts in config.

Returns
vector of LoopMountDetails that were in the config

◆ getLoopMounts()

std::vector< LoopMountProperties > Storage::getLoopMounts ( ) const
private

Reads container config and creates all loop mounts in LoopMountProperties type objects.

Returns
vector of LoopMountProperties that were in the config

◆ getMappedId()

uint32_t Storage::getMappedId ( uint32_t  id,
rt_defs_id_mapping **  mapping,
size_t  mapping_len 
) const
private

Gets userId or groupId based on mappings.

Parameters
[in]idId we want to map
[in]mappingMapping that should be used
[in]mapping_lenLength of mapping
Returns
if found mapped id, if not found initial id

◆ getMountOwnerDetails()

std::vector< std::unique_ptr< MountOwnerDetails > > Storage::getMountOwnerDetails ( ) const
private

Create mount owner details vector from all mount owners in config.

Returns
vector of MountOwnerDetails that were in the config

◆ getMountOwners()

std::vector< MountOwnerProperties > Storage::getMountOwners ( ) const
private

Reads container config to obtain source path on host, userId, groupId and recursive options. These will be used later to change ownership of the source path based on userId and groupId within the host namespace.

Returns
vector of MountOwnerProperties that were in the config

◆ name()

std::string Storage::name ( ) const
inlineoverridevirtual

Should return the name of the plugin.

Returns
string with the name of the hook.

Implements IDobbyRdkPlugin.

◆ postStart()

bool Storage::postStart ( )
overridevirtual

OCI Hook - Run in container namespace.

OCI Hook - Run in host namespace once container has started

Reimplemented from RdkPluginBase.

◆ setupOwnerIds()

void Storage::setupOwnerIds ( uid_t &  uid,
gid_t &  gid 
) const
private

Gets userId and groupId.

Parameters
[in]idId we want to map
[in]mappingMapping that should be used
[in]mapping_lenLength of mapping
Returns
if found mapped id, if not found initial id

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