Esempio n. 1
0
 def _get_resp(self, ret_prev):
   # header = self._read_bytes(HEADER_RES_LEN)
   # magic, msg_id, op, st, topo_mark = struct.unpack(HEADER_RES_FMT, header)
   # msg_id is vlong
   magic = struct.unpack('>B',  self._read_bytes(1))[0]
   msg_id = from_varint(self.s)
   op,st,topo_mark = struct.unpack('>BBB',  self._read_bytes(3))
   assert (magic == MAGIC[1]), "Got magic: %d" % magic
   return RECV[op](self, st, ret_prev)
Esempio n. 2
0
 def _read_bounded_map(self):
   map = {}
   for i in range(0, from_varint(self.s)):
     key = self._read_ranged_bytes()
     map[key] = self._read_ranged_bytes()
   return map
Esempio n. 3
0
 def _read_ranged_bytes(self):
   return self._read_bytes(from_varint(self.s))