Exemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     """
     This class is a 'GEvent'-optimized subclass of libcouchbase
     which utilizes the underlying IOPS structures and the gevent
     event primitives to efficiently utilize couroutine switching.
     """
     experimental.enabled_or_raise()
     super(GConnection, self).__init__(IOPS(), *args, **kwargs)
Exemplo n.º 2
0
    def __init__(self, **kwargs):
        """
        Connection subclass for Twisted. This inherits from the 'Async' class,
        but also adds some twisted-specific logic for hooking on a connection.
        """

        experimental.enabled_or_raise()

        iops = v0Iops(reactor)
        super(TxAsyncConnection, self).__init__(iops=iops, **kwargs)

        self._evq = {"connect": ConnectionEventQueue(), "_dtor": TxEventQueue()}

        self._conncb = self._evq["connect"]
        self._dtorcb = self._evq["_dtor"]
Exemplo n.º 3
0
try:
    import asyncio
except ImportError:
    import trollius as asyncio

from acouchbase.asyncio_iops import IOPS
from acouchbase.iterator import AView, AN1QLRequest
from couchbase. async .bucket import AsyncBucket
from couchbase.experimental import enabled_or_raise
enabled_or_raise()


class Bucket(AsyncBucket):
    def __init__(self, *args, **kwargs):
        loop = asyncio.get_event_loop()
        super(Bucket, self).__init__(IOPS(loop), *args, **kwargs)
        self._loop = loop

        cft = asyncio.Future(loop=loop)

        def ftresult(err):
            if err:
                cft.set_exception(err)
            else:
                cft.set_result(True)

        self._cft = cft
        self._conncb = ftresult

    def _meth_factory(meth, name):
        def ret(self, *args, **kwargs):
Exemplo n.º 4
0
try:
    import asyncio
except ImportError:
    import trollius as asyncio

from acouchbase.asyncio_iops import IOPS
from couchbase.async.bucket import AsyncBucket
from couchbase.experimental import enabled_or_raise; enabled_or_raise()


class Bucket(AsyncBucket):
    def __init__(self, *args, **kwargs):
        loop = asyncio.get_event_loop()
        super(Bucket, self).__init__(IOPS(loop), *args, **kwargs)
        self._loop = loop

        cft = asyncio.Future(loop=loop)
        def ftresult(err):
            if err:
                cft.set_exception(err)
            else:
                cft.set_result(True)

        self._cft = cft
        self._conncb = ftresult

    def _meth_factory(meth, name):
        def ret(self, *args, **kwargs):
            rv = meth(self, *args, **kwargs)
            ft = asyncio.Future()
            def on_ok(res):