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
61public:
62 IDobbyIPCUtils::BusType systemDbus() const override;
63 IDobbyIPCUtils::BusType sessionDbus() const override;
64 IDobbyIPCUtils::BusType debugDbus() const override;
65
66public:
67 bool consoleDisabled() const override;
68 ssize_t consoleLimit() const override;
69 const std::string& consolePath() const override;
70
71public:
72 bool restartOnCrash() const override;
73
74public:
75 const std::string& rootfsPath() const override;
76
77public:
78 std::shared_ptr<rt_dobby_schema> config() const override;
79
80public:
81 const std::map<std::string, Json::Value>& rdkPlugins() const override;
82
83#if defined(LEGACY_COMPONENTS)
84public:
85 const std::map<std::string, Json::Value>& legacyPlugins() const override;
86#endif // defined(LEGACY_COMPONENTS)
87
88// ----------------------------------------------------------------------------
92private:
93 bool parseOCIConfig(const std::string& bundlePath);
94 bool constructConfig(const ContainerId& id,
95 const std::string& bundlePath);
96
97private:
98#if defined(LEGACY_COMPONENTS)
99 bool processLegacyPlugins(const Json::Value& value);
100#endif // defined(LEGACY_COMPONENTS)
101
102// ----------------------------------------------------------------------------
106private:
107 const std::shared_ptr<IDobbyUtils> mUtilities;
108 const std::shared_ptr<const IDobbySettings> mSettings;
109
110private:
111 bool mValid;
112
113private:
114 Json::Value mConfig;
115 std::shared_ptr<rt_dobby_schema> mConf;
116
117private:
118 uid_t mUserId;
119 gid_t mGroupId;
120
121private:
122 //TODO: how to handle restart on crash option in extended bundles?
123 bool mRestartOnCrash;
124
125private:
126 IDobbyIPCUtils::BusType mSystemDbus;
127 IDobbyIPCUtils::BusType mSessionDbus;
128 IDobbyIPCUtils::BusType mDebugDbus;
129
130private:
131 bool mConsoleDisabled;
132 std::string mConsolePath;
133 ssize_t mConsoleLimit;
134
135private:
136 std::map<std::string, Json::Value> mRdkPlugins;
137
138#if defined(LEGACY_COMPONENTS)
139private:
140 std::map<std::string, Json::Value> mLegacyPlugins;
141#endif // defined(LEGACY_COMPONENTS)
142
143private:
144 std::string mRootfsPath;
145};
146
147#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:107
bool constructConfig(const ContainerId &id, const std::string &bundlePath)
Creates config object.
Definition DobbyBundleConfig.cpp:113
bool parseOCIConfig(const std::string &bundlePath)
Parses the bundle config's contents that are needed by plugins.
Definition DobbyBundleConfig.cpp:233
bool isValid() const override
Getters used for plugins.
Definition DobbyBundleConfig.cpp:150
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