Esempio n. 1
0
    def delete(self, robj, rw=None, r=None, w=None, dw=None, pr=None, pw=None,
               timeout=None):
        """
        Serialize get request and deserialize response
        """
        bucket = robj.bucket

        req = riak_pb.RpbDelReq()
        if rw:
            req.rw = self._encode_quorum(rw)
        if r:
            req.r = self._encode_quorum(r)
        if w:
            req.w = self._encode_quorum(w)
        if dw:
            req.dw = self._encode_quorum(dw)

        if self.quorum_controls():
            if pr:
                req.pr = self._encode_quorum(pr)
            if pw:
                req.pw = self._encode_quorum(pw)

        if self.client_timeouts() and timeout:
            req.timeout = timeout

        if self.tombstone_vclocks() and robj.vclock:
            req.vclock = robj.vclock.encode('binary')

        req.bucket = bucket.name
        req.key = robj.key

        msg_code, resp = self._request(MSG_CODE_DEL_REQ, req,
                                       MSG_CODE_DEL_RESP)
        return self
Esempio n. 2
0
    def delete(self, robj, rw=None, r=None, w=None, dw=None, pr=None, pw=None):
        """
        Serialize get request and deserialize response
        """
        bucket = robj.bucket

        req = riak_pb.RpbDelReq()
        if rw:
            req.rw = self.translate_rw_val(rw)
        if r:
            req.r = self.translate_rw_val(r)
        if w:
            req.w = self.translate_rw_val(w)
        if dw:
            req.dw = self.translate_rw_val(dw)

        if self.quorum_controls():
            if pr:
                req.pr = self.translate_rw_val(pr)
            if pw:
                req.pw = self.translate_rw_val(pw)

        if self.tombstone_vclocks() and robj.vclock:
            req.vclock = robj.vclock

        req.bucket = bucket.name
        req.key = robj.key

        msg_code, resp = self._request(MSG_CODE_DEL_REQ, req,
                                       MSG_CODE_DEL_RESP)
        return self
Esempio n. 3
0
    def delete(self, robj, rw=None, r=None, w=None, dw=None, pr=None, pw=None):
        """
        Serialize get request and deserialize response
        """
        bucket = robj.get_bucket()

        req = riak_pb.RpbDelReq()
        req.rw = self.translate_rw_val(rw)
        req.r = self.translate_rw_val(r)
        req.w = self.translate_rw_val(w)
        req.dw = self.translate_rw_val(dw)

        if self.quorum_controls():
            req.pr = self.translate_rw_val(pr)
            req.pw = self.translate_rw_val(pw)

        if self.tombstone_vclocks() and robj.vclock():
            req.vclock = robj.vclock()

        req.bucket = bucket.get_name()
        req.key = robj.get_key()

        msg_code, resp = self.send_msg(MSG_CODE_DEL_REQ, req,
                                       MSG_CODE_DEL_RESP)
        return self
Esempio n. 4
0
    async def delete(self, robj):
        req = riak_pb.RpbDelReq()

        use_vclocks = (hasattr(robj, 'vclock') and robj.vclock)
        if use_vclocks:
            req.vclock = robj.vclock.encode('binary')

        bucket = robj.bucket
        req.bucket = str_to_bytes(bucket.name)
        self._add_bucket_type(req, bucket.bucket_type)
        req.key = str_to_bytes(robj.key)

        msg_code, resp = await self._request(messages.MSG_CODE_DEL_REQ, req,
                                             messages.MSG_CODE_DEL_RESP)
        return self
    def delete(self,
               robj,
               rw=None,
               r=None,
               w=None,
               dw=None,
               pr=None,
               pw=None,
               timeout=None):
        req = riak_pb.RpbDelReq()
        if rw:
            req.rw = self._encode_quorum(rw)
        if r:
            req.r = self._encode_quorum(r)
        if w:
            req.w = self._encode_quorum(w)
        if dw:
            req.dw = self._encode_quorum(dw)

        if self.quorum_controls():
            if pr:
                req.pr = self._encode_quorum(pr)
            if pw:
                req.pw = self._encode_quorum(pw)

        if self.client_timeouts() and timeout:
            req.timeout = timeout

        use_vclocks = (self.tombstone_vclocks() and hasattr(robj, 'vclock')
                       and robj.vclock)
        if use_vclocks:
            req.vclock = robj.vclock.encode('binary')

        bucket = robj.bucket
        req.bucket = str_to_bytes(bucket.name)
        self._add_bucket_type(req, bucket.bucket_type)
        req.key = str_to_bytes(robj.key)

        msg_code, resp = self._request(MSG_CODE_DEL_REQ, req,
                                       MSG_CODE_DEL_RESP)
        return self