StateFS
 All Classes Files Functions Variables Typedefs Enumerations Groups Pages
loader.hpp
Go to the documentation of this file.
1 #ifndef _STATEFS_LOADER_HPP_
2 #define _STATEFS_LOADER_HPP_
3 
10 #include <statefs/provider.h>
11 #include <memory>
12 
13 namespace statefs
14 {
15 
25 typedef std::shared_ptr<statefs_provider> provider_ptr;
26 
27 /* increase minor version for backward compatible loaders, major - if
28  * provider logic or interface is changed in way not handled by new
29  * version of the server
30  */
31 #define STATEFS_CPP_LOADER_VERSION STATEFS_MK_VERSION(4, 0)
32 
36 class Loader
37 {
38 public:
39  virtual ~Loader() {}
40 
49  virtual provider_ptr load(std::string const& path
50  , statefs_server *server) =0;
51 
59  virtual std::string name() const =0;
60 
69  virtual bool is_reloadable() const =0;
70 
71  unsigned version() { return STATEFS_CPP_LOADER_VERSION; }
72 };
73 
74 static inline char const *cpp_loader_accessor()
75 {
76  return "create_cpp_provider_loader";
77 }
78 
79 
80 }
81 
82 typedef statefs::Loader * (*create_provider_loader_fn)();
83 EXTERN_C statefs::Loader * create_cpp_provider_loader();
84 
89 #endif //_STATEFS_LOADER_HPP_