rhmessaging commits: r3958 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-05-10 15:57:40 -0400 (Mon, 10 May 2010)
New Revision: 3958
Modified:
store/trunk/cpp/lib/MessageStoreImpl.cpp
store/trunk/cpp/lib/MessageStoreImpl.h
Log:
Removed some unused functions left over from the removal of the message db
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2010-05-10 19:53:29 UTC (rev 3957)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2010-05-10 19:57:40 UTC (rev 3958)
@@ -1187,40 +1187,6 @@
throw mrg::journal::jexception(mrg::journal::jerrno::JERR__NOTIMPL, "MessageStoreImpl", "destroy");
}
-u_int64_t MessageStoreImpl::getRecordSize(db_ptr db,
- Dbt& key)
-{
- u_int64_t ret = 0;
- TxnCtxt txn;
- txn.begin(dbenv.get(), true);
- try {
- ret = getRecordSize(txn.get(), db, key);
- txn.commit();
- } catch (...) {
- txn.abort();
- throw;
- }
- return ret;
-}
-
-u_int64_t MessageStoreImpl::getRecordSize(DbTxn* txn,
- db_ptr db,
- Dbt& key)
-{
- Dbt peek;
- peek.set_flags(DB_DBT_USERMEM);
- peek.set_ulen(0);
- try {
- int status = db->get(txn, &key, &peek, 0);
- if (status != DB_BUFFER_SMALL) {
- THROW_STORE_EXCEPTION("Unexpected status code when determining record length: " + std::string(DbEnv::strerror(status)));
- }
- } catch (const DbMemoryException& expected) {
- //api doc indicates may throw exception instead of status = DB_BUFFER_SMALL;
- }
- return peek.get_size();
-}
-
void MessageStoreImpl::appendContent(const intrusive_ptr<const PersistableMessage>& /*msg*/,
const std::string& /*data*/)
{
@@ -1550,24 +1516,6 @@
}
}
-bool MessageStoreImpl::deleteKeyValuePair(db_ptr db,
- DbTxn* txn,
- Dbt& key,
- Dbt& value)
-{
- Cursor cursor;
- cursor.open(db, txn);
- int status = cursor->get(&key, &value, DB_GET_BOTH | DB_RMW);
- if (status == 0) {
- cursor->del(0);
- return true;
- } else if (status == DB_NOTFOUND) {
- return false;
- } else {
- THROW_STORE_EXCEPTION("Deletion failed: " + std::string(DbEnv::strerror(status)));
- }
-}
-
void MessageStoreImpl::deleteBindingsForQueue(const PersistableQueue& queue)
{
TxnCtxt txn;
Modified: store/trunk/cpp/lib/MessageStoreImpl.h
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.h 2010-05-10 19:53:29 UTC (rev 3957)
+++ store/trunk/cpp/lib/MessageStoreImpl.h 2010-05-10 19:57:40 UTC (rev 3958)
@@ -221,28 +221,15 @@
const qpid::broker::Persistable& p);
void completed(TxnCtxt& txn,
bool commit);
- void record2pcOp(db_ptr db,
- TPCTxnCtxt& txn,
- u_int64_t messageId,
- u_int64_t queueId);
void deleteBindingsForQueue(const qpid::broker::PersistableQueue& queue);
void deleteBinding(const qpid::broker::PersistableExchange& exchange,
const qpid::broker::PersistableQueue& queue,
const std::string& key);
- u_int64_t getRecordSize(db_ptr db,
- Dbt& key);
- u_int64_t getRecordSize(DbTxn* txn,
- db_ptr db,
- Dbt& key);
void put(db_ptr db,
DbTxn* txn,
Dbt& key,
Dbt& value);
- bool deleteKeyValuePair(db_ptr db,
- DbTxn* txn,
- Dbt& key,
- Dbt& value);
void open(db_ptr db,
DbTxn* txn,
const char* file,
14 years, 7 months
rhmessaging commits: r3957 - mgmt/newdata/wooly/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-05-10 15:53:29 -0400 (Mon, 10 May 2010)
New Revision: 3957
Modified:
mgmt/newdata/wooly/python/wooly/resources.py
Log:
Don't explode if a resource dir is missing
Modified: mgmt/newdata/wooly/python/wooly/resources.py
===================================================================
--- mgmt/newdata/wooly/python/wooly/resources.py 2010-05-10 19:09:10 UTC (rev 3956)
+++ mgmt/newdata/wooly/python/wooly/resources.py 2010-05-10 19:53:29 UTC (rev 3957)
@@ -56,6 +56,9 @@
self.whitelists = dict() # dir => (name1, name2, ...)
def add_dir(self, dir):
+ if not os.path.isdir(dir):
+ return
+
self.dirs.append(dir)
self.whitelists[dir] = set(os.listdir(dir))
14 years, 7 months
rhmessaging commits: r3956 - in mgmt/newdata/cumin: python/cumin and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-05-10 15:09:10 -0400 (Mon, 10 May 2010)
New Revision: 3956
Modified:
mgmt/newdata/cumin/etc/cumin.conf
mgmt/newdata/cumin/python/cumin/config.py
Log:
Spruce up the config file; add the system config file to the config search path
Modified: mgmt/newdata/cumin/etc/cumin.conf
===================================================================
--- mgmt/newdata/cumin/etc/cumin.conf 2010-05-10 18:11:41 UTC (rev 3955)
+++ mgmt/newdata/cumin/etc/cumin.conf 2010-05-10 19:09:10 UTC (rev 3956)
@@ -1,2 +1,17 @@
-[main]
-data: postgresql://cumin@localhost/cumin
+# Fields in comments reflect the default values
+
+[common]
+# database: dbname=cumin user=cumin host=localhost
+# broker: localhost:5672
+# debug: False
+log-file: /var/log/cumin/cumin.log
+log-level: info
+
+[web]
+# host: localhost
+# port: 45672
+# operator-email: [none]
+
+[data]
+# expire-frequency: 600
+# expire-threshold: 86400
Modified: mgmt/newdata/cumin/python/cumin/config.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/config.py 2010-05-10 18:11:41 UTC (rev 3955)
+++ mgmt/newdata/cumin/python/cumin/config.py 2010-05-10 19:09:10 UTC (rev 3956)
@@ -39,6 +39,8 @@
def parse(self):
paths = list()
+
+ paths.append(os.path.join("", "etc", "cumin.conf"))
paths.append(os.path.join(self.home, "etc", "cumin.conf"))
paths.append(os.path.join(os.path.expanduser("~"), ".cumin.conf"))
14 years, 7 months
rhmessaging commits: r3955 - in store/trunk/cpp: lib/jrnl and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-05-10 14:11:41 -0400 (Mon, 10 May 2010)
New Revision: 3955
Added:
store/trunk/cpp/lib/jrnl/smutex.cpp
store/trunk/cpp/lib/jrnl/smutex.hpp
Modified:
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/JournalImpl.h
store/trunk/cpp/lib/Makefile.am
store/trunk/cpp/lib/jrnl/arr_cnt.hpp
store/trunk/cpp/lib/jrnl/cvar.hpp
store/trunk/cpp/lib/jrnl/data_tok.cpp
store/trunk/cpp/lib/jrnl/data_tok.hpp
store/trunk/cpp/lib/jrnl/enq_map.cpp
store/trunk/cpp/lib/jrnl/enq_map.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/jexception.hpp
store/trunk/cpp/lib/jrnl/slock.hpp
store/trunk/cpp/lib/jrnl/txn_map.cpp
store/trunk/cpp/lib/jrnl/txn_map.hpp
store/trunk/cpp/tests/jrnl/jtt/data_src.cpp
store/trunk/cpp/tests/jrnl/jtt/data_src.hpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp
Log:
Thread lock reorganization to solve static thread protection problem
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -43,9 +43,9 @@
qpid::sys::Timer* JournalImpl::journalTimerPtr = 0;
u_int32_t JournalImpl::cnt = 0;
-void InactivityFireEvent::fire() { slock s(&_ife_mutex); if (parent) parent->flushFire(); }
+void InactivityFireEvent::fire() { slock s(_ife_mutex); if (_parent) _parent->flushFire(); }
-void GetEventsFireEvent::fire() { slock s(&_gefe_mutex); if (parent) parent->getEventsFire(); }
+void GetEventsFireEvent::fire() { slock s(_gefe_mutex); if (_parent) _parent->getEventsFire(); }
JournalImpl::JournalImpl(const std::string& journalId,
const std::string& journalDirectory,
@@ -66,7 +66,6 @@
_agent(a),
_mgmtObject(0)
{
- ::pthread_mutex_init(&_getf_mutex, 0);
getEventsFireEventsPtr = new GetEventsFireEvent(this, getEventsTimeout);
inactivityFireEventPtr = new InactivityFireEvent(this, flushTimeout);
if (journalTimerPtr == 0)
@@ -125,7 +124,6 @@
_mgmtObject = 0;
}
- ::pthread_mutex_destroy(&_getf_mutex);
log(LOG_DEBUG, "Destroyed");
}
@@ -505,7 +503,7 @@
{
const iores res = jcntl::flush(block_till_aio_cmpl);
{
- slock s(&_getf_mutex);
+ slock s(_getf_mutex);
if (_wmgr.get_aio_evt_rem() && !getEventsTimerSetFlag) { setGetEventTimer(); }
}
return res;
@@ -535,7 +533,7 @@
void
JournalImpl::getEventsFire()
{
- slock s(&_getf_mutex);
+ slock s(_getf_mutex);
getEventsTimerSetFlag = false;
if (_wmgr.get_aio_evt_rem()) { jcntl::get_wr_events(); }
if (_wmgr.get_aio_evt_rem()) { setGetEventTimer(); }
Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/JournalImpl.h 2010-05-10 18:11:41 UTC (rev 3955)
@@ -28,6 +28,7 @@
#include "jrnl/enums.hpp"
#include "jrnl/jcntl.hpp"
#include "jrnl/slock.hpp"
+#include "jrnl/smutex.hpp"
#include "DataTokenImpl.h"
#include "PreparedTransaction.h"
#include <qpid/broker/PersistableQueue.h>
@@ -45,28 +46,28 @@
class InactivityFireEvent : public qpid::sys::TimerTask
{
- JournalImpl* parent;
- pthread_mutex_t _ife_mutex;
+ JournalImpl* _parent;
+ mrg::journal::smutex _ife_mutex;
public:
InactivityFireEvent(JournalImpl* p, const qpid::sys::Duration timeout):
- qpid::sys::TimerTask(timeout), parent(p) { ::pthread_mutex_init(&_ife_mutex, 0); }
- virtual ~InactivityFireEvent() { ::pthread_mutex_destroy(&_ife_mutex); }
+ qpid::sys::TimerTask(timeout), _parent(p) {}
+ virtual ~InactivityFireEvent() {}
void fire();
- inline void cancel() { mrg::journal::slock s(&_ife_mutex); parent = 0; }
+ inline void cancel() { mrg::journal::slock s(_ife_mutex); _parent = 0; }
};
class GetEventsFireEvent : public qpid::sys::TimerTask
{
- JournalImpl* parent;
- pthread_mutex_t _gefe_mutex;
+ JournalImpl* _parent;
+ mrg::journal::smutex _gefe_mutex;
public:
GetEventsFireEvent(JournalImpl* p, const qpid::sys::Duration timeout):
- qpid::sys::TimerTask(timeout), parent(p) { ::pthread_mutex_init(&_gefe_mutex, 0); }
- virtual ~GetEventsFireEvent() { ::pthread_mutex_destroy(&_gefe_mutex); }
+ qpid::sys::TimerTask(timeout), _parent(p) {}
+ virtual ~GetEventsFireEvent() {}
void fire();
- inline void cancel() { mrg::journal::slock s(&_gefe_mutex); parent = 0; }
+ inline void cancel() { mrg::journal::slock s(_gefe_mutex); _parent = 0; }
};
class JournalImpl : public qpid::broker::ExternalQueueStore, public mrg::journal::jcntl, public mrg::journal::aio_callback
@@ -77,7 +78,7 @@
bool getEventsTimerSetFlag;
boost::intrusive_ptr<qpid::sys::TimerTask> getEventsFireEventsPtr;
- pthread_mutex_t _getf_mutex;
+ mrg::journal::smutex _getf_mutex;
u_int64_t lastReadRid; // rid of last read msg for loadMsgContent() - detects out-of-order read requests
std::vector<u_int64_t> oooRidList; // list of out-of-order rids (greater than current rid) encountered during read sequence
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/Makefile.am 2010-05-10 18:11:41 UTC (rev 3955)
@@ -80,6 +80,7 @@
jrnl/rfc.cpp \
jrnl/rrfc.cpp \
jrnl/slock.cpp \
+ jrnl/smutex.cpp \
jrnl/time_ns.cpp \
jrnl/txn_map.cpp \
jrnl/txn_rec.cpp \
@@ -115,6 +116,7 @@
jrnl/rfc.hpp \
jrnl/rrfc.hpp \
jrnl/slock.hpp \
+ jrnl/smutex.hpp \
jrnl/time_ns.hpp \
jrnl/txn_hdr.hpp \
jrnl/txn_map.hpp \
Modified: store/trunk/cpp/lib/jrnl/arr_cnt.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/arr_cnt.hpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/arr_cnt.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -47,6 +47,8 @@
* for which the number of elements is unknown, but for which the efficiency of a static
* array is required. None of the counts may go below zero.
*/
+
+ // TODO: Replace this class with instance of std::vector<u_int32_t>
class arr_cnt
{
private:
Modified: store/trunk/cpp/lib/jrnl/cvar.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/cvar.hpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/cvar.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -35,6 +35,7 @@
#include <cstring>
#include "jrnl/jerrno.hpp"
#include "jrnl/jexception.hpp"
+#include "jrnl/smutex.hpp"
#include "jrnl/time_ns.hpp"
#include <pthread.h>
#include <sstream>
@@ -48,37 +49,35 @@
class cvar
{
private:
- pthread_mutex_t& _m;
+ const smutex& _sm;
pthread_cond_t _c;
public:
- inline cvar(pthread_mutex_t& m) : _m(m) { ::pthread_cond_init(&_c, 0); }
+ inline cvar(const smutex& sm) : _sm(sm) { ::pthread_cond_init(&_c, 0); }
inline ~cvar() { ::pthread_cond_destroy(&_c); }
inline void wait()
{
- PTHREAD_CHK(::pthread_cond_wait(&_c, &_m), "pthread_cond_wait", "cvar", "wait");
+ PTHREAD_CHK(::pthread_cond_wait(&_c, _sm.get()), "::pthread_cond_wait", "cvar", "wait");
}
inline void timedwait(timespec& ts)
{
- PTHREAD_CHK(::pthread_cond_timedwait(&_c, &_m, &ts), "pthread_cond_timedwait", "cvar",
- "timedwait");
+ PTHREAD_CHK(::pthread_cond_timedwait(&_c, _sm.get(), &ts), "::pthread_cond_timedwait", "cvar", "timedwait");
}
inline bool waitintvl(const long intvl_ns)
{
time_ns t; t.now(); t+=intvl_ns;
- int ret = ::pthread_cond_timedwait(&_c, &_m, &t);
+ int ret = ::pthread_cond_timedwait(&_c, _sm.get(), &t);
if (ret == ETIMEDOUT)
return true;
- PTHREAD_CHK(ret, "pthread_cond_timedwait", "cvar", "waitintvl");
+ PTHREAD_CHK(ret, "::pthread_cond_timedwait", "cvar", "waitintvl");
return false;
}
inline void signal()
{
- PTHREAD_CHK(::pthread_cond_signal(&_c), "pthread_cond_signal", "cvar", "notify");
+ PTHREAD_CHK(::pthread_cond_signal(&_c), "::pthread_cond_signal", "cvar", "notify");
}
inline void broadcast()
{
- PTHREAD_CHK(::pthread_cond_broadcast(&_c), "pthread_cond_broadcast", "cvar",
- "broadcast");
+ PTHREAD_CHK(::pthread_cond_broadcast(&_c), "::pthread_cond_broadcast", "cvar", "broadcast");
}
};
Modified: store/trunk/cpp/lib/jrnl/data_tok.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/data_tok.cpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/data_tok.cpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -35,6 +35,7 @@
#include <iomanip>
#include "jrnl/jerrno.hpp"
#include "jrnl/jexception.hpp"
+#include "jrnl/slock.hpp"
#include <sstream>
namespace mrg
@@ -45,6 +46,7 @@
// Static members
u_int64_t data_tok::_cnt = 0;
+smutex data_tok::_mutex;
data_tok::data_tok():
_wstate(NONE),
@@ -59,16 +61,11 @@
_dequeue_rid(0),
_external_rid(false)
{
- pthread_mutex_init(&_mutex, 0);
- pthread_mutex_lock(&_mutex);
+ slock s(_mutex);
_icnt = _cnt++;
- pthread_mutex_unlock(&_mutex);
}
-data_tok::~data_tok()
-{
- pthread_mutex_destroy(&_mutex);
-}
+data_tok::~data_tok() {}
const char*
data_tok::wstate_str() const
Modified: store/trunk/cpp/lib/jrnl/data_tok.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/data_tok.hpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/data_tok.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -43,6 +43,7 @@
#include <cassert>
#include <cstddef>
+#include "jrnl/smutex.hpp"
#include <pthread.h>
#include <string>
#include <sys/types.h>
@@ -94,7 +95,7 @@
};
protected:
- pthread_mutex_t _mutex;
+ static smutex _mutex;
static u_int64_t _cnt;
u_int64_t _icnt;
write_state _wstate; ///< Enqueued / dequeued state of data
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -46,14 +46,9 @@
enq_map::enq_map():
_map(),
_pfid_enq_cnt()
-{
- pthread_mutex_init(&_mutex, 0);
-}
+{}
-enq_map::~enq_map()
-{
- pthread_mutex_destroy(&_mutex);
-}
+enq_map::~enq_map() {}
void
enq_map::set_num_jfiles(const u_int16_t num_jfiles)
@@ -73,7 +68,7 @@
std::pair<emap_itr, bool> ret;
emap_data_struct rec(pfid, locked);
{
- slock s(&_mutex);
+ slock s(_mutex);
ret = _map.insert(emap_param(rid, rec));
}
if (ret.second == false)
@@ -88,11 +83,8 @@
u_int16_t
enq_map::get_pfid(const u_int64_t rid)
{
- emap_itr itr;
- {
- slock s(&_mutex);
- itr = _map.find(rid);
- }
+ slock s(_mutex);
+ emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
std::ostringstream oss;
@@ -111,7 +103,7 @@
u_int16_t
enq_map::get_remove_pfid(const u_int64_t rid, const bool txn_flag)
{
- slock s(&_mutex);
+ slock s(_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
@@ -134,7 +126,7 @@
bool
enq_map::is_enqueued(const u_int64_t rid, bool ignore_lock)
{
- slock s(&_mutex);
+ slock s(_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
return false;
@@ -146,7 +138,7 @@
void
enq_map::lock(const u_int64_t rid)
{
- slock s(&_mutex);
+ slock s(_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
@@ -160,7 +152,7 @@
void
enq_map::unlock(const u_int64_t rid)
{
- slock s(&_mutex);
+ slock s(_mutex);
emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
@@ -174,11 +166,8 @@
bool
enq_map::is_locked(const u_int64_t rid)
{
- emap_itr itr;
- {
- slock s(&_mutex);
- itr = _map.find(rid);
- }
+ slock s(_mutex);
+ emap_itr itr = _map.find(rid);
if (itr == _map.end()) // not found in map
{
std::ostringstream oss;
@@ -193,7 +182,7 @@
{
rv.clear();
{
- slock s(&_mutex);
+ slock s(_mutex);
for (emap_itr itr = _map.begin(); itr != _map.end(); itr++)
rv.push_back(itr->first);
}
@@ -204,7 +193,7 @@
{
fv.clear();
{
- slock s(&_mutex);
+ slock s(_mutex);
for (emap_itr itr = _map.begin(); itr != _map.end(); itr++)
fv.push_back(itr->second._pfid);
}
Modified: store/trunk/cpp/lib/jrnl/enq_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.hpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -43,6 +43,7 @@
#include "jrnl/arr_cnt.hpp"
#include "jrnl/jexception.hpp"
+#include "jrnl/smutex.hpp"
#include <map>
#include <pthread.h>
#include <vector>
@@ -87,7 +88,7 @@
typedef emap::iterator emap_itr;
emap _map;
- pthread_mutex_t _mutex;
+ smutex _mutex;
arr_cnt _pfid_enq_cnt;
public:
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -73,10 +73,7 @@
_rmgr(this, _emap, _tmap, _rrfc),
_wmgr(this, _emap, _tmap, _wrfc),
_rcvdat()
-{
- ::pthread_mutex_init(&_wr_mutex, 0);
- ::pthread_mutex_init(&_gev_mutex, 0);
-}
+{}
jcntl::~jcntl()
{
@@ -84,8 +81,6 @@
try { stop(true); }
catch (const jexception& e) { std::cerr << e << std::endl; }
_lpmgr.finalize();
- ::pthread_mutex_destroy(&_gev_mutex);
- ::pthread_mutex_destroy(&_wr_mutex);
}
void
@@ -201,7 +196,7 @@
{
check_wstatus("enqueue_data_record");
{
- slock s(&_wr_mutex);
+ slock s(_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp, 0,
0, transient, false), r, dtokp)) ;
@@ -214,7 +209,7 @@
{
check_wstatus("enqueue_extern_data_record");
{
- slock s(&_wr_mutex);
+ slock s(_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(0, tot_data_len, 0, dtokp, 0, 0, transient,
true), r, dtokp)) ;
@@ -229,7 +224,7 @@
{
check_wstatus("enqueue_tx_data_record");
{
- slock s(&_wr_mutex);
+ slock s(_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp,
xid.data(), xid.size(), transient, false), r, dtokp)) ;
@@ -243,7 +238,7 @@
{
check_wstatus("enqueue_extern_txn_data_record");
{
- slock s(&_wr_mutex);
+ slock s(_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.enqueue(0, tot_data_len, 0, dtokp, xid.data(), xid.size(),
transient, true), r, dtokp)) ;
@@ -301,7 +296,7 @@
{
check_wstatus("dequeue_data");
{
- slock s(&_wr_mutex);
+ slock s(_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.dequeue(dtokp, 0, 0, txn_coml_commit), r, dtokp)) ;
return r;
@@ -313,7 +308,7 @@
{
check_wstatus("dequeue_data");
{
- slock s(&_wr_mutex);
+ slock s(_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.dequeue(dtokp, xid.data(), xid.size(), txn_coml_commit), r, dtokp)) ;
return r;
@@ -325,7 +320,7 @@
{
check_wstatus("txn_abort");
{
- slock s(&_wr_mutex);
+ slock s(_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.abort(dtokp, xid.data(), xid.size()), r, dtokp)) ;
return r;
@@ -337,7 +332,7 @@
{
check_wstatus("txn_commit");
{
- slock s(&_wr_mutex);
+ slock s(_wr_mutex);
iores r;
while (handle_aio_wait(_wmgr.commit(dtokp, xid.data(), xid.size()), r, dtokp)) ;
return r;
@@ -347,14 +342,14 @@
bool
jcntl::is_txn_synced(const std::string& xid)
{
- slock s(&_wr_mutex);
+ slock s(_wr_mutex);
return _wmgr.is_txn_synced(xid);
}
u_int32_t
jcntl::get_wr_events()
{
- stlock t(&_wr_mutex);
+ stlock t(_wr_mutex);
if (t.locked())
return _wmgr.get_events(pmgr::UNUSED);
return 0;
@@ -404,7 +399,7 @@
throw jexception(jerrno::JERR_JCNTL_READONLY, "jcntl", "flush");
iores res;
{
- slock s(&_wr_mutex);
+ slock s(_wr_mutex);
res = _wmgr.flush();
}
if (block_till_aio_cmpl)
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -47,6 +47,7 @@
#include "jrnl/fcntl.hpp"
#include "jrnl/lpmgr.hpp"
#include "jrnl/rcvdat.hpp"
+#include "jrnl/smutex.hpp"
#include "jrnl/rmgr.hpp"
#include "jrnl/wmgr.hpp"
#include "jrnl/wrfc.hpp"
@@ -143,8 +144,7 @@
rmgr _rmgr; ///< Read page manager which manages AIO
wmgr _wmgr; ///< Write page manager which manages AIO
rcvdat _rcvdat; ///< Recovery data used for recovery
- pthread_mutex_t _wr_mutex; ///< Mutex for journal writes
- pthread_mutex_t _gev_mutex; ///< Mutex for get_events
+ smutex _wr_mutex; ///< Mutex for journal writes
public:
/**
Modified: store/trunk/cpp/lib/jrnl/jexception.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jexception.hpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/jexception.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -43,10 +43,13 @@
}
}
+#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <exception>
+#include "jrnl/jerrno.hpp"
+#include <sstream>
#include <string>
#include <sys/types.h>
Modified: store/trunk/cpp/lib/jrnl/slock.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/slock.hpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/slock.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -33,12 +33,9 @@
#ifndef mrg_journal_slock_hpp
#define mrg_journal_slock_hpp
-#include <cerrno>
-#include <cstring>
-#include "jrnl/jerrno.hpp"
#include "jrnl/jexception.hpp"
+#include "jrnl/smutex.hpp"
#include <pthread.h>
-#include <sstream>
namespace mrg
{
@@ -49,15 +46,15 @@
class slock
{
protected:
- pthread_mutex_t* _m;
+ const smutex& _sm;
public:
- inline slock(pthread_mutex_t* m) : _m(m)
+ inline slock(const smutex& sm) : _sm(sm)
{
- PTHREAD_CHK(::pthread_mutex_lock(_m), "pthread_mutex_lock", "slock", "slock");
+ PTHREAD_CHK(::pthread_mutex_lock(_sm.get()), "::pthread_mutex_lock", "slock", "slock");
}
inline ~slock()
{
- PTHREAD_CHK(::pthread_mutex_unlock(_m), "pthread_mutex_unlock", "slock", "~slock");
+ PTHREAD_CHK(::pthread_mutex_unlock(_sm.get()), "::pthread_mutex_unlock", "slock", "~slock");
}
};
@@ -65,21 +62,19 @@
class stlock
{
protected:
- pthread_mutex_t* _m;
+ const smutex& _sm;
bool _locked;
public:
- inline stlock(pthread_mutex_t* m) : _m(m), _locked(false)
+ inline stlock(const smutex& sm) : _sm(sm), _locked(false)
{
- int ret = ::pthread_mutex_trylock(_m);
+ int ret = ::pthread_mutex_trylock(_sm.get());
_locked = (ret == 0); // check if lock obtained
- if (!_locked && ret != EBUSY) PTHREAD_CHK(ret, "pthread_mutex_trylock", "stlock",
- "stlock");
+ if (!_locked && ret != EBUSY) PTHREAD_CHK(ret, "::pthread_mutex_trylock", "stlock", "stlock");
}
inline ~stlock()
{
if (_locked)
- PTHREAD_CHK(::pthread_mutex_unlock(_m), "pthread_mutex_unlock", "stlock",
- "~stlock");
+ PTHREAD_CHK(::pthread_mutex_unlock(_sm.get()), "::pthread_mutex_unlock", "stlock", "~stlock");
}
inline bool locked() const { return _locked; }
};
Added: store/trunk/cpp/lib/jrnl/smutex.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/smutex.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/smutex.cpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -0,0 +1,33 @@
+/**
+ * \file smutex.cpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * File containing code for class mrg::journal::smutex (scoped mutex). See
+ * comments in file smutex.hpp for details.
+ *
+ * \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 "jrnl/smutex.hpp"
Added: store/trunk/cpp/lib/jrnl/smutex.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/smutex.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/smutex.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -0,0 +1,64 @@
+/**
+ * \file smutex.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * Messaging journal scoped mutex class mrg::journal::smutex.
+ *
+ * \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_journal_smutex_hpp
+#define mrg_journal_smutex_hpp
+
+#include "jrnl/jexception.hpp"
+#include <pthread.h>
+
+namespace mrg
+{
+namespace journal
+{
+
+ // Ultra-simple scoped mutex class that allows a posix mutex to be initialized and destroyed with error checks
+ class smutex
+ {
+ protected:
+ mutable pthread_mutex_t _m;
+ public:
+ inline smutex()
+ {
+ PTHREAD_CHK(::pthread_mutex_init(&_m, 0), "::pthread_mutex_init", "smutex", "smutex");
+ }
+ inline virtual ~smutex()
+ {
+ PTHREAD_CHK(::pthread_mutex_destroy(&_m), "::pthread_mutex_destroy", "smutex", "~smutex");
+ }
+ inline pthread_mutex_t* get() const { return &_m; }
+ };
+
+} // namespace journal
+} // namespace mrg
+
+#endif // ifndef mrg_journal_smutex_hpp
Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -56,14 +56,9 @@
txn_map::txn_map():
_map(),
_pfid_txn_cnt()
-{
- pthread_mutex_init(&_mutex, 0);
-}
+{}
-txn_map::~txn_map()
-{
- pthread_mutex_destroy(&_mutex);
-}
+txn_map::~txn_map() {}
void
txn_map::set_num_jfiles(const u_int16_t num_jfiles)
@@ -75,7 +70,7 @@
txn_map::insert_txn_data(const std::string& xid, const txn_data& td)
{
bool ok = true;
- slock s(&_mutex);
+ slock s(_mutex);
xmap_itr itr = _map.find(xid);
if (itr == _map.end()) // not found in map
{
@@ -94,7 +89,7 @@
const txn_data_list
txn_map::get_tdata_list(const std::string& xid)
{
- slock s(&_mutex);
+ slock s(_mutex);
return get_tdata_list_nolock(xid);
}
@@ -114,7 +109,7 @@
const txn_data_list
txn_map::get_remove_tdata_list(const std::string& xid)
{
- slock s(&_mutex);
+ slock s(_mutex);
xmap_itr itr = _map.find(xid);
if (itr == _map.end()) // not found in map
{
@@ -132,7 +127,7 @@
bool
txn_map::in_map(const std::string& xid)
{
- slock s(&_mutex);
+ slock s(_mutex);
xmap_itr itr= _map.find(xid);
if (itr == _map.end()) // not found in map
return false;
@@ -142,7 +137,7 @@
u_int32_t
txn_map::get_rid_count(const std::string& xid)
{
- slock s(&_mutex);
+ slock s(_mutex);
xmap_itr itr = _map.find(xid);
if (itr == _map.end()) // not found in map
{
@@ -156,7 +151,7 @@
u_int32_t
txn_map::cnt(const bool enq_flag)
{
- slock s(&_mutex);
+ slock s(_mutex);
u_int32_t c = 0;
for (xmap_itr i = _map.begin(); i != _map.end(); i++)
{
@@ -172,7 +167,7 @@
u_int32_t
txn_map::cnt(const std::string& xid, const bool enq_flag)
{
- slock s(&_mutex);
+ slock s(_mutex);
u_int32_t c = 0;
xmap_itr i = _map.find(xid);
if (i == _map.end()) // not found in map
@@ -188,7 +183,7 @@
bool
txn_map::is_txn_synced(const std::string& xid)
{
- slock s(&_mutex);
+ slock s(_mutex);
xmap_itr itr = _map.find(xid);
if (itr == _map.end()) // not found in map
{
@@ -214,7 +209,7 @@
bool ok = true;
bool found = false;
{
- slock s(&_mutex);
+ slock s(_mutex);
xmap_itr itr = _map.find(xid);
if (itr == _map.end()) // not found in map
ok = false;
@@ -245,7 +240,7 @@
{
bool found = false;
{
- slock s(&_mutex);
+ slock s(_mutex);
txn_data_list tdl = get_tdata_list_nolock(xid);
tdl_itr itr = tdl.begin();
while (itr != tdl.end() && !found)
@@ -268,7 +263,7 @@
{
bool found = false;
{
- slock s(&_mutex);
+ slock s(_mutex);
for (xmap_itr i = _map.begin(); i != _map.end() && !found; i++)
{
txn_data_list list = i->second;
@@ -289,7 +284,7 @@
{
xv.clear();
{
- slock s(&_mutex);
+ slock s(_mutex);
for (xmap_itr itr = _map.begin(); itr != _map.end(); itr++)
xv.push_back(itr->first);
}
Modified: store/trunk/cpp/lib/jrnl/txn_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.hpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/lib/jrnl/txn_map.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -42,6 +42,7 @@
}
#include "jrnl/arr_cnt.hpp"
+#include "jrnl/smutex.hpp"
#include <map>
#include <pthread.h>
#include <string>
@@ -116,7 +117,7 @@
typedef xmap::iterator xmap_itr;
xmap _map;
- pthread_mutex_t _mutex;
+ smutex _mutex;
arr_cnt _pfid_txn_cnt;
public:
Modified: store/trunk/cpp/tests/jrnl/jtt/data_src.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/data_src.cpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/tests/jrnl/jtt/data_src.cpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -36,7 +36,7 @@
char data_src::_xid_src[data_src::max_xsize];
bool data_src::_initialized = data_src::__init();
u_int64_t data_src::_xid_cnt = 0ULL;
-data_src::mutex data_src::_m;
+mrg::journal::smutex data_src::_sm;
data_src::data_src()
{}
Modified: store/trunk/cpp/tests/jrnl/jtt/data_src.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/data_src.hpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/tests/jrnl/jtt/data_src.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -26,6 +26,7 @@
#include <cstddef>
#include "jrnl/slock.hpp"
+#include "jrnl/smutex.hpp"
#include <pthread.h>
#include <string>
#include <sys/types.h>
@@ -48,16 +49,7 @@
static char _xid_src[];
static u_int64_t _xid_cnt;
static bool _initialized;
- class mutex
- {
- private:
- pthread_mutex_t _mutex;
- public:
- inline mutex() { pthread_mutex_init(&_mutex, 0); }
- inline ~mutex() { pthread_mutex_destroy(&_mutex); }
- inline pthread_mutex_t* m() { return &_mutex; }
- };
- static mutex _m;
+ static mrg::journal::smutex _sm;
public:
static const char* get_data(const std::size_t offs);
@@ -65,7 +57,7 @@
private:
data_src();
- static u_int64_t get_xid_cnt() { mrg::journal::slock s(_m.m()); return _xid_cnt++; }
+ static u_int64_t get_xid_cnt() { mrg::journal::slock s(_sm); return _xid_cnt++; }
static const char* get_xid_content(const std::size_t offs);
static bool __init();
};
Modified: store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -55,12 +55,7 @@
_deq_list_cv(_deq_list_mutex),
_tcp(),
_tcrp()
-{
- pthread_mutex_init(&_rd_aio_mutex, 0);
- pthread_mutex_init(&_wr_full_mutex, 0);
- pthread_mutex_init(&_rd_list_mutex, 0);
- pthread_mutex_init(&_deq_list_mutex, 0);
-}
+{}
jrnl_instance::jrnl_instance(const jrnl_init_params::shared_ptr& p):
mrg::journal::jcntl(p->jid(), p->jdir(), p->base_filename()),
@@ -76,20 +71,9 @@
_deq_list_cv(_deq_list_mutex),
_tcp(),
_tcrp()
-{
- pthread_mutex_init(&_rd_aio_mutex, 0);
- pthread_mutex_init(&_wr_full_mutex, 0);
- pthread_mutex_init(&_rd_list_mutex, 0);
- pthread_mutex_init(&_deq_list_mutex, 0);
-}
+{}
-jrnl_instance::~jrnl_instance()
-{
- pthread_mutex_destroy(&_rd_aio_mutex);
- pthread_mutex_destroy(&_wr_full_mutex);
- pthread_mutex_destroy(&_rd_list_mutex);
- pthread_mutex_destroy(&_deq_list_mutex);
-}
+jrnl_instance::~jrnl_instance() {}
void
@@ -209,7 +193,7 @@
}
else if (get_wr_events() == 0)
{
- mrg::journal::slock sl(&_wr_full_mutex);
+ mrg::journal::slock sl(_wr_full_mutex);
_wr_full_cv.waitintvl(MAX_WR_WAIT * 1000000); // MAX_WR_WAIT in ms
}
break;
@@ -239,7 +223,7 @@
{
journal::data_tok* dtokp = 0;
{
- mrg::journal::slock sl(&_rd_list_mutex);
+ mrg::journal::slock sl(_rd_list_mutex);
if (_dtok_rd_list.empty())
_rd_list_cv.wait();
if (!_dtok_rd_list.empty())
@@ -273,7 +257,7 @@
{
case mrg::journal::RHM_IORES_SUCCESS:
{
- mrg::journal::slock sl(&_deq_list_mutex);
+ mrg::journal::slock sl(_deq_list_mutex);
_dtok_deq_list.push_back(dtokp);
_deq_list_cv.broadcast();
}
@@ -291,7 +275,7 @@
case mrg::journal::RHM_IORES_PAGE_AIOWAIT:
if (get_rd_events() == 0)
{
- mrg::journal::slock sl(&_rd_aio_mutex);
+ mrg::journal::slock sl(_rd_aio_mutex);
_rd_aio_cv.waitintvl(MAX_RD_WAIT * 1000000); // MAX_RD_WAIT in ms
}
break;
@@ -301,7 +285,7 @@
oss << "\" returned " << mrg::journal::iores_str(res) << ".";
_tcrp->add_exception(oss.str());
{
- mrg::journal::slock sl(&_deq_list_mutex);
+ mrg::journal::slock sl(_deq_list_mutex);
_deq_list_cv.broadcast(); // wake up deq thread
}
}
@@ -326,7 +310,7 @@
{
journal::data_tok* dtokp = 0;
{
- mrg::journal::slock sl(&_deq_list_mutex);
+ mrg::journal::slock sl(_deq_list_mutex);
if (_dtok_deq_list.empty())
_deq_list_cv.wait();
if (!_dtok_deq_list.empty())
@@ -426,20 +410,20 @@
{
if (_args_ptr->read_mode.val() == read_arg::NONE)
{
- mrg::journal::slock sl(&_deq_list_mutex);
+ mrg::journal::slock sl(_deq_list_mutex);
_dtok_deq_list.push_back(dtokp);
_deq_list_cv.broadcast();
}
else
{
- mrg::journal::slock sl(&_rd_list_mutex);
+ mrg::journal::slock sl(_rd_list_mutex);
_dtok_rd_list.push_back(dtokp);
_rd_list_cv.broadcast();
}
}
else // DEQ
{
- mrg::journal::slock sl(&_wr_full_mutex);
+ mrg::journal::slock sl(_wr_full_mutex);
_wr_full_cv.broadcast();
}
}
@@ -449,7 +433,7 @@
void
jrnl_instance::rd_aio_cb(std::vector<u_int16_t>& /*pil*/)
{
- mrg::journal::slock sl(&_rd_aio_mutex);
+ mrg::journal::slock sl(_rd_aio_mutex);
_rd_aio_cv.broadcast();
}
Modified: store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp 2010-05-10 17:48:27 UTC (rev 3954)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp 2010-05-10 18:11:41 UTC (rev 3955)
@@ -33,6 +33,7 @@
#include "jrnl/data_tok.hpp"
#include "jrnl/jcntl.hpp"
#include "jrnl/slock.hpp"
+#include "jrnl/smutex.hpp"
#include <list>
#include <vector>
@@ -54,14 +55,14 @@
std::vector<dtok_ptr> _dtok_master_txn_list;
std::list<journal::data_tok*> _dtok_rd_list;
std::list<journal::data_tok*> _dtok_deq_list;
- pthread_mutex_t _rd_aio_mutex; ///< Mutex for read aio wait conditions
- mrg::journal::cvar _rd_aio_cv; ///< Condition var for read aio wait conditions
- pthread_mutex_t _wr_full_mutex; ///< Mutex for write full conditions
- mrg::journal::cvar _wr_full_cv; ///< Condition var for write full conditions
- pthread_mutex_t _rd_list_mutex; ///< Mutex for _dtok_rd_list
- mrg::journal::cvar _rd_list_cv; ///< Condition var for _dtok_rd_list
- pthread_mutex_t _deq_list_mutex; ///< Mutex for _dtok_deq_list
- mrg::journal::cvar _deq_list_cv; ///< Condition var for _dtok_deq_list
+ mrg::journal::smutex _rd_aio_mutex; ///< Mutex for read aio wait conditions
+ mrg::journal::cvar _rd_aio_cv; ///< Condition var for read aio wait conditions
+ mrg::journal::smutex _wr_full_mutex; ///< Mutex for write full conditions
+ mrg::journal::cvar _wr_full_cv; ///< Condition var for write full conditions
+ mrg::journal::smutex _rd_list_mutex; ///< Mutex for _dtok_rd_list
+ mrg::journal::cvar _rd_list_cv; ///< Condition var for _dtok_rd_list
+ mrg::journal::smutex _deq_list_mutex; ///< Mutex for _dtok_deq_list
+ mrg::journal::cvar _deq_list_cv; ///< Condition var for _dtok_deq_list
pthread_t _enq_thread;
pthread_t _deq_thread;
pthread_t _read_thread;
14 years, 7 months
rhmessaging commits: r3954 - mgmt/newdata/cumin/python/cumin/messaging.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-05-10 13:48:27 -0400 (Mon, 10 May 2010)
New Revision: 3954
Modified:
mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py
mgmt/newdata/cumin/python/cumin/messaging/main.py
Log:
Added 'Add broker group' task on main messaging frame
Modified: mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py 2010-05-10 17:45:19 UTC (rev 3953)
+++ mgmt/newdata/cumin/python/cumin/messaging/brokergroup.py 2010-05-10 17:48:27 UTC (rev 3954)
@@ -86,33 +86,46 @@
def __init__(self, app, name, task):
super(BrokerGroupForm, self).__init__(app, name, task)
- self.name_ = StringField(app, "name")
+ self.name_ = self.NameField(app, "name")
self.add_field(self.name_)
self.description = self.Description(app, "description")
self.add_field(self.description)
+ class NameField(StringField):
+ def render_title(self, session):
+ return "Group Name"
+
class Description(MultilineStringField):
def render_title(self, session):
return "Description"
-class BrokerGroupAdd(ObjectTask):
- def __init__(self, app, frame):
- super(BrokerGroupAdd, self).__init__(app, frame)
+class BrokerGroupAdd(Task):
+ def __init__(self, app):
+ super(BrokerGroupAdd, self).__init__(app)
self.form = BrokerGroupAddForm(app, self.name, self)
def get_title(self, session):
return "Add broker group"
+ def enter(self, session):
+ nsession = wooly.Session(self.app.form_page)
+
+ self.form.return_url.set(nsession, session.marshal())
+ self.form.show(nsession)
+
+ return nsession
+
def do_invoke(self, invoc, obj, name, description):
conn = self.app.database.get_connection()
cursor = conn.cursor()
- group = self.cls.create_object(cursor)
+ cls = self.app.model.com_redhat_cumin.BrokerGroup
+ group = cls.create_object(cursor)
+
group.name = name
group.description = description
-
group.fake_qmf_values()
try:
@@ -121,11 +134,8 @@
cursor.close()
conn.commit()
-
invoc.end()
- return group
-
class BrokerGroupAddForm(BrokerGroupForm):
def process_submit(self, session):
self.validate(session)
@@ -138,7 +148,7 @@
self.task.exit_with_redirect(session)
def render_title(self, session):
- return self.task.get_title(session, None)
+ return self.task.get_title(session)
class BrokerGroupEdit(ObjectTask):
def __init__(self, app, frame):
Modified: mgmt/newdata/cumin/python/cumin/messaging/main.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/main.py 2010-05-10 17:45:19 UTC (rev 3953)
+++ mgmt/newdata/cumin/python/cumin/messaging/main.py 2010-05-10 17:48:27 UTC (rev 3954)
@@ -40,6 +40,16 @@
self.brokergroup = BrokerGroupFrame(app, "brokergroup")
self.add_mode(self.brokergroup)
+ self.add_group = BrokerGroupAdd(app)
+ self.tasks = list()
+ self.tasks.append(self.add_group)
+
+ def init(self):
+ super(MessagingFrame, self).init()
+
+ for task in self.tasks:
+ task.init()
+
def render_title(self, session):
return "Messaging"
@@ -47,7 +57,7 @@
def __init__(self, app, name):
super(MessagingView, self).__init__(app, name)
- heading = self.Heading(app, "heading")
+ heading = self.MessageViewHeading(app, "heading")
self.add_child(heading)
self.tabs = TabbedModeSet(app, "tabs")
@@ -56,9 +66,23 @@
self.tabs.add_tab(BrokerBrowser(app, "brokers"))
self.tabs.add_tab(BrokerGroupSelector(app, "brokergroups"))
- class Heading(CuminHeading):
+ class MessageViewHeading(CuminSummary):
+ def __init__(self, app, name):
+ super(MessagingView.MessageViewHeading, self).__init__(app, name, None)
+
+ self.tasks = self.SummaryTasks(app, "tasks")
+ self.replace_child(self.tasks)
+
+ props = Widget(app, "properties")
+ self.replace_child(props)
+
def render_title(self, session):
return "Messaging"
def render_icon_href(self, session):
return "resource?name=broker-36.png"
+
+ class SummaryTasks(ActionSet):
+ def do_get_items(self, session):
+ return [(x.get_href(session), x.get_title(session), True)
+ for x in self.frame.tasks]
14 years, 7 months
rhmessaging commits: r3953 - mgmt/newdata/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-05-10 13:45:19 -0400 (Mon, 10 May 2010)
New Revision: 3953
Modified:
mgmt/newdata/cumin/python/cumin/objecttask.py
Log:
Moved invoke and do_invoke to base class
Modified: mgmt/newdata/cumin/python/cumin/objecttask.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/objecttask.py 2010-05-10 17:25:54 UTC (rev 3952)
+++ mgmt/newdata/cumin/python/cumin/objecttask.py 2010-05-10 17:45:19 UTC (rev 3953)
@@ -71,6 +71,20 @@
return invoc
+ def invoke(self, session, obj, *args):
+ if obj:
+ assert isinstance(obj, RosemaryObject), obj
+
+ invoc = self.start(session, obj)
+
+ try:
+ self.do_invoke(invoc, obj, *args)
+ except Exception, e:
+ self.exception(invoc, e)
+
+ def do_invoke(self, invoc, obj, *args):
+ pass
+
def qmf_call(self, invoc, obj, meth, *args):
def completion(status_code, output_args):
invoc.status_code = status_code
@@ -119,20 +133,6 @@
def do_enter(self, session):
pass
- def invoke(self, session, obj, *args):
- if obj:
- assert isinstance(obj, RosemaryObject), obj
-
- invoc = self.start(session, obj)
-
- try:
- self.do_invoke(invoc, obj, *args)
- except Exception, e:
- self.exception(invoc, e)
-
- def do_invoke(self, invoc, obj, *args):
- pass
-
class TaskInvocation(object):
PENDING = "pending"
FAILED = "failed"
14 years, 7 months
rhmessaging commits: r3952 - in mgmt/newdata: cumin/bin and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-05-10 13:25:54 -0400 (Mon, 10 May 2010)
New Revision: 3952
Removed:
mgmt/newdata/cumin/bin/cumin-instance-init
Modified:
mgmt/newdata/cumin/Makefile
mgmt/newdata/etc/Makefile.common
Log:
Simplify install rule around CUMIN_HOME variable
Modified: mgmt/newdata/cumin/Makefile
===================================================================
--- mgmt/newdata/cumin/Makefile 2010-05-10 16:00:01 UTC (rev 3951)
+++ mgmt/newdata/cumin/Makefile 2010-05-10 17:25:54 UTC (rev 3952)
@@ -2,34 +2,32 @@
include ../etc/Makefile.common
-name := cumin
-home := ${SHARE_DIR}/${name}
+CUMIN_HOME := $(shell mktemp -d)
build:
python -m compileall -x '/\.svn' -f python
install: build
- install -d ${BIN_DIR}
- install -pm 0755 bin/cumin bin/cumin-* ${BIN_DIR}
- install -d ${DOC_DIR}/${name}
- install -pm 0644 LICENSE COPYING ${DOC_DIR}/${name}
- install -pm 0644 ../wooly/LICENSE-for-wsgiserver ${DOC_DIR}/${name}
- install -pm 0644 ../wooly/COPYING-for-wsgiserver ${DOC_DIR}/${name}
- install -d ${home}/model
- install -pm 0644 model/*.xml ${home}/model
- install -d ${home}/resources
- install -pm 0644 ../wooly/resources/* ${home}/resources
- install -pm 0644 resources/* ${home}/resources
- install -d ${ETC_DIR}/${name}
- ln -sf ${ETC_DIR}/${name} ${home}/etc
- install -pm 0644 etc/cumin.* ${ETC_DIR}/${name}
- install -pm 0755 etc/sysvinit-cumin ${ETC_DIR}/${name}
- install -d ${VAR_DIR}/log/${name}
- ln -sf ${VAR_DIR}/log/${name} ${home}/log
- bin/install-python-code python ${home}/python
- bin/install-python-code ../wooly/python ${home}/python
- bin/install-python-code ../rosemary/python ${home}/python
- bin/install-python-code ../mint/python ${home}/python
- bin/install-python-code ../parsley/python ${home}/python
+ install -d ${CUMIN_HOME}/bin
+ install -pm 0755 bin/cumin bin/cumin-* ${CUMIN_HOME}/bin
+ install -d ${CUMIN_HOME}/doc
+ install -pm 0644 LICENSE COPYING ${CUMIN_HOME}/doc
+ install -pm 0644 ../wooly/LICENSE-for-wsgiserver ${CUMIN_HOME}/doc
+ install -pm 0644 ../wooly/COPYING-for-wsgiserver ${CUMIN_HOME}/doc
+ install -d ${CUMIN_HOME}/model
+ install -pm 0644 model/*.xml ${CUMIN_HOME}/model
+ install -d ${CUMIN_HOME}/resources
+ install -pm 0644 ../wooly/resources/* ${CUMIN_HOME}/resources
+ install -pm 0644 resources/* ${CUMIN_HOME}/resources
+ install -d ${CUMIN_HOME}/etc
+ install -pm 0644 etc/cumin.* ${CUMIN_HOME}/etc
+ install -pm 0755 etc/sysvinit-cumin ${CUMIN_HOME}/etc
+ install -d ${CUMIN_HOME}/log
+ bin/install-python-code python ${CUMIN_HOME}/python
+ bin/install-python-code ../wooly/python ${CUMIN_HOME}/python
+ bin/install-python-code ../rosemary/python ${CUMIN_HOME}/python
+ bin/install-python-code ../mint/python ${CUMIN_HOME}/python
+ bin/install-python-code ../parsley/python ${CUMIN_HOME}/python
+ find ${CUMIN_HOME} -type d
clean: clean-python-files
Deleted: mgmt/newdata/cumin/bin/cumin-instance-init
===================================================================
--- mgmt/newdata/cumin/bin/cumin-instance-init 2010-05-10 16:00:01 UTC (rev 3951)
+++ mgmt/newdata/cumin/bin/cumin-instance-init 2010-05-10 17:25:54 UTC (rev 3952)
@@ -1,78 +0,0 @@
-#!/usr/bin/python
-
-import sys, os
-from os.path import *
-
-def usage():
- print "Usage: cumin-instance-init [system|local|prefix PREFIX]"
- sys.exit(1)
-
-def check_home(dir):
- if isdir(dir):
- # Check writable
- pass
- else:
- os.makedirs(dir)
-
-if "-h" in sys.argv or "--help" in sys.argv:
- usage()
-
-try:
- type = sys.argv[1]
-except IndexError:
- usage()
-
-if type == "system":
- prefix = join(sep, "usr")
- home = join(sep, "var", "lib", "cumin")
-
- check_home(home)
-
- map = ((join(sep, "etc", "cumin"), join(home, "etc")),
- (join(sep, "var", "log", "cumin"), join(home, "log")),
- (join(prefix, "share", "wooly", "resources"), join(home, "resources-wooly")),
- (join(prefix, "share", "cumin", "resources"), join(home, "resources")),
- (join(prefix, "share", "mint", "sql"), join(home, "sql")),
- (join(prefix, "share", "mint", "xml"), join(home, "xml")))
-elif type == "local":
- prefix = join(sep, "usr", "local")
- home = join(sep, "var", "local", "lib", "cumin")
-
- check_home(home)
-
- map = ((join(prefix, "etc", "cumin"), join(home, "etc")),
- (join(sep, "var", "local", "log", "cumin"), join(home, "log")),
- (join(prefix, "share", "wooly", "resources"), join(home, "resources-wooly")),
- (join(prefix, "share", "cumin", "resources"), join(home, "resources")),
- (join(prefix, "share", "mint", "sql"), join(home, "sql")),
- (join(prefix, "share", "mint", "xml"), join(home, "xml")))
-elif type == "prefix":
- try:
- prefix = sys.argv[2]
- except IndexError:
- usage()
-
- home = join(prefix, "var", "lib", "cumin")
-
- check_home(home)
-
- map = ((join(prefix, "etc", "cumin"), join(home, "etc")),
- (join(prefix, "var", "log", "cumin"), join(home, "log")),
- (join(prefix, "share", "wooly", "resources"), join(home, "resources-wooly")),
- (join(prefix, "share", "cumin", "resources"), join(home, "resources")),
- (join(prefix, "share", "mint", "sql"), join(home, "sql")),
- (join(prefix, "share", "mint", "xml"), join(home, "xml")))
-else:
- print "Error: '%s' is not a recognized instance type" % type
- usage()
-
-for src, dst in map:
- if exists(dst):
- #print "File already exists: %s" % dst
- pass
- elif islink(dst):
- #print "Link already exists: %s" % dst
- pass
- else:
- #print "Creating symlink: %s -> %s" % (dst, src)
- os.symlink(src, dst)
Modified: mgmt/newdata/etc/Makefile.common
===================================================================
--- mgmt/newdata/etc/Makefile.common 2010-05-10 16:00:01 UTC (rev 3951)
+++ mgmt/newdata/etc/Makefile.common 2010-05-10 17:25:54 UTC (rev 3952)
@@ -13,5 +13,7 @@
VAR_DIR := ${PREFIX}/var
endif
+LOG_DIR := ${VAR_DIR}/log
+
clean-python-files:
find python -type f -name \*.py[co] -delete
14 years, 7 months
rhmessaging commits: r3951 - mgmt/newdata/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-05-10 12:00:01 -0400 (Mon, 10 May 2010)
New Revision: 3951
Modified:
mgmt/newdata/cumin/Makefile
Log:
Copy binaries with more discrimination; add wsgiserver license files
Modified: mgmt/newdata/cumin/Makefile
===================================================================
--- mgmt/newdata/cumin/Makefile 2010-05-10 15:42:52 UTC (rev 3950)
+++ mgmt/newdata/cumin/Makefile 2010-05-10 16:00:01 UTC (rev 3951)
@@ -10,9 +10,11 @@
install: build
install -d ${BIN_DIR}
- install -pm 0755 bin/* ${BIN_DIR}
+ install -pm 0755 bin/cumin bin/cumin-* ${BIN_DIR}
install -d ${DOC_DIR}/${name}
install -pm 0644 LICENSE COPYING ${DOC_DIR}/${name}
+ install -pm 0644 ../wooly/LICENSE-for-wsgiserver ${DOC_DIR}/${name}
+ install -pm 0644 ../wooly/COPYING-for-wsgiserver ${DOC_DIR}/${name}
install -d ${home}/model
install -pm 0644 model/*.xml ${home}/model
install -d ${home}/resources
14 years, 7 months
rhmessaging commits: r3950 - in mgmt/newdata/cumin: bin and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-05-10 11:42:52 -0400 (Mon, 10 May 2010)
New Revision: 3950
Added:
mgmt/newdata/cumin/bin/install-python-code
Removed:
mgmt/newdata/cumin/bin/cumin-database-destroy
mgmt/newdata/cumin/bin/cumin-database-init
mgmt/newdata/cumin/bin/cumin-server
Modified:
mgmt/newdata/cumin/Makefile
mgmt/newdata/cumin/bin/cumin-admin
mgmt/newdata/cumin/bin/cumin-data
mgmt/newdata/cumin/bin/cumin-test
mgmt/newdata/cumin/bin/cumin-web
mgmt/newdata/cumin/python/cumin/config.py
Log:
* Put cumin python code under its home dir, not in site-packages
* Make the cumin home default to /usr/share/cumin
* Remove unused entry points
Modified: mgmt/newdata/cumin/Makefile
===================================================================
--- mgmt/newdata/cumin/Makefile 2010-05-06 20:28:40 UTC (rev 3949)
+++ mgmt/newdata/cumin/Makefile 2010-05-10 15:42:52 UTC (rev 3950)
@@ -3,40 +3,31 @@
include ../etc/Makefile.common
name := cumin
-lib := ${PYTHON_LIB_DIR}/${name}
-etc := ${ETC_DIR}/${name}
-doc := ${DOC_DIR}/${name}
-log := ${VAR_DIR}/log/${name}
-share := ${SHARE_DIR}/${name}
+home := ${SHARE_DIR}/${name}
build:
python -m compileall -x '/\.svn' -f python
install: build
- install -d ${lib}
- install -pm 0644 python/cumin/*.py python/cumin/*.pyc python/cumin/*.strings ${lib}
- install -d ${lib}/account
- install -pm 0644 python/cumin/account/*.py python/cumin/account/*.pyc python/cumin/account/*.strings ${lib}/account
- install -d ${lib}/messaging
- install -pm 0644 python/cumin/messaging/*.py python/cumin/messaging/*.pyc python/cumin/messaging/*.strings ${lib}/messaging
- install -d ${lib}/grid
- install -pm 0644 python/cumin/grid/*.py python/cumin/grid/*.pyc python/cumin/grid/*.strings ${lib}/grid
- install -d ${lib}/usergrid
- install -pm 0644 python/cumin/usergrid/*.py python/cumin/usergrid/*.pyc python/cumin/usergrid/*.strings ${lib}/usergrid
- install -d ${lib}/inventory
- install -pm 0644 python/cumin/inventory/*.py python/cumin/inventory/*.pyc python/cumin/inventory/*.strings ${lib}/inventory
install -d ${BIN_DIR}
install -pm 0755 bin/* ${BIN_DIR}
- install -d ${doc}
- install -pm 0644 LICENSE COPYING ${doc}
- install -d ${share}/model
- install -pm 0644 model/*.xml ${share}/model
- install -d ${share}/resources
- install -pm 0644 resources/* ${share}/resources
- ln -sf ../wooly/resources ${share}/resources-wooly
- install -d ${etc}
- install -pm 0644 etc/cumin.* ${etc}
- install -pm 0755 etc/sysvinit-cumin ${etc}
- install -d ${log}
+ install -d ${DOC_DIR}/${name}
+ install -pm 0644 LICENSE COPYING ${DOC_DIR}/${name}
+ install -d ${home}/model
+ install -pm 0644 model/*.xml ${home}/model
+ install -d ${home}/resources
+ install -pm 0644 ../wooly/resources/* ${home}/resources
+ install -pm 0644 resources/* ${home}/resources
+ install -d ${ETC_DIR}/${name}
+ ln -sf ${ETC_DIR}/${name} ${home}/etc
+ install -pm 0644 etc/cumin.* ${ETC_DIR}/${name}
+ install -pm 0755 etc/sysvinit-cumin ${ETC_DIR}/${name}
+ install -d ${VAR_DIR}/log/${name}
+ ln -sf ${VAR_DIR}/log/${name} ${home}/log
+ bin/install-python-code python ${home}/python
+ bin/install-python-code ../wooly/python ${home}/python
+ bin/install-python-code ../rosemary/python ${home}/python
+ bin/install-python-code ../mint/python ${home}/python
+ bin/install-python-code ../parsley/python ${home}/python
clean: clean-python-files
Modified: mgmt/newdata/cumin/bin/cumin-admin
===================================================================
--- mgmt/newdata/cumin/bin/cumin-admin 2010-05-06 20:28:40 UTC (rev 3949)
+++ mgmt/newdata/cumin/bin/cumin-admin 2010-05-10 15:42:52 UTC (rev 3950)
@@ -1,5 +1,11 @@
#!/usr/bin/python
+import os
+import sys
+
+home = os.environ.get("CUMIN_HOME", os.path.normpath("/usr/share/cumin"))
+sys.path.append(os.path.join(home, "python"))
+
from parsley.collectionsex import defaultdict
from cumin import *
Modified: mgmt/newdata/cumin/bin/cumin-data
===================================================================
--- mgmt/newdata/cumin/bin/cumin-data 2010-05-06 20:28:40 UTC (rev 3949)
+++ mgmt/newdata/cumin/bin/cumin-data 2010-05-10 15:42:52 UTC (rev 3950)
@@ -1,5 +1,11 @@
#!/usr/bin/python
+import os
+import sys
+
+home = os.environ.get("CUMIN_HOME", os.path.normpath("/usr/share/cumin"))
+sys.path.append(os.path.join(home, "python"))
+
from cumin.config import *
from cumin.util import *
from mint import *
Deleted: mgmt/newdata/cumin/bin/cumin-database-destroy
===================================================================
--- mgmt/newdata/cumin/bin/cumin-database-destroy 2010-05-06 20:28:40 UTC (rev 3949)
+++ mgmt/newdata/cumin/bin/cumin-database-destroy 2010-05-10 15:42:52 UTC (rev 3950)
@@ -1,6 +0,0 @@
-#!/bin/bash -e
-
-echo "Warning: this command is deprecated; it has been replaced by"
-echo "the command 'mint-database destroy'"
-
-exec mint-database destroy
Deleted: mgmt/newdata/cumin/bin/cumin-database-init
===================================================================
--- mgmt/newdata/cumin/bin/cumin-database-init 2010-05-06 20:28:40 UTC (rev 3949)
+++ mgmt/newdata/cumin/bin/cumin-database-init 2010-05-10 15:42:52 UTC (rev 3950)
@@ -1,6 +0,0 @@
-#!/bin/bash -e
-
-echo "Warning: this command is deprecated; it has been replaced by"
-echo "the command 'mint-database create'"
-
-exec mint-database create
Deleted: mgmt/newdata/cumin/bin/cumin-server
===================================================================
--- mgmt/newdata/cumin/bin/cumin-server 2010-05-06 20:28:40 UTC (rev 3949)
+++ mgmt/newdata/cumin/bin/cumin-server 2010-05-10 15:42:52 UTC (rev 3950)
@@ -1,9 +0,0 @@
-#!/usr/bin/python
-
-from cumin.tools import CuminServerTool
-
-if __name__ == "__main__":
- try:
- CuminServerTool("cumin-server").main()
- except KeyboardInterrupt:
- pass
Modified: mgmt/newdata/cumin/bin/cumin-test
===================================================================
--- mgmt/newdata/cumin/bin/cumin-test 2010-05-06 20:28:40 UTC (rev 3949)
+++ mgmt/newdata/cumin/bin/cumin-test 2010-05-10 15:42:52 UTC (rev 3950)
@@ -1,7 +1,11 @@
#!/usr/bin/python
-import sys, os
+import os
+import sys
+home = os.environ.get("CUMIN_HOME", os.path.normpath("/usr/share/cumin"))
+sys.path.append(os.path.join(home, "python"))
+
from cumin.tools import CuminTestTool
if __name__ == "__main__":
Modified: mgmt/newdata/cumin/bin/cumin-web
===================================================================
--- mgmt/newdata/cumin/bin/cumin-web 2010-05-06 20:28:40 UTC (rev 3949)
+++ mgmt/newdata/cumin/bin/cumin-web 2010-05-10 15:42:52 UTC (rev 3950)
@@ -1,5 +1,11 @@
#!/usr/bin/python
+import os
+import sys
+
+home = os.environ.get("CUMIN_HOME", os.path.normpath("/usr/share/cumin"))
+sys.path.append(os.path.join(home, "python"))
+
from cumin import *
from cumin.config import *
from cumin.util import *
Added: mgmt/newdata/cumin/bin/install-python-code
===================================================================
--- mgmt/newdata/cumin/bin/install-python-code (rev 0)
+++ mgmt/newdata/cumin/bin/install-python-code 2010-05-10 15:42:52 UTC (rev 3950)
@@ -0,0 +1,19 @@
+#!/bin/bash -e
+
+if [[ $# != 2 ]]; then
+ echo "install-python-code SOURCE-DIR DESTINATION-DIR"
+ exit 1
+fi
+
+src_top=$1
+dst_top=$2
+
+find $src_top -type d -not -path "**/.svn*" | while read src_dir
+do
+ dst_dir="${dst_top}${src_dir#$src_top}"
+
+ install -d "$dst_dir"
+ install -pm 0644 ${src_dir}/*.py "$dst_dir" 2> /dev/null || :
+ install -pm 0644 ${src_dir}/*.pyc "$dst_dir" 2> /dev/null || :
+ install -pm 0644 ${src_dir}/*.strings "$dst_dir" 2> /dev/null || :
+done
Property changes on: mgmt/newdata/cumin/bin/install-python-code
___________________________________________________________________
Name: svn:executable
+ *
Modified: mgmt/newdata/cumin/python/cumin/config.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/config.py 2010-05-06 20:28:40 UTC (rev 3949)
+++ mgmt/newdata/cumin/python/cumin/config.py 2010-05-10 15:42:52 UTC (rev 3950)
@@ -11,7 +11,7 @@
def __init__(self):
super(CuminConfig, self).__init__()
- hdef = os.path.normpath("/var/lib/cumin")
+ hdef = os.path.normpath("/usr/share/cumin")
self.home = os.environ.get("CUMIN_HOME", hdef)
if not os.path.isdir(self.home):
14 years, 7 months
rhmessaging commits: r3949 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-05-06 16:28:40 -0400 (Thu, 06 May 2010)
New Revision: 3949
Modified:
mgmt/newdata/mint/python/mint/newupdate.py
Log:
getName is removed, so don't use it
Modified: mgmt/newdata/mint/python/mint/newupdate.py
===================================================================
--- mgmt/newdata/mint/python/mint/newupdate.py 2010-05-05 21:31:36 UTC (rev 3948)
+++ mgmt/newdata/mint/python/mint/newupdate.py 2010-05-06 20:28:40 UTC (rev 3949)
@@ -101,7 +101,7 @@
def do_process(self, conn, stats):
cls = self.get_class()
- obj = self.get_object(cls, self.object.getName())
+ obj = self.get_object(cls, self.object.getObjectId().objectName)
columns = list()
@@ -180,7 +180,7 @@
# XXX session_id may have changed too?
else:
obj._qmf_agent_id = self.agent.id
- obj._qmf_object_id = self.object.getName()
+ obj._qmf_object_id = self.object.getObjectId().objectName
obj._qmf_session_id = str(self.object.getObjectId().getSequence())
obj._qmf_class_key = str(self.object.getClassKey())
obj._qmf_update_time = update_time
@@ -273,14 +273,14 @@
def __repr__(self):
name = self.__class__.__name__
cls = self.object.getClassKey().getClassName()
- id = self.object.getName()
+ id = self.object.getObjectId().objectName
return "%s(%s,%s,%s)" % (name, self.agent.id, cls, id)
class ObjectDelete(ObjectUpdate):
def do_process(self, conn, stats):
cls = self.get_class()
- obj = self.get_object(cls, self.object.getName())
+ obj = self.get_object(cls, self.object.getObjectId().objectName)
cursor = conn.cursor()
@@ -290,7 +290,7 @@
cursor.close()
try:
- del self.agent.objects_by_id[self.object.getName()]
+ del self.agent.objects_by_id[self.object.getObjectId().objectName]
except KeyError:
pass
@@ -299,7 +299,7 @@
class ObjectAddSample(ObjectUpdate):
def do_process(self, conn, stats):
cls = self.get_class()
- obj = self.get_object(cls, self.object.getName())
+ obj = self.get_object(cls, self.object.getObjectId().objectName)
if not cls._statistics:
stats.samples_dropped += 1; return
14 years, 7 months