]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/librados_test_stub/TestMemRadosClient.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / test / librados_test_stub / TestMemRadosClient.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef CEPH_TEST_MEM_RADOS_CLIENT_H
5 #define CEPH_TEST_MEM_RADOS_CLIENT_H
6
7 #include "test/librados_test_stub/TestRadosClient.h"
8 #include "include/ceph_assert.h"
9 #include <list>
10 #include <string>
11
12 namespace librados {
13
14 class AioCompletionImpl;
15 class TestMemCluster;
16
17 class TestMemRadosClient : public TestRadosClient {
18 public:
19 TestMemRadosClient(CephContext *cct, TestMemCluster *test_mem_cluster);
20 ~TestMemRadosClient() override;
21
22 TestIoCtxImpl *create_ioctx(int64_t pool_id,
23 const std::string &pool_name) override;
24
25 uint32_t get_nonce() override {
26 return m_nonce;
27 }
28 uint64_t get_instance_id() override {
29 return m_global_id;
30 }
31
32 int get_min_compatible_osd(int8_t* require_osd_release) override {
33 *require_osd_release = CEPH_RELEASE_OCTOPUS;
34 return 0;
35 }
36
37 int get_min_compatible_client(int8_t* min_compat_client,
38 int8_t* require_min_compat_client) override {
39 *min_compat_client = CEPH_RELEASE_MIMIC;
40 *require_min_compat_client = CEPH_RELEASE_MIMIC;
41 return 0;
42 }
43
44 void object_list(int64_t pool_id,
45 std::list<librados::TestRadosClient::Object> *list) override;
46
47 int service_daemon_register(const std::string& service,
48 const std::string& name,
49 const std::map<std::string,std::string>& metadata) override {
50 return 0;
51 }
52 int service_daemon_update_status(std::map<std::string,std::string>&& status) override {
53 return 0;
54 }
55
56 int pool_create(const std::string &pool_name) override;
57 int pool_delete(const std::string &pool_name) override;
58 int pool_get_base_tier(int64_t pool_id, int64_t* base_tier) override;
59 int pool_list(std::list<std::pair<int64_t, std::string> >& v) override;
60 int64_t pool_lookup(const std::string &name) override;
61 int pool_reverse_lookup(int64_t id, std::string *name) override;
62
63 int watch_flush() override;
64
65 bool is_blacklisted() const override;
66 int blacklist_add(const std::string& client_address,
67 uint32_t expire_seconds) override;
68 protected:
69 TestMemCluster *get_mem_cluster() {
70 return m_mem_cluster;
71 }
72
73 protected:
74 void transaction_start(const std::string& nspace,
75 const std::string &oid) override;
76 void transaction_finish(const std::string& nspace,
77 const std::string &oid) override;
78
79 private:
80 TestMemCluster *m_mem_cluster;
81 uint32_t m_nonce;
82 uint64_t m_global_id;
83
84 };
85
86 } // namespace librados
87
88 #endif // CEPH_TEST_MEM_RADOS_CLIENT_H