Dobby  3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
DobbyBundle.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: DobbyBundle.h
21  *
22  */
23 #ifndef DOBBYBUNDLE_H
24 #define DOBBYBUNDLE_H
25 
26 #include "IDobbyUtils.h"
27 #include "ContainerId.h"
28 
29 #include <memory>
30 #include <string>
31 
32 
33 class IDobbyEnv;
34 
35 
36 // -----------------------------------------------------------------------------
46 {
47 public:
48 #if defined(LEGACY_COMPONENTS)
49  DobbyBundle(const std::shared_ptr<const IDobbyUtils>& utils,
50  const std::shared_ptr<const IDobbyEnv>& env,
51  const ContainerId& id);
52  DobbyBundle(const std::shared_ptr<const IDobbyUtils>& utils,
53  const std::string& path,
54  bool persist = true);
55 #endif // defined(LEGACY_COMPONENTS)
56  DobbyBundle(const std::shared_ptr<const IDobbyUtils>& utils,
57  const std::shared_ptr<const IDobbyEnv>& env,
58  const std::string& bundlePath);
59  ~DobbyBundle();
60 
61 public:
62  bool isValid() const;
63 
64  const std::string& path() const;
65  int dirFd() const;
66 
67  void setPersistence(bool persist);
68  bool getPersistence() const;
69 
70 private:
71  const std::shared_ptr<const IDobbyUtils> mUtilities;
72  bool mPersist;
73 
74 private:
75  std::string mPath;
76  int mDirFd;
77 };
78 
79 
80 #endif // !defined(DOBBYBUNDLE_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
Simple class that just creates a subdir in the bundles directory.
Definition: DobbyBundle.h:46
DobbyBundle(const std::shared_ptr< const IDobbyUtils > &utils, const std::shared_ptr< const IDobbyEnv > &env, const std::string &bundlePath)
Constructor that populates member variables in the object based on bundlePath.
Definition: DobbyBundle.cpp:218
Interface that exports the environment of the daemon to plugins.
Definition: IDobbyEnv.h:46