rhmessaging commits: r1805 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-27 13:44:39 -0400 (Thu, 27 Mar 2008)
New Revision: 1805
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Add missing stats to the ui metadata
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-03-27 15:24:41 UTC (rev 1804)
+++ mgmt/cumin/python/cumin/model.py 2008-03-27 17:44:39 UTC (rev 1805)
@@ -405,6 +405,7 @@
stat.title = "Msgs. Unacked"
stat.unit = "message"
stat.categories = ("general")
+ stat.highlow = True
stat = CuminStat(self, "messageLatencyMin", "int")
stat.title = "Min. Msg. Latency"
@@ -416,11 +417,16 @@
stat.unit = "nanosecond"
stat.categories = ("general")
- stat = CuminStat(self, "messageLatencyAvg", "int")
+ stat = CuminStat(self, "messageLatencyAverage", "int")
stat.title = "Avg. Msg. Latency"
stat.unit = "nanosecond"
stat.categories = ("general")
+ stat = CuminStat(self, "messageLatencySamples", "int")
+ stat.title = "Msg. Latency Samples"
+ stat.unit = "sample"
+ stat.categories = ("general")
+
# Disk
#stat = CuminStat(self, "diskPageSize", "int")
@@ -604,6 +610,10 @@
def __init__(self, model):
super(CuminClient, self).__init__(model, "client", Client, ClientStats)
+ stat = CuminStat(self, "closing", "bool")
+ stat.title = "Closing Down"
+ stat.categories = ("general")
+
stat = CuminStat(self, "bytesFromClient", "int")
stat.title = "Bytes Sent"
stat.unit = "byte"
@@ -644,9 +654,8 @@
super(CuminSession, self).__init__(model, "session",
Session, SessionStats)
- stat = CuminStat(self, "remainingLifespan", "int")
- stat.title = "Remaining Lifespan"
- stat.unit = "second"
+ stat = CuminStat(self, "expireTime", "datetime")
+ stat.title = "Expiration"
stat.categories = ("general")
stat = CuminStat(self, "framesOutstanding", "int")
@@ -698,6 +707,10 @@
def __init__(self, model):
super(CuminLink, self).__init__(model, "link", Link, LinkStats)
+ stat = CuminStat(self, "closing", "bool")
+ stat.title = "Closing Down"
+ stat.categories = ("general")
+
stat = CuminStat(self, "framesFromPeer", "int")
stat.title = "Frames from Peer"
stat.unit = "frame"
16 years, 9 months
rhmessaging commits: r1804 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-03-27 11:24:41 -0400 (Thu, 27 Mar 2008)
New Revision: 1804
Modified:
store/trunk/cpp/lib/jrnl/enums.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/jinf.cpp
store/trunk/cpp/lib/jrnl/jinf.hpp
store/trunk/cpp/lib/jrnl/nlfh.hpp
store/trunk/cpp/lib/jrnl/rcvdat.hpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/lib/jrnl/rmgr.hpp
store/trunk/cpp/lib/jrnl/rrfc.cpp
store/trunk/cpp/lib/jrnl/rrfc.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
store/trunk/cpp/lib/jrnl/wrfc.cpp
store/trunk/cpp/lib/jrnl/wrfc.hpp
store/trunk/cpp/tests/jrnl/_st_read.cpp
Log:
Added read sync to journal. Fixes BZ430479. This fix should enable lazy-load to work.
Modified: store/trunk/cpp/lib/jrnl/enums.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enums.hpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/enums.hpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -47,6 +47,7 @@
RHM_IORES_PAGE_AIOWAIT, ///< IO operation suspended - next page is waiting for AIO.
RHM_IORES_FILE_AIOWAIT, ///< IO operation suspended - next file is waiting for AIO.
RHM_IORES_EMPTY, ///< During read operations, nothing further is available to read.
+ RHM_IORES_RCINVALID, ///< Read page cache is invalid (ie obsolete or uninitialized)
RHM_IORES_ENQCAPTHRESH, ///< Enqueue capacity threshold (limit) reached.
RHM_IORES_FULL, ///< During write operations, the journal files are full.
RHM_IORES_BUSY, ///< Another blocking operation is in progress.
@@ -63,6 +64,7 @@
case RHM_IORES_PAGE_AIOWAIT: return "RHM_IORES_PAGE_AIOWAIT";
case RHM_IORES_FILE_AIOWAIT: return "RHM_IORES_FILE_AIOWAIT";
case RHM_IORES_EMPTY: return "RHM_IORES_EMPTY";
+ case RHM_IORES_RCINVALID: return "RHM_IORES_RCINVALID";
case RHM_IORES_ENQCAPTHRESH: return "RHM_IORES_ENQCAPTHRESH";
case RHM_IORES_FULL: return "RHM_IORES_FULL";
case RHM_IORES_BUSY: return "RHM_IORES_BUSY";
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -151,7 +151,7 @@
rcvr_janalyze(_rcvdat, prep_txn_list);
highest_rid = _rcvdat._h_rid;
if (_rcvdat._full)
- throw jexception(jerrno::JERR_JCNTL_RECOVERJFULL, "jcntl", "recover_complete");
+ throw jexception(jerrno::JERR_JCNTL_RECOVERJFULL, "jcntl", "recover");
// Debug info; should be sent to log file
// std::cout << _rcvdat.to_string(_jid) << std::endl << std::flush;
@@ -264,27 +264,46 @@
}
}
+/* TODO
const iores
jcntl::get_data_record(const u_int64_t& rid, const size_t& dsize, const size_t& dsize_avail,
const void** const data, bool auto_discard)
{
check_rstatus("get_data_record");
return _rmgr.get(rid, dsize, dsize_avail, data, auto_discard);
-}
+} */
+/* TODO
const iores
jcntl::discard_data_record(data_tok* const dtokp)
{
check_rstatus("discard_data_record");
return _rmgr.discard(dtokp);
-}
+} */
+#define MAX_RCINVALID_CNT 50
+#define RCINVALID_SLEEP_TIME_MS 2
const iores
jcntl::read_data_record(void** const datapp, size_t& dsize, void** const xidpp, size_t& xidsize,
bool& transient, bool& external, data_tok* const dtokp)
{
check_rstatus("read_data");
- return _rmgr.read(datapp, dsize, xidpp, xidsize, transient, external, dtokp);
+ unsigned cnt = 0;
+ iores res;
+ do
+ {
+ res = _rmgr.read(datapp, dsize, xidpp, xidsize, transient, external, dtokp);
+ if (res == RHM_IORES_RCINVALID)
+ {
+ get_wr_events(); // check for outstanding write events
+ _rmgr.synchronize();
+ if (cnt > 0)
+ ::usleep(RCINVALID_SLEEP_TIME_MS * 1000);
+ }
+ cnt++;
+ }
+ while (cnt < MAX_RCINVALID_CNT && res == RHM_IORES_RCINVALID);
+ return res;
}
const iores
@@ -385,8 +404,15 @@
return res;
}
-// Private functions
+void
+jcntl::chk_wr_frot()
+{
+ if (_wrfc.index() == _rrfc.index())
+ _rmgr.invalidate();
+}
+// Protected/Private functions
+
void
jcntl::check_wstatus(const char* fn_name) const
{
@@ -507,6 +533,7 @@
rd._ffid = ji.get_start_file();
rd._lfid = ji.get_end_file();
rd._owi = ji.get_initial_owi();
+ rd._frot = ji.get_frot();
rd._empty = false;
}
catch (const jexception& e)
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -294,7 +294,8 @@
const iores enqueue_extern_txn_data_record(const size_t tot_data_len, data_tok* dtokp,
const std::string& xid, const bool transient = false);
- /**
+ /* TODO
+ **
* \brief Retrieve details of next record to be read without consuming the record.
*
* Retrieve information about current read record. A pointer to the data is returned, along
@@ -350,18 +351,21 @@
* discard_next_data_record() must be explicitly called.
*
* \exception TODO
- */
+ *
// *** NOT YET IMPLEMENTED ***
const iores get_data_record(const u_int64_t& rid, const size_t& dsize,
const size_t& dsize_avail, const void** const data, bool auto_discard = false);
+ */
- /**
+ /* TODO
+ **
* \brief Discard (skip) next record to be read without reading or retrieving it.
*
* \exception TODO
- */
+ *
// *** NOT YET IMPLEMENTED ***
const iores discard_data_record(data_tok* const dtokp);
+ */
/**
* \brief Reads data from the journal. It is the responsibility of the reader to free
@@ -524,6 +528,10 @@
inline const u_int32_t get_rd_outstanding_aio_dblks(u_int16_t pi) const
{ return _rrfc.file_handle(pi)->rd_aio_outstanding_dblks(); }
+ inline const u_int16_t get_rd_fid() const { return _rrfc.index(); }
+ inline const u_int16_t get_wr_fid() const { return _wrfc.index(); }
+ inline const u_int16_t get_earliest_fid() const { return _wrfc.earliest_index(); }
+
/**
* \brief Check if a particular rid is enqueued. Note that this function will return
* false if the rid is transactionally enqueued and is not committed, or if it is
@@ -578,8 +586,12 @@
inline const u_int32_t jfsize_sblks() const { return _jfsize_sblks; }
+ // these are _rmgr to _wmgr interactions, remove when _rmgr contains ref to _wmgr:
+ void chk_wr_frot();
+ inline const u_int32_t unflushed_dblks() { return _wmgr.unflushed_dblks(); }
+
protected:
/**
* \brief Check status of journal before allowing write operations.
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -57,7 +57,8 @@
_analyzed_flag(false),
_start_file(0),
_end_file(0),
- _initial_owi(false)
+ _initial_owi(false),
+ _frot(false)
{
read(jinf_filename);
if (validate_flag)
@@ -179,6 +180,7 @@
{
if (!fnum)
throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf", "analyze");
+ _frot = true;
done = true;
}
else if (fnum == 0) // First file only
@@ -238,6 +240,14 @@
return _initial_owi;
}
+const bool
+jinf::get_frot()
+{
+ if (!_analyzed_flag)
+ analyze();
+ return _frot;
+}
+
const std::string
jinf::to_string() const
{
Modified: store/trunk/cpp/lib/jrnl/jinf.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.hpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/jinf.hpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -64,6 +64,7 @@
u_int16_t _start_file;
u_int16_t _end_file;
bool _initial_owi;
+ bool _frot;
public:
// constructor for reading existing jinf file
@@ -93,6 +94,7 @@
const u_int16_t get_start_file();
const u_int16_t get_end_file();
const bool get_initial_owi();
+ const bool get_frot();
const std::string to_string() const;
const std::string xml_str() const;
Modified: store/trunk/cpp/lib/jrnl/nlfh.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.hpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/nlfh.hpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -111,7 +111,8 @@
// Derived helper functions
- inline const bool rd_empty() const { return _wr_cmpl_cnt_dblks == 0; }
+ inline const bool rd_void() const { return _wr_cmpl_cnt_dblks == 0; }
+ inline const bool rd_empty() const { return _wr_cmpl_cnt_dblks <= JRNL_SBLK_SIZE; }
inline const u_int32_t rd_remaining_dblks() const
{ return _wr_cmpl_cnt_dblks - _rd_subm_cnt_dblks; }
inline const bool is_rd_full() const { return _wr_cmpl_cnt_dblks == _rd_subm_cnt_dblks; }
@@ -121,7 +122,8 @@
{ return _rd_subm_cnt_dblks - _rd_cmpl_cnt_dblks; }
inline const bool rd_file_rotate() const { return is_rd_full() && is_wr_compl(); }
- inline const bool wr_empty() const { return _wr_subm_cnt_dblks == 0; }
+ inline const bool wr_void() const { return _wr_subm_cnt_dblks == 0; }
+ inline const bool wr_empty() const { return _wr_subm_cnt_dblks <= JRNL_SBLK_SIZE; }
inline const u_int32_t wr_remaining_dblks() const
{ return _ffull_dblks - _wr_subm_cnt_dblks; }
inline const bool is_wr_full() const { return _ffull_dblks == _wr_subm_cnt_dblks; }
Modified: store/trunk/cpp/lib/jrnl/rcvdat.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rcvdat.hpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/rcvdat.hpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -45,7 +45,8 @@
struct rcvdat
{
- bool _owi;
+ bool _owi; ///< Overwrite indicator
+ bool _frot; ///< First rotation flag
bool _empty; ///< Journal data files empty
u_int16_t _ffid; ///< First file id
size_t _fro; ///< First record offset in ffid
@@ -57,6 +58,7 @@
rcvdat(u_int16_t num_jfiles):
_owi(false),
+ _frot(false),
_empty(true),
_ffid(0),
_fro(0),
@@ -70,6 +72,7 @@
void reset()
{
_owi=false;
+ _frot = false;
_empty=true;
_ffid=0;
_fro=0;
@@ -86,6 +89,7 @@
std::ostringstream oss;
oss << "Jorunal file analysis (jid=\"" << jid << "\"):" << std::endl;
oss << " Overwrite indicator (_owi) = " << (_owi ? "TRUE" : "FALSE") << std::endl;
+ oss << " First rotation (_frot) = " << (_frot ? "TRUE" : "FALSE") << std::endl;
oss << " Journal empty (_empty) = " << (_empty ? "TRUE" : "FALSE") << std::endl;
oss << " First fid (_ffid) = " << _ffid << std::endl;
oss << " First record offset in first fid (_fro) = 0x" << std::hex << _fro <<
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -44,11 +44,17 @@
rmgr::rmgr(jcntl* jc, enq_map& emap, txn_map& tmap, rrfc& rrfc):
pmgr(jc, emap, tmap, JRNL_RMGR_PAGE_SIZE, JRNL_RMGR_PAGES),
_rrfc(rrfc),
- _hdr()
+ _hdr(),
+ _valid(false),
+ _fhdr_buffer(0),
+ _iocbp(0),
+ _fhdr_rd_outstanding(false)
{}
rmgr::~rmgr()
-{}
+{
+ clean();
+}
void
rmgr::initialize(const rd_aio_cb rd_cb, const size_t fro)
@@ -65,150 +71,30 @@
_rrfc.add_subm_cnt_dblks(tot_pg_offs_dblks);
_rrfc.add_cmpl_cnt_dblks(tot_pg_offs_dblks);
}
-}
-const iores
-rmgr::get(const u_int64_t& /*rid*/, const size_t& /*dsize*/, const size_t& /*dsize_avail*/,
- const void** const /*data*/, bool /*auto_discard*/)
-{
-//std::cout << " rmgr::get()" << std::flush;
- iores res = pre_read_check(0);
- if (res != RHM_IORES_SUCCESS)
- return res;
-
- return RHM_IORES_NOTIMPL;
-
-/* TODO...
- _hdr.reset();
- // Read header, determine next record type
- while (true)
+ // Allocate memory for reading file header
+ if (::posix_memalign(&_fhdr_buffer, _sblksize, _sblksize))
{
- if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
- {
- aio_cycle(); // check if any AIOs have returned
- return RHM_IORES_EMPTY;
- }
- if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
- {
- aio_cycle();
- return RHM_IORES_PAGE_AIOWAIT;
- }
- void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
- (_pg_offset_dblks * JRNL_DBLK_SIZE));
- ::memcpy(&_hdr, rptr, sizeof(hdr));
- switch (_hdr._magic)
- {
- case RHM_JDAT_ENQ_MAGIC:
- {
- size_t xid_size = *((size_t*)((char*)rptr + sizeof(hdr)
-#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
- + sizeof(u_int32_t) // filler0
-#endif
- ));
- size_t data_size = *((size_t*)((char*)rptr + sizeof(hdr) + sizeof(u_int64_t)
-#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
- + sizeof(u_int32_t) // filler1
-#endif
- ));
- // TODO: Check if transaction is still in transaction map. If so, block read
- // (unless in recovery, in whcih case return info normally
-// std::string xid = ?? (decode xid here)
-// if (xid_size && !readonly && tx_map.exists(xid))
-// return RHM_IORES_TXPENDING;
- rid = _hdr._rid;
- dsize = data_size;
-
- // Analyze how much of message is available
- void* data_ptr = (char*)rptr + sizeof(enq_hdr) + xid_size;
- void* page_end_ptr = (char*)_page_base_ptr + _pagesize * _sblksize * _pages;
- u_int16_t data_start_pg_index = _pg_index;
- u_int16_t data_start_pg_index = _pg_index;
- for (u_int16_t i=0; i<_pages; i++)
- {
- pi = (i + _pg_index) % _pages;
- if (data_ptr >= _page_ptr_arr[pi] &&
- data_ptr < (char*)_page_ptr_arr[pi] + _pagesize * _sblksize)
- data_end_pg_index = pi; // found start page index
-
- }
- u_int16_t data_end_pg_index;
- u_int16_t last_pg_avail_index;
-
- void* data_ptr = (char*)rptr + sizeof(enq_hdr) + xid_size;
- void* page_end_ptr = (char*)_page_base_ptr + _pagesize * _sblksize * _pages;
- if (data_ptr >= page_end_ptr) // folded, go back to first page...
- data_ptr = (char*)_page_base_ptr + data_ptr - page_end_ptr;
- void* data_end_ptr = (char*)data_ptr + data_size;
- if (data_end_ptr >= page_end_ptr) // folded, go back to first page...
- data_end_ptr = (char*)_page_base_ptr + data_end_ptr - page_end_ptr;
- dsize_avail = ??;
- if(data_ptr folded)
- else
- *data = data_ptr;
- }
- break;
- case RHM_JDAT_DEQ_MAGIC:
- consume_deq();
- break;
- case RHM_JDAT_EMPTY_MAGIC:
- consume_filler();
- break;
- default:
- std::ostringstream oss;
- oss << std::hex << std::setfill('0');
- oss << "Magic=0x" << std::setw(8) << _hdr._magic << std::dec;
- throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, oss.str(), "rmgr", "get");
- } // switch(_hdr._magic)
- } // while */
+ clean();
+ std::ostringstream oss;
+ oss << "posix_memalign(): blksize=" << _sblksize << " size=" << _sblksize;
+ oss << " errno=" << errno;
+ throw jexception(jerrno::JERR__MALLOC, oss.str(), "rmgr", "initialize");
+ }
+ _iocbp = new iocb;
+ ::memset(_iocbp, 0, sizeof(iocb*));
}
-const iores
-rmgr::discard(data_tok* dtokp)
+void
+rmgr::clean()
{
-//std::cout << " rmgr::get()" << std::flush;
- iores res = pre_read_check(dtokp);
- if (res != RHM_IORES_SUCCESS)
- return res;
-
- return RHM_IORES_NOTIMPL;
-
-/* TODO...
- _hdr.reset();
- // Read header, determine next record type
- while (true)
+ ::free(_fhdr_buffer);
+ _fhdr_buffer = 0;
+ if (_iocbp)
{
- if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
- {
- aio_cycle(); // check if any AIOs have returned
- return RHM_IORES_EMPTY;
- }
- if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
- {
- aio_cycle();
- return RHM_IORES_PAGE_AIOWAIT;
- }
- void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
- (_pg_offset_dblks * JRNL_DBLK_SIZE));
- ::memcpy(&_hdr, rptr, sizeof(hdr));
- switch (_hdr._magic)
- {
- case RHM_JDAT_ENQ_MAGIC:
- {
- }
- break;
- case RHM_JDAT_DEQ_MAGIC:
- consume_deq();
- break;
- case RHM_JDAT_EMPTY_MAGIC:
- consume_filler();
- break;
- default:
- std::ostringstream oss;
- oss << std::hex << std::setfill('0');
- oss << "Magic=0x" << std::setw(8) << _hdr._magic << std::dec;
- throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, oss.str(), "rmgr", "discard");
- } // switch
- } // while */
+ delete _iocbp;
+ _iocbp = 0;
+ }
}
const iores
@@ -225,7 +111,10 @@
if (dtokp->rstate() == data_tok::SKIP_PART)
{
if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
+ {
+ aio_cycle(); // check if rd AIOs returned; initiate new reads if possible
return RHM_IORES_PAGE_AIOWAIT;
+ }
const iores res = skip(dtokp);
if (res != RHM_IORES_SUCCESS)
{
@@ -250,8 +139,11 @@
{
if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
{
- aio_cycle(); // check if any AIOs have returned
- return RHM_IORES_EMPTY;
+ aio_cycle(); // check if rd AIOs returned; initiate new reads if possible
+ if (_jc->unflushed_dblks() > 0)
+ _jc->flush();
+ else
+ return RHM_IORES_EMPTY;
}
if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
{
@@ -405,13 +297,25 @@
throw jexception(jerrno::JERR__AIO, oss.str(), "rmgr", "get_events");
}
- // Increment the completed read offset
- // NOTE: We cannot use _rrfc here, as it may have rotated since submitting count.
- // Use stored pointer to nlfh in the pcb instead.
- pcbp->_rdblks = iocbp->u.c.nbytes / JRNL_DBLK_SIZE;
- pcbp->_rfh->add_rd_cmpl_cnt_dblks(pcbp->_rdblks);
- pcbp->_state = state;
- pil[i] = pcbp->_index;
+ if (pcbp) // Page reads have pcb
+ {
+ // Increment the completed read offset
+ // NOTE: We cannot use _rrfc here, as it may have rotated since submitting count.
+ // Use stored pointer to nlfh in the pcb instead.
+ pcbp->_rdblks = iocbp->u.c.nbytes / JRNL_DBLK_SIZE;
+ pcbp->_rfh->add_rd_cmpl_cnt_dblks(pcbp->_rdblks);
+ pcbp->_state = state;
+ pil[i] = pcbp->_index;
+ }
+ else // File header reads have no pcb
+ {
+ ::memcpy(&_fhdr, _fhdr_buffer, sizeof(file_hdr));
+ _rrfc.add_cmpl_cnt_dblks(JRNL_SBLK_SIZE);
+ size_t fro_dblks = _fhdr._fro / JRNL_DBLK_SIZE;
+ _pg_offset_dblks += fro_dblks - JRNL_SBLK_SIZE;
+ _fhdr_rd_outstanding = false;
+ _valid = true;
+ }
}
// Perform AIO return callback
@@ -436,6 +340,19 @@
}
void
+rmgr::invalidate()
+{
+ if (_valid)
+ {
+ _valid = false;
+ for (int i=0; i<_pages; i++)
+ _page_cb_arr[i]._state = UNUSED;
+ _rrfc.reset();
+ _pg_offset_dblks = 0;
+ }
+}
+
+void
rmgr::initialize()
{
pmgr::initialize();
@@ -447,9 +364,24 @@
if (_aio_evt_rem)
get_events();
+ if (!_valid)
+ {
+ if (_rrfc.is_void() && !_rrfc.is_wr_aio_outstanding())
+ return RHM_IORES_EMPTY;
+ else
+ return RHM_IORES_RCINVALID;
+ }
+
+ // block reads until outstanding file header read completes as fro is needed to read
+ if (_fhdr_rd_outstanding)
+ return RHM_IORES_PAGE_AIOWAIT;
+
if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
{
aio_cycle(); // check if any AIOs have returned
+ if (_jc->unflushed_dblks() > 0)
+ _jc->flush();
+ else
return RHM_IORES_EMPTY;
}
@@ -639,16 +571,24 @@
{
for (int16_t i=0; i<num_uninit; i++)
{
- if (_rrfc.empty()) // Nothing to do; this file not yet written to
+ if (_rrfc.is_void()) // Nothing to do; this file not yet written to
break;
- // If this is the first read from a file, increase the read pointers to beyond fhdr
- // or consume fhdr here for analysis (not req'd at present)
if (_rrfc.subm_offs() == 0)
{
- _rrfc.add_subm_cnt_dblks(JRNL_SBLK_SIZE);
- _rrfc.add_cmpl_cnt_dblks(JRNL_SBLK_SIZE);
+ if (_valid)
+ {
+ _rrfc.add_subm_cnt_dblks(JRNL_SBLK_SIZE);
+ _rrfc.add_cmpl_cnt_dblks(JRNL_SBLK_SIZE);
+ }
+ else
+ {
+ u_int16_t fid = _jc->get_earliest_fid();
+ init_file_header_read(fid);
+ }
}
+ else
+ _valid = true;
// TODO: Future perf improvement: Do a single AIO read for all available file
// space into all contiguous empty pages in one AIO operation.
@@ -681,9 +621,6 @@
void
rmgr::consume_fhdr()
{
- // If in the future it should become necessary to read each file header, this is where it would
- // happen.
-
// Set read pointers to first dblk after file header
_rrfc.add_subm_cnt_dblks(JRNL_SBLK_SIZE);
_rrfc.add_cmpl_cnt_dblks(JRNL_SBLK_SIZE);
@@ -725,5 +662,155 @@
xidsize = 0;
}
+void
+rmgr::init_file_header_read(u_int16_t fid)
+{
+ int rfh = _rrfc.file_handle(fid)->rd_fh();
+ rhm_prep_pread(_iocbp, rfh, _fhdr_buffer, _sblksize, 0);
+ if (::io_submit(_ioctx, 1, &_iocbp) < 0)
+ throw jexception(jerrno::JERR__AIO, "rmgr", "init_file_header_read");
+ _aio_evt_rem++;
+ _rrfc.add_subm_cnt_dblks(JRNL_SBLK_SIZE);
+ _fhdr_rd_outstanding = true;
+}
+
+/* TODO (sometime in the future)
+const iores
+rmgr::get(const u_int64_t& rid, const size_t& dsize, const size_t& dsize_avail,
+ const void** const data, bool auto_discard)
+{
+ iores res = pre_read_check(0);
+ if (res != RHM_IORES_SUCCESS)
+ return res;
+
+ _hdr.reset();
+ // Read header, determine next record type
+ while (true)
+ {
+ if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
+ {
+ aio_cycle(); // check if any AIOs have returned
+ return RHM_IORES_EMPTY;
+ }
+ if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
+ {
+ aio_cycle();
+ return RHM_IORES_PAGE_AIOWAIT;
+ }
+ void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
+ (_pg_offset_dblks * JRNL_DBLK_SIZE));
+ ::memcpy(&_hdr, rptr, sizeof(hdr));
+ switch (_hdr._magic)
+ {
+ case RHM_JDAT_ENQ_MAGIC:
+ {
+ size_t xid_size = *((size_t*)((char*)rptr + sizeof(hdr)
+#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
+ + sizeof(u_int32_t) // filler0
+#endif
+ ));
+ size_t data_size = *((size_t*)((char*)rptr + sizeof(hdr) + sizeof(u_int64_t)
+#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
+ + sizeof(u_int32_t) // filler1
+#endif
+ ));
+ // TODO: Check if transaction is still in transaction map. If so, block read
+ // (unless in recovery, in whcih case return info normally
+// std::string xid = ?? (decode xid here)
+// if (xid_size && !readonly && tx_map.exists(xid))
+// return RHM_IORES_TXPENDING;
+ rid = _hdr._rid;
+ dsize = data_size;
+
+ // Analyze how much of message is available
+ void* data_ptr = (char*)rptr + sizeof(enq_hdr) + xid_size;
+ void* page_end_ptr = (char*)_page_base_ptr + _pagesize * _sblksize * _pages;
+ u_int16_t data_start_pg_index = _pg_index;
+ u_int16_t data_start_pg_index = _pg_index;
+ for (u_int16_t i=0; i<_pages; i++)
+ {
+ pi = (i + _pg_index) % _pages;
+ if (data_ptr >= _page_ptr_arr[pi] &&
+ data_ptr < (char*)_page_ptr_arr[pi] + _pagesize * _sblksize)
+ data_end_pg_index = pi; // found start page index
+
+ }
+ u_int16_t data_end_pg_index;
+ u_int16_t last_pg_avail_index;
+
+ void* data_ptr = (char*)rptr + sizeof(enq_hdr) + xid_size;
+ void* page_end_ptr = (char*)_page_base_ptr + _pagesize * _sblksize * _pages;
+ if (data_ptr >= page_end_ptr) // folded, go back to first page...
+ data_ptr = (char*)_page_base_ptr + data_ptr - page_end_ptr;
+ void* data_end_ptr = (char*)data_ptr + data_size;
+ if (data_end_ptr >= page_end_ptr) // folded, go back to first page...
+ data_end_ptr = (char*)_page_base_ptr + data_end_ptr - page_end_ptr;
+ dsize_avail = ??;
+ if(data_ptr folded)
+ else
+ *data = data_ptr;
+ }
+ break;
+ case RHM_JDAT_DEQ_MAGIC:
+ consume_deq();
+ break;
+ case RHM_JDAT_EMPTY_MAGIC:
+ consume_filler();
+ break;
+ default:
+ std::ostringstream oss;
+ oss << std::hex << std::setfill('0');
+ oss << "Magic=0x" << std::setw(8) << _hdr._magic << std::dec;
+ throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, oss.str(), "rmgr", "get");
+ } // switch(_hdr._magic)
+ } // while
+}
+
+const iores
+rmgr::discard(data_tok* dtokp)
+{
+ iores res = pre_read_check(dtokp);
+ if (res != RHM_IORES_SUCCESS)
+ return res;
+
+ _hdr.reset();
+ // Read header, determine next record type
+ while (true)
+ {
+ if(dblks_rem() == 0 && _rrfc.is_compl() && !_rrfc.is_wr_aio_outstanding())
+ {
+ aio_cycle(); // check if any AIOs have returned
+ return RHM_IORES_EMPTY;
+ }
+ if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
+ {
+ aio_cycle();
+ return RHM_IORES_PAGE_AIOWAIT;
+ }
+ void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
+ (_pg_offset_dblks * JRNL_DBLK_SIZE));
+ ::memcpy(&_hdr, rptr, sizeof(hdr));
+ switch (_hdr._magic)
+ {
+ case RHM_JDAT_ENQ_MAGIC:
+ {
+ }
+ break;
+ case RHM_JDAT_DEQ_MAGIC:
+ consume_deq();
+ break;
+ case RHM_JDAT_EMPTY_MAGIC:
+ consume_filler();
+ break;
+ default:
+ std::ostringstream oss;
+ oss << std::hex << std::setfill('0');
+ oss << "Magic=0x" << std::setw(8) << _hdr._magic << std::dec;
+ throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, oss.str(), "rmgr", "discard");
+ } // switch
+ } // while
+}
+*/
+
} // namespace journal
} // namespace rhm
Modified: store/trunk/cpp/lib/jrnl/rmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.hpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/rmgr.hpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -41,6 +41,7 @@
#include <jrnl/aio_cb.hpp>
#include <jrnl/enums.hpp>
+#include <jrnl/file_hdr.hpp>
#include <jrnl/pmgr.hpp>
#include <jrnl/rec_hdr.hpp>
#include <jrnl/rrfc.hpp>
@@ -63,21 +64,34 @@
rec_hdr _hdr; ///< Header used to determind record type
rd_aio_cb _cb; ///< Callback function pointer for AIO events
+ bool _valid; ///< Flag is true when read pages contain vailid data
+ void* _fhdr_buffer; ///< Buffer used for fhdr reads
+ iocb* _iocbp; ///< iocb pointer for fhdr reads
+ file_hdr _fhdr; ///< file header instance for reading file headers
+ bool _fhdr_rd_outstanding; ///< true if a fhdr read is outstanding
+
public:
rmgr(jcntl* jc, enq_map& emap, txn_map& tmap, rrfc& rrfc);
virtual ~rmgr();
void initialize(const rd_aio_cb rd_cb, const size_t fro);
- const iores get(const u_int64_t& rid, const size_t& dsize, const size_t& dsize_avail,
- const void** const data, bool auto_discard);
- const iores discard(data_tok* dtok);
const iores read(void** const datapp, size_t& dsize, void** const xidpp, size_t& xidsize,
bool& transient, bool& external, data_tok* dtokp);
const u_int32_t get_events(page_state state = AIO_COMPLETE);
void recover_complete(size_t fro);
+ inline const bool is_valid() const {return _valid; }
+ inline void synchronize() { if (!_valid) aio_cycle(); }
+ void invalidate();
+
+ /* TODO (if required)
+ const iores get(const u_int64_t& rid, const size_t& dsize, const size_t& dsize_avail,
+ const void** const data, bool auto_discard);
+ const iores discard(data_tok* dtok);
+ */
private:
void initialize();
+ void clean();
const iores pre_read_check(data_tok* dtokp);
const iores read_enq(rec_hdr& h, void* rptr, data_tok* dtokp);
void consume_xid_rec(rec_hdr& h, void* rptr, data_tok* dtokp);
@@ -90,6 +104,7 @@
const u_int32_t dblks_rem() const;
void set_params_null(void** const datapp, size_t& dsize, void** const xidpp,
size_t& xidsize);
+ void init_file_header_read(u_int16_t fid);
// Special version of libaio's io_prep_pread() which preserves the value of the data
Modified: store/trunk/cpp/lib/jrnl/rrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.cpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/rrfc.cpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -53,6 +53,12 @@
{
_nfiles = nfiles;
_fh_arr = fh_arr;
+ reset(fh_index);
+}
+
+void
+rrfc::reset(u_int32_t fh_index)
+{
_fh_index = fh_index;
_curr_fh = _fh_arr[_fh_index];
}
Modified: store/trunk/cpp/lib/jrnl/rrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.hpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/rrfc.hpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -73,6 +73,8 @@
*/
void initialize(const u_int16_t nfiles, nlfh** fh_arr, u_int32_t fh_index = 0);
+ void reset(u_int32_t fh_index = 0);
+
/**
* \brief Rotate active file handle to next file in rotating file group.
* \exception jerrno::JERR__NINIT if called before calling initialize().
@@ -99,7 +101,7 @@
// Convenience access methods to current file handle
- inline const u_int32_t fid() const { return _curr_fh->fid(); }
+ inline const u_int16_t fid() const { return _curr_fh->fid(); }
inline const int fh() const { return _curr_fh->rd_fh(); }
inline const u_int32_t enqcnt() const { return _curr_fh->enqcnt(); }
inline const u_int32_t incr_enqcnt() { return _curr_fh->incr_enqcnt(); }
@@ -121,7 +123,8 @@
inline const u_int32_t add_cmpl_cnt_dblks(u_int32_t a)
{ return _curr_fh->add_rd_cmpl_cnt_dblks(a); }
- inline const bool empty() const { return _curr_fh->rd_empty(); }
+ inline const bool is_void() const { return _curr_fh->rd_void(); }
+ inline const bool is_empty() const { return _curr_fh->rd_empty(); }
inline const u_int32_t remaining_dblks() { return _curr_fh->rd_remaining_dblks(); }
inline const bool is_full() const { return _curr_fh->is_rd_full(); }
inline const bool is_compl() const { return _curr_fh->is_rd_compl(); }
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -199,7 +199,7 @@
dtokp->set_wstate(data_tok::ENQ_PART);
// Has the file header been written (i.e. write pointers still at 0)?
- if (_wrfc.empty())
+ if (_wrfc.is_void())
{
u_int32_t rec_dblks_rem = _enq_rec.rec_size_dblks() - data_offs_dblks;
bool file_fit = rec_dblks_rem <= _jfsize_dblks;
@@ -342,7 +342,7 @@
dtokp->set_wstate(data_tok::DEQ_PART);
// Has the file header been written (i.e. write pointers still at 0)?
- if (_wrfc.empty())
+ if (_wrfc.is_void())
{
u_int32_t rec_dblks_rem = _deq_rec.rec_size_dblks() - data_offs_dblks;
bool file_fit = rec_dblks_rem <= _jfsize_dblks;
@@ -483,7 +483,7 @@
dtokp->set_wstate(data_tok::ABORT_PART);
// Has the file header been written (i.e. write pointers still at 0)?
- if (_wrfc.empty())
+ if (_wrfc.is_void())
{
u_int32_t rec_dblks_rem = _txn_rec.rec_size_dblks() - data_offs_dblks;
bool file_fit = rec_dblks_rem <= _jfsize_dblks;
@@ -620,7 +620,7 @@
dtokp->set_wstate(data_tok::COMMIT_PART);
// Has the file header been written (i.e. write pointers still at 0)?
- if (_wrfc.empty())
+ if (_wrfc.is_void())
{
u_int32_t rec_dblks_rem = _txn_rec.rec_size_dblks() - data_offs_dblks;
bool file_fit = rec_dblks_rem <= _jfsize_dblks;
@@ -737,7 +737,9 @@
wmgr::rotate_file()
{
_pg_cntr = 0;
- return _wrfc.rotate();
+ iores res = _wrfc.rotate();
+ _jc->chk_wr_frot();
+ return res;
}
const u_int32_t
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -116,6 +116,7 @@
inline const bool curr_pg_blocked() const
{ return _page_cb_arr[_pg_index]._state != UNUSED; }
inline const bool curr_file_blocked() const { return _wrfc.aio_cnt() > 0; }
+ inline const u_int32_t unflushed_dblks() { return _cached_offset_dblks; }
// Debug aid
const std::string status_str() const;
Modified: store/trunk/cpp/lib/jrnl/wrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.cpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/wrfc.cpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -50,7 +50,8 @@
_rid(0),
#endif
_reset_ok(false),
- _owi(false)
+ _owi(false),
+ _frot(true)
{}
wrfc::~wrfc() {}
@@ -64,6 +65,7 @@
_rid = rdp->_h_rid + 1;
_reset_ok = true;
_owi = rdp->_owi;
+ _frot = rdp->_frot;
}
else
{
@@ -94,6 +96,7 @@
{
_fh_index = 0;
_owi = !_owi;
+ _frot = false;
}
_curr_fh = _fh_arr[_fh_index];
if (_curr_fh->aio_cnt())
@@ -103,6 +106,17 @@
return RHM_IORES_SUCCESS;
}
+const u_int16_t
+wrfc::earliest_index() const
+{
+ if (_frot)
+ return 0;
+ u_int16_t next_index = _fh_index + 1;
+ if (next_index >= _nfiles)
+ next_index = 0;
+ return next_index;
+}
+
const bool
wrfc::reset()
{
Modified: store/trunk/cpp/lib/jrnl/wrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.hpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/lib/jrnl/wrfc.hpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -60,6 +60,7 @@
u_int64_t _rid; ///< Master counter for record ID (rid)
bool _reset_ok; ///< Flag set when reset succeeds
bool _owi; ///< Overwrite indicator
+ bool _frot; ///< Flag is true for first rotation, false at all other times
public:
wrfc();
@@ -83,11 +84,19 @@
*/
const iores rotate();
+ /**
+ * \brief Returns the index of the earliest complete file within the rotating
+ * file group. Unwritten files are excluded. The currently active file is
+ * excluded unless it is the only written file.
+ */
+ const u_int16_t earliest_index() const;
+
inline const u_int64_t rid() const { return _rid; }
inline const u_int64_t get_incr_rid() { return _rid++; }
const bool reset();
inline const bool is_reset() const { return _reset_ok; }
inline const bool owi() const { return _owi; }
+ inline const bool frot() const { return _frot; }
// Convenience access methods to current file handle
@@ -107,7 +116,8 @@
inline const u_int16_t incr_aio_cnt() { return _curr_fh->incr_aio_cnt(); }
inline const u_int16_t decr_aio_cnt() { return _curr_fh->decr_aio_cnt(); }
- inline const bool empty() const { return _curr_fh->wr_empty(); }
+ inline const bool is_void() const { return _curr_fh->wr_void(); }
+ inline const bool is_empty() const { return _curr_fh->wr_empty(); }
inline const u_int32_t remaining_dblks() const { return _curr_fh->wr_remaining_dblks(); }
inline const bool is_full() const { return _curr_fh->is_wr_full(); };
inline const bool is_compl() const { return _curr_fh->is_wr_compl(); };
Modified: store/trunk/cpp/tests/jrnl/_st_read.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read.cpp 2008-03-27 15:24:30 UTC (rev 1803)
+++ store/trunk/cpp/tests/jrnl/_st_read.cpp 2008-03-27 15:24:41 UTC (rev 1804)
@@ -46,6 +46,25 @@
// === Test suite ===
+QPID_AUTO_TEST_CASE(empty_read)
+{
+ string test_name = get_test_name(test_filename, "empty_read");
+ try
+ {
+ string msg;
+ string rmsg;
+ string xid;
+ bool transientFlag;
+ bool externalFlag;
+
+ jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jrnl_init(jc);
+ read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+ }
+ catch(const exception& e) { BOOST_FAIL(e.what()); }
+ cout << "ok" << endl;
+}
+
QPID_AUTO_TEST_CASE(enqueue_read_dequeue_block)
{
string test_name = get_test_name(test_filename, "enqueue_read_dequeue_block");
@@ -232,24 +251,24 @@
string test_name = get_test_name(test_filename, "delayed_read");
try
{
- cout << "[NOTE: Disabled until outstanding issue(s) resolved.] ";
-// string msg;
-// string rmsg;
-// string xid;
-// bool transientFlag;
-// bool externalFlag;
-//
-// jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
-// jrnl_init(jc);
-// unsigned m;
-// for (m=0; m<2*NUM_MSGS; m+=2)
-// {
-// enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
-// deq_msg(jc, m);
-// }
-// enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
-// read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
-// BOOST_CHECK_EQUAL(msg, rmsg);
+ string msg;
+ string rmsg;
+ string xid;
+ bool transientFlag;
+ bool externalFlag;
+
+ jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jrnl_init(jc);
+ unsigned m;
+ for (m=0; m<2*NUM_MSGS; m+=2)
+ {
+ enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+ deq_msg(jc, m);
+ }
+ enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+ jc.flush();
+ read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+ BOOST_CHECK_EQUAL(msg, rmsg);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
@@ -260,29 +279,77 @@
string test_name = get_test_name(test_filename, "cache_cycled_delayed_read");
try
{
- cout << "[NOTE: Disabled until outstanding issue(s) resolved.] ";
-// string msg;
-// string rmsg;
-// string xid;
-// bool transientFlag;
-// bool externalFlag;
-//
-// jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
-// jrnl_init(jc);
-// unsigned m;
-// unsigned n = num_msgs_to_full(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS * JRNL_SBLK_SIZE,
-// MSG_REC_SIZE_DBLKS);
-// for (m=0; m<12*2*n; m+=2) // 12 file cycles
-// {
-// enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
-// deq_msg(jc, m);
-// }
-// enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
-// read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
-// BOOST_CHECK_EQUAL(msg, rmsg);
+ string msg;
+ string rmsg;
+ string xid;
+ bool transientFlag;
+ bool externalFlag;
+
+ jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jrnl_init(jc);
+ unsigned m;
+ unsigned read_buffer_size_dblks = JRNL_RMGR_PAGES * JRNL_RMGR_PAGE_SIZE * JRNL_SBLK_SIZE;
+ unsigned n = num_msgs_to_full(1, read_buffer_size_dblks, MSG_REC_SIZE_DBLKS, true);
+ for (m=0; m<2*2*n + 20; m+=2) // fill read buffer twice + 10 msgs
+ {
+ enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+ deq_msg(jc, m);
+ }
+ enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+ jc.flush();
+ read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+ BOOST_CHECK_EQUAL(msg, rmsg);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
}
+QPID_AUTO_TEST_CASE(increasing_interval_delayed_read)
+{
+ string test_name = get_test_name(test_filename, "increasing_interval_delayed_read");
+ try
+ {
+ string msg;
+ string rmsg;
+ string xid;
+ bool transientFlag;
+ bool externalFlag;
+
+ jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jrnl_init(jc);
+ unsigned read_buffer_size_dblks = JRNL_RMGR_PAGES * JRNL_RMGR_PAGE_SIZE * JRNL_SBLK_SIZE;
+ unsigned n = num_msgs_to_full(1, read_buffer_size_dblks, MSG_REC_SIZE_DBLKS, true);
+ unsigned m = 0;
+
+ // Validate read pipeline
+ enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+ jc.flush();
+ read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+ deq_msg(jc, m);
+ m += 2;
+
+ // repeat the following multiple times...
+ for (int i=0; i<10; i++)
+ {
+ // Invalidate read pipeline with large write
+ unsigned t = m + (i*n) + 25;
+ for (; m<t; m+=2)
+ {
+ enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+ deq_msg(jc, m);
+ }
+
+ // Revalidate read pipeline
+ enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+ jc.flush();
+ read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+ BOOST_CHECK_EQUAL(msg, rmsg);
+ deq_msg(jc, m);
+ m += 2;
+ }
+ }
+ catch(const exception& e) { BOOST_FAIL(e.what()); }
+ cout << "ok" << endl;
+}
+
QPID_AUTO_TEST_SUITE_END()
16 years, 9 months
rhmessaging commits: r1803 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-27 11:24:30 -0400 (Thu, 27 Mar 2008)
New Revision: 1803
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/model.py
Log:
Add stat metadata for broker links.
Add columns using some of that data to BrokerLinkSet.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-03-27 14:48:15 UTC (rev 1802)
+++ mgmt/cumin/python/cumin/broker.py 2008-03-27 15:24:30 UTC (rev 1803)
@@ -130,6 +130,12 @@
col = self.AddressColumn(app, "addr")
self.add_column(col)
+ col = self.FromPeerColumn(app, "from_peer")
+ self.add_column(col)
+
+ col = self.ToPeerColumn(app, "to_peer")
+ self.add_column(col)
+
def get_args(self, session):
return self.frame.get_args(session)
@@ -149,9 +155,20 @@
def render_title(self, session, data):
return "Address"
- def render_content(self, session, data):
- return data[name]
+ class FromPeerColumn(NullSortColumn, FreshDataOnlyColumn):
+ def render_title(self, session, data):
+ return "Bytes from Peer"
+ def render_value(self, session, value):
+ return fmt_rate(value)
+
+ class ToPeerColumn(NullSortColumn, FreshDataOnlyColumn):
+ def render_title(self, session, data):
+ return "Bytes to Peer"
+
+ def render_value(self, session, value):
+ return fmt_rate(value)
+
class BrokerFrame(CuminFrame):
def __init__(self, app, name):
super(BrokerFrame, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2008-03-27 14:48:15 UTC (rev 1802)
+++ mgmt/cumin/python/cumin/broker.strings 2008-03-27 15:24:30 UTC (rev 1803)
@@ -40,9 +40,17 @@
</form>
[BrokerLinkSet.sql]
-select l.id, l.address as addr
+select
+ l.id,
+ l.address as addr,
+ c.bytes_from_peer as from_peer,
+ case when p.bytes_from_peer is null then true else false end as from_peer_is_null,
+ c.bytes_to_peer as to_peer,
+ case when p.bytes_to_peer is null then true else false end as to_peer_is_null
from link as l
join vhost as v on v.id = l.vhost_id
+left outer join link_stats as c on c.id = l.stats_curr_id
+left outer join link_stats as p on p.id = l.stats_prev_id
{sql_where}
{sql_orderby}
{sql_limit}
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-03-27 14:48:15 UTC (rev 1802)
+++ mgmt/cumin/python/cumin/model.py 2008-03-27 15:24:30 UTC (rev 1803)
@@ -24,6 +24,7 @@
CuminBinding(self)
CuminClient(self)
CuminSession(self)
+ CuminLink(self)
CuminBrokerRegistration(self)
CuminBrokerGroup(self)
@@ -693,6 +694,33 @@
def do_invoke(self, object, args, completion):
object.solicitAck(self.model.data, completion)
+class CuminLink(CuminClass):
+ def __init__(self, model):
+ super(CuminLink, self).__init__(model, "link", Link, LinkStats)
+
+ stat = CuminStat(self, "framesFromPeer", "int")
+ stat.title = "Frames from Peer"
+ stat.unit = "frame"
+ stat.categories = ("general")
+
+ stat = CuminStat(self, "framesToPeer", "int")
+ stat.title = "Frames to Peer"
+ stat.unit = "frame"
+ stat.categories = ("general")
+
+ stat = CuminStat(self, "bytesFromPeer", "int")
+ stat.title = "Bytes from Peer"
+ stat.unit = "byte"
+ stat.categories = ("general")
+
+ stat = CuminStat(self, "bytesToPeer", "int")
+ stat.title = "Bytes to Peer"
+ stat.unit = "byte"
+ stat.categories = ("general")
+
+ def get_title(self, session):
+ return "Broker Link"
+
class CuminBrokerRegistration(CuminClass):
def __init__(self, model):
super(CuminBrokerRegistration, self).__init__ \
16 years, 9 months
rhmessaging commits: r1802 - in mgmt: cumin/python/wooly and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-27 10:48:15 -0400 (Thu, 27 Mar 2008)
New Revision: 1802
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/forms.py
mgmt/cumin/python/wooly/parameters.py
mgmt/misc/boneyard.py
mgmt/notes/justin-todo.txt
Log:
Eliminate set_default.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-03-27 12:28:06 UTC (rev 1801)
+++ mgmt/cumin/python/cumin/broker.py 2008-03-27 14:48:15 UTC (rev 1802)
@@ -472,7 +472,7 @@
self.add_attribute(self.addr_errors)
self.group_param = BrokerGroupParameter(app, "group_param")
- self.group_param.set_default(None)
+ self.group_param.default = None
self.add_parameter(self.group_param)
self.add_form_parameter(self.group_param)
@@ -481,7 +481,7 @@
self.add_form_parameter(self.groups)
self.fields = IntegerParameter(app, "fields")
- self.fields.set_default(3)
+ self.fields.default = 3
self.add_parameter(self.fields)
self.field_tmpl = Template(self, "field_html")
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-03-27 12:28:06 UTC (rev 1801)
+++ mgmt/cumin/python/cumin/exchange.py 2008-03-27 14:48:15 UTC (rev 1802)
@@ -265,7 +265,7 @@
self.add_child(self.exchange_name)
self.type = Parameter(app, "type")
- self.type.set_default("direct")
+ self.type.default = "direct"
self.add_parameter(self.type)
self.direct = RadioInput(app, "direct", self)
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-03-27 12:28:06 UTC (rev 1801)
+++ mgmt/cumin/python/cumin/widgets.py 2008-03-27 14:48:15 UTC (rev 1802)
@@ -248,7 +248,7 @@
self.titles[state] = title
if self.param.default is None:
- self.param.set_default(state)
+ self.param.default = state
def get(self, session):
return self.param.get(session)
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2008-03-27 12:28:06 UTC (rev 1801)
+++ mgmt/cumin/python/wooly/__init__.py 2008-03-27 14:48:15 UTC (rev 1802)
@@ -25,9 +25,6 @@
else:
self.path = self.name
- def set_required(self, required):
- self.required = required
-
def validate(self, session):
value = self.get(session)
@@ -55,9 +52,6 @@
def get_default(self, session):
return self.default
- def set_default(self, default):
- self.default = default
-
def __repr__(self):
return "%s('%s')" % (self.__class__.__name__, self.path)
Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py 2008-03-27 12:28:06 UTC (rev 1801)
+++ mgmt/cumin/python/wooly/forms.py 2008-03-27 14:48:15 UTC (rev 1802)
@@ -73,9 +73,6 @@
def get_default(self, session):
return self.param.get_default(session)
- def set_default(self, default):
- return self.param.set_default(default)
-
def set_tab_index(self, tab_index):
self.tab_index = tab_index
Modified: mgmt/cumin/python/wooly/parameters.py
===================================================================
--- mgmt/cumin/python/wooly/parameters.py 2008-03-27 12:28:06 UTC (rev 1801)
+++ mgmt/cumin/python/wooly/parameters.py 2008-03-27 14:48:15 UTC (rev 1802)
@@ -36,7 +36,7 @@
def __init__(self, model, name):
Parameter.__init__(self, model, name)
- self.set_default(False)
+ self.default = False
def do_unmarshal(self, string):
return string == "t"
@@ -45,9 +45,6 @@
return object and "t" or "f"
class VoidBooleanParameter(Parameter):
- def set_default(self, default):
- raise Exception("Unsupported operation")
-
def get(self, session):
return self.path in session.values
Modified: mgmt/misc/boneyard.py
===================================================================
--- mgmt/misc/boneyard.py 2008-03-27 12:28:06 UTC (rev 1801)
+++ mgmt/misc/boneyard.py 2008-03-27 14:48:15 UTC (rev 1802)
@@ -150,7 +150,7 @@
self.add_parameter(self.param)
self.source = Parameter(app, "source")
- self.source.set_default("local")
+ self.source.default = "local"
self.add_parameter(self.source)
self.profile = RadioInput(app, "profile", self)
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-03-27 12:28:06 UTC (rev 1801)
+++ mgmt/notes/justin-todo.txt 2008-03-27 14:48:15 UTC (rev 1802)
@@ -1,7 +1,5 @@
Current
- * Resolve design questions around view navigation
-
* Tables: Make null values in tables dashes, not zeroes
* Get rid of single object confirms
@@ -16,8 +14,12 @@
* Fix the status box updates, to avoid the "/sec" display
+ * Fix obnoxious HTML resizing bug
+
Deferred
+ * Resolve design questions around view navigation
+
* Blow up if we try to call set_redirect_url twice in a session
* Need to add cherrypy bsd license to binary dist?
@@ -56,11 +58,6 @@
* Avoid dirtying js namespace with updateFoo methods
- * Add a widget for the html client side of chart images
-
- * Directly set attr.default for static defaults; eliminate
- attr.set_default
-
* So that list params can embed an item param, find a way to avoid
the need to attach params to widgets in every instance
16 years, 9 months
rhmessaging commits: r1801 - in mgmt/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-27 08:28:06 -0400 (Thu, 27 Mar 2008)
New Revision: 1801
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/widgets.py
Log:
Remove an obsolete feature of Widget
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2008-03-27 04:49:04 UTC (rev 1800)
+++ mgmt/cumin/python/cumin/page.py 2008-03-27 12:28:06 UTC (rev 1801)
@@ -197,8 +197,6 @@
def __init__(self, app, name):
super(MainFrameTabs, self).__init__(app, name)
- self.html_class = "tabs"
-
self.selection = Parameter(app, "sel")
self.selection.default = "mtab"
self.add_parameter(self.selection)
@@ -207,6 +205,9 @@
#self.add_link(self.GridTab(app, "gtab"))
self.add_link(self.SystemsTab(app, "stab"))
+ def render_class(self, session):
+ return "tabs"
+
class Tab(Link):
def render_class(self, session):
if self.parent.selection.get(session) == self.name:
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2008-03-27 04:49:04 UTC (rev 1800)
+++ mgmt/cumin/python/wooly/__init__.py 2008-03-27 12:28:06 UTC (rev 1801)
@@ -96,9 +96,6 @@
self.attributes = list()
self.parameters = list()
- # XXX get rid of this
- self.html_class = None
-
# These are set in the init() pass
self.ancestors = None
self.path = None
@@ -239,7 +236,7 @@
return self.path
def render_class(self, session, *args):
- return self.html_class
+ return None
def render_href(self, session, *args):
return session.marshal()
Modified: mgmt/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/cumin/python/wooly/widgets.py 2008-03-27 04:49:04 UTC (rev 1800)
+++ mgmt/cumin/python/wooly/widgets.py 2008-03-27 12:28:06 UTC (rev 1801)
@@ -102,9 +102,6 @@
return link.render(session)
class Link(Widget):
- def render_class(self, session, *args):
- return self.html_class
-
def edit_session(self, session, *args):
pass
16 years, 9 months
rhmessaging commits: r1800 - in mgmt: cumin/python/wooly and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-27 00:49:04 -0400 (Thu, 27 Mar 2008)
New Revision: 1800
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/brokercluster.py
mgmt/cumin/python/cumin/brokergroup.py
mgmt/cumin/python/cumin/brokerprofile.py
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/system.py
mgmt/cumin/python/cumin/virtualhost.py
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/forms.py
mgmt/cumin/python/wooly/parameters.py
mgmt/cumin/python/wooly/widgets.py
mgmt/misc/boneyard.py
Log:
Now that we have an init() pass, we can set widget relation just once
at start time. This has a nice performance impact for common
operations such as marshal_url_vars().
Changes the path(), page(), and frame() methods to be simple
attributes with precomputed values.
Gets rid of the get_child(name) method in favor of a member dict,
widget.children_by_name.
Changes the api for saving parameters.
widget.save_parameters(session, list) is now the way to edit
the set of parameters saved between page loads.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/broker.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -57,13 +57,13 @@
self.parent.ids.clear(session)
branch = session.branch()
- frame = self.frame().show_brokers_remove(branch)
+ frame = self.frame.show_brokers_remove(branch)
frame.ids.set(branch, ids)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.set_redirect_url(session, branch.marshal())
class BrokerSetGroupInput(BrokerGroupInput):
def render_submit_id(self, session):
- return self.parent.groupify.path()
+ return self.parent.groupify.path
class Groupify(FormButton):
def render_content(self, session):
@@ -83,7 +83,7 @@
except IntegrityError:
pass
- self.page().set_redirect_url(session, session.marshal())
+ self.page.set_redirect_url(session, session.marshal())
class NameColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -131,7 +131,7 @@
self.add_column(col)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, broker):
count = self.get_item_count(session, broker)
@@ -189,25 +189,25 @@
def show_queue(self, session, queue):
self.queue.set_object(session, queue)
- self.page().set_current_frame(session, self.queue)
+ self.page.set_current_frame(session, self.queue)
return self.show_mode(session, self.queue)
def show_queues_purge(self, session):
- self.page().set_current_frame(session, self.queues_purge)
+ self.page.set_current_frame(session, self.queues_purge)
return self.show_mode(session, self.queues_purge)
def show_exchange(self, session, exchange):
self.exchange.set_object(session, exchange)
- self.page().set_current_frame(session, self.exchange)
+ self.page.set_current_frame(session, self.exchange)
return self.show_mode(session, self.exchange)
def show_client(self, session, client):
self.client.set_object(session, client)
- self.page().set_current_frame(session, self.client)
+ self.page.set_current_frame(session, self.client)
return self.show_mode(session, self.client)
def show_clients_close(self, session):
- self.page().set_current_frame(session, self.clients_close)
+ self.page.set_current_frame(session, self.clients_close)
return self.show_mode(session, self.clients_close)
def render_title(self, session, broker):
@@ -273,7 +273,7 @@
for group in reg.groups:
branch = session.branch()
- self.frame().frame().show_broker_group(branch, group).show_view \
+ self.frame.frame.show_broker_group(branch, group).show_view \
(branch)
links.append(fmt_olink(branch, group))
@@ -284,7 +284,7 @@
if cluster:
branch = session.branch()
- self.page().show_broker_cluster(branch, cluster).show_view(branch)
+ self.page.show_broker_cluster(branch, cluster).show_view(branch)
return fmt_olink(branch, cluster)
else:
return fmt_none()
@@ -294,7 +294,7 @@
if profile:
branch = session.branch()
- self.page().show_broker_profile(branch, profile).show_view(branch)
+ self.page.show_broker_profile(branch, profile).show_view(branch)
return fmt_olink(branch, profile)
else:
return fmt_none()
@@ -307,7 +307,7 @@
self.add_child(self.__queues)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, reg):
vhost = reg.getDefaultVhost()
@@ -315,12 +315,12 @@
def render_add_queue_href(self, session, reg):
branch = session.branch()
- self.frame().show_queue(branch, None).show_add(branch)
+ self.frame.show_queue(branch, None).show_add(branch)
return branch.marshal()
class BrokerExchangeTab(ExchangeSet):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, reg):
vhost = reg.getDefaultVhost()
@@ -329,7 +329,7 @@
class BrokerClientTab(ClientSet):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, reg):
vhost = reg.getDefaultVhost()
@@ -338,14 +338,14 @@
class BrokerStatsTab(Widget):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, reg):
return "Statistics"
class BrokerLogTab(Widget):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, reg):
return "Log Messages"
@@ -393,7 +393,7 @@
def render_add_broker_href(self, session):
branch = session.branch()
- self.frame().show_brokers_add(branch)
+ self.frame.show_brokers_add(branch)
return branch.marshal()
def render_clear_filters_href(self, session):
@@ -507,7 +507,7 @@
return writer.to_string()
def render_field_name_name(self, session, index):
- return self.names.path()
+ return self.names.path
def render_field_name_value(self, session, index):
names = self.names.get(session)
@@ -521,7 +521,7 @@
"</li><li>".join(errors[index])
def render_field_address_name(self, session, index):
- return self.addrs.path()
+ return self.addrs.path
def render_field_address_value(self, session, index):
addrs = self.addrs.get(session)
@@ -535,7 +535,7 @@
"</li><li>".join(errors[index])
def render_field_group_name(self, session, index):
- return self.groups.path()
+ return self.groups.path
def render_groups(self, session, index):
writer = Writer()
@@ -564,8 +564,8 @@
class BrokerSetAdd(BrokerSetForm):
def process_cancel(self, session):
branch = session.branch()
- self.frame().show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session):
action = self.app.model.broker_registration.add
@@ -644,19 +644,19 @@
def init(self):
super(BrokerEdit, self).init()
- self.broker_name.set_object_attr(self.frame().get_object_parameter())
+ self.broker_name.set_object_attr(self.frame.get_object_parameter())
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, reg):
return "Edit Broker '%s'" % reg.name
def process_cancel(self, session, reg):
branch = session.branch()
- self.page().pop_current_frame(branch)
- self.page().get_current_frame(branch).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.pop_current_frame(branch)
+ self.page.get_current_frame(branch).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, reg):
errors = self.validate(session)
@@ -688,20 +688,20 @@
class BrokerRemove(CuminConfirmForm):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, reg):
branch = session.branch()
- self.frame().show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, reg):
action = self.app.model.broker_registration.remove
action.invoke(reg)
branch = session.branch()
- self.page().show_main(branch).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_main(branch).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def render_title(self, session, reg):
return "Unregister Broker '%s'" % reg.name
@@ -715,10 +715,9 @@
class BrokerSetRemove(CuminBulkActionForm, Frame):
def process_return(self, session):
branch = session.branch()
- frame = self.frame()
- frame.show_view(branch)
- self.page().set_current_frame(branch, frame)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.show_view(branch)
+ self.page.set_current_frame(branch, self.frame)
+ self.page.set_redirect_url(session, branch.marshal())
def process_item(self, session, id):
action = self.app.model.broker_registration.remove
Modified: mgmt/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/cumin/python/cumin/brokercluster.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/brokercluster.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -15,7 +15,7 @@
class BrokerClusterSet(SQLObjectItemSet):
def render_cluster_add_href(self, session, *args):
branch = session.branch()
- self.page().show_broker_cluster_add(branch)
+ self.page.show_broker_cluster_add(branch)
return branch.marshal()
def render_title(self, session, *args):
@@ -26,7 +26,7 @@
def render_item_link(self, session, cluster):
branch = session.branch()
- self.page().show_broker_cluster(branch, cluster).show_view(branch)
+ self.page.show_broker_cluster(branch, cluster).show_view(branch)
return fmt_olink(branch, cluster)
def render_item_config(self, session, cluster):
@@ -94,7 +94,7 @@
class ClusterBrokerTab(BrokerSet):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, cluster):
return "Brokers %s" % fmt_count(len(cluster.brokers))
@@ -104,7 +104,7 @@
class ClusterStatsTab(Widget):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, cluster):
return "Statistics"
@@ -120,8 +120,8 @@
cluster.name = self.cluster_name.get(session)
branch = session.branch()
- self.page().show_broker_cluster(branch, cluster).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_broker_cluster(branch, cluster).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
class BrokerClusterAdd(BrokerClusterForm, Frame):
def render_title(self, session):
@@ -129,8 +129,8 @@
def process_cancel(self, session):
branch = session.branch()
- self.page().show_main(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_main(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session):
cluster = BrokerCluster()
@@ -138,12 +138,12 @@
class BrokerClusterEdit(BrokerClusterForm, Frame):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, cluster):
branch = session.branch()
self.parent.show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, cluster):
self.process_cluster(session, cluster)
@@ -160,15 +160,15 @@
def process_cancel(self, session, cluster):
branch = session.branch()
- self.page().show_broker_cluster(branch, cluster).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_broker_cluster(branch, cluster).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, cluster):
cluster.destroySelf()
branch = session.branch()
- self.page().show_main(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_main(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def render_title(self, session, cluster):
return "Remove Broker Cluster '%s'" % cluster.name
Modified: mgmt/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/brokergroup.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -26,7 +26,7 @@
def render_group_add_href(self, session):
branch = session.branch()
- self.frame().show_broker_group(branch, None).show_add(branch)
+ self.frame.show_broker_group(branch, None).show_add(branch)
return branch.marshal()
class NameColumn(SqlTableColumn):
@@ -130,7 +130,7 @@
class GroupBrokerTab(BrokerSet):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, group):
return "Brokers %s" % \
@@ -154,15 +154,15 @@
def init(self):
super(BrokerGroupForm, self).init()
- self.group_name.set_object_attr(self.frame().get_object_parameter())
+ self.group_name.set_object_attr(self.frame.get_object_parameter())
class BrokerGroupAdd(BrokerGroupForm):
def process_cancel(self, session):
branch = session.branch()
- self.page().pop_current_frame(branch)
- self.page().pop_current_frame(branch)
- self.page().get_current_frame(branch).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.pop_current_frame(branch)
+ self.page.pop_current_frame(branch)
+ self.page.get_current_frame(branch).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session):
errors = self.validate(session)
@@ -181,13 +181,13 @@
class BrokerGroupEdit(BrokerGroupForm):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, group):
branch = session.branch()
- self.page().pop_current_frame(branch)
- self.page().get_current_frame(branch).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.pop_current_frame(branch)
+ self.page.get_current_frame(branch).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, group):
errors = self.validate(session)
@@ -209,24 +209,24 @@
class BrokerGroupRemove(CuminConfirmForm, Frame):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, group):
branch = session.branch()
- self.frame().show_view(branch)
- self.page().pop_current_frame(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.show_view(branch)
+ self.page.pop_current_frame(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, group):
method = self.app.model.broker_group.remove
method.invoke(group)
branch = session.branch()
- self.frame().frame().show_view(branch)
- self.page().pop_current_frame(branch)
- self.page().pop_current_frame(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.frame.show_view(branch)
+ self.page.pop_current_frame(branch)
+ self.page.pop_current_frame(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def render_title(self, session, group):
return "Remove Broker Group '%s'" % group.name
Modified: mgmt/cumin/python/cumin/brokerprofile.py
===================================================================
--- mgmt/cumin/python/cumin/brokerprofile.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/brokerprofile.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -14,7 +14,7 @@
class BrokerProfileSet(SQLObjectItemSet):
def render_profile_add_href(self, session, *args):
branch = session.branch()
- self.page().show_broker_profile_add(branch)
+ self.page.show_broker_profile_add(branch)
return branch.marshal()
def render_title(self, session, *args):
@@ -25,7 +25,7 @@
def render_item_link(self, session, profile):
branch = session.branch()
- self.page().show_broker_profile(branch, profile).show_view(branch)
+ self.page.show_broker_profile(branch, profile).show_view(branch)
return fmt_olink(branch, profile)
class BrokerProfileFrame(CuminFrame):
@@ -69,7 +69,7 @@
class ProfileConfigTab(ConfigPropertySet):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def do_get_items(self, session, profile):
return sorted_by(profile.properties)
@@ -82,7 +82,7 @@
super(BrokerProfileView.ProfileBrokerTab, self).__init__(app, name)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, profile):
return "Brokers %s" % fmt_count(len(profile.brokers))
@@ -92,7 +92,7 @@
def render_item_config_href(self, session, broker):
branch = session.branch()
- frame = self.page().show_broker(branch, broker)
+ frame = self.page.show_broker(branch, broker)
frame.show_view(branch).show_config(branch)
return branch.marshal()
@@ -121,8 +121,8 @@
profile.name = self.profile_name.get(session)
branch = session.branch()
- self.page().show_broker_profile(branch, profile).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_broker_profile(branch, profile).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
class BrokerProfileAdd(BrokerProfileForm, Frame):
def render_title(self, session):
@@ -130,8 +130,8 @@
def process_cancel(self, session):
branch = session.branch()
- self.page().show_main(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_main(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session):
profile = BrokerProfile()
@@ -139,12 +139,12 @@
class BrokerProfileEdit(BrokerProfileForm, Frame):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, profile):
branch = session.branch()
self.parent.show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, profile):
self.process_profile(session, profile)
@@ -157,19 +157,19 @@
class BrokerProfileRemove(CuminConfirmForm):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, profile):
branch = session.branch()
- self.page().show_broker_profile(branch, profile).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_broker_profile(branch, profile).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, profile):
profile.destroySelf()
branch = session.branch()
- self.page().show_main(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_main(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def render_title(self, session, profile):
return "Remove Broker Profile '%s'" % profile.name
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/client.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -46,7 +46,7 @@
self.add_child(self.__close)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def get_unit_plural(self, session):
return self.unit.get(session) == "b" and "Bytes" or "Frames"
@@ -72,9 +72,9 @@
self.parent.ids.clear(session)
branch = session.branch()
- frame = self.frame().show_clients_close(branch)
+ frame = self.frame.show_clients_close(branch)
frame.ids.set(branch, ids)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.set_redirect_url(session, branch.marshal())
class AddressColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -83,7 +83,7 @@
def render_content(self, session, data):
client = Identifiable(data["id"])
branch = session.branch()
- self.frame().show_client(branch, client).show_view(branch)
+ self.frame.show_client(branch, client).show_view(branch)
return fmt_olink(branch, client, name=data["addr"])
class SessionsColumn(SqlTableColumn):
@@ -93,7 +93,7 @@
def render_content(self, session, data):
client = Identifiable(data["id"])
branch = session.branch()
- frame = self.frame().show_client(branch, client)
+ frame = self.frame.show_client(branch, client)
frame.show_view(branch).show_sessions(branch)
# XXX client.sessions won't work
#return fmt_link(branch.marshal(), client.sessions.count())
@@ -161,12 +161,12 @@
class ClientClose(CuminConfirmForm):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, client):
branch = session.branch()
- self.frame().show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, client):
try:
@@ -188,10 +188,9 @@
class ClientSetClose(CuminBulkActionForm):
def process_return(self, session):
branch = session.branch()
- frame = self.frame()
- frame.show_view(branch)
- self.page().set_current_frame(branch, frame)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.show_view(branch)
+ self.page.set_current_frame(branch, self.frame)
+ self.page.set_redirect_url(session, branch.marshal())
def process_item(self, session, id):
client = Client.get(id)
@@ -296,10 +295,9 @@
class ClientSessionSetDetach(CuminBulkActionForm, Frame):
def process_return(self, session):
branch = session.branch()
- frame = self.frame()
- frame.show_view(branch).show_sessions(branch)
- self.page().set_current_frame(branch, frame)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.show_view(branch).show_sessions(branch)
+ self.page.set_current_frame(branch, self.frame)
+ self.page.set_redirect_url(session, branch.marshal())
def process_item(self, session, id):
session_ = Session.get(id)
@@ -315,10 +313,9 @@
class ClientSessionSetClose(CuminBulkActionForm, Frame):
def process_return(self, session):
branch = session.branch()
- frame = self.frame()
- frame.show_view(branch).show_sessions(branch)
- self.page().set_current_frame(branch, frame)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.show_view(branch).show_sessions(branch)
+ self.page.set_current_frame(branch, self.frame)
+ self.page.set_redirect_url(session, branch.marshal())
def process_item(self, session, id):
session_ = Session.get(id)
@@ -359,7 +356,7 @@
self.add_child(self.__close)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, client):
return "Sessions %s" % fmt_count(client.sessions.count())
@@ -382,10 +379,10 @@
self.parent.ids.clear(session)
branch = session.branch()
- frame = self.frame().show_sessions_detach(branch)
+ frame = self.frame.show_sessions_detach(branch)
frame.ids.set(branch, ids)
- self.page().set_current_frame(branch, frame)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.set_current_frame(branch, frame)
+ self.page.set_redirect_url(session, branch.marshal())
class Close(FormButton):
def render_content(self, session):
@@ -396,10 +393,10 @@
self.parent.ids.clear(session)
branch = session.branch()
- frame = self.frame().show_sessions_close(branch)
+ frame = self.frame.show_sessions_close(branch)
frame.ids.set(branch, ids)
- self.page().set_current_frame(branch, frame)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.set_current_frame(branch, frame)
+ self.page.set_redirect_url(session, branch.marshal())
class NameColumn(SqlTableColumn):
def render_title(self, session, data):
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/exchange.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -66,7 +66,7 @@
self.add_child(self.phase)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, vhost):
return "Exchanges %s" % fmt_count(vhost.exchanges.count())
@@ -87,7 +87,7 @@
def render_content(self, session, data):
exchange = Identifiable(data["id"])
branch = session.branch()
- self.frame().show_exchange(branch, exchange).show_view(branch)
+ self.frame.show_exchange(branch, exchange).show_view(branch)
name = data["name"] or "<em>Default</em>"
return fmt_olink(branch, exchange, name=name)
@@ -101,7 +101,7 @@
# Restore later
exchange = Identifiable(data["id"])
branch = session.branch()
- frame = self.frame().show_exchange(branch, exchange)
+ frame = self.frame.show_exchange(branch, exchange)
frame.show_view(branch).show_producers(branch)
return fmt_link(branch.marshal(), data["producers"])
@@ -112,7 +112,7 @@
def render_content(self, session, data):
exchange = Identifiable(data["id"])
branch = session.branch()
- frame = self.frame().show_exchange(branch, exchange)
+ frame = self.frame.show_exchange(branch, exchange)
frame.show_view(branch).show_bindings(branch)
return fmt_link(branch.marshal(), data["bindings"])
@@ -235,7 +235,7 @@
class ExchangeBindingSet(BindingSet):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, exchange):
return "Queue Bindings %s" % \
@@ -250,7 +250,7 @@
def render_item_href(self, session, binding):
branch = session.branch()
- self.frame().frame().show_queue(branch, binding.queue)
+ self.frame.frame.show_queue(branch, binding.queue)
return branch.marshal()
def render_item_name(self, session, binding):
@@ -302,12 +302,12 @@
class ExchangeAdd(ExchangeForm):
def get_args(self, session):
- return self.frame().frame().get_args(session)
+ return self.frame.frame.get_args(session)
def process_cancel(self, session, vhost):
branch = session.branch()
- self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_broker(branch, vhost.get_broker()).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, vhost):
if self.validate(session):
@@ -318,20 +318,20 @@
vhost.addExchange(exchange)
branch = session.branch()
- self.page().show_exchange(branch, exchange).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_exchange(branch, exchange).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def render_title(self, session, vhost):
return "Add Exchange"
class ExchangeEdit(ExchangeForm):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, exchange):
branch = session.branch()
- self.page().show_exchange(branch, exchange).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_exchange(branch, exchange).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, exchange):
if self.validate(session):
@@ -353,11 +353,11 @@
class ExchangeRemove(CuminConfirmForm):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, exchange):
branch = session.branch()
- self.page().show_exchange(branch, exchange).show_view(branch)
+ self.page.show_exchange(branch, exchange).show_view(branch)
session.set_redirect(branch.marshal())
def process_submit(self, session, exchange):
@@ -366,8 +366,8 @@
exchange.remove()
branch = session.branch()
- self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_broker(branch, vhost.get_broker()).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def render_title(self, session, exchange):
return "Remove Exchange '%s'" % exchange.name
@@ -386,7 +386,7 @@
self.add_tab(self.StatisticsHistory(app, "history"))
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, exchange):
return "Statistics"
@@ -399,7 +399,7 @@
self.add_child(StatSet(app, "general", "general"))
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, exchange):
return "Current"
@@ -424,14 +424,14 @@
self.add_child(chart)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, exchange):
return "History"
class ExchangeProducerSet(ItemSet):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, exchange):
return "Producers %s" % \
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/page.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -111,7 +111,7 @@
self.__object.set(session, object)
writer = Writer()
- for frame in self.page().get_frames(session):
+ for frame in self.page.get_frames(session):
self.__frame_tmpl.render(writer, session, frame)
return writer.to_string()
@@ -138,35 +138,35 @@
def show_broker(self, session, broker):
frame = self.show_mode(session, self.__broker)
frame.set_object(session, broker)
- return self.page().set_current_frame(session, frame)
+ return self.page.set_current_frame(session, frame)
def show_brokers_add(self, session):
frame = self.show_mode(session, self.__brokers_add)
- return self.page().set_current_frame(session, frame)
+ return self.page.set_current_frame(session, frame)
def show_brokers_remove(self, session):
frame = self.show_mode(session, self.__brokers_remove)
- return self.page().set_current_frame(session, frame)
+ return self.page.set_current_frame(session, frame)
def show_broker_group(self, session, group):
frame = self.show_mode(session, self.__group)
frame.set_object(session, group)
- return self.page().set_current_frame(session, frame)
+ return self.page.set_current_frame(session, frame)
def show_broker_profile(self, session, profile):
frame = self.show_mode(session, self.__profile)
frame.set_object(session, profile)
- return self.page().set_current_frame(session, frame)
+ return self.page.set_current_frame(session, frame)
def show_broker_cluster(self, session, cluster):
frame = self.show_mode(session, self.__cluster)
frame.set_object(session, cluster)
- return self.page().set_current_frame(session, frame)
+ return self.page.set_current_frame(session, frame)
def show_system(self, session, system):
frame = self.show_mode(session, self.__system)
frame.set_object(session, system)
- return self.page().set_current_frame(session, frame)
+ return self.page.set_current_frame(session, frame)
def do_process(self, session, *args):
if self.__logout.get(session):
@@ -189,7 +189,7 @@
# lastLoggedOut and lastChallenged
sleep(1)
- self.page().set_redirect_url(session, session.marshal())
+ self.page.set_redirect_url(session, session.marshal())
super(MainFrame, self).do_process(session, *args)
@@ -218,7 +218,7 @@
def edit_session(self, session):
self.parent.selection.set(session, self.name)
- frame = self.page().show_main(session).show_view(session)
+ frame = self.page.show_main(session).show_view(session)
frame.show_messaging(session)
class GridTab(Tab):
@@ -227,7 +227,7 @@
def edit_session(self, session):
self.parent.selection.set(session, self.name)
- frame = self.page().show_main(session).show_view(session)
+ frame = self.page.show_main(session).show_view(session)
frame.show_grid(session)
class SystemsTab(Tab):
@@ -236,7 +236,7 @@
def edit_session(self, session):
self.parent.selection.set(session, self.name)
- frame = self.page().show_main(session).show_view(session)
+ frame = self.page.show_main(session).show_view(session)
frame.show_systems(session)
class MainView(ModeSet):
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/queue.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -61,7 +61,7 @@
self.add_child(self.__purge)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, *args):
return "Queues %s" % fmt_count(Queue.select().count())
@@ -81,9 +81,9 @@
self.parent.ids.clear(session)
branch = session.branch()
- frame = self.frame().show_queues_purge(branch)
+ frame = self.frame.show_queues_purge(branch)
frame.ids.set(branch, ids)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.set_redirect_url(session, branch.marshal())
def render_content(self, session):
return "Purge"
@@ -95,7 +95,7 @@
def render_content(self, session, data):
queue = Identifiable(data["id"])
branch = session.branch()
- self.frame().show_queue(branch, queue).show_view(branch)
+ self.frame.show_queue(branch, queue).show_view(branch)
return fmt_olink(branch, queue, name=data["name"])
class ConsumersColumn(SqlTableColumn):
@@ -108,7 +108,7 @@
# Restore later
queue = Identifiable(data["id"])
branch = session.branch()
- frame = self.frame().show_queue(branch, queue)
+ frame = self.frame.show_queue(branch, queue)
frame.show_view(branch).show_consumers(branch)
return fmt_link(branch.marshal(), data["consumers"])
@@ -119,7 +119,7 @@
def render_content(self, session, data):
queue = Identifiable(data["id"])
branch = session.branch()
- frame = self.frame().show_queue(branch, queue)
+ frame = self.frame.show_queue(branch, queue)
frame.show_view(branch).show_bindings(branch)
return fmt_link(branch.marshal(), data["bindings"])
@@ -277,7 +277,7 @@
class QueueBindingSet(BindingSet):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, queue):
count = fmt_count(self.get_item_count(session, queue))
@@ -296,7 +296,7 @@
def render_item_href(self, session, binding):
branch = session.branch()
- self.frame().frame().show_exchange(branch, binding.exchange)
+ self.frame.frame.show_exchange(branch, binding.exchange)
return branch.marshal()
def render_item_name(self, session, binding):
@@ -315,10 +315,10 @@
class QueueAdd(QueueForm):
def process_cancel(self, session):
branch = session.branch()
- self.page().pop_current_frame(branch)
- self.page().pop_current_frame(branch)
- self.page().get_current_frame(branch).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.pop_current_frame(branch)
+ self.page.pop_current_frame(branch)
+ self.page.get_current_frame(branch).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session):
errors = self.validate(session)
@@ -326,7 +326,7 @@
if errors:
pass
else:
- reg = self.frame().frame().get_object(session)
+ reg = self.frame.frame.get_object(session)
vhost = reg.getDefaultVhost()
name = self.namef.get(session)
@@ -337,20 +337,20 @@
self.process_cancel(session)
def render_title(self, session):
- reg = self.frame().frame().get_object(session)
+ reg = self.frame.frame.get_object(session)
return "Add Queue to Broker '%s'" % reg.name
class QueuePurge(CuminConfirmForm):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, queue):
return "Purge Queue '%s'" % queue.name
def process_cancel(self, session, queue):
branch = session.branch()
- self.frame().show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, queue):
action = self.app.model.queue.purge
@@ -367,10 +367,9 @@
class QueueSetPurge(CuminBulkActionForm):
def process_return(self, session):
branch = session.branch()
- frame = self.frame()
- frame.show_view(branch)
- self.page().set_current_frame(branch, frame)
- self.page().set_redirect_url(session, branch.marshal())
+ self.frame.show_view(branch)
+ self.page.set_current_frame(branch, self.frame)
+ self.page.set_redirect_url(session, branch.marshal())
def process_item(self, session, id):
queue = Queue.get(id)
@@ -394,12 +393,12 @@
self.add_child(self.binding_key)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, queue):
branch = session.branch()
- self.page().show_queue(branch, queue).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_queue(branch, queue).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def validate(self, session):
valid = True
@@ -439,12 +438,12 @@
class QueueBindingRemove(CuminConfirmForm):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def process_cancel(self, session, binding):
branch = session.branch()
- self.page().show_queue(branch, binding.get_queue()).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_queue(branch, binding.get_queue()).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, binding):
log.info("Removing binding %s" % binding)
@@ -504,7 +503,7 @@
class QueueConsumerSet(PaginatedItemSet):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_title(self, session, queue):
count = fmt_count(self.get_item_count(session, queue))
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/stat.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -24,7 +24,7 @@
self.add_attribute(self.object);
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def do_get_items(self, session, object):
stats = list()
@@ -49,7 +49,7 @@
#if stat.link_cb:
# branch = session.branch()
- # stat.link_cb(self.page(), branch, object)
+ # stat.link_cb(self.page, branch, object)
# return fmt_link(branch.marshal(), stat.value(object))
#else:
@@ -84,7 +84,7 @@
self.add_child(self.duration)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_href(self, session, object):
params = list()
Modified: mgmt/cumin/python/cumin/system.py
===================================================================
--- mgmt/cumin/python/cumin/system.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/system.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -36,7 +36,7 @@
def render_content(self, session, data):
system = Identifiable(data["id"])
branch = session.branch()
- self.frame().show_system(branch, system).show_view(branch)
+ self.frame.show_system(branch, system).show_view(branch)
return fmt_olink(branch, system, name=data["name"])
class SystemFrame(CuminFrame):
Modified: mgmt/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/cumin/python/cumin/virtualhost.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/virtualhost.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -21,7 +21,7 @@
def render_item_link(self, session, vhost):
branch = session.branch()
- self.page().show_virtual_host(branch, vhost).show_view(branch)
+ self.page.show_virtual_host(branch, vhost).show_view(branch)
return fmt_olink(branch, vhost)
class VirtualHostFrame(CuminFrame):
@@ -82,7 +82,7 @@
if broker:
branch = session.branch()
- self.page().show_broker(branch, broker).show_view(branch)
+ self.page.show_broker(branch, broker).show_view(branch)
return fmt_olink(branch, broker)
else:
return fmt_none()
@@ -92,7 +92,7 @@
if cluster:
branch = session.branch()
- self.page().show_broker_cluster(branch, cluster).show_view(branch)
+ self.page.show_broker_cluster(branch, cluster).show_view(branch)
return fmt_olink(branch, cluster)
else:
return fmt_none()
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/cumin/widgets.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -74,27 +74,27 @@
self.show_mode(session, mode)
if isinstance(mode, Frame):
- self.page().set_current_frame(session, mode)
+ self.page.set_current_frame(session, mode)
return mode
def do_process(self, session, *args):
- self.page().get_frames(session).append(self)
+ self.page.get_frames(session).append(self)
super(CuminFrame, self).do_process(session, *args)
def render_href(self, session, *args):
branch = session.branch()
- self.page().set_current_frame(branch, self)
+ self.page.set_current_frame(branch, self)
self.show_view(branch)
return branch.marshal()
class CuminView(Widget):
def get_args(self, session):
- return (self.frame().get_object(session),)
+ return (self.frame.get_object(session),)
def render_title(self, session, *args):
- return self.frame().render_title(session, *args)
+ return self.frame.render_title(session, *args)
def render_edit_href(self, session, *args):
branch = session.branch()
@@ -119,7 +119,7 @@
self.add_child(self.submit)
def do_process(self, session, *args):
- self.page().set_modal(session, True)
+ self.page.set_modal(session, True)
if self.cancel.get(session):
self.cancel.set(session, False)
@@ -212,7 +212,7 @@
class CuminStatus(Widget):
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def render_class(self, session, object):
if hasattr(object, "errors"):
@@ -557,7 +557,7 @@
self.ids.set(session, list())
def do_render(self, session, data):
- name = self.ids.path()
+ name = self.ids.path
id = data[self.name]
attr = id in self.ids.get(session) and "checked=\"checked\"" or ""
t = "<td><input type=\"checkbox\" name=\"%s\" value=\"%i\" %s/></td>"
@@ -566,10 +566,10 @@
class CheckboxIdColumnHeader(ItemTableColumnHeader):
def render_form_id(self, session, *args):
- return self.column.form.path()
+ return self.column.form.path
def render_elem_name(self, session, *args):
- return self.column.ids.path()
+ return self.column.ids.path
class NameField(StringField):
def __init__(self, app, name, form):
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/wooly/__init__.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -15,36 +15,33 @@
self.name = name
self.widget = None
self.default = None
- self.is_required = True
+ self.required = True
- self.__path = None
+ self.path = None
- def path(self):
- if self.__path == None:
- if not self.widget.parent:
- self.__path = self.name
- else:
- self.__path = self.widget.path() + "." + self.name
+ def init(self):
+ if self.widget.path:
+ self.path = ".".join((self.widget.path, self.name))
+ else:
+ self.path = self.name
- return self.__path
+ def set_required(self, required):
+ self.required = required
- def set_required(self, is_required):
- self.is_required = is_required
-
def validate(self, session):
value = self.get(session)
- if value == None and self.is_required:
+ if value is None and self.required:
raise Exception("%s not set" % self)
def get(self, session):
- value = session.get(self.path())
+ value = session.get(self.path)
# Use strict test because empty collections are False
- if value == None:
+ if value is None:
default = self.get_default(session)
- if default != None:
+ if default is not None:
value = self.set(session, default)
return value
@@ -53,7 +50,7 @@
self.set(session, value)
def set(self, session, value):
- return session.set(self.path(), value)
+ return session.set(self.path, value)
def get_default(self, session):
return self.default
@@ -62,7 +59,7 @@
self.default = default
def __repr__(self):
- return "%s('%s')" % (self.__class__.__name__, self.path())
+ return "%s('%s')" % (self.__class__.__name__, self.path)
class Parameter(Attribute):
def __init__(self, app, name):
@@ -95,19 +92,21 @@
self.name = name
self.parent = None
self.children = list()
+ self.children_by_name = dict()
self.attributes = list()
self.parameters = list()
+ # XXX get rid of this
self.html_class = None
+ # These are set in the init() pass
+ self.ancestors = None
+ self.path = None
+ self.page = None
+ self.frame = None
+
self.__main_tmpl = Template(self, "html")
- self.__ancestors = None
- self.__path = None
- self.__page = None
- self.__frame = None
- self.__child_index = None
-
app.add_widget(self)
for cls in self.__class__.__mro__:
@@ -115,73 +114,59 @@
if cls is Widget:
break
+ self.sealed = False
+
def init(self):
- for child in self.children:
- child.init()
+ assert not self.sealed
- def ancestors(self):
- if self.__ancestors is None:
- if self.parent is None:
- self.__ancestors = tuple()
- else:
- ancs = list(self.parent.ancestors())
- ancs.append(self.parent)
+ ancestors = list()
+ widget = self.parent
- self.__ancestors = tuple(ancs)
+ while widget is not None:
+ ancestors.append(widget)
+ widget = widget.parent
- return self.__ancestors
+ for widget in ancestors:
+ if isinstance(widget, Frame):
+ self.frame = widget
+ break
- def path(self):
- if self.__path is None:
- if self.parent is None:
- self.__path = ""
- elif self.parent.parent is None:
- self.__path = self.name;
- else:
- self.__path = self.parent.path() + "." + self.name
+ self.ancestors = tuple(reversed(ancestors))
+
+ pelems = [x.name for x in self.ancestors]
+ pelems.append(self.name)
+ self.path = ".".join(pelems[1:])
- return self.__path
+ assert isinstance(self.ancestors[0], Page)
+ self.page = self.ancestors[0]
- def page(self):
- if self.__page is None:
- if self.parent is None:
- self.__page = self
- else:
- self.__page = self.parent.page()
+ self.sealed = True
- return self.__page
+ self.init_children()
- def frame(self):
- if self.__frame is None:
- if self.parent is None:
- assert isinstance(self, Page)
+ def init_children(self):
+ for attr in self.attributes:
+ attr.init()
- self.__frame = self
- else:
- for anc in self.ancestors():
- if isinstance(anc, Frame):
- self.__frame = anc
-
- return self.__frame
+ for param in self.parameters:
+ param.init()
- def add_child(self, widget):
- self.children.append(widget)
- widget.parent = self
+ for child in self.children:
+ child.init()
- def get_child(self, name):
- if not self.__child_index:
- self.__child_index = dict()
+ def add_child(self, child):
+ assert not self.sealed
+ self.children.append(child)
+ self.children_by_name[child.name] = child
+ child.parent = self
- for child in self.children:
- self.__child_index[child.name] = child
-
- return self.__child_index.get(name, None)
-
def add_attribute(self, attribute):
+ assert not self.sealed
self.attributes.append(attribute)
attribute.widget = self
def add_parameter(self, parameter):
+ assert not self.sealed
self.parameters.append(parameter)
parameter.widget = self
@@ -206,17 +191,12 @@
if str:
return str
- def get_saved_parameters(self, session):
- params = list()
+ def save_parameters(self, session, params):
params.extend(self.parameters)
for child in self.children:
- cparams = child.get_saved_parameters(session)
- if cparams:
- params.extend(cparams)
+ child.save_parameters(session, params)
- return params
-
def get_args(self, session):
return ()
@@ -256,7 +236,7 @@
return writer.to_string()
def render_id(self, session, *args):
- return self.path()
+ return self.path
def render_class(self, session, *args):
return self.html_class
@@ -282,14 +262,14 @@
print " %-30s %s" % (key + ":", value)
def __repr__(self):
- return "%s('%s')" % (self.__class__.__name__, self.path())
+ return "%s('%s')" % (self.__class__.__name__, self.path)
class Frame(Widget):
- def get_saved_parameters(self, session):
- frame = self.page().get_current_frame(session)
+ def save_parameters(self, session, params):
+ frame = self.page.get_current_frame(session)
- if self is frame or self in frame.ancestors():
- return super(Frame, self).get_saved_parameters(session)
+ if self is frame or self in frame.ancestors:
+ super(Frame, self).save_parameters(session, params)
class Page(Frame):
xml_content_type = "text/xml"
@@ -304,12 +284,25 @@
self.redirect = Attribute(app, "redirect")
self.add_attribute(self.redirect)
- self.frame = self.FrameParameter(app, "frame")
- self.add_parameter(self.frame)
+ self.current_frame = self.FrameParameter(app, "frame")
+ self.add_parameter(self.current_frame)
self.set_default_frame(self)
- self.cached_parameters = dict()
+ self.__saved_params = dict()
+ def init(self):
+ assert not self.sealed
+ assert self.parent is None
+
+ self.ancestors = ()
+ self.path = ""
+ self.page = self
+ self.frame = self
+
+ self.sealed = True
+
+ self.init_children()
+
def get_last_modified(self, session):
return datetime.utcnow()
@@ -332,22 +325,19 @@
# XXX take "current" out of these
def set_current_frame(self, session, frame):
- self.frame.set(session, frame)
-
+ self.current_frame.set(session, frame)
return frame
def get_current_frame(self, session):
- return self.frame.get(session)
+ return self.current_frame.get(session)
def pop_current_frame(self, session):
frame = self.get_current_frame(session)
-
#print "Popping current frame", frame
+ return self.set_current_frame(session, frame.frame)
- return self.set_current_frame(session, frame.frame())
-
def set_default_frame(self, frame):
- self.frame.default = frame
+ self.current_frame.default = frame
def get_saved_parameters(self, session):
"""
@@ -359,18 +349,21 @@
preserve the state of parameters in the current frame and all
of its ancestor frames.
"""
-
+
frame = self.get_current_frame(session)
- if frame not in self.cached_parameters:
- params = super(Page, self).get_saved_parameters(session)
- self.cached_parameters[frame] = params
-
- return self.cached_parameters[frame]
+ try:
+ params = self.__saved_params[frame]
+ except KeyError:
+ params = list()
+ self.save_parameters(session, params)
+ self.__saved_params[frame] = params
+ return params
+
class FrameParameter(Parameter):
def do_marshal(self, frame):
- return frame.path()
+ return frame.path
def do_unmarshal(self, path):
return self.app.get_widget(path)
@@ -431,7 +424,7 @@
index = dict()
for widget in self.widgets:
- index[widget.path()] = widget
+ index[widget.path] = widget
self.widget_index = index
@@ -449,7 +442,7 @@
for param in self.parameters:
if param.widget:
- index[(param.widget.page(), param.path())] = param
+ index[(param.widget.page, param.path)] = param
self.parameter_index = index
@@ -553,7 +546,7 @@
vars = list()
for param in params:
- key = param.path()
+ key = param.path
if param.is_collection:
collection = self.get(key)
@@ -715,7 +708,7 @@
if method:
fragments.append(method)
else:
- child = self.widget.get_child(key)
+ child = self.widget.children_by_name.get(key)
if child:
fragments.append(child)
@@ -806,17 +799,3 @@
for call in self.callees:
call.write(writer)
-
-class ArgsDict(dict):
- def __init__(self, parent):
- super(ArgsDict, self).__init__()
-
- self.__parent = parent
-
- def __getitem__(self, key):
- value = super(ArgsDict, self).__getitem__(key)
-
- if value is None and self.__parent:
- value = self.__parent.__getitem__(key)
-
- return value
Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/wooly/forms.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -21,7 +21,7 @@
params.difference_update(self.form_params)
for param in params:
- key = param.path()
+ key = param.path
if param.is_collection:
collection = session.get(key)
@@ -83,7 +83,7 @@
self.disabled = disabled
def render_name(self, session, *args):
- return self.param.path()
+ return self.param.path
def render_value(self, session, *args):
return self.param.marshal(self.param.get(session))
Modified: mgmt/cumin/python/wooly/parameters.py
===================================================================
--- mgmt/cumin/python/wooly/parameters.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/wooly/parameters.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -49,10 +49,10 @@
raise Exception("Unsupported operation")
def get(self, session):
- return self.path() in session.values
+ return self.path in session.values
def set(self, session, value):
- key = self.path()
+ key = self.path
if value:
session.set(key, None)
Modified: mgmt/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/cumin/python/wooly/widgets.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/cumin/python/wooly/widgets.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -22,7 +22,7 @@
self.mode.default = mode.name
def get_selected_mode(self, session):
- return self.get_child(self.mode.get(session))
+ return self.children_by_name.get(self.mode.get(session))
def set_selected_mode(self, session, mode):
self.mode.set(session, mode.name)
Modified: mgmt/misc/boneyard.py
===================================================================
--- mgmt/misc/boneyard.py 2008-03-26 18:38:46 UTC (rev 1799)
+++ mgmt/misc/boneyard.py 2008-03-27 04:49:04 UTC (rev 1800)
@@ -12,7 +12,7 @@
self.add_child(self.servers)
def get_args(self, session):
- return self.frame().get_args(session)
+ return self.frame.get_args(session)
def get_object(self, session):
return self.param.get(session)
@@ -32,13 +32,13 @@
def render_add_group_href(self, session, group):
branch = session.branch()
- self.page().show_server_group_add(branch)
+ self.page.show_server_group_add(branch)
return branch.marshal()
def render_edit_group_href(self, session, group):
if group:
branch = session.branch()
- self.page().show_server_group_edit(branch, group)
+ self.page.show_server_group_edit(branch, group)
return branch.marshal()
def render_remove_group_href(self, session, group):
@@ -115,13 +115,13 @@
def render_add_cluster_href(self, session, cluster):
branch = session.branch()
- #self.page().show_cluster_add(branch)
+ #self.page.show_cluster_add(branch)
return branch.marshal()
def render_edit_cluster_href(self, session, cluster):
if cluster:
branch = session.branch()
- #self.page().show_cluster_edit(branch, cluster)
+ #self.page.show_cluster_edit(branch, cluster)
return branch.marshal()
def render_remove_cluster_href(self, session, cluster):
@@ -190,8 +190,8 @@
def process_cancel(self, session, prop):
branch = session.branch()
- self.page().show_broker(branch, prop.get_broker()).show_view(branch)
- self.page().set_redirect_url(session, branch.marshal())
+ self.page.show_broker(branch, prop.get_broker()).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session, prop):
source = self.source.get(session)
@@ -235,7 +235,7 @@
def render_item_edit_href(self, session, prop):
branch = session.branch()
- frame = self.page().show_broker(branch, prop.get_broker())
+ frame = self.page.show_broker(branch, prop.get_broker())
frame.show_config_property(branch, prop)
return branch.marshal()
16 years, 9 months
rhmessaging commits: r1799 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-26 14:38:46 -0400 (Wed, 26 Mar 2008)
New Revision: 1799
Modified:
mgmt/cumin/python/cumin/broker.py
Log:
Use UniqueNameField in the BrokerEdit form
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-03-26 18:32:58 UTC (rev 1798)
+++ mgmt/cumin/python/cumin/broker.py 2008-03-26 18:38:46 UTC (rev 1799)
@@ -634,12 +634,18 @@
def __init__(self, app, name):
super(BrokerEdit, self).__init__(app, name)
- self.broker_name = NameField(app, "name", self)
+ self.broker_name = UniqueNameField(app, "name", self,
+ BrokerRegistration)
self.add_field(self.broker_name)
self.groups = BrokerGroupCheckboxField(app, "groups", self)
self.add_field(self.groups)
+ def init(self):
+ super(BrokerEdit, self).init()
+
+ self.broker_name.set_object_attr(self.frame().get_object_parameter())
+
def get_args(self, session):
return self.frame().get_args(session)
16 years, 9 months
rhmessaging commits: r1798 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-26 14:32:58 -0400 (Wed, 26 Mar 2008)
New Revision: 1798
Modified:
mgmt/cumin/python/cumin/broker.py
Log:
Fix a bug that was crashing multibroker add when there were errors in
the form.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-03-26 16:51:38 UTC (rev 1797)
+++ mgmt/cumin/python/cumin/broker.py 2008-03-26 18:32:58 UTC (rev 1798)
@@ -553,8 +553,9 @@
def render_group_selected_attr(self, session, index, group):
groups = self.groups.get(session)
- if len(groups) > index and group.id == groups[index].id:
- return "selected=\"selected\""
+ if len(groups) > index:
+ if groups[index] and group.id == groups[index].id:
+ return "selected=\"selected\""
class MoreEntries(FormButton):
def render_content(self, session):
16 years, 9 months
rhmessaging commits: r1797 - in mgmt: cumin/python/wooly and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-26 12:51:38 -0400 (Wed, 26 Mar 2008)
New Revision: 1797
Modified:
mgmt/cumin/python/cumin/brokergroup.py
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/__init__.py
mgmt/mint/python/mint/__init__.py
mgmt/mint/sql/schema.sql
Log:
Makes broker group name unique in the schema.
Introduces a field, UniqueNameField, that checks the database for
objects that already have the given name.
Introduces an init() pass to Widget (I thought I would need this), so
that it's possible link widgets to the state of other widgets. This
can't be accomplished in the __init__ pass because the whole tree of
widgets doesn't exist yet.
Modified: mgmt/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.py 2008-03-26 15:28:34 UTC (rev 1796)
+++ mgmt/cumin/python/cumin/brokergroup.py 2008-03-26 16:51:38 UTC (rev 1797)
@@ -148,9 +148,14 @@
def __init__(self, app, name):
super(BrokerGroupForm, self).__init__(app, name)
- self.group_name = NameField(app, "name", self)
+ self.group_name = UniqueNameField(app, "name", self, BrokerGroup)
self.add_field(self.group_name)
+ def init(self):
+ super(BrokerGroupForm, self).init()
+
+ self.group_name.set_object_attr(self.frame().get_object_parameter())
+
class BrokerGroupAdd(BrokerGroupForm):
def process_cancel(self, session):
branch = session.branch()
@@ -158,7 +163,7 @@
self.page().pop_current_frame(branch)
self.page().get_current_frame(branch).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
-
+
def process_submit(self, session):
errors = self.validate(session)
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-03-26 15:28:34 UTC (rev 1796)
+++ mgmt/cumin/python/cumin/widgets.py 2008-03-26 16:51:38 UTC (rev 1797)
@@ -31,9 +31,14 @@
else:
return ()
+ # XXX these should be object_attr, not _parameter
def set_object_parameter(self, param):
self.__param = param
+ return param
+ def get_object_parameter(self):
+ return self.__param
+
def get_object(self, session):
if self.__param:
return self.__param.get(session)
@@ -593,6 +598,40 @@
break
+class UniqueNameField(NameField):
+ def __init__(self, app, name, form, cls, fld="name"):
+ super(UniqueNameField, self).__init__(app, name, form)
+
+ self.__class = cls
+ self.__field = fld
+ self.__object = None
+
+ def set_object_attr(self, attr):
+ self.__object = attr
+
+ def do_validate(self, session, errors):
+ name = self.get(session)
+
+ args = {self.__field: name, }
+ results = self.__class.selectBy(**args)
+
+ if self.__object:
+ object = self.__object.get(session)
+ if object:
+ results = results.filter(self.__class.q.id != object.id)
+
+ if results.count() > 0:
+ errors.append(DuplicateValueError())
+
+class DuplicateValueError(Error):
+ def __init__(self, fld="name"):
+ super(Error, self).__init__()
+
+ self.__field = fld
+
+ def get_message(self, session):
+ return "An item with this %s already exists" % self.__field
+
class DurabilityField(RadioField):
def __init__(self, app, name, form):
super(DurabilityField, self).__init__(app, name, form)
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2008-03-26 15:28:34 UTC (rev 1796)
+++ mgmt/cumin/python/wooly/__init__.py 2008-03-26 16:51:38 UTC (rev 1797)
@@ -115,6 +115,10 @@
if cls is Widget:
break
+ def init(self):
+ for child in self.children:
+ child.init()
+
def ancestors(self):
if self.__ancestors is None:
if self.parent is None:
@@ -403,6 +407,8 @@
self.pages[page.name] = page
+ page.init()
+
def get_page(self, name):
#print "Looking for", name, "in", self.pages
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2008-03-26 15:28:34 UTC (rev 1796)
+++ mgmt/mint/python/mint/__init__.py 2008-03-26 16:51:38 UTC (rev 1797)
@@ -67,7 +67,7 @@
class sqlmeta:
lazyUpdate = True
- name = StringCol(length=1000, default=None)
+ name = StringCol(length=1000, default=None, unique=True, notNone=True)
brokers = SQLRelatedJoin("BrokerRegistration",
intermediateTable="broker_group_mapping",
createRelatedTable=False)
Modified: mgmt/mint/sql/schema.sql
===================================================================
--- mgmt/mint/sql/schema.sql 2008-03-26 15:28:34 UTC (rev 1796)
+++ mgmt/mint/sql/schema.sql 2008-03-26 16:51:38 UTC (rev 1797)
@@ -5,7 +5,7 @@
CREATE TABLE broker_group (
id SERIAL PRIMARY KEY,
- name VARCHAR(1000)
+ name VARCHAR(1000) NOT NULL UNIQUE
);
CREATE TABLE broker_group_mapping (
16 years, 9 months
rhmessaging commits: r1796 - in mgmt: cumin-test-0/etc and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-03-26 11:28:34 -0400 (Wed, 26 Mar 2008)
New Revision: 1796
Modified:
mgmt/cumin-test-0/etc/cumin.conf
mgmt/cumin/bin/cumin
Log:
The new default port for cumin is 45672, to reflect its amqp heritage.
Don't set the port in the devel instance config file.
Modified: mgmt/cumin/bin/cumin
===================================================================
--- mgmt/cumin/bin/cumin 2008-03-25 20:23:42 UTC (rev 1795)
+++ mgmt/cumin/bin/cumin 2008-03-26 15:28:34 UTC (rev 1796)
@@ -53,7 +53,7 @@
config.add_param("addr", str, "localhost", summ)
summ = ("PORT", "Run web server on port PORT")
- config.add_param("port", int, 8080, summ)
+ config.add_param("port", int, 45672, summ)
summ = "Serve web pages using SSL"
config.add_param("ssl", bool, False, summ)
Modified: mgmt/cumin-test-0/etc/cumin.conf
===================================================================
--- mgmt/cumin-test-0/etc/cumin.conf 2008-03-25 20:23:42 UTC (rev 1795)
+++ mgmt/cumin-test-0/etc/cumin.conf 2008-03-26 15:28:34 UTC (rev 1796)
@@ -1,3 +1,2 @@
[main]
-port: 9090
debug: True
16 years, 9 months