def Main(): """ The main point of entry for the checker service. This will set up the DBUS and glib extensions, the gobject/glib main loop, and start the service. """ global log log = Log("rabbitvcs.services.checkerservice:main") log.debug("Checker: starting service: %s (%s)" % (OBJECT_PATH, os.getpid())) # We need this to for the client to be able to do asynchronous calls dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) # The following calls are required to make DBus thread-aware and therefore # support the ability run threads. gobject.threads_init() dbus.glib.threads_init() # This registers our service name with the bus session_bus = dbus.SessionBus() service_name = dbus.service.BusName(SERVICE, session_bus) mainloop = gobject.MainLoop() checker_service = StatusCheckerService(session_bus, mainloop) gobject.idle_add(sys.stdout.write, "Started status checker service\n") gobject.idle_add(sys.stdout.flush) mainloop.run() log.debug("Checker: ended service: %s (%s)" % (OBJECT_PATH, os.getpid()))
try: revision_index = self.revisions.index(status.revision) except ValueError, e: self.revisions.append(status.revision) revision_index = len(self.revisions) -1 self.cache[path] = ( content_index, metadata_index, revision_index, author_index, status.date ) except Exception, e: log.debug(e) def __getitem__(self, path): try: (content_index, metadata_index, revision_index, author_index, date) = self.cache[path] content = self.keys[content_index] metadata = self.keys[metadata_index] revision = self.revisions[revision_index] author = self.authors[author_index] return Status(path, content, metadata, revision=revision, author=author, date=date) except Exception, e: log.debug(e)