- /**
- * struct handling the data needed to pass to the call back
- * function in asynchronous operations
- */
- struct CompletionData : RefCountedObject {
- /// constructor
- CompletionData(libradosstriper::RadosStriperImpl * striper,
- const std::string& soid,
- const std::string& lockCookie,
- librados::AioCompletionImpl *userCompletion = 0,
- int n = 1);
- /// destructor
- ~CompletionData() override;
- /// complete method
- void complete(int r);
- /// striper to be used to handle the write completion
- libradosstriper::RadosStriperImpl *m_striper;
- /// striped object concerned by the write operation
- std::string m_soid;
- /// shared lock to be released at completion
- std::string m_lockCookie;
- /// completion handler
- librados::IoCtxImpl::C_aio_Complete *m_ack;
- };
-
- /**
- * struct handling the data needed to pass to the call back
- * function in asynchronous read operations
- */
- struct ReadCompletionData : CompletionData {
- /// bufferlist containing final result
- bufferlist* m_bl;
- /// extents that will be read
- std::vector<ObjectExtent>* m_extents;
- /// intermediate results
- std::vector<bufferlist>* m_resultbl;
- /// return code of read completion, to be remembered until unlocking happened
- int m_readRc;
- /// completion object for the unlocking of the striped object at the end of the read
- librados::AioCompletion *m_unlockCompletion;
- /// constructor
- ReadCompletionData(libradosstriper::RadosStriperImpl * striper,
- const std::string& soid,
- const std::string& lockCookie,
- librados::AioCompletionImpl *userCompletion,
- bufferlist* bl,
- std::vector<ObjectExtent>* extents,
- std::vector<bufferlist>* resultbl,
- int n);
- /// destructor
- ~ReadCompletionData() override;
- /// complete method for when reading is over
- void complete_read(int r);
- /// complete method for when object is unlocked
- void complete_unlock(int r);
- };
-
- /**
- * struct handling the data needed to pass to the call back
- * function in asynchronous write operations
- */
- struct WriteCompletionData : CompletionData {
- /// safe completion handler
- librados::IoCtxImpl::C_aio_Complete *m_safe;
- /// return code of write completion, to be remembered until unlocking happened
- int m_writeRc;
- /// completion object for the unlocking of the striped object at the end of the write
- librados::AioCompletion *m_unlockCompletion;
- /// constructor
- WriteCompletionData(libradosstriper::RadosStriperImpl * striper,
- const std::string& soid,
- const std::string& lockCookie,
- librados::AioCompletionImpl *userCompletion,
- int n);
- /// destructor
- ~WriteCompletionData() override;
- /// complete method for when writing is over
- void complete_write(int r);
- /// complete method for when object is unlocked
- void complete_unlock(int r);
- /// safe method
- void safe(int r);
- };
-
- /**
- * struct handling the data needed to pass to the call back
- * function in asynchronous read operations of a Rados File
- */
- struct RadosReadCompletionData : RefCountedObject {
- /// constructor
- RadosReadCompletionData(MultiAioCompletionImpl *multiAioCompl,
- uint64_t expectedBytes,
- bufferlist *bl,
- CephContext *context,
- int n = 1) :
- RefCountedObject(context, n),
- m_multiAioCompl(multiAioCompl), m_expectedBytes(expectedBytes), m_bl(bl) {};
- /// the multi asynch io completion object to be used
- MultiAioCompletionImpl *m_multiAioCompl;
- /// the expected number of bytes
- uint64_t m_expectedBytes;
- /// the bufferlist object where data have been written
- bufferlist *m_bl;
- };
-
- /**
- * struct handling (most of) the data needed to pass to the call back
- * function in asynchronous stat operations.
- * Inherited by the actual type for adding time information in different
- * versions (time_t or struct timespec)
- */
- struct BasicStatCompletionData : CompletionData {
- /// constructor
- BasicStatCompletionData(libradosstriper::RadosStriperImpl* striper,
- const std::string& soid,
- librados::AioCompletionImpl *userCompletion,
- libradosstriper::MultiAioCompletionImpl *multiCompletion,
- uint64_t *psize,
- int n = 1) :
- CompletionData(striper, soid, "", userCompletion, n),
- m_multiCompletion(multiCompletion), m_psize(psize),
- m_statRC(0), m_getxattrRC(0) {};
- // MultiAioCompletionImpl used to handle the double aysnc
- // call in the back (stat + getxattr)
- libradosstriper::MultiAioCompletionImpl *m_multiCompletion;
- // where to store the size of first objct
- // this will be ignored but we need a place to store it when
- // async stat is called
- uint64_t m_objectSize;
- // where to store the file size
- uint64_t *m_psize;
- /// the bufferlist object used for the getxattr call
- bufferlist m_bl;
- /// return code of the stat
- int m_statRC;
- /// return code of the getxattr
- int m_getxattrRC;
- };