Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / rbd_replay / BufferReader.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_RBD_REPLAY_BUFFER_READER_H
5 #define CEPH_RBD_REPLAY_BUFFER_READER_H
6
7 #include "include/int_types.h"
8 #include "include/buffer.h"
9
10 namespace rbd_replay {
11
12 class BufferReader {
13 public:
14   static const size_t DEFAULT_MIN_BYTES = 1<<20;
15   static const size_t DEFAULT_MAX_BYTES = 1<<22;
16
17   BufferReader(int fd, size_t min_bytes = DEFAULT_MIN_BYTES,
18                size_t max_bytes = DEFAULT_MAX_BYTES);
19
20   int fetch(bufferlist::iterator **it);
21
22 private:
23   int m_fd;
24   size_t m_min_bytes;
25   size_t m_max_bytes;
26   bufferlist m_bl;
27   bufferlist::iterator m_bl_it;
28   bool m_eof_reached;
29
30 };
31
32 } // namespace rbd_replay
33
34 #endif // CEPH_RBD_REPLAY_BUFFER_READER_H