Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
DobbyEnv.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: DobbyEnv.ch
21  *
22  */
23 #ifndef DOBBYENV_H
24 #define DOBBYENV_H
25 
26 #include <IDobbyEnv.h>
27 #include <IDobbySettings.h>
28 
29 #include <cstdint>
30 #include <string>
31 #include <memory>
32 #include <map>
33 
34 // -----------------------------------------------------------------------------
45 class DobbyEnv : public IDobbyEnv
46 {
47 public:
48  explicit DobbyEnv(const std::shared_ptr<const IDobbySettings>& settings);
49  ~DobbyEnv() final = default;
50 
51 public:
52  std::string workspaceMountPath() const override;
53 
54  std::string flashMountPath() const override;
55 
56  std::string pluginsWorkspacePath() const override;
57 
58  std::string cgroupMountPath(Cgroup cgroup) const override;
59 
60  uint16_t platformIdent() const override;
61 
62 private:
63  static std::map<IDobbyEnv::Cgroup, std::string> getCgroupMountPoints();
64  static uint16_t getPlatformIdent();
65 
66 private:
67  const std::string mWorkspacePath;
68  const std::string mFlashMountPath;
69  const std::string mPluginsWorkspacePath;
70  const std::map<IDobbyEnv::Cgroup, std::string> mCgroupMountPaths;
71  const uint16_t mPlatformIdent;
72 };
73 
74 #endif // !defined(DOBBYENV_H)
Basic class used to store the stb environment.
Definition: DobbyEnv.h:46
static uint16_t getPlatformIdent()
Attempts to get the STB platform identifier bytes.
Definition: DobbyEnv.cpp:93
std::string cgroupMountPath(Cgroup cgroup) const override
Returns the absolute path to the cgroup mount point for the given cgroup.
Definition: DobbyEnv.cpp:67
uint16_t platformIdent() const override
Returns the two byte platform identification number.
Definition: DobbyEnv.cpp:78
static std::map< IDobbyEnv::Cgroup, std::string > getCgroupMountPoints()
Attempts to get the mount points of the cgroup filesystems.
Definition: DobbyEnv.cpp:135
std::string pluginsWorkspacePath() const override
Returns the path to directory that plugins can write to.
Definition: DobbyEnv.cpp:62
std::string flashMountPath() const override
Returns the absolute path to the AI area on flash.
Definition: DobbyEnv.cpp:57
std::string workspaceMountPath() const override
Returns the absolute AI workspace mount point path.
Definition: DobbyEnv.cpp:52
Interface that exports the environment of the daemon to plugins.
Definition: IDobbyEnv.h:46