in pyignite/queries/response.py [0:0]
def __parse_header(self, stream):
init_pos = stream.tell()
if self.protocol_context.is_status_flags_supported():
header_class = StatusFlagResponseHeader
else:
header_class = ResponseHeader
header_len = ctypes.sizeof(header_class)
header = stream.read_ctype(header_class)
stream.seek(header_len, SEEK_CUR)
fields = []
has_error = False
if self.protocol_context.is_status_flags_supported():
if header.flags & RHF_TOPOLOGY_CHANGED:
fields = [
('affinity_version', ctypes.c_longlong),
('affinity_minor', ctypes.c_int),
]
if header.flags & RHF_ERROR:
fields.append(('status_code', ctypes.c_int))
has_error = True
else:
has_error = header.status_code != OP_SUCCESS
if fields:
stream.seek(sum(ctypes.sizeof(c_type) for _, c_type in fields), SEEK_CUR)
if has_error:
msg_type = String.parse(stream)
fields.append(('error_message', msg_type))
return not has_error, init_pos, header_class, fields