Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief Allows one to list all available backends
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : *
8 : */
9 :
10 : #ifndef TOOLS_BACKENDS_HPP
11 : #define TOOLS_BACKENDS_HPP
12 :
13 : #include <string>
14 : #include <vector>
15 :
16 : #include <keyset.hpp>
17 : #include <toolexcept.hpp>
18 :
19 : namespace kdb
20 : {
21 :
22 : namespace tools
23 : {
24 :
25 : /**
26 : * @brief Info about a backend
27 : */
28 27456 : struct BackendInfo
29 : {
30 : std::string name; ///< escaped mountpoint name (except for old mountpoints)
31 : std::string mountpoint; ///< where the backend is mounted
32 : std::string path; ///< the configuration file path to this backend
33 : };
34 :
35 : /**
36 : * @brief Allows one to list backends
37 : */
38 : class Backends
39 : {
40 : public:
41 : typedef std::vector<BackendInfo> BackendInfoVector;
42 :
43 : static BackendInfoVector getBackendInfo (KeySet mountConf);
44 :
45 : static BackendInfo findBackend (std::string const & backend, KeySet mountConf, bool verbose = false);
46 :
47 : static bool umount (std::string const & backend, KeySet & mountConf);
48 :
49 : static std::string getBasePath (std::string name);
50 :
51 : static const char * mountpointsPath;
52 : };
53 : } // namespace tools
54 : } // namespace kdb
55 :
56 : #endif
|