XRootD
Loading...
Searching...
No Matches
CephIOAdapterAIORaw.hh
Go to the documentation of this file.
1#ifndef __CEPH_IO_ADAPTER_AIORAW_HH__
2#define __CEPH_IO_ADAPTER_AIORAW_HH__
3//------------------------------------------------------------------------------
4// Interface of the logic part of the buffering
5// Intention to be able to abstract the underlying implementation and code against the inteface
6// e.g. for different complexities of control.
7// Couples loosely to IXrdCepgBufferData and anticipated to be called by XrdCephOssBufferedFile.
8// Should managage all of the IO and logic to give XrdCephOssBufferedFile only simple commands to call.
9// implementations are likely to use (via callbacks?) CephPosix library code for actual reads and writes.
10//------------------------------------------------------------------------------
11
12#include <sys/types.h>
13#include "IXrdCephBufferData.hh"
14#include "ICephIOAdapter.hh"
15#include "BufferUtils.hh"
16
17#include <chrono>
18#include <memory>
19#include <atomic>
20#include <condition_variable>
21#include <mutex>
22
23#include "XrdSfs/XrdSfsAio.hh"
24
25
26namespace XrdCephBuffer {
27
28 class CephBufSfsAio : virtual public XrdSfsAio
29 {
30 public:
32 // Method to handle completed reads
33 //
34 virtual void doneRead() override;
35
36 // Method to hand completed writes
37 //
38 virtual void doneWrite() override;
39
40 // Method to recycle free object
41 //
42 virtual void Recycle() override{};
43 std::mutex m_mutex;
44 std::unique_lock<std::mutex> m_lock;
45 std::condition_variable m_condVar;
46 bool isDone() {return m_dataOpDone;}
47
48 protected:
49 bool m_dataOpDone {false};
50
51 };
52
59class CephIOAdapterAIORaw: public virtual ICephIOAdapter {
60 public:
61 CephIOAdapterAIORaw(IXrdCephBufferData * bufferdata, int fd);
62 virtual ~CephIOAdapterAIORaw();
63
74 virtual ssize_t write(off64_t offset,size_t count) override;
75
86 virtual ssize_t read(off64_t offset,size_t count) override;
87
88 private:
89 IXrdCephBufferData * m_bufferdata;
90 int m_fd;
91
92 // timer and counter info
93 std::atomic< long> m_stats_read_timer{0}, m_stats_write_timer{0};
94 std::atomic< long> m_stats_read_bytes{0}, m_stats_write_bytes{0};
95 std::atomic< long> m_stats_read_req{0}, m_stats_write_req{0};
96 long m_stats_read_longest{0}, m_stats_write_longest{0};
97
98};
99
100}
101
102#endif
#define write(a, b, c)
Definition XrdPosix.hh:115
#define read(a, b, c)
Definition XrdPosix.hh:82
virtual void doneWrite() override
virtual void Recycle() override
std::unique_lock< std::mutex > m_lock
std::condition_variable m_condVar
virtual void doneRead() override
Implements a non-async read and write to ceph via aio ceph_posix calls Using the standard ceph_posix_...
Manage the actual IO operations that read and write the data into Ceph via librados striper....
Interface to the Buffer's physical representation. Allow an interface to encapsulate the requirements...
is a simple implementation of IXrdCephBufferData using std::vector<char> representation for the buffe...