Example #1
0
 def __init__(self, name=None):
     self.name = name or str(uuid4())
     self.mongo_handler = MongoHandler(MONGOR,
                                       cursor_timeout=TIMEOUT,
                                       fluentd=FLUENT,
                                       logtag=LOGTAG)
     self.cursors = set()
Example #2
0
 def __init__(self, name=None):
     self.name = name or str(uuid4())
     self.mongo_handler = MongoHandler(MONGOR, 
                          cursor_timeout = TIMEOUT,
                          fluentd = FLUENT,
                          logtag = LOGTAG)
     self.cursors = set()
Example #3
0
class MongooseHandler:
    def __init__(self, name=None):
        self.name = name or str(uuid4())
        self.mongo_handler = MongoHandler(MONGOR, 
                             cursor_timeout = TIMEOUT,
                             fluentd = FLUENT,
                             logtag = LOGTAG)
        self.cursors = set()
        
    def close(self):
        return
        
    def handle_request(self, args, func_name, db_type, collection):
        response_content = StringIO()
        out = response_content.write
        func = getattr(self.mongo_handler, func_name, None)
        LOGGER.debug({"debug":"sending to %s" %(func_name)})
        if callable(func):
            func(args, out, 
                 name = "", #TODO: remove this, around since sleepy.mongoose
                 db = db_type, 
                 collection = collection)
        else:
            out('{"ok" : 0, "errmsg" : "%s not callable"}' %(func_name))
        current_cursors = set(self.mongo_handler.available_cursors())
        return response_content.getvalue(), current_cursors
Example #4
0
class MongooseHandler:
    def __init__(self, name=None):
        self.name = name or str(uuid4())
        self.mongo_handler = MongoHandler(MONGOR,
                                          cursor_timeout=TIMEOUT,
                                          fluentd=FLUENT,
                                          logtag=LOGTAG)
        self.cursors = set()

    def close(self):
        return

    def handle_request(self, args, func_name, db_type, collection):
        response_content = StringIO()
        out = response_content.write
        func = getattr(self.mongo_handler, func_name, None)
        LOGGER.debug({"debug": "sending to %s" % (func_name)})
        if callable(func):
            func(
                args,
                out,
                name="",  #TODO: remove this, around since sleepy.mongoose
                db=db_type,
                collection=collection)
        else:
            out('{"ok" : 0, "errmsg" : "%s not callable"}' % (func_name))
        current_cursors = set(self.mongo_handler.available_cursors())
        return response_content.getvalue(), current_cursors