def _observe_callback(self, instance, cookie, err, resp):
        # Special handling needed here, as this is a multi operation
        if not resp.v.v0.key:
            return #NULL

        res = self._get_response(resp, err, ValueResult)
        if not res:
            # Error
            return

        obs_l = res.value
        if obs_l is None:
            res.value = []
            obs_l = res.value

        obs_info = ObserveInfo()
        obs_info.cas = resp.v.v0.cas
        obs_info.flags = resp.v.v0.status
        obs_info.from_master = bool(resp.v.v0.from_master)
        obs_l.append(obs_info)
예제 #2
0
    def _observe_callback(self, instance, cbtype, resp):
        resp = ffi.cast('lcb_RESPOBSERVE*', resp)
        if resp.rflags & C.LCB_RESP_F_FINAL:
            mres = ffi.from_handle(resp.cookie)
            self._chk_op_done(mres)
            return

        rc = resp.rc
        result, mres = self._callback_common(instance, cbtype, resp)

        if rc:
            if not result.rc:
                result.rc = rc
            return

        oi = ObserveInfo()
        oi.cas = resp.cas
        oi.flags = resp.status
        oi.from_master = resp.ismaster
        result.value.append(oi)