Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
DobbyBundleConfig.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2016 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * File: DobbyBundleConfig.h
21 *
22 */
23#ifndef DOBBYBUNDLECONFIG_H
24#define DOBBYBUNDLECONFIG_H
25
26#include "DobbyConfig.h"
27
28#include <fstream>
29
30// -----------------------------------------------------------------------------
42{
43// ----------------------------------------------------------------------------
47public:
48 DobbyBundleConfig(const std::shared_ptr<IDobbyUtils>& utils,
49 const std::shared_ptr<const IDobbySettings>& settings,
50 const ContainerId& id,
51 const std::string& bundlePath);
53
54public:
55 bool isValid() const override;
56
57public:
58 uid_t userId() const override;
59 gid_t groupId() const override;
60 void setUidGidMappings(uid_t userId, gid_t groupId);
61
62public:
63 IDobbyIPCUtils::BusType systemDbus() const override;
64 IDobbyIPCUtils::BusType sessionDbus() const override;
65 IDobbyIPCUtils::BusType debugDbus() const override;
66
67public:
68 bool consoleDisabled() const override;
69 ssize_t consoleLimit() const override;
70 const std::string& consolePath() const override;
71
72public:
73 bool restartOnCrash() const override;
74
75public:
76 const std::string& rootfsPath() const override;
77
78public:
79 std::shared_ptr<rt_dobby_schema> config() const override;
80
81public:
82 const std::map<std::string, Json::Value>& rdkPlugins() const override;
83
84#if defined(LEGACY_COMPONENTS)
85public:
86 const std::map<std::string, Json::Value>& legacyPlugins() const override;
87#endif // defined(LEGACY_COMPONENTS)
88
89// ----------------------------------------------------------------------------
93private:
94 bool parseOCIConfig(const std::string& bundlePath);
95 bool constructConfig(const ContainerId& id,
96 const std::string& bundlePath);
97
98private:
99#if defined(LEGACY_COMPONENTS)
100 bool processLegacyPlugins(const Json::Value& value);
101#endif // defined(LEGACY_COMPONENTS)
102
103// ----------------------------------------------------------------------------
107private:
108 const std::shared_ptr<IDobbyUtils> mUtilities;
109 const std::shared_ptr<const IDobbySettings> mSettings;
110
111private:
112 bool mValid;
113
114private:
115 Json::Value mConfig;
116 std::shared_ptr<rt_dobby_schema> mConf;
117
118private:
119 uid_t mUserId;
120 gid_t mGroupId;
121
122private:
123 //TODO: how to handle restart on crash option in extended bundles?
124 bool mRestartOnCrash;
125
126private:
127 IDobbyIPCUtils::BusType mSystemDbus;
128 IDobbyIPCUtils::BusType mSessionDbus;
129 IDobbyIPCUtils::BusType mDebugDbus;
130
131private:
132 bool mConsoleDisabled;
133 std::string mConsolePath;
134 ssize_t mConsoleLimit;
135
136private:
137 std::map<std::string, Json::Value> mRdkPlugins;
138
139#if defined(LEGACY_COMPONENTS)
140private:
141 std::map<std::string, Json::Value> mLegacyPlugins;
142#endif // defined(LEGACY_COMPONENTS)
143
144private:
145 std::string mRootfsPath;
146};
147
148#endif // !defined(DOBBYBUNDLECONFIG_H)
A wrapper around a std::string, used to add some type definition to to an id and also to sanity check...
Definition ContainerId.h:41
Takes a JSON formatted OCI bundle configuration file in the constructor, parses it and extracts the r...
Definition DobbyBundleConfig.h:42
const std::shared_ptr< IDobbyUtils > mUtilities
Definition DobbyBundleConfig.h:108
bool constructConfig(const ContainerId &id, const std::string &bundlePath)
Creates config object.
Definition DobbyBundleConfig.cpp:118
bool parseOCIConfig(const std::string &bundlePath)
Parses the bundle config's contents that are needed by plugins.
Definition DobbyBundleConfig.cpp:308
bool isValid() const override
Getters used for plugins.
Definition DobbyBundleConfig.cpp:160
Interface that configuration file parser classes have to implement.
Definition DobbyConfig.h:66
BusType
The type of dbus to call methods on / emit signals.
Definition IDobbyIPCUtils.h:60