Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Member Functions
MoinMoin.search.builtin.IndexerQueue Class Reference

Search Engine Abstraction. More...

List of all members.

Public Member Functions

def __init__
def get_cache
def put
def get

Public Attributes

 request
 xapian_dir
 queuename
 timeout

Private Member Functions

def _queue

Detailed Description

Search Engine Abstraction.

Represents a locked on-disk queue with jobs for the xapian indexer

Each job is a tuple like: (PAGENAME, ATTACHMENTNAME, REVNO)
PAGENAME: page name (unicode)
ATTACHMENTNAME: attachment name (unicode) or None (for pages)
REVNO: revision number (int) - meaning "look at that revision",
       or None - meaning "look at all revisions"

Definition at line 27 of file builtin.py.


Constructor & Destructor Documentation

def MoinMoin.search.builtin.IndexerQueue.__init__ (   self,
  request,
  xapian_dir,
  queuename,
  timeout = 10.0 
)
@param request: request object
@param xapian_dir: the xapian main directory
@param queuename: name of the queue (used for caching key)
@param timeout: lock acquire timeout

Definition at line 38 of file builtin.py.

00038 
00039     def __init__(self, request, xapian_dir, queuename, timeout=10.0):
00040         """
00041         @param request: request object
00042         @param xapian_dir: the xapian main directory
00043         @param queuename: name of the queue (used for caching key)
00044         @param timeout: lock acquire timeout
00045         """
00046         self.request = request
00047         self.xapian_dir = xapian_dir
00048         self.queuename = queuename
00049         self.timeout = timeout


Member Function Documentation

def MoinMoin.search.builtin.IndexerQueue._queue (   self,
  cache 
) [private]

Definition at line 54 of file builtin.py.

00054 
00055     def _queue(self, cache):
00056         try:
00057             queue = cache.content()
00058         except caching.CacheError:
00059             # likely nothing there yet
00060             queue = []
00061         return queue

Here is the caller graph for this function:

Get (and remove) first entry from the queue

Raises IndexError if queue was empty when calling get().

Definition at line 79 of file builtin.py.

00079 
00080     def get(self):
00081         """ Get (and remove) first entry from the queue
00082 
00083         Raises IndexError if queue was empty when calling get().
00084         """
00085         cache = self.get_cache(locking=False) # we lock manually
00086         cache.lock('w', 60.0)
00087         try:
00088             queue = self._queue(cache)
00089             entry = queue.pop(0)
00090             cache.update(queue)
00091         finally:
00092             cache.unlock()
00093         return entry
00094 

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.search.builtin.IndexerQueue.get_cache (   self,
  locking 
)

Definition at line 50 of file builtin.py.

00050 
00051     def get_cache(self, locking):
00052         return caching.CacheEntry(self.request, self.xapian_dir, self.queuename,
00053                                   scope='dir', use_pickle=True, do_locking=locking)

Here is the caller graph for this function:

def MoinMoin.search.builtin.IndexerQueue.put (   self,
  pagename,
  attachmentname = None,
  revno = None 
)
Put an entry into the queue (append at end)

@param pagename: page name [unicode]
@param attachmentname: attachment name [unicode]
@param revno: revision number (int) or None (all revs)

Definition at line 62 of file builtin.py.

00062 
00063     def put(self, pagename, attachmentname=None, revno=None):
00064         """ Put an entry into the queue (append at end)
00065 
00066         @param pagename: page name [unicode]
00067         @param attachmentname: attachment name [unicode]
00068         @param revno: revision number (int) or None (all revs)
00069         """
00070         cache = self.get_cache(locking=False) # we lock manually
00071         cache.lock('w', 60.0)
00072         try:
00073             queue = self._queue(cache)
00074             entry = (pagename, attachmentname, revno)
00075             queue.append(entry)
00076             cache.update(queue)
00077         finally:
00078             cache.unlock()

Here is the call graph for this function:


Member Data Documentation

Definition at line 47 of file builtin.py.

Definition at line 45 of file builtin.py.

Definition at line 48 of file builtin.py.

Definition at line 46 of file builtin.py.


The documentation for this class was generated from the following file: