def parse(buf)
      n, count = 0, 0
      while n < buf.size
        key_size, value_size = buf[n, 8].unpack('NN')
        data_size = key_size + 8
        data_size += value_size if value_size != DELETE
        data = buf[n, data_size]
        n += data_size
        raise 'CRC mismatch: your data might be corrupted!' unless buf[n, 4] == crc32(data)
        n += 4
        yield(value_size == DELETE ? [data[8, key_size]] : [data[8, key_size], data[8 + key_size, value_size]])
        count += 1
      end
      count
    end
def parse(buf)
      n, count = 0, 0
      while n < buf.size
        key_size, value_size = buf[n, 8].unpack('NN')
        data_size = key_size + 8
        data_size += value_size if value_size != DELETE
        data = buf[n, data_size]
        n += data_size
        raise 'CRC mismatch: your data might be corrupted!' unless buf[n, 4] == crc32(data)
        n += 4
        yield(value_size == DELETE ? [data[8, key_size]] : [data[8, key_size], data[8 + key_size, value_size]])
        count += 1
      end
      count
    end
Deserialize records from buffer, and yield them.
 @param [String] buf the buffer to read from
 @yield [Array] blk deserialized record [key, value] or [key] if the record is deleted
 @return [Fixnum] number of records