Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Minidump.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 2021 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: Minidump.h
21  *
22  */
23 #ifndef MINIDUMP_H
24 #define MINIDUMP_H
25 
26 #include <RdkPluginBase.h>
27 
28 #include <string>
29 #include <memory>
30 
36 class Minidump : public RdkPluginBase
37 {
38 public:
39  Minidump(std::shared_ptr<rt_dobby_schema>& containerConfig,
40  const std::shared_ptr<DobbyRdkPluginUtils> &utils,
41  const std::string &rootfsPath);
42 
43 public:
44  inline std::string name() const override
45  {
46  return mName;
47  };
48 
49  unsigned hookHints() const override;
50 
51 public:
52  // This hook creates anonymous file and adds its fd into preserve container list
53  bool preCreation() override;
54 
55  // This hook copies minidump file to a host namespace
56  bool postHalt() override;
57 
58 public:
59  std::vector<std::string> getDependencies() const override;
60 
61 private:
62  std::string getDestinationFile();
63 
64  const std::string mName;
65  std::shared_ptr<rt_dobby_schema> mContainerConfig;
66  const std::string mRootfsPath;
67  const std::shared_ptr<DobbyRdkPluginUtils> mUtils;
68 };
69 
70 #endif // !defined(MINIDUMP_H)
Dobby RDK Minidump Plugin.
Definition: Minidump.h:37
bool preCreation() override
OCI Hook - Run in host namespace.
Definition: Minidump.cpp:67
unsigned hookHints() const override
Set the bit flags for which hooks we're going to use.
Definition: Minidump.cpp:56
bool postHalt() override
Dobby Hook - Run in host namespace when container terminates.
Definition: Minidump.cpp:105
std::vector< std::string > getDependencies() const override
Should return the names of the plugins this plugin depends on.
Definition: Minidump.cpp:159
Minidump(std::shared_ptr< rt_dobby_schema > &containerConfig, const std::shared_ptr< DobbyRdkPluginUtils > &utils, const std::string &rootfsPath)
Constructor - called when plugin is loaded by PluginLauncher.
Definition: Minidump.cpp:41
std::string getDestinationFile()
Creates a target location for the file where minidumps will be loaded.
Definition: Minidump.cpp:138
std::string name() const override
Should return the name of the plugin.
Definition: Minidump.h:44
Basic object that provides the default overrides for a plugin.
Definition: RdkPluginBase.h:34