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

Factory that spawns the DobbyDaemon and supplies a proxy to it. More...

#include <DobbyFactory.h>

Public Member Functions

 DobbyFactory (const std::shared_ptr< AI_IPC::IIpcService > &ipcService)
 
void setWorkspacePath (const std::string &path)
 
void setFlashMountPath (const std::string &path)
 
void setPlatformIdent (const std::string &platformIdent)
 
void setPlatformType (const std::string &platformType)
 
void setPlatformModel (const std::string &platformModel)
 
std::shared_ptr< IDobbyProxygetProxy ()
 Starts the Dobby 'Hypervisor' daemon and returns a proxy object.
 

Private Member Functions

bool startDobbyDaemon ()
 Starts the Dobby 'Hypervisor' daemon.
 
bool pingDobbyDaemon ()
 Sends pings to the Dobby 'Hypervisor' daemon until a pong is received or we timeout.
 

Private Attributes

std::mutex mLock
 
std::string mWorkspacePath
 
std::string mFlashMountPath
 
std::string mPlatformIdent
 
std::string mPlatformType
 
std::string mPlatformModel
 
std::shared_ptr< AI_IPC::IIpcServicemIpcService
 
std::shared_ptr< IDobbyProxymProxy
 

Detailed Description

Factory that spawns the DobbyDaemon and supplies a proxy to it.

The setters on the factory should be called prior to the getProxy call, this is because the paths and platform ident is passed to the daemon when it is launched.

Member Function Documentation

◆ getProxy()

std::shared_ptr< IDobbyProxy > DobbyFactory::getProxy ( )

Starts the Dobby 'Hypervisor' daemon and returns a proxy object.

The function first tries to the start the daemon using Upstart, if this fails we're in trouble and just returns an invalid proxy.

If the daemon did start then we try and open a connection to it, if that was successful we wrap it in a proxy object and return that. The proxy is just a lightweight wrapper around the dbus method calls into the daemon.

Returns
a shared_ptr to an IDobbyProxy object which allows you to start / stop containers, etc. On failure an empty shared_ptr is returned.

◆ pingDobbyDaemon()

bool DobbyFactory::pingDobbyDaemon ( )
private

Sends pings to the Dobby 'Hypervisor' daemon until a pong is received or we timeout.

This sends ping method calls to the daemon and waits for a second for a reply, we do this for 60 seconds before giving up.

This method shouldn't be required, but we've seen timeouts at start-up and this is an attempt to recover.

Returns
true if a ping / pong was received, false on failure.

◆ startDobbyDaemon()

bool DobbyFactory::startDobbyDaemon ( )
private

Starts the Dobby 'Hypervisor' daemon.

The function tries to the start the daemon using Upstart, if this fails we're in trouble and just returns false.

Returns
true on success, false on failure.

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