1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_TEST_CLASS_HANDLER_H
5 #define CEPH_TEST_CLASS_HANDLER_H
7 #include "objclass/objclass.h"
8 #include "common/snap_types.h"
9 #include <boost/shared_ptr.hpp>
19 class TestClassHandler {
25 struct MethodContext {
28 TestIoCtxImpl *io_ctx_impl;
32 typedef boost::shared_ptr<MethodContext> SharedMethodContext;
35 cls_method_cxx_call_t class_call;
37 typedef boost::shared_ptr<Method> SharedMethod;
38 typedef std::map<std::string, SharedMethod> Methods;
39 typedef std::map<std::string, cls_cxx_filter_factory_t> Filters;
45 typedef boost::shared_ptr<Class> SharedClass;
47 void open_all_classes();
49 int create(const std::string &name, cls_handle_t *handle);
50 int create_method(cls_handle_t hclass, const char *method,
51 cls_method_cxx_call_t class_call,
52 cls_method_handle_t *handle);
53 cls_method_cxx_call_t get_method(const std::string &cls,
54 const std::string &method);
55 SharedMethodContext get_method_context(TestIoCtxImpl *io_ctx_impl,
56 const std::string &oid,
57 const SnapContext &snapc);
59 int create_filter(cls_handle_t hclass, const std::string& filter_name,
60 cls_cxx_filter_factory_t fn);
64 typedef std::map<std::string, SharedClass> Classes;
65 typedef std::list<void*> ClassHandles;
68 ClassHandles m_class_handles;
71 void open_class(const std::string& name, const std::string& path);
75 } // namespace librados
77 #endif // CEPH_TEST_CLASS_HANDLER_H