def internal_kv_del(self, key: bytes) -> int: req = gcs_service_pb2.InternalKVDelRequest(key=key) reply = self._kv_stub.InternalKVDel(req) if reply.status.code == GcsCode.OK: return reply.deleted_num else: raise RuntimeError(f"Failed to delete key {key} " f"due to error {reply.status.message}")
def internal_kv_del(self, key: bytes, namespace: Optional[str]) -> int: logger.debug(f"internal_kv_del {key} {namespace}") key = _make_key(namespace, key) req = gcs_service_pb2.InternalKVDelRequest(key=key) reply = self._kv_stub.InternalKVDel(req) if reply.status.code == GcsCode.OK: return reply.deleted_num else: raise RuntimeError(f"Failed to delete key {key} " f"due to error {reply.status.message}")
async def internal_kv_del( self, key: bytes, del_by_prefix: bool, namespace: Optional[bytes], timeout: Optional[float] = None, ) -> int: logger.debug(f"internal_kv_del {key!r} {del_by_prefix} {namespace!r}") req = gcs_service_pb2.InternalKVDelRequest(namespace=namespace, key=key, del_by_prefix=del_by_prefix) reply = await self._kv_stub.InternalKVDel(req, timeout=timeout) if reply.status.code == GcsCode.OK: return reply.deleted_num else: raise RuntimeError(f"Failed to delete key {key!r} " f"due to error {reply.status.message}")