@Override
  public void serialize(OutputStream stream) throws IOException {
    lock.readLock().lock();
    try {
      ProgressIndexType.STATE_PROGRESS_INDEX.serialize(stream);

      ReadWriteIOUtils.write(version, stream);

      ReadWriteIOUtils.write(state.size(), stream);
      for (final Map.Entry<String, Binary> entry : state.entrySet()) {
        ReadWriteIOUtils.write(entry.getKey(), stream);
        ReadWriteIOUtils.write(entry.getValue(), stream);
      }

      innerProgressIndex.serialize(stream);
    } finally {
      lock.readLock().unlock();
    }
  }
NOTE: Currently, {@link StateProgressIndex} does not perform deep copies of the {@link Binary}
during construction or when exposed through accessors, which may lead to unintended shared state
or modifications. This behavior should be reviewed and adjusted as necessary to ensure the
integrity and independence of the progress index instances.
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/consensus/index/impl/StateProgressIndex.java