Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
PluginBase.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: PluginBase.h
21  *
22  */
23 #ifndef PLUGINBASE_H
24 #define PLUGINBASE_H
25 
26 #include <IDobbyPlugin.h>
27 
28 // -----------------------------------------------------------------------------
37 class PluginBase : public IDobbyPlugin
38 {
39 public:
40  virtual ~PluginBase() { }
41 
42 
43  // Inherited classes must implement these, no excuses
44 public:
45  // virtual std::string name() const override;
46  // virtual unsigned hookHints() const override;
47 
48 
49  // Inherited classes should override the following where appropriate
50 public:
51  virtual bool postConstruction(const ContainerId& id,
52  const std::shared_ptr<IDobbyStartState>& startupState,
53  const std::string& rootfsPath,
54  const Json::Value& jsonData) override
55  { return true; }
56 
57  virtual bool preStart(const ContainerId& id,
58  pid_t pid,
59  const std::string& rootfsPath,
60  const Json::Value& jsonData) override
61  { return true; }
62 
63  virtual bool postStart(const ContainerId& id,
64  pid_t pid,
65  const std::string& rootfsPath,
66  const Json::Value& jsonData) override
67  { return true; }
68 
69  virtual bool postStop(const ContainerId& id,
70  const std::string& rootfsPath,
71  const Json::Value& jsonData) override
72  { return true; }
73 
74  virtual bool preDestruction(const ContainerId& id,
75  const std::string& rootfsPath,
76  const Json::Value& jsonData) override
77  { return true; }
78 
79 };
80 
81 #endif // !defined(PLUGINBASE_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
Interface that plugin libraries have to implement.
Definition: IDobbyPlugin.h:51
Basic object that provides the default overrides for a plugin.
Definition: PluginBase.h:38
virtual bool postStart(const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData) override
Hook function called after the container is started and the init process is now running.
Definition: PluginBase.h:63
virtual bool preDestruction(const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData) override
Hook function called just before the rootfs is deleted, this is called even if there was an error sta...
Definition: PluginBase.h:74
virtual bool preStart(const ContainerId &id, pid_t pid, const std::string &rootfsPath, const Json::Value &jsonData) override
Hook function called after the container is setup, but before the init process is executed.
Definition: PluginBase.h:57
virtual bool postConstruction(const ContainerId &id, const std::shared_ptr< IDobbyStartState > &startupState, const std::string &rootfsPath, const Json::Value &jsonData) override
Hook function called after the rootfs has been created, but before the container is launched.
Definition: PluginBase.h:51
virtual bool postStop(const ContainerId &id, const std::string &rootfsPath, const Json::Value &jsonData) override
Hook function called after the container has stopped.
Definition: PluginBase.h:69