27 #include <IDobbySettings.h>
30 # include <json/json.h>
32 # include <jsoncpp/json.h>
52 explicit Settings(
const Json::Value& settings);
57 static std::shared_ptr<Settings>
fromJsonFile(
const std::string& filePath);
58 static std::shared_ptr<Settings> defaultSettings();
77 Json::Value rdkPluginsData()
const override;
84 void dump(
int aiLogLevel = -1)
const;
89 bool isDir(
const std::string& path,
int accessFlags = 0)
const;
92 std::set<int>
getGroupIds(
const Json::Value& field)
const;
95 const char* fallbackPath)
const;
99 const Json::Path& path)
const;
101 std::list<std::string>
getDevNodes(
const Json::Value& root,
102 const Json::Path& path)
const;
105 const Json::Path& path)
const;
110 std::shared_ptr<HardwareAccessSettings>
getHardwareAccess(
const Json::Value& root,
111 const Json::Path& path)
const;
114 const std::shared_ptr<const HardwareAccessSettings>& hwAccess)
const;
117 std::string mWorkspaceDir;
118 std::string mPersistentDir;
119 std::string mConsoleSocketPath;
121 std::map<std::string, std::string> mExtraEnvVars;
123 std::shared_ptr<HardwareAccessSettings> mGpuHardwareAccess;
124 std::shared_ptr<HardwareAccessSettings> mVpuHardwareAccess;
126 std::vector<std::string> mExternalInterfaces;
127 std::pair<std::string, in_addr_t> mAddressRange;
128 std::vector<std::string> mDefaultPlugins;
130 Json::Value mRdkPluginsData;
Interface provided to the library at startup, contains the configuration options for Dobby.
Definition: IDobbySettings.h:50
Object containing the settings to pass to the Dobby.
Definition: Settings.h:49
void dump(int aiLogLevel=-1) const
Debugging function to dump the settings to the log - info level.
Definition: Settings.cpp:557
void dumpHardwareAccess(int aiLogLevel, const std::string &name, const std::shared_ptr< const HardwareAccessSettings > &hwAccess) const
Debugging function to dump the settings to access certain H/W.
Definition: Settings.cpp:603
void setDefaults()
Sets the default values for all settings.
Definition: Settings.cpp:395
std::shared_ptr< HardwareAccessSettings > vpuAccessSettings() const override
Returns any extra details needed to access the VPU (video pipeline) inside the container.
Definition: Settings.cpp:471
in_addr_t addressRange() const override
Returns the Dobby network address range in in_addr_t format.
Definition: Settings.cpp:501
int getGroupId(const std::string &name) const
Returns the group id associated with the name.
Definition: Settings.cpp:681
std::shared_ptr< HardwareAccessSettings > gpuAccessSettings() const override
Returns any extra details needed to access the GPU inside the container.
Definition: Settings.cpp:461
std::map< std::string, std::string > extraEnvVariables() const override
A list of extra environment variables that will be set for all containers.
Definition: Settings.cpp:451
std::list< std::string > getDevNodes(const Json::Value &root, const Json::Path &path) const
Attempts to read the list of GPU device nodes that are needed for apps.
Definition: Settings.cpp:907
static std::shared_ptr< Settings > fromJsonFile(const std::string &filePath)
Sets the default values for all settings.
Definition: Settings.cpp:59
std::list< ExtraMount > getExtraMounts(const Json::Value &root, const Json::Path &path) const
Attempts to read the mount JSON structure(s) from the object.
Definition: Settings.cpp:952
std::vector< std::string > defaultPlugins() const override
Returns any default plugins the platform should run.
Definition: Settings.cpp:511
std::string getPathFromEnv(const char *env, const char *fallbackPath) const
Attempts to get and validate a path from environment vars.
Definition: Settings.cpp:761
std::string addressRangeStr() const override
Returns the Dobby network address range in string format.
Definition: Settings.cpp:491
std::set< int > getGroupIds(const Json::Value &field) const
Processes a JSON array containing numbers and names of user groups.
Definition: Settings.cpp:708
std::map< std::string, std::string > getEnvVarsFromJson(const Json::Value &root, const Json::Path &path) const
Returns a map of strings to strings as read from the JSON.
Definition: Settings.cpp:849
std::list< std::string > getPathsFromJson(const Json::Value &value) const
Attempts to read a path from the JSON object.
Definition: Settings.cpp:805
bool isDir(const std::string &path, int accessFlags=0) const
Checks if path is a directory and has the given access flags.
Definition: Settings.cpp:652
std::shared_ptr< HardwareAccessSettings > getHardwareAccess(const Json::Value &root, const Json::Path &path) const
Processes a json 'gpu' or 'vpu' object.
Definition: Settings.cpp:1081
Settings()
Constructs the settings object with the default settings.
Definition: Settings.cpp:97
bool processMountObject(const Json::Value &value, ExtraMount *mount) const
Processes a json 'mount' object.
Definition: Settings.cpp:997
std::string consoleSocketPath() const override
Location to create the socket used for capturing container logs.
Definition: Settings.cpp:441
std::string workspaceDir() const override
Should return the path to a directory used to store temporary data like runc bundles.
Definition: Settings.cpp:421
std::string persistentDir() const override
Should return a path to a directory on a persistent storage mount.
Definition: Settings.cpp:431
std::vector< std::string > externalInterfaces() const override
Returns the set of external interface that container traffic maybe routed through.
Definition: Settings.cpp:481
Definition: IDobbySettings.h:241
Definition: IDobbySettings.h:201
Definition: IDobbySettings.h:261
Definition: IDobbySettings.h:223