code: @Override
    public void encode(OutputStream out, TransactionSnapshot snapshot) {
      BinaryEncoder encoder = new BinaryEncoder(out);
      try {
        encoder.writeLong(snapshot.getTimestamp());
        encoder.writeLong(snapshot.getReadPointer());
        encoder.writeLong(snapshot.getWritePointer());
        // supporting old versions of codecs
        encodeObsoleteAttributes(encoder);
        encodeInvalid(encoder, snapshot.getInvalid());
        encodeInProgress(encoder, snapshot.getInProgress());
        encodeChangeSets(encoder, snapshot.getCommittingChangeSets());
        encodeChangeSets(encoder, snapshot.getCommittedChangeSets());
  
      } catch (IOException e) {
        LOG.error("Unable to serialize transaction state: ", e);
        throw Throwables.propagate(e);
      }
    }
docs: --------- helpers to encode or decode the transaction state --------------