Author: kpvdr
Date: 2010-12-09 09:33:48 -0500 (Thu, 09 Dec 2010)
New Revision: 4435
Added:
store/trunk/cpp/lib/jrnl2/AioCallback.hpp
store/trunk/cpp/lib/jrnl2/DataToken.cpp
store/trunk/cpp/lib/jrnl2/DataToken.hpp
store/trunk/cpp/lib/jrnl2/DataTokenState.cpp
store/trunk/cpp/lib/jrnl2/DataTokenState.hpp
store/trunk/cpp/lib/jrnl2/JournalDirectory.cpp
store/trunk/cpp/lib/jrnl2/JournalDirectory.hpp
store/trunk/cpp/lib/jrnl2/JournalErrors.cpp
store/trunk/cpp/lib/jrnl2/JournalErrors.hpp
store/trunk/cpp/lib/jrnl2/JournalException.cpp
store/trunk/cpp/lib/jrnl2/JournalException.hpp
Removed:
store/trunk/cpp/lib/jrnl2/aio_callback.hpp
store/trunk/cpp/lib/jrnl2/dtok.cpp
store/trunk/cpp/lib/jrnl2/dtok.hpp
store/trunk/cpp/lib/jrnl2/dtok_state.cpp
store/trunk/cpp/lib/jrnl2/dtok_state.hpp
store/trunk/cpp/lib/jrnl2/jdir.cpp
store/trunk/cpp/lib/jrnl2/jdir.hpp
store/trunk/cpp/lib/jrnl2/jerrno.cpp
store/trunk/cpp/lib/jrnl2/jerrno.hpp
store/trunk/cpp/lib/jrnl2/jexception.cpp
store/trunk/cpp/lib/jrnl2/jexception.hpp
Modified:
store/trunk/cpp/lib/jrnl2/JournalParameters.hpp
store/trunk/cpp/lib/jrnl2/Makefile.am
store/trunk/cpp/lib/jrnl2/jrnl.cpp
store/trunk/cpp/lib/jrnl2/jrnl.hpp
store/trunk/cpp/lib/jrnl2/jrnl_state.cpp
store/trunk/cpp/lib/jrnl2/slock.hpp
store/trunk/cpp/lib/jrnl2/smutex.hpp
store/trunk/cpp/perf/JournalInstance.cpp
store/trunk/cpp/perf/JournalInstance.hpp
store/trunk/cpp/perf/JournalParameters.cpp
store/trunk/cpp/perf/JournalPerformanceTest.cpp
store/trunk/cpp/perf/PerformanceResult.cpp
store/trunk/cpp/perf/TestParameters.cpp
store/trunk/cpp/perf/m
Log:
Further code tidy-up and refactorization in lib/jrnl2
Copied: store/trunk/cpp/lib/jrnl2/AioCallback.hpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/aio_callback.hpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/AioCallback.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/AioCallback.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,57 @@
+/**
+ * \file AioCallback.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_journal2_AioCallback_hpp
+#define mrg_journal2_AioCallback_hpp
+
+#include "DataToken.hpp"
+#include <sys/types.h> // u_int16_t, u_int32_t
+#include <vector>
+
+namespace mrg
+{
+namespace journal2
+{
+
+ class AioCallback
+ {
+ public:
+ virtual ~AioCallback() {}
+ virtual void writeAioCompleteCallback(std::vector<DataToken*>&
dataTokenList) = 0;
+ virtual void readAioCompleteCallback(std::vector<u_int16_t>&
buffPageCtrlBlkIndexList) = 0;
+ };
+
+} // namespace journal2
+} // namespace mrg
+
+
+#endif // mrg_journal2_AioCallback_hpp
+
Copied: store/trunk/cpp/lib/jrnl2/DataToken.cpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/dtok.cpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/DataToken.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/DataToken.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,78 @@
+/**
+ * \file DataToken.cpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "DataToken.hpp"
+
+namespace mrg
+{
+namespace journal2
+{
+
+ // static
+ recordId_t AtomicRecordIdCounter::_recordId;
+
+ // static
+ smutex AtomicRecordIdCounter::_recordIdMutex;
+
+ DataToken::DataToken() :
+ _dataTokenState(),
+ _recordId(AtomicRecordIdCounter::s_getNextRecordId()),
+ _externalRecordIdFlag(false)
+ {}
+
+ DataToken::DataToken(const recordId_t rid) :
+ _dataTokenState(),
+ _recordId(rid),
+ _externalRecordIdFlag(true)
+ {}
+
+ void
+ DataToken::setRecordId(const recordId_t rid)
+ {
+ _recordId = rid;
+ _externalRecordIdFlag = true;
+ }
+
+ void
+ DataToken::setDequeueRecordId(const recordId_t drid)
+ {
+ _dequeueRecordId = drid;
+ }
+
+ std::string
+ DataToken::statusStr()
+ {
+ return "status string";
+ }
+
+} // namespace journal2
+} // namespace mrg
+
Copied: store/trunk/cpp/lib/jrnl2/DataToken.hpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/dtok.hpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/DataToken.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/DataToken.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,90 @@
+/**
+ * \file DataToken.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_journal2_DataToken_hpp
+#define mrg_journal2_DataToken_hpp
+
+#include <string>
+#include <sys/types.h> // u_int16_t, u_int32_t
+
+#include "DataTokenState.hpp"
+#include "slock.hpp"
+#include "smutex.hpp"
+
+namespace mrg
+{
+namespace journal2
+{
+
+ typedef u_int64_t recordId_t;
+
+ class AtomicRecordIdCounter
+ {
+ static recordId_t _recordId;
+ static smutex _recordIdMutex;
+ public:
+ inline static recordId_t s_getNextRecordId() { slock l(_recordIdMutex); return
++_recordId; }
+ };
+
+ class DataToken
+ {
+ DataTokenState _dataTokenState;
+ bool _transientFlag;
+ bool _externalFlag;
+ std::string _externalPath;
+ recordId_t _recordId;
+ bool _externalRecordIdFlag;
+ recordId_t _dequeueRecordId;
+
+ public:
+ DataToken();
+ DataToken(const recordId_t rid);
+
+ inline DataTokenState& getDataTokenState() { return _dataTokenState; }
+ inline bool isTransient() const { return _transientFlag; }
+ inline bool isExternal() const { return _externalFlag; }
+ inline std::string& getExternalPath() { return _externalPath; }
+ void setRecordId(const recordId_t rid);
+ inline recordId_t getRecordId() const { return _recordId; }
+ inline bool isRecordIdExternal() { return _externalRecordIdFlag; }
+ void setDequeueRecordId(const recordId_t drid);
+ inline recordId_t getDequeueRecordId() const { return _dequeueRecordId; }
+
+ // debug aids
+ std::string statusStr();
+ };
+
+} // namespace journal2
+} // namespace mrg
+
+
+#endif // mrg_journal2_DataToken_hpp
+
Copied: store/trunk/cpp/lib/jrnl2/DataTokenState.cpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/dtok_state.cpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/DataTokenState.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/DataTokenState.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,237 @@
+/**
+ * \file DataTokenState.cpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "DataTokenState.hpp"
+
+#include "JournalException.hpp"
+
+namespace mrg
+{
+namespace journal2
+{
+
+ DataTokenState::DataTokenState() :
+ _opState(OP_NONE),
+ _txnState(TX_NONE),
+ _bufferWriteState(IO_NONE),
+ _aioSubmissionState(IO_NONE),
+ _aioCompletionState(IO_NONE)
+ {}
+
+ DataTokenState::DataTokenState(const DataTokenState& s) :
+ _opState(s._opState),
+ _txnState(s._txnState),
+ _bufferWriteState(s._bufferWriteState),
+ _aioSubmissionState(s._aioSubmissionState),
+ _aioCompletionState(s._aioCompletionState)
+ {}
+
+ DataTokenState::DataTokenState(const opState_t o,
+ const txnState_t t,
+ const aioState_t b,
+ const aioState_t s,
+ const aioState_t c) :
+ _opState(o),
+ _txnState(t),
+ _bufferWriteState(b),
+ _aioSubmissionState(s),
+ _aioCompletionState(c)
+ {}
+
+ void
+ DataTokenState::reset()
+ {
+ _opState = OP_NONE;
+ _txnState = TX_NONE;
+ _bufferWriteState = IO_NONE;
+ _aioSubmissionState = IO_NONE;
+ _aioCompletionState = IO_NONE;
+ }
+
+ void
+ DataTokenState::setOpStateToEnqueue()
+ {
+ if (_opState != OP_NONE)
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADDTOKOPSTATE,
+ s_getStateAsString(OP_ENQUEUE),
+ s_getStateAsString(_opState),
+ "dtok_state",
+ "set_enqueue");
+ _opState = OP_ENQUEUE;
+ }
+
+ void
+ DataTokenState::setOpStateToDequeue()
+ {
+ if (_opState != OP_ENQUEUE)
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADDTOKOPSTATE,
+ s_getStateAsString(OP_DEQUEUE),
+ s_getStateAsString(_opState),
+ "dtok_state",
+ "set_dequeue");
+ _opState = OP_DEQUEUE;
+ }
+
+ void
+ DataTokenState::setTxnStateToCommit()
+ {
+ if (_txnState != TX_NONE)
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADDTOKTXNSTATE,
+ s_getStateAsString(TX_COMMIT),
+ s_getStateAsString(_txnState),
+ "dtok_state",
+ "set_txn_commit");
+ _txnState = TX_COMMIT;
+ }
+
+ void
+ DataTokenState::setTxnStateToAbort()
+ {
+ if (_txnState != TX_NONE)
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADDTOKTXNSTATE,
+ s_getStateAsString(TX_ABORT),
+ s_getStateAsString(_txnState),
+ "dtok_state",
+ "set_txn_abort");
+ _txnState = TX_ABORT;
+ }
+
+ void
+ DataTokenState::setBufferWriteStateToPart()
+ {
+ if (_bufferWriteState != IO_NONE)
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADDTOKIOSTATE,
+ s_getStateAsString(IO_PART),
+ s_getStateAsString(_bufferWriteState),
+ "dtok_state",
+ "set_buff_part");
+ _bufferWriteState = IO_PART;
+ }
+
+ void
+ DataTokenState::setBufferWriteStateToComplete()
+ {
+ _bufferWriteState = IO_COMPLETE;
+ }
+
+ void
+ DataTokenState::setAioSubmissionStateToPart()
+ {
+ if (_aioSubmissionState != IO_NONE)
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADDTOKIOSTATE,
+ s_getStateAsString(IO_PART),
+ s_getStateAsString(_aioSubmissionState),
+ "dtok_state",
+ "set_iosubm_part");
+ _aioSubmissionState = IO_PART;
+ }
+
+ void
+ DataTokenState::setAioSubmissionStateToComplete()
+ {
+ _aioSubmissionState = IO_COMPLETE;
+ }
+
+ void
+ DataTokenState::setAioCompletionStateToPart()
+ {
+ if (_aioCompletionState != IO_NONE)
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADDTOKIOSTATE,
+ s_getStateAsString(IO_PART),
+ s_getStateAsString(_aioCompletionState),
+ "dtok_state",
+ "set_iocompl_part");
+ _aioCompletionState = IO_PART;
+ }
+
+ void
+ DataTokenState::setAioCompletionStateToComplete()
+ {
+ _aioCompletionState = IO_COMPLETE;
+ }
+
+ //static
+ std::string
+ DataTokenState::s_getStateAsString(opState_t s)
+ {
+ switch (s) {
+ case OP_NONE:
+ return "OP_NONE";
+ case OP_ENQUEUE:
+ return "OP_ENQUEUE";
+ case OP_DEQUEUE:
+ return "OP_DEQUEUE";
+ default:
+ std::ostringstream oss;
+ oss << "<unknown state (" << s <<
")>";
+ return oss.str();
+ }
+ }
+
+ //static
+ std::string
+ DataTokenState::s_getStateAsString(txnState_t s)
+ {
+ switch (s) {
+ case TX_NONE:
+ return "TX_NONE";
+ case TX_COMMIT:
+ return "TX_COMMIT";
+ case TX_ABORT:
+ return "TX_ABORT";
+ default:
+ std::ostringstream oss;
+ oss << "<unknown state (" << s <<
")>";
+ return oss.str();
+ }
+ }
+
+ //static
+ std::string
+ DataTokenState::s_getStateAsString(aioState_t s)
+ {
+ switch (s) {
+ case IO_NONE:
+ return "IO_NONE";
+ case IO_PART:
+ return "IO_PART";
+ case IO_COMPLETE:
+ return "IO_COMPLETE";
+ default:
+ std::ostringstream oss;
+ oss << "<unknown state (" << s <<
")>";
+ return oss.str();
+ }
+ }
+
+} // namespace journal2
+} // namespace mrg
+
Copied: store/trunk/cpp/lib/jrnl2/DataTokenState.hpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/dtok_state.hpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/DataTokenState.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/DataTokenState.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,123 @@
+/**
+ * \file DataTokenState.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_journal2_DataTokenState_hpp
+#define mrg_journal2_DataTokenState_hpp
+
+#include <string>
+
+namespace mrg
+{
+namespace journal2
+{
+
+ typedef enum
+ {
+ OP_NONE = 0,
+ OP_ENQUEUE,
+ OP_DEQUEUE
+ } opState_t;
+
+ typedef enum
+ {
+ TX_NONE = 0,
+ TX_COMMIT,
+ TX_ABORT
+ } txnState_t;
+
+ typedef enum
+ {
+ IO_NONE = 0,
+ IO_PART,
+ IO_COMPLETE
+ } aioState_t;
+
+ class DataTokenState
+ {
+ opState_t _opState;
+ txnState_t _txnState;
+ aioState_t _bufferWriteState;
+ aioState_t _aioSubmissionState;
+ aioState_t _aioCompletionState;
+ public:
+ DataTokenState();
+ DataTokenState(const DataTokenState& s);
+ DataTokenState(const opState_t o,
+ const txnState_t t,
+ const aioState_t b,
+ const aioState_t s,
+ const aioState_t c);
+
+ // Raw state get/set functions
+ inline opState_t getOpState() const { return _opState; }
+ inline void setOpState(const opState_t s) { _opState = s; }
+ inline txnState_t getTxnState() const { return _txnState; }
+ inline void setTxnState(const txnState_t t) { _txnState = t; }
+ inline aioState_t getBufferWriteState() const { return _bufferWriteState; }
+ inline void setBufferWriteState(const aioState_t b) { _bufferWriteState = b; }
+ inline aioState_t getAioSubmissionState() const { return _aioSubmissionState; }
+ inline void setAioSubmissionState(const aioState_t s) { _aioSubmissionState = s;
}
+ inline aioState_t getAioCompletionState() const { return _aioCompletionState; }
+ inline void setAioCompletionState(const aioState_t c) { _aioCompletionState = c;
}
+
+ // State change functions
+ void reset();
+ void setOpStateToEnqueue();
+ void setOpStateToDequeue();
+ void setTxnStateToCommit();
+ void setTxnStateToAbort();
+ void setBufferWriteStateToPart();
+ void setBufferWriteStateToComplete();
+ void setAioSubmissionStateToPart();
+ void setAioSubmissionStateToComplete();
+ void setAioCompletionStateToPart();
+ void setAioCompletionStateToComplete();
+
+ // State query functions
+ inline bool isEnqueueable() const { return _opState == OP_NONE; }
+ inline bool isDequeueable() const { return _opState == OP_ENQUEUE; }
+ inline bool isTxnOpen() const { return _txnState == TX_NONE; }
+ inline bool isBufferWriteStateComplete() const { return _bufferWriteState ==
IO_COMPLETE; }
+ inline bool isAioSubmissionStateComplete() const { return _aioSubmissionState ==
IO_COMPLETE; }
+ inline bool isAioCompletionStateComplete() const { return _aioCompletionState ==
IO_COMPLETE; }
+
+ // State-to-string function(s)
+ static std::string s_getStateAsString(opState_t s);
+ static std::string s_getStateAsString(txnState_t s);
+ static std::string s_getStateAsString(aioState_t s);
+ };
+
+} // namespace journal2
+} // namespace mrg
+
+
+#endif // mrg_journal2_DataTokenState_hpp
+
Copied: store/trunk/cpp/lib/jrnl2/JournalDirectory.cpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/jdir.cpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/JournalDirectory.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/JournalDirectory.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,83 @@
+/**
+ * \file JournalDirectory.cpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "JournalDirectory.hpp"
+
+namespace mrg
+{
+namespace journal2
+{
+
+ // static
+ bool
+ JournalDirectory::s_exists(const std::string& name)
+ {
+ return s_exists(name.c_str());
+ }
+
+ // static
+ bool
+ JournalDirectory::s_exists(const char* /*name*/)
+ {
+ // TODO - add impl here
+ return false;
+ }
+
+ // static
+ void
+ JournalDirectory::s_create(const std::string& name)
+ {
+ s_create(name.c_str());
+ }
+
+ // static
+ void
+ JournalDirectory::s_create(const char* /*name*/)
+ {
+ // TODO - add impl here
+ }
+
+ // static
+ void
+ JournalDirectory::s_delete(const std::string& name)
+ {
+ s_delete(name.c_str());
+ }
+
+ // static
+ void
+ JournalDirectory::s_delete(const char* /*name*/)
+ {
+ // TODO - add impl here
+ }
+
+} // namespace journal2
+} // namespace mrg
Copied: store/trunk/cpp/lib/jrnl2/JournalDirectory.hpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/jdir.hpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/JournalDirectory.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/JournalDirectory.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,59 @@
+/**
+ * \file JournalDirectory.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_journal2_JournalDirectory_hpp
+#define mrg_journal2_JournalDirectory_hpp
+
+#include <string>
+
+namespace mrg
+{
+namespace journal2
+{
+
+ class JournalDirectory
+ {
+ public:
+ static bool s_exists(const std::string& name);
+ static bool s_exists(const char* name);
+ static void s_create(const std::string& name);
+ static void s_create(const char* name);
+ static void s_delete(const std::string& name);
+ static void s_delete(const char* name);
+ };
+
+
+} // namespace journal2
+} // namespace mrg
+
+
+#endif // mrg_journal2_JournalDirectory_hpp
+
Copied: store/trunk/cpp/lib/jrnl2/JournalErrors.cpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/jerrno.cpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/JournalErrors.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/JournalErrors.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,73 @@
+/**
+ * \file JournalErrors.cpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "JournalErrors.hpp"
+
+namespace mrg
+{
+namespace journal2
+{
+
+ std::map<u_int32_t, const char*> JournalErrors::_s_errorMap;
+ std::map<u_int32_t, const char*>::iterator JournalErrors::_s_errorMapIterator;
+ bool JournalErrors::_s_initializedFlag = JournalErrors::_s_initialize();
+
+ // generic errors
+ const u_int32_t JournalErrors::JERR_PTHREAD = 0x0001;
+
+ // illegal states
+ const u_int32_t JournalErrors::JERR_BADJRNLSTATE = 0x0101;
+ const u_int32_t JournalErrors::JERR_BADDTOKOPSTATE = 0x0102;
+ const u_int32_t JournalErrors::JERR_BADDTOKTXNSTATE = 0x0103;
+ const u_int32_t JournalErrors::JERR_BADDTOKIOSTATE = 0x0104;
+
+ bool
+ JournalErrors::_s_initialize()
+ {
+ _s_errorMap[JERR_PTHREAD] = "JERR_PTHREAD: pthread operation failure";
+ _s_errorMap[JERR_BADJRNLSTATE] = "JERR_BADJRNLSTATE: Illegal journal
state";
+ _s_errorMap[JERR_BADDTOKOPSTATE] = "JERR_BADDTOKOPSTATE: Illegal data token
op state";
+ _s_errorMap[JERR_BADDTOKTXNSTATE] = "JERR_BADDTOKTXNSTATE: Illegal data
token txn state";
+ _s_errorMap[JERR_BADDTOKIOSTATE] = "JERR_BADDTOKIOSTATE: Illegal data token
io state";
+ return true;
+ }
+
+ const char*
+ JournalErrors::s_errorMessage(const u_int32_t err_no) throw ()
+ {
+ _s_errorMapIterator = _s_errorMap.find(err_no);
+ if (_s_errorMapIterator == _s_errorMap.end())
+ return "<Unknown error code>";
+ return _s_errorMapIterator->second;
+ }
+
+} // namespace journal2
+} // namespace mrg
Copied: store/trunk/cpp/lib/jrnl2/JournalErrors.hpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/jerrno.hpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/JournalErrors.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/JournalErrors.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,66 @@
+/**
+ * \file JournalErrors.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_journal2_JournalErrors_hpp
+#define mrg_journal2_JournalErrors_hpp
+
+#include <map>
+#include <sys/types.h> // u_int16_t, u_int32_t
+
+namespace mrg
+{
+namespace journal2
+{
+
+ class JournalErrors
+ {
+ static std::map<u_int32_t, const char*> _s_errorMap; ///< Map
of error messages
+ static std::map<u_int32_t, const char*>::iterator _s_errorMapIterator;
///< Iterator
+ static bool _s_initializedFlag; ///< Dummy
flag, used to initialize map.
+ static bool _s_initialize(); ///< Static fn
for initializing static data
+ public:
+ // generic errors
+ static const u_int32_t JERR_PTHREAD; ///< pthread
operation failure
+
+ // illegal states
+ static const u_int32_t JERR_BADJRNLSTATE; ///< Illegal
journal state
+ static const u_int32_t JERR_BADDTOKOPSTATE; ///< Illegal
data token op state
+ static const u_int32_t JERR_BADDTOKTXNSTATE; ///< Illegal
data token txn state
+ static const u_int32_t JERR_BADDTOKIOSTATE; ///< Illegal
data token io state
+
+
+ static const char* s_errorMessage(const u_int32_t err_no) throw ();
+ };
+
+} // namespace journal2
+} // namespace mrg
+
+#endif // mrg_journal2_JournalErrors_hpp
Copied: store/trunk/cpp/lib/jrnl2/JournalException.cpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/jexception.cpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/JournalException.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/JournalException.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,190 @@
+/**
+ * \file JournalException.cpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "JournalException.hpp"
+
+#include <iomanip>
+
+namespace mrg
+{
+namespace journal2
+{
+
+ JournalException::JournalException() throw ():
+ std::exception(),
+ _errorCode(0)
+ {
+ _formatWhatStr();
+ }
+
+ JournalException::JournalException(const u_int32_t errorCode) throw ():
+ std::exception(),
+ _errorCode(errorCode)
+ {
+ _formatWhatStr();
+ }
+
+ JournalException::JournalException(const char* additionalInfo) throw ():
+ std::exception(),
+ _errorCode(0),
+ _additionalInfo(additionalInfo)
+ {
+ _formatWhatStr();
+ }
+
+ JournalException::JournalException(const std::string& additionalInfo) throw ():
+ std::exception(),
+ _errorCode(0),
+ _additionalInfo(additionalInfo)
+ {
+ _formatWhatStr();
+ }
+
+ JournalException::JournalException(const u_int32_t errorCode,
+ const char* additionalInfo) throw ():
+ std::exception(),
+ _errorCode(errorCode),
+ _additionalInfo(additionalInfo)
+ {
+ _formatWhatStr();
+ }
+
+ JournalException::JournalException(const u_int32_t errorCode,
+ const std::string& additionalInfo) throw ():
+ std::exception(),
+ _errorCode(errorCode),
+ _additionalInfo(additionalInfo)
+ {
+ _formatWhatStr();
+ }
+
+ JournalException::JournalException(const u_int32_t errorCode,
+ const char* throwingClass,
+ const char* throwingFunction) throw ():
+ std::exception(),
+ _errorCode(errorCode),
+ _throwingClass(throwingClass),
+ _throwingFunction(throwingFunction)
+ {
+ _formatWhatStr();
+ }
+
+ JournalException::JournalException(const u_int32_t errorCode,
+ const std::string& throwingClass,
+ const std::string& throwingFunction) throw
():
+ std::exception(),
+ _errorCode(errorCode),
+ _throwingClass(throwingClass),
+ _throwingFunction(throwingFunction)
+ {
+ _formatWhatStr();
+ }
+
+ JournalException::JournalException(const u_int32_t errorCode,
+ const char* additionalInfo,
+ const char* throwingClass,
+ const char* throwingFunction) throw ():
+ std::exception(),
+ _errorCode(errorCode),
+ _additionalInfo(additionalInfo),
+ _throwingClass(throwingClass),
+ _throwingFunction(throwingFunction)
+ {
+ _formatWhatStr();
+ }
+
+ JournalException::JournalException(const u_int32_t errorCode,
+ const std::string& additionalInfo,
+ const std::string& throwingClass,
+ const std::string& throwingFunction) throw
():
+ std::exception(),
+ _errorCode(errorCode),
+ _additionalInfo(additionalInfo),
+ _throwingClass(throwingClass),
+ _throwingFunction(throwingFunction)
+ {
+ _formatWhatStr();
+ }
+
+ void
+ JournalException::_formatWhatStr() throw ()
+ {
+ try {
+ const bool ai = !_additionalInfo.empty();
+ const bool tc = !_throwingClass.empty();
+ const bool tf = !_throwingFunction.empty();
+ std::ostringstream oss;
+ oss << "JournalException 0x" << std::hex <<
std::setfill('0') << std::setw(4) << _errorCode << "
";
+ if (tc) {
+ oss << _throwingClass;
+ if (tf) {
+ oss << "::";
+ } else {
+ oss << " ";
+ }
+ }
+ if (tf) {
+ oss << _throwingFunction << "() ";
+ }
+ if (tc || tf) {
+ oss << "threw " <<
JournalErrors::s_errorMessage(_errorCode);
+ }
+ if (ai) {
+ oss << " (" << _additionalInfo <<
")";
+ }
+ _what.assign(oss.str());
+ } catch (...) {}
+ }
+
+ const char*
+ JournalException::what() const throw ()
+ {
+ return _what.c_str();
+ }
+
+ std::ostream&
+ operator<<(std::ostream& os,
+ const JournalException& je)
+ {
+ os << je.what();
+ return os;
+ }
+
+ std::ostream&
+ operator<<(std::ostream& os,
+ const JournalException* jePtr)
+ {
+ os << jePtr->what();
+ return os;
+ }
+
+} // namespace journal2
+} // namespace mrg
Copied: store/trunk/cpp/lib/jrnl2/JournalException.hpp (from rev 4429,
store/trunk/cpp/lib/jrnl2/jexception.hpp)
===================================================================
--- store/trunk/cpp/lib/jrnl2/JournalException.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl2/JournalException.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -0,0 +1,118 @@
+/**
+ * \file JournalException.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains async journal code (v.2).
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_journal2_JournalException_hpp
+#define mrg_journal2_JournalException_hpp
+
+#include <cstring>
+#include <sstream>
+#include <string>
+#include <sys/types.h> // u_int16_t, u_int32_t
+
+#include "JournalErrors.hpp"
+
+// Macro definitions
+
+#define FORMAT_SYSERR(errno) " errno=" << errno << " ("
<< std::strerror(errno) << ")"
+
+#define PTHREAD_CHK(err, pfn, cls, fn) if(err != 0) { \
+ std::ostringstream oss; \
+ oss << pfn << " failed: " << FORMAT_SYSERR(err); \
+ throw JournalException(JournalErrors::JERR_PTHREAD, oss.str(), cls, fn); \
+ }
+
+#define THROW_STATE_EXCEPTION(jerrno, target_st, curr_st, cls, fn) { \
+ std::ostringstream oss; \
+ oss << cls << "::" << fn << "() in state
" << curr_st << " cannot be moved to state " << target_st
<< "."; \
+ throw JournalException(jerrno, oss.str(), cls, fn); \
+ }
+
+namespace mrg
+{
+namespace journal2
+{
+
+ class JournalException : public std::exception
+ {
+ protected:
+ u_int32_t _errorCode;
+ std::string _additionalInfo;
+ std::string _throwingClass;
+ std::string _throwingFunction;
+ std::string _what;
+
+ void _formatWhatStr() throw ();
+
+ public:
+ JournalException() throw ();
+
+ JournalException(const u_int32_t errorCode) throw ();
+
+ JournalException(const char* additionalInfo) throw ();
+ JournalException(const std::string& additionalInfo) throw ();
+
+ JournalException(const u_int32_t errorCode,
+ const char* additionalInfo) throw ();
+ JournalException(const u_int32_t errorCode,
+ const std::string& additionalInfo) throw ();
+
+ JournalException(const u_int32_t errorCode,
+ const char* throwingClass,
+ const char* throwingFunction) throw ();
+ JournalException(const u_int32_t errorCode,
+ const std::string& throwingClass,
+ const std::string& throwingFunction) throw ();
+
+ JournalException(const u_int32_t errorCode,
+ const char* additionalInfo,
+ const char* throwingClass,
+ const char* throwingFunction) throw ();
+ JournalException(const u_int32_t errorCode,
+ const std::string& additionalInfo,
+ const std::string& throwingClass,
+ const std::string& throwingFunction) throw ();
+
+ virtual ~JournalException() throw () {}
+ const char* what() const throw (); // override std::exception::what()
+
+ inline u_int32_t getErrorCode() const throw () { return _errorCode; }
+ inline const std::string getAdditionalInfo() const throw () { return
_additionalInfo; }
+ inline const std::string getThrowingClass() const throw () { return
_throwingClass; }
+ inline const std::string getThrowingFunction() const throw () { return
_throwingFunction; }
+
+ friend std::ostream& operator<<(std::ostream& os, const
JournalException& je);
+ friend std::ostream& operator<<(std::ostream& os, const
JournalException* jePtr);
+ }; // class JournalException
+
+} // namespace journal2
+} // namespace mrg
+
+#endif // mrg_journal2_JournalException_hpp
Modified: store/trunk/cpp/lib/jrnl2/JournalParameters.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/JournalParameters.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/JournalParameters.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -61,6 +61,7 @@
u_int16_t _autoExpandMaxJrnlFiles;
u_int16_t _writeBuffNumPgs;
u_int32_t _writeBuffPgSize_sblks;
+
JournalParameters();
JournalParameters(const std::string& jrnlDir,
const std::string& jrnlBaseFileName,
Modified: store/trunk/cpp/lib/jrnl2/Makefile.am
===================================================================
--- store/trunk/cpp/lib/jrnl2/Makefile.am 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/Makefile.am 2010-12-09 14:33:48 UTC (rev 4435)
@@ -24,22 +24,22 @@
lib_LTLIBRARIES = libasyncjrnl2.la
libasyncjrnl2_la_SOURCES = \
- dtok.cpp \
- dtok_state.cpp \
- jdir.cpp \
- jerrno.cpp \
- jexception.cpp \
+ DataToken.cpp \
+ DataTokenState.cpp \
+ JournalDirectory.cpp \
+ JournalErrors.cpp \
+ JournalException.cpp \
jrnl.cpp \
jrnl_state.cpp \
slock.cpp \
smutex.cpp \
JournalParameters.cpp \
- aio_callback.hpp \
+ AioCallback.hpp \
dtok.hpp \
- dtok_state.hpp \
- jdir.hpp \
- jerrno.hpp \
- jexception.hpp \
+ DataTokenState.hpp \
+ JournalDirectory.hpp \
+ JournalErrors.hpp \
+ JournalException.hpp \
jrnl.hpp \
jrnl_state.hpp \
slock.hpp \
Deleted: store/trunk/cpp/lib/jrnl2/aio_callback.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/aio_callback.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/aio_callback.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,57 +0,0 @@
-/**
- * \file aio_callback.hpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#ifndef mrg_journal2_aio_callback_hpp
-#define mrg_journal2_aio_callback_hpp
-
-#include "dtok.hpp"
-#include <sys/types.h> // u_int16_t, u_int32_t
-#include <vector>
-
-namespace mrg
-{
-namespace journal2
-{
-
- class aio_callback
- {
- public:
- virtual ~aio_callback() {}
- virtual void wr_aio_cb(std::vector<dtok*>& dtokl) = 0;
- virtual void rd_aio_cb(std::vector<u_int16_t>& pil) = 0;
- };
-
-} // namespace journal2
-} // namespace mrg
-
-
-#endif // mrg_journal2_aio_callback_hpp
-
Deleted: store/trunk/cpp/lib/jrnl2/dtok.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/dtok.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/dtok.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,69 +0,0 @@
-/**
- * \file dtok.cpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#include "dtok.hpp"
-
-namespace mrg
-{
-namespace journal2
-{
-// static
-rec_id rid_counter::_rid;
-
-// static
-smutex rid_counter::_rid_mutex;
-
-dtok::dtok() : _dtok_state(), _rid(rid_counter::get_next_rid()), _external_rid(false) {}
-
-dtok::dtok(const rec_id rid) : _dtok_state(), _rid(rid), _external_rid(true) {}
-
-void
-dtok::set_rid(const rec_id rid)
-{
- _rid = rid;
- _external_rid = true;
-}
-
-void
-dtok::set_drid(const rec_id drid)
-{
- _drid = drid;
-}
-
-std::string
-dtok::status_str()
-{
- return "status string";
-}
-
-} // namespace journal2
-} // namespace mrg
-
Deleted: store/trunk/cpp/lib/jrnl2/dtok.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/dtok.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/dtok.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,92 +0,0 @@
-/**
- * \file dtok.hpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#ifndef mrg_journal2_dtok_hpp
-#define mrg_journal2_dtok_hpp
-
-#include <string>
-#include <sys/types.h> // u_int16_t, u_int32_t
-
-#include "dtok_state.hpp"
-#include "slock.hpp"
-#include "smutex.hpp"
-
-namespace mrg
-{
-namespace journal2
-{
-
- typedef u_int64_t rec_id;
-
- class rid_counter
- {
- protected:
- static rec_id _rid;
- static smutex _rid_mutex;
- public:
- inline static rec_id get_next_rid() { slock l(_rid_mutex); return ++_rid; }
- };
-
- class dtok
- {
- protected:
- dtok_state _dtok_state;
- bool _transient;
- bool _external;
- std::string _external_location;
- rec_id _rid;
- bool _external_rid;
- rec_id _drid;
-
- public:
- dtok();
- dtok(const rec_id rid);
-
- inline dtok_state& get_dtok_state() { return _dtok_state; }
- inline bool is_transient() const { return _transient; }
- inline bool is_external() const { return _external; }
- inline std::string& get_external_location() { return _external_location; }
- void set_rid(const rec_id rid);
- inline rec_id get_rid() const { return _rid; }
- inline bool is_external_rid() { return _external_rid; }
- void set_drid(const rec_id drid);
- inline rec_id get_drid() const { return _drid; }
-
- // debug aids
- std::string status_str();
- };
-
-} // namespace journal2
-} // namespace mrg
-
-
-#endif // mrg_journal2_dtok_hpp
-
Deleted: store/trunk/cpp/lib/jrnl2/dtok_state.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/dtok_state.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/dtok_state.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,237 +0,0 @@
-/**
- * \file dtok_state.cpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#include "dtok_state.hpp"
-
-#include "jexception.hpp"
-
-namespace mrg
-{
-namespace journal2
-{
-
-dtok_state::dtok_state() :
- _op_state(OP_NONE),
- _txn_state(TX_NONE),
- _buff_state(IO_NONE),
- _iosubm_state(IO_NONE),
- _iocmpl_state(IO_NONE)
-{}
-
-dtok_state::dtok_state(const dtok_state& s) :
- _op_state(s._op_state),
- _txn_state(s._txn_state),
- _buff_state(s._buff_state),
- _iosubm_state(s._iosubm_state),
- _iocmpl_state(s._iocmpl_state)
-{}
-
-dtok_state::dtok_state(const opstate_t o,
- const txnstate_t t,
- const iostate_t b,
- const iostate_t s,
- const iostate_t c) :
- _op_state(o),
- _txn_state(t),
- _buff_state(b),
- _iosubm_state(s),
- _iocmpl_state(c)
-{}
-
-void
-dtok_state::reset()
-{
- _op_state = OP_NONE;
- _txn_state = TX_NONE;
- _buff_state = IO_NONE;
- _iosubm_state = IO_NONE;
- _iocmpl_state = IO_NONE;
-}
-
-void
-dtok_state::set_enqueue()
-{
- if (_op_state != OP_NONE)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADDTOKOPSTATE,
- get_state_str(OP_ENQUEUE),
- get_state_str(_op_state),
- "dtok_state",
- "set_enqueue");
- _op_state = OP_ENQUEUE;
-}
-
-void
-dtok_state::set_dequeue()
-{
- if (_op_state != OP_ENQUEUE)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADDTOKOPSTATE,
- get_state_str(OP_DEQUEUE),
- get_state_str(_op_state),
- "dtok_state",
- "set_dequeue");
- _op_state = OP_DEQUEUE;
-}
-
-void
-dtok_state::set_txn_commit()
-{
- if (_txn_state != TX_NONE)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADDTOKTXNSTATE,
- get_state_str(TX_COMMIT),
- get_state_str(_txn_state),
- "dtok_state",
- "set_txn_commit");
- _txn_state = TX_COMMIT;
-}
-
-void
-dtok_state::set_txn_abort()
-{
- if (_txn_state != TX_NONE)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADDTOKTXNSTATE,
- get_state_str(TX_ABORT),
- get_state_str(_txn_state),
- "dtok_state",
- "set_txn_abort");
- _txn_state = TX_ABORT;
-}
-
-void
-dtok_state::set_buff_part()
-{
- if (_buff_state != IO_NONE)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADDTOKIOSTATE,
- get_state_str(IO_PART),
- get_state_str(_buff_state),
- "dtok_state",
- "set_buff_part");
- _buff_state = IO_PART;
-}
-
-void
-dtok_state::set_buff_compl()
-{
- _buff_state = IO_COMPLETE;
-}
-
-void
-dtok_state::set_iosubm_part()
-{
- if (_iosubm_state != IO_NONE)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADDTOKIOSTATE,
- get_state_str(IO_PART),
- get_state_str(_iosubm_state),
- "dtok_state",
- "set_iosubm_part");
- _iosubm_state = IO_PART;
-}
-
-void
-dtok_state::set_iosubm_compl()
-{
- _iosubm_state = IO_COMPLETE;
-}
-
-void
-dtok_state::set_iocompl_part()
-{
- if (_iocmpl_state != IO_NONE)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADDTOKIOSTATE,
- get_state_str(IO_PART),
- get_state_str(_iocmpl_state),
- "dtok_state",
- "set_iocompl_part");
- _iocmpl_state = IO_PART;
-}
-
-void
-dtok_state::set_iocompl_compl()
-{
- _iocmpl_state = IO_COMPLETE;
-}
-
-//static
-std::string
-dtok_state::get_state_str(opstate_t s)
-{
- switch (s) {
- case OP_NONE:
- return "OP_NONE";
- case OP_ENQUEUE:
- return "OP_ENQUEUE";
- case OP_DEQUEUE:
- return "OP_DEQUEUE";
- default:
- std::ostringstream oss;
- oss << "<unknown state (" << s <<
")>";
- return oss.str();
- }
-}
-
-//static
-std::string
-dtok_state::get_state_str(txnstate_t s)
-{
- switch (s) {
- case TX_NONE:
- return "TX_NONE";
- case TX_COMMIT:
- return "TX_COMMIT";
- case TX_ABORT:
- return "TX_ABORT";
- default:
- std::ostringstream oss;
- oss << "<unknown state (" << s <<
")>";
- return oss.str();
- }
-}
-
-//static
-std::string
-dtok_state::get_state_str(iostate_t s)
-{
- switch (s) {
- case IO_NONE:
- return "IO_NONE";
- case IO_PART:
- return "IO_PART";
- case IO_COMPLETE:
- return "IO_COMPLETE";
- default:
- std::ostringstream oss;
- oss << "<unknown state (" << s <<
")>";
- return oss.str();
- }
-}
-
-} // namespace journal2
-} // namespace mrg
-
Deleted: store/trunk/cpp/lib/jrnl2/dtok_state.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/dtok_state.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/dtok_state.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,124 +0,0 @@
-/**
- * \file dtok_state.hpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#ifndef mrg_journal2_dtok_state_hpp
-#define mrg_journal2_dtok_state_hpp
-
-#include <string>
-
-namespace mrg
-{
-namespace journal2
-{
-
- typedef enum
- {
- OP_NONE = 0,
- OP_ENQUEUE,
- OP_DEQUEUE
- } opstate_t;
-
- typedef enum
- {
- TX_NONE = 0,
- TX_COMMIT,
- TX_ABORT
- } txnstate_t;
-
- typedef enum
- {
- IO_NONE = 0,
- IO_PART,
- IO_COMPLETE
- } iostate_t;
-
- class dtok_state
- {
- protected:
- opstate_t _op_state;
- txnstate_t _txn_state;
- iostate_t _buff_state;
- iostate_t _iosubm_state;
- iostate_t _iocmpl_state;
- public:
- dtok_state();
- dtok_state(const dtok_state& s);
- dtok_state(const opstate_t o,
- const txnstate_t t,
- const iostate_t b,
- const iostate_t s,
- const iostate_t c);
-
- // Raw state get/set functions
- inline opstate_t get_op_state() const { return _op_state; }
- inline void set_op_state(const opstate_t s) { _op_state = s; }
- inline txnstate_t get_txn_state() const { return _txn_state; }
- inline void set_txn_state(const txnstate_t t) { _txn_state = t; }
- inline iostate_t get_buff_state() const { return _buff_state; }
- inline void set_buff_state(const iostate_t b) { _buff_state = b; }
- inline iostate_t get_iosubm_state() const { return _iosubm_state; }
- inline void set_iosubm_state(const iostate_t s) { _iosubm_state = s; }
- inline iostate_t get_iocompl_state() const { return _iocmpl_state; }
- inline void set_iocompl_state(const iostate_t c) { _iocmpl_state = c; }
-
- // State change functions
- void reset();
- void set_enqueue();
- void set_dequeue();
- void set_txn_commit();
- void set_txn_abort();
- void set_buff_part();
- void set_buff_compl();
- void set_iosubm_part();
- void set_iosubm_compl();
- void set_iocompl_part();
- void set_iocompl_compl();
-
- // State query functions
- inline bool is_enqueueable() const { return _op_state == OP_NONE; }
- inline bool is_dequeueable() const { return _op_state == OP_ENQUEUE; }
- inline bool is_txn_open() const { return _txn_state == TX_NONE; }
- inline bool is_buff_write_compl() const { return _buff_state == IO_COMPLETE; }
- inline bool is_iosubm_compl() const { return _iosubm_state == IO_COMPLETE; }
- inline bool is_iocompl_compl() const { return _iocmpl_state == IO_COMPLETE; }
-
- // State-to-string function(s)
- static std::string get_state_str(opstate_t s);
- static std::string get_state_str(txnstate_t s);
- static std::string get_state_str(iostate_t s);
- };
-
-} // namespace journal2
-} // namespace mrg
-
-
-#endif // mrg_journal2_dtok_state_hpp
-
Deleted: store/trunk/cpp/lib/jrnl2/jdir.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/jdir.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/jdir.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,84 +0,0 @@
-/**
- * \file jdir.cpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#include "jdir.hpp"
-
-namespace mrg
-{
-namespace journal2
-{
-
-// static
-bool
-jdir::exists(const std::string& name)
-{
- return exists(name.c_str());
-}
-
-// static
-bool
-jdir::exists(const char* /*name*/)
-{
- // TODO - add impl here
- return false;
-}
-
-// static
-void
-jdir::create_dir(const std::string& name)
-{
- return create_dir(name.c_str());
-}
-
-// static
-void
-jdir::create_dir(const char* /*name*/)
-{
- // TODO - add impl here
-}
-
-// static
-void
-jdir::delete_dir(const std::string& name)
-{
- return delete_dir(name.c_str());
-}
-
-// static
-void
-jdir::delete_dir(const char* /*name*/)
-{
- // TODO - add impl here
-}
-
-
-} // namespace journal2
-} // namespace mrg
Deleted: store/trunk/cpp/lib/jrnl2/jdir.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/jdir.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/jdir.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,59 +0,0 @@
-/**
- * \file jdir.hpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#ifndef mrg_journal2_jdir_hpp
-#define mrg_journal2_jdir_hpp
-
-#include <string>
-
-namespace mrg
-{
-namespace journal2
-{
-
- class jdir
- {
- public:
- static bool exists(const std::string& name);
- static bool exists(const char* name);
- static void create_dir(const std::string& name);
- static void create_dir(const char* name);
- static void delete_dir(const std::string& name);
- static void delete_dir(const char* name);
- };
-
-
-} // namespace journal2
-} // namespace mrg
-
-
-#endif // mrg_journal2_jdir_hpp
-
Deleted: store/trunk/cpp/lib/jrnl2/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/jerrno.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/jerrno.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,74 +0,0 @@
-/**
- * \file jerrno.cpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#include "jerrno.hpp"
-
-namespace mrg
-{
-namespace journal2
-{
-
-std::map<u_int32_t, const char*> jerrno::_err_map;
-std::map<u_int32_t, const char*>::iterator jerrno::_err_map_itr;
-bool jerrno::_initialized = jerrno::__init();
-
-// generic errors
-const u_int32_t jerrno::JERR_PTHREAD = 0x0001;
-
-// illegal states
-const u_int32_t jerrno::JERR_BADJRNLSTATE = 0x0101;
-const u_int32_t jerrno::JERR_BADDTOKOPSTATE = 0x0102;
-const u_int32_t jerrno::JERR_BADDTOKTXNSTATE = 0x0103;
-const u_int32_t jerrno::JERR_BADDTOKIOSTATE = 0x0104;
-
-bool
-jerrno::__init()
-{
- _err_map[JERR_PTHREAD] = "JERR_PTHREAD: pthread operation failure";
- _err_map[JERR_BADJRNLSTATE] = "JERR_BADJRNLSTATE: Illegal journal state";
- _err_map[JERR_BADDTOKOPSTATE] = "JERR_BADDTOKOPSTATE: Illegal data token op
state";
- _err_map[JERR_BADDTOKTXNSTATE] = "JERR_BADDTOKTXNSTATE: Illegal data token txn
state";
- _err_map[JERR_BADDTOKIOSTATE] = "JERR_BADDTOKIOSTATE: Illegal data token io
state";
-
- return true;
-}
-
-const char*
-jerrno::err_msg(const u_int32_t err_no) throw ()
-{
- _err_map_itr = _err_map.find(err_no);
- if (_err_map_itr == _err_map.end())
- return "<Unknown error code>";
- return _err_map_itr->second;
-}
-
-} // namespace journal2
-} // namespace mrg
Deleted: store/trunk/cpp/lib/jrnl2/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/jerrno.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/jerrno.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,67 +0,0 @@
-/**
- * \file jerrno.hpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#ifndef mrg_journal2_jerrno_hpp
-#define mrg_journal2_jerrno_hpp
-
-#include <map>
-#include <sys/types.h> // u_int16_t, u_int32_t
-
-namespace mrg
-{
-namespace journal2
-{
-
- class jerrno
- {
- protected:
- static std::map<u_int32_t, const char*> _err_map; ///< Map
of error messages
- static std::map<u_int32_t, const char*>::iterator _err_map_itr; ///<
Iterator
- static bool _initialized; ///< Dummy
flag, used to initialize map.
- static bool __init(); ///< Static fn
for initializing static data
- public:
- // generic errors
- static const u_int32_t JERR_PTHREAD; ///< pthread
operation failure
-
- // illegal states
- static const u_int32_t JERR_BADJRNLSTATE; ///< Illegal
journal state
- static const u_int32_t JERR_BADDTOKOPSTATE; ///< Illegal
data token op state
- static const u_int32_t JERR_BADDTOKTXNSTATE; ///< Illegal
data token txn state
- static const u_int32_t JERR_BADDTOKIOSTATE; ///< Illegal
data token io state
-
-
- static const char* err_msg(const u_int32_t err_no) throw ();
- };
-
-} // namespace journal2
-} // namespace mrg
-
-#endif // mrg_journal2_jerrno_hpp
Deleted: store/trunk/cpp/lib/jrnl2/jexception.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/jexception.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/jexception.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,187 +0,0 @@
-/**
- * \file jexception.cpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#include "jexception.hpp"
-
-#include <iomanip>
-#include "jerrno.hpp"
-
-namespace mrg
-{
-namespace journal2
-{
-
-jexception::jexception() throw ():
- std::exception(),
- _err_code(0)
-{
- format();
-}
-
-jexception::jexception(const u_int32_t err_code) throw ():
- std::exception(),
- _err_code(err_code)
-{
- format();
-}
-
-jexception::jexception(const char* additional_info) throw ():
- std::exception(),
- _err_code(0),
- _additional_info(additional_info)
-{
- format();
-}
-
-jexception::jexception(const std::string& additional_info) throw ():
- std::exception(),
- _err_code(0),
- _additional_info(additional_info)
-{
- format();
-}
-
-jexception::jexception(const u_int32_t err_code,
- const char* additional_info) throw ():
- std::exception(),
- _err_code(err_code),
- _additional_info(additional_info)
-{
- format();
-}
-
-jexception::jexception(const u_int32_t err_code,
- const std::string& additional_info) throw ():
- std::exception(),
- _err_code(err_code),
- _additional_info(additional_info)
-{
- format();
-}
-
-jexception::jexception(const u_int32_t err_code,
- const char* throwing_class,
- const char* throwing_fn) throw ():
- std::exception(),
- _err_code(err_code),
- _throwing_class(throwing_class),
- _throwing_fn(throwing_fn)
-{
- format();
-}
-
-jexception::jexception(const u_int32_t err_code,
- const std::string& throwing_class,
- const std::string& throwing_fn) throw ():
- std::exception(),
- _err_code(err_code),
- _throwing_class(throwing_class),
- _throwing_fn(throwing_fn)
-{
- format();
-}
-
-jexception::jexception(const u_int32_t err_code,
- const char* additional_info,
- const char* throwing_class,
- const char* throwing_fn) throw ():
- std::exception(),
- _err_code(err_code),
- _additional_info(additional_info),
- _throwing_class(throwing_class),
- _throwing_fn(throwing_fn)
-{
- format();
-}
-
-jexception::jexception(const u_int32_t err_code,
- const std::string& additional_info,
- const std::string& throwing_class,
- const std::string& throwing_fn) throw ():
- std::exception(),
- _err_code(err_code),
- _additional_info(additional_info),
- _throwing_class(throwing_class),
- _throwing_fn(throwing_fn)
-{
- format();
-}
-
-jexception::~jexception() throw ()
-{}
-
-void
-jexception::format()
-{
- const bool ai = !_additional_info.empty();
- const bool tc = !_throwing_class.empty();
- const bool tf = !_throwing_fn.empty();
- std::ostringstream oss;
- oss << "jexception 0x" << std::hex <<
std::setfill('0') << std::setw(4) << _err_code << "
";
- if (tc)
- {
- oss << _throwing_class;
- if (tf)
- oss << "::";
- else
- oss << " ";
- }
- if (tf)
- oss << _throwing_fn << "() ";
- if (tc || tf)
- oss << "threw " << jerrno::err_msg(_err_code);
- if (ai)
- oss << " (" << _additional_info << ")";
- _what.assign(oss.str());
-}
-
-const char*
-jexception::what() const throw ()
-{
- return _what.c_str();
-}
-
-std::ostream&
-operator<<(std::ostream& os, const jexception& je)
-{
- os << je.what();
- return os;
-}
-
-std::ostream&
-operator<<(std::ostream& os, const jexception* jePtr)
-{
- os << jePtr->what();
- return os;
-}
-
-} // namespace journal2
-} // namespace mrg
Deleted: store/trunk/cpp/lib/jrnl2/jexception.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/jexception.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/jexception.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -1,118 +0,0 @@
-/**
- * \file jexception.hpp
- *
- * Qpid asynchronous store plugin library
- *
- * This file contains async journal code (v.2).
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2010 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
- * USA
- *
- * The GNU Lesser General Public License is available in the file COPYING.
- */
-
-#ifndef mrg_journal2_jexception_hpp
-#define mrg_journal2_jexception_hpp
-
-#include <cstring>
-#include <sstream>
-#include <string>
-#include <sys/types.h> // u_int16_t, u_int32_t
-
-#include "jerrno.hpp"
-
-// Macro definitions
-
-#define FORMAT_SYSERR(errno) " errno=" << errno << " ("
<< std::strerror(errno) << ")"
-
-#define PTHREAD_CHK(err, pfn, cls, fn) if(err != 0) { \
- std::ostringstream oss; \
- oss << pfn << " failed: " << FORMAT_SYSERR(err); \
- throw jexception(jerrno::JERR_PTHREAD, oss.str(), cls, fn); \
- }
-
-#define THROW_STATE_EXCEPTION(jerrno, target_st, curr_st, cls, fn) { \
- std::ostringstream oss; \
- oss << cls << "::" << fn << "() in state
" << curr_st << " cannot be moved to state " << target_st
<< "."; \
- throw jexception(jerrno, oss.str(), cls, fn); \
- }
-
-namespace mrg
-{
-namespace journal2
-{
-
- class jexception : public std::exception
- {
- protected:
- u_int32_t _err_code;
- std::string _additional_info;
- std::string _throwing_class;
- std::string _throwing_fn;
- std::string _what;
- void format();
-
- public:
- jexception() throw ();
-
- jexception(const u_int32_t err_code) throw ();
-
- jexception(const char* additional_info) throw ();
- jexception(const std::string& additional_info) throw ();
-
- jexception(const u_int32_t err_code,
- const char* additional_info) throw ();
- jexception(const u_int32_t err_code,
- const std::string& additional_info) throw ();
-
- jexception(const u_int32_t err_code,
- const char* throwing_class,
- const char* throwing_fn) throw ();
- jexception(const u_int32_t err_code,
- const std::string& throwing_class,
- const std::string& throwing_fn)
- throw ();
-
- jexception(const u_int32_t err_code,
- const char* additional_info,
- const char* throwing_class,
- const char* throwing_fn) throw ();
- jexception(const u_int32_t err_code,
- const std::string& additional_info,
- const std::string& throwing_class,
- const std::string& throwing_fn) throw ();
-
- virtual ~jexception() throw ();
- const char* what() const throw (); // override std::exception::what()
-
- inline u_int32_t get_err_code() const throw () { return _err_code; }
- inline const std::string get_additional_info() const throw () { return
_additional_info; }
- inline const std::string get_throwing_class() const throw () { return
_throwing_class; }
- inline const std::string get_throwing_fn() const throw () { return _throwing_fn;
}
-
- friend std::ostream& operator<<(std::ostream& os, const
jexception& je);
- friend std::ostream& operator<<(std::ostream& os, const jexception*
jePtr);
- }; // class jexception
-
-} // namespace journal2
-} // namespace mrg
-
-#endif // mrg_journal2_jexception_hpp
Modified: store/trunk/cpp/lib/jrnl2/jrnl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/jrnl.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/jrnl.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -65,16 +65,16 @@
{}
void
-jrnl::initialize(const JournalParameters* sp, aio_callback* const cbp)
+jrnl::initialize(const JournalParameters* sp, AioCallback* const cbp)
{
_store_params_ptr = sp;
_cbp = cbp;
}
iores
-jrnl::enqueue(const void* const /*msg_ptr*/, const std::size_t /*msg_size*/, dtok* const
dtokp)
+jrnl::enqueue(const void* const /*msg_ptr*/, const std::size_t /*msg_size*/, DataToken*
const dtokp)
{
- dtokp->get_dtok_state().set_enqueue();
+ dtokp->getDataTokenState().setOpStateToEnqueue();
// --- temp code ---
bool flush_flag;
{
@@ -89,10 +89,10 @@
}
iores
-jrnl::dequeue(dtok* const dtokp)
+jrnl::dequeue(DataToken* const dtokp)
{
- dtokp->get_dtok_state().set_dequeue();
- dtokp->set_drid(dtokp->get_rid());
+ dtokp->getDataTokenState().setOpStateToDequeue();
+ dtokp->setDequeueRecordId(dtokp->getRecordId());
// --- temp code ---
bool flush_flag;
{
@@ -166,7 +166,7 @@
if (l1.locked()) {
int i = cb_dtok_list_switch ? 0 : 1;
if (cb_dtok_list[i].size() && _cbp) {
- _cbp->wr_aio_cb(cb_dtok_list[i]);
+ _cbp->writeAioCompleteCallback(cb_dtok_list[i]);
}
cb_dtok_list[i].clear();
Modified: store/trunk/cpp/lib/jrnl2/jrnl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/jrnl.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/jrnl.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -36,8 +36,8 @@
#include <sys/types.h> // u_int64_t, u_int32_t, etc.
#include <time.h> // timespec
-#include "aio_callback.hpp"
-#include "dtok.hpp"
+#include "AioCallback.hpp"
+#include "DataToken.hpp"
#include "jrnl_state.hpp"
#include "JournalParameters.hpp"
@@ -66,12 +66,12 @@
std::string _base_filename;
jrnl_state _jrnl_state;
const JournalParameters* _store_params_ptr;
- aio_callback* _cbp;
+ AioCallback* _cbp;
// --- temp code ---
static u_int32_t list_thresh;
- std::vector<dtok*> wr_dtok_list;
- std::vector<dtok*> cb_dtok_list[2];
+ std::vector<DataToken*> wr_dtok_list;
+ std::vector<DataToken*> cb_dtok_list[2];
bool cb_dtok_list_switch;
smutex wr_dtok_list_lock;
smutex cb_dtok_list_lock;
@@ -89,9 +89,9 @@
inline const JournalParameters* get_store_params() const { return
_store_params_ptr; }
// msg ops
- void initialize(const JournalParameters* sp, aio_callback* const cbp);
- iores enqueue(const void* const msg_ptr, const std::size_t msg_size, dtok* const
dtokp);
- iores dequeue(dtok* const dtokp);
+ void initialize(const JournalParameters* sp, AioCallback* const cbp);
+ iores enqueue(const void* const msg_ptr, const std::size_t msg_size, DataToken*
const dtokp);
+ iores dequeue(DataToken* const dtokp);
iores commit();
iores abort();
Modified: store/trunk/cpp/lib/jrnl2/jrnl_state.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/jrnl_state.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/jrnl_state.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -31,7 +31,7 @@
#include "jrnl_state.hpp"
-#include "jexception.hpp"
+#include "JournalException.hpp"
namespace mrg
{
@@ -69,7 +69,7 @@
jrnl_state::initialize()
{
if (_jrnl_state != JS_NONE)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADJRNLSTATE,
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADJRNLSTATE,
get_state_str(JS_INITIALIZING),
get_state_str(_jrnl_state),
"jrnl_state",
@@ -81,7 +81,7 @@
jrnl_state::initialize_compl()
{
if (_jrnl_state != JS_INITIALIZING)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADJRNLSTATE,
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADJRNLSTATE,
get_state_str(JS_RUNNING),
get_state_str(_jrnl_state),
"jrnl_state",
@@ -93,7 +93,7 @@
jrnl_state::recover_phase_1()
{
if (_jrnl_state != JS_NONE)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADJRNLSTATE,
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADJRNLSTATE,
get_state_str(JS_RECOVERING_PHASE_1),
get_state_str(_jrnl_state),
"jrnl_state",
@@ -105,7 +105,7 @@
jrnl_state::recover_phase_2()
{
if (_jrnl_state != JS_RECOVERING_PHASE_1)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADJRNLSTATE,
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADJRNLSTATE,
get_state_str(JS_RECOVERING_PHASE_2),
get_state_str(_jrnl_state),
"jrnl_state",
@@ -117,7 +117,7 @@
jrnl_state::recover_compl()
{
if (_jrnl_state != JS_RECOVERING_PHASE_2)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADJRNLSTATE,
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADJRNLSTATE,
get_state_str(JS_RUNNING),
get_state_str(_jrnl_state),
"jrnl_state",
@@ -129,7 +129,7 @@
jrnl_state::stop()
{
if (_jrnl_state != JS_RUNNING)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADJRNLSTATE,
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADJRNLSTATE,
get_state_str(JS_STOPPING),
get_state_str(_jrnl_state),
"jrnl_state",
@@ -141,7 +141,7 @@
jrnl_state::stop_compl()
{
if (_jrnl_state != JS_STOPPING)
- THROW_STATE_EXCEPTION(jerrno::JERR_BADJRNLSTATE,
+ THROW_STATE_EXCEPTION(JournalErrors::JERR_BADJRNLSTATE,
get_state_str(JS_STOPPED),
get_state_str(_jrnl_state),
"jrnl_state",
Modified: store/trunk/cpp/lib/jrnl2/slock.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/slock.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/slock.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -35,7 +35,7 @@
#include <cerrno> // EBUSY
#include <pthread.h>
-#include "jexception.hpp"
+#include "JournalException.hpp"
#include "smutex.hpp"
namespace mrg
Modified: store/trunk/cpp/lib/jrnl2/smutex.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/smutex.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/lib/jrnl2/smutex.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -34,7 +34,7 @@
#include <pthread.h>
-#include "jexception.hpp"
+#include "JournalException.hpp"
namespace mrg
{
Modified: store/trunk/cpp/perf/JournalInstance.cpp
===================================================================
--- store/trunk/cpp/perf/JournalInstance.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/perf/JournalInstance.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -46,11 +46,11 @@
#else
mrg::journal::jcntl* const jrnlPtr) :
#endif
- _numMsgs(numMsgs),
- _msgSize(msgSize),
- _msgData(msgData),
- _jrnlPtr(jrnlPtr),
- _threadSwitch(false)
+ _numMsgs(numMsgs),
+ _msgSize(msgSize),
+ _msgData(msgData),
+ _jrnlPtr(jrnlPtr),
+ _threadSwitch(false)
{}
JournalInstance::~JournalInstance()
@@ -69,7 +69,7 @@
uint32_t i = 0;
while (i < _numMsgs) {
#ifdef JOURNAL2
- mrg::journal2::dtok* dtokPtr = new mrg::journal2::dtok();
+ mrg::journal2::DataToken* dtokPtr = new mrg::journal2::DataToken();
mrg::journal2::iores jrnlIoRes = _jrnlPtr->enqueue(_msgData, _msgSize,
dtokPtr);
#else
mrg::journal::data_tok* dtokPtr = new mrg::journal::data_tok();
@@ -127,7 +127,7 @@
uint32_t i = 0;
while (i < _numMsgs) {
#ifdef JOURNAL2
- mrg::journal2::dtok* dtokPtr = 0;
+ mrg::journal2::DataToken* dtokPtr = 0;
#else
mrg::journal::data_tok* dtokPtr = 0;
#endif
@@ -172,7 +172,7 @@
default:
#ifdef JOURNAL2
std::cerr << "dequeue_data_record FAILED with "
<< mrg::journal2::iores_str(jrnlIoRes) << ": "
- << dtokPtr->status_str() << std::endl;
+ << dtokPtr->statusStr() << std::endl;
#else
std::cerr << "dequeue_data_record FAILED with "
<< mrg::journal::iores_str(jrnlIoRes) << ": "
<< dtokPtr->status_str() << std::endl;
@@ -210,9 +210,9 @@
// This method will be called by multiple threads simultaneously
void
#ifdef JOURNAL2
- JournalInstance::wr_aio_cb(std::vector<mrg::journal2::dtok*>&
dataTokenList)
+
JournalInstance::writeAioCompleteCallback(std::vector<mrg::journal2::DataToken*>&
dataTokenList)
{
- mrg::journal2::dtok* dtokPtr;
+ mrg::journal2::DataToken* dtokPtr;
#else
JournalInstance::wr_aio_cb(std::vector<mrg::journal::data_tok*>&
dataTokenList)
{
@@ -223,7 +223,7 @@
dtokPtr = dataTokenList.back();
dataTokenList.pop_back();
#ifdef JOURNAL2
- switch (dtokPtr->get_dtok_state().get_op_state()) {
+ switch (dtokPtr->getDataTokenState().getOpState()) {
case mrg::journal2::OP_ENQUEUE:
#else
@@ -244,7 +244,11 @@
// *** MUST BE THREAD-SAFE ****
// This method will be called by multiple threads simultaneously
void
+#ifdef JOURNAL2
+ JournalInstance::readAioCompleteCallback(std::vector<uint16_t>&
/*buffPageCtrlBlkIndexList*/)
+#else
JournalInstance::rd_aio_cb(std::vector<uint16_t>&
/*buffPageCtrlBlkIndexList*/)
+#endif
{}
} // namespace jtest
Modified: store/trunk/cpp/perf/JournalInstance.hpp
===================================================================
--- store/trunk/cpp/perf/JournalInstance.hpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/perf/JournalInstance.hpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -37,8 +37,8 @@
#include <queue>
#ifdef JOURNAL2
-#include "jrnl2/aio_callback.hpp"
-#include "jrnl2/dtok.hpp"
+#include "jrnl2/AioCallback.hpp"
+#include "jrnl2/DataToken.hpp"
#include "jrnl2/jrnl.hpp"
#else
#include "jrnl/aio_callback.hpp"
@@ -59,7 +59,7 @@
* journal instance is provided as a pointer to the constructor.
*/
#ifdef JOURNAL2
- class JournalInstance: public mrg::journal2::aio_callback
+ class JournalInstance: public mrg::journal2::AioCallback
#else
class JournalInstance: public mrg::journal::aio_callback
#endif
@@ -69,7 +69,7 @@
const char* _msgData; ///< Pointer to message content to be
used for each message.
#ifdef JOURNAL2
mrg::journal2::jrnl* const _jrnlPtr; ///< Journal instance pointer
- std::queue<mrg::journal2::dtok*> _unprocCallbackList; ///< Queue of
unprocessed callbacks to be dequeued
+ std::queue<mrg::journal2::DataToken*> _unprocCallbackList; ///< Queue of
unprocessed callbacks to be dequeued
#else
mrg::journal::jcntl* const _jrnlPtr; ///< Journal instance pointer
std::queue<mrg::journal::data_tok*> _unprocCallbackList; ///< Queue of
unprocessed callbacks to be dequeued
@@ -152,7 +152,7 @@
* operations
*/
#ifdef JOURNAL2
- void wr_aio_cb(std::vector<mrg::journal2::dtok*>& dataTokenList);
+ void writeAioCompleteCallback(std::vector<mrg::journal2::DataToken*>&
dataTokenList);
#else
void wr_aio_cb(std::vector<mrg::journal::data_tok*>& dataTokenList);
#endif
@@ -164,7 +164,11 @@
*
* \param buffPageCtrlBlkIndexList A vector of indices to the buffer page control
blocks for completed reads
*/
+#ifdef JOURNAL2
+ void readAioCompleteCallback(std::vector<uint16_t>&
buffPageCtrlBlkIndexList);
+#else
void rd_aio_cb(std::vector<uint16_t>& buffPageCtrlBlkIndexList);
+#endif
};
} // namespace jtest
Modified: store/trunk/cpp/perf/JournalParameters.cpp
===================================================================
--- store/trunk/cpp/perf/JournalParameters.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/perf/JournalParameters.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -47,15 +47,15 @@
uint32_t JournalParameters::_s_defaultWriteBuffPgSize_sblks = 128;
JournalParameters::JournalParameters() :
- Streamable(),
- _jrnlDir(_s_defaultJrnlDir),
- _jrnlBaseFileName(_s_defaultJrnlBaseFileName),
- _numJrnlFiles(_s_defaultNumJrnlFiles),
-
_jrnlFileSize_sblks(_s_defaultJrnlFileSize_sblks),
- _autoExpand(_s_defaultAutoExpand),
-
_autoExpandMaxJrnlFiles(_s_defaultAutoExpandMaxJrnlFiles),
- _writeBuffNumPgs(_s_defaultWriteBuffNumPgs),
-
_writeBuffPgSize_sblks(_s_defaultWriteBuffPgSize_sblks)
+ Streamable(),
+ _jrnlDir(_s_defaultJrnlDir),
+ _jrnlBaseFileName(_s_defaultJrnlBaseFileName),
+ _numJrnlFiles(_s_defaultNumJrnlFiles),
+ _jrnlFileSize_sblks(_s_defaultJrnlFileSize_sblks),
+ _autoExpand(_s_defaultAutoExpand),
+ _autoExpandMaxJrnlFiles(_s_defaultAutoExpandMaxJrnlFiles),
+ _writeBuffNumPgs(_s_defaultWriteBuffNumPgs),
+ _writeBuffPgSize_sblks(_s_defaultWriteBuffPgSize_sblks)
{}
JournalParameters::JournalParameters(const std::string& jrnlDir,
@@ -66,28 +66,27 @@
const uint16_t autoExpandMaxJrnlFiles,
const uint16_t writeBuffNumPgs,
const uint32_t writeBuffPgSize_sblks) :
- Streamable(),
- _jrnlDir(jrnlDir),
- _jrnlBaseFileName(jrnlBaseFileName),
- _numJrnlFiles(numJrnlFiles),
- _jrnlFileSize_sblks(jrnlFileSize_sblks),
- _autoExpand(autoExpand),
-
_autoExpandMaxJrnlFiles(autoExpandMaxJrnlFiles),
- _writeBuffNumPgs(writeBuffNumPgs),
- _writeBuffPgSize_sblks(writeBuffPgSize_sblks)
+ Streamable(),
+ _jrnlDir(jrnlDir),
+ _jrnlBaseFileName(jrnlBaseFileName),
+ _numJrnlFiles(numJrnlFiles),
+ _jrnlFileSize_sblks(jrnlFileSize_sblks),
+ _autoExpand(autoExpand),
+ _autoExpandMaxJrnlFiles(autoExpandMaxJrnlFiles),
+ _writeBuffNumPgs(writeBuffNumPgs),
+ _writeBuffPgSize_sblks(writeBuffPgSize_sblks)
{}
JournalParameters::JournalParameters(const JournalParameters& jp) :
- Streamable(),
- _jrnlDir(jp._jrnlDir),
- _jrnlBaseFileName(jp._jrnlBaseFileName),
- _numJrnlFiles(jp._numJrnlFiles),
- _jrnlFileSize_sblks(jp._jrnlFileSize_sblks),
- _autoExpand(jp._autoExpand),
-
_autoExpandMaxJrnlFiles(jp._autoExpandMaxJrnlFiles),
- _writeBuffNumPgs(jp._writeBuffNumPgs),
-
_writeBuffPgSize_sblks(jp._writeBuffPgSize_sblks)
-
+ Streamable(),
+ _jrnlDir(jp._jrnlDir),
+ _jrnlBaseFileName(jp._jrnlBaseFileName),
+ _numJrnlFiles(jp._numJrnlFiles),
+ _jrnlFileSize_sblks(jp._jrnlFileSize_sblks),
+ _autoExpand(jp._autoExpand),
+ _autoExpandMaxJrnlFiles(jp._autoExpandMaxJrnlFiles),
+ _writeBuffNumPgs(jp._writeBuffNumPgs),
+ _writeBuffPgSize_sblks(jp._writeBuffPgSize_sblks)
{}
void
Modified: store/trunk/cpp/perf/JournalPerformanceTest.cpp
===================================================================
--- store/trunk/cpp/perf/JournalPerformanceTest.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/perf/JournalPerformanceTest.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -42,7 +42,7 @@
#include "ScopedTimer.hpp"
#ifdef JOURNAL2
-#include "jrnl2/jdir.hpp"
+#include "jrnl2/JournalDirectory.hpp"
#else
#include "jrnl/jdir.hpp"
#endif
@@ -57,11 +57,11 @@
#else
JournalPerformanceTest::JournalPerformanceTest(const TestParameters& tp, const
JournalParameters& jp) :
#endif
- Streamable(),
- _testParams(tp),
- _jrnlParams(jp),
- _jrnlPerf(tp),
- msgData(new char[tp._msgSize])
+ Streamable(),
+ _testParams(tp),
+ _jrnlParams(jp),
+ _jrnlPerf(tp),
+ msgData(new char[tp._msgSize])
{}
JournalPerformanceTest::~JournalPerformanceTest()
@@ -77,10 +77,10 @@
JournalPerformanceTest::_prepareJournals()
{
#ifdef JOURNAL2
- if (mrg::journal2::jdir::exists(_jrnlParams._jrnlDir)) {
- mrg::journal2::jdir::delete_dir(_jrnlParams._jrnlDir);
+ if (mrg::journal2::JournalDirectory::s_exists(_jrnlParams._jrnlDir)) {
+ mrg::journal2::JournalDirectory::s_delete(_jrnlParams._jrnlDir);
}
- mrg::journal2::jdir::create_dir(_jrnlParams._jrnlDir);
+ mrg::journal2::JournalDirectory::s_create(_jrnlParams._jrnlDir);
mrg::journal2::jrnl* jp;
#else
if (mrg::journal::jdir::exists(_jrnlParams._jrnlDir)) {
Modified: store/trunk/cpp/perf/PerformanceResult.cpp
===================================================================
--- store/trunk/cpp/perf/PerformanceResult.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/perf/PerformanceResult.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -39,9 +39,9 @@
{
PerformanceResult::PerformanceResult(const TestParameters& tp) :
- ScopedTimable(),
- Streamable(),
- _testParams(tp)
+ ScopedTimable(),
+ Streamable(),
+ _testParams(tp)
{}
void
Modified: store/trunk/cpp/perf/TestParameters.cpp
===================================================================
--- store/trunk/cpp/perf/TestParameters.cpp 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/perf/TestParameters.cpp 2010-12-09 14:33:48 UTC (rev 4435)
@@ -45,13 +45,13 @@
uint16_t TestParameters::_s_defaultDeqTxnBlkSize = 0;
TestParameters::TestParameters():
- Streamable(),
- _numMsgs(_s_defaultNumMsgs),
- _msgSize(_s_defaultMsgSize),
- _numQueues(_s_defaultNumQueues),
-
_numThreadPairsPerQueue(_s_defaultNumThreadPairsPerQueue),
- _enqTxnBlockSize(_s_defaultEnqTxnBlkSize),
- _deqTxnBlockSize(_s_defaultDeqTxnBlkSize)
+ Streamable(),
+ _numMsgs(_s_defaultNumMsgs),
+ _msgSize(_s_defaultMsgSize),
+ _numQueues(_s_defaultNumQueues),
+ _numThreadPairsPerQueue(_s_defaultNumThreadPairsPerQueue),
+ _enqTxnBlockSize(_s_defaultEnqTxnBlkSize),
+ _deqTxnBlockSize(_s_defaultDeqTxnBlkSize)
{}
TestParameters::TestParameters(const uint32_t numMsgs,
@@ -60,23 +60,23 @@
const uint16_t numThreadPairsPerQueue,
const uint16_t enqTxnBlockSize,
const uint16_t deqTxnBlockSize) :
- Streamable(),
- _numMsgs(numMsgs),
- _msgSize(msgSize),
- _numQueues(numQueues),
- _numThreadPairsPerQueue(numThreadPairsPerQueue),
- _enqTxnBlockSize(enqTxnBlockSize),
- _deqTxnBlockSize(deqTxnBlockSize)
+ Streamable(),
+ _numMsgs(numMsgs),
+ _msgSize(msgSize),
+ _numQueues(numQueues),
+ _numThreadPairsPerQueue(numThreadPairsPerQueue),
+ _enqTxnBlockSize(enqTxnBlockSize),
+ _deqTxnBlockSize(deqTxnBlockSize)
{}
TestParameters::TestParameters(const TestParameters& tp):
- Streamable(),
- _numMsgs(tp._numMsgs),
- _msgSize(tp._msgSize),
- _numQueues(tp._numQueues),
- _numThreadPairsPerQueue(tp._numThreadPairsPerQueue),
- _enqTxnBlockSize(tp._enqTxnBlockSize),
- _deqTxnBlockSize(tp._deqTxnBlockSize)
+ Streamable(),
+ _numMsgs(tp._numMsgs),
+ _msgSize(tp._msgSize),
+ _numQueues(tp._numQueues),
+ _numThreadPairsPerQueue(tp._numThreadPairsPerQueue),
+ _enqTxnBlockSize(tp._enqTxnBlockSize),
+ _deqTxnBlockSize(tp._deqTxnBlockSize)
{}
void
Modified: store/trunk/cpp/perf/m
===================================================================
--- store/trunk/cpp/perf/m 2010-12-08 18:07:29 UTC (rev 4434)
+++ store/trunk/cpp/perf/m 2010-12-09 14:33:48 UTC (rev 4435)
@@ -58,13 +58,13 @@
DEFINES=-DJOURNAL2
-JRNL_FILES="../lib/jrnl2/dtok.cpp \
- ../lib/jrnl2/jdir.cpp \
- ../lib/jrnl2/jexception.cpp \
+JRNL_FILES="../lib/jrnl2/DataToken.cpp \
+ ../lib/jrnl2/JournalDirectory.cpp \
+ ../lib/jrnl2/JournalException.cpp \
../lib/jrnl2/jrnl_state.cpp \
../lib/jrnl2/smutex.cpp \
- ../lib/jrnl2/dtok_state.cpp \
- ../lib/jrnl2/jerrno.cpp \
+ ../lib/jrnl2/DataTokenState.cpp \
+ ../lib/jrnl2/JournalErrors.cpp \
../lib/jrnl2/jrnl.cpp \
../lib/jrnl2/slock.cpp \
../lib/jrnl2/JournalParameters.cpp"