static IndexValue getIndexValue(long size, Offset offset, byte flags, long expiresAtMs, long originalMessageOffset,
      long operationTimeMs, short accountId, short containerId, short lifeVersion, short persistentIndexVersion) {
    IndexValue indexValue;
    switch (persistentIndexVersion) {
      case PersistentIndex.VERSION_0:
        ByteBuffer value = ByteBuffer.allocate(IndexValue.INDEX_VALUE_SIZE_IN_BYTES_V0);
        value.putLong(size);
        value.putLong(offset.getOffset());
        value.put(flags);
        value.putLong(expiresAtMs);
        value.putLong(originalMessageOffset);
        value.position(0);
        indexValue = new IndexValue(offset.getName(), value, PersistentIndex.VERSION_0);
        break;
      case PersistentIndex.VERSION_1:
      case PersistentIndex.VERSION_2:
        value = ByteBuffer.allocate(IndexValue.INDEX_VALUE_SIZE_IN_BYTES_V1_V2);
        value.putLong(size);
        value.putLong(offset.getOffset());
        value.put(flags);
        value.putInt(expiresAtMs != Utils.Infinite_Time ? (int) (expiresAtMs / Time.MsPerSec) : (int) expiresAtMs);
        value.putLong(originalMessageOffset);
        value.putInt(
            operationTimeMs != Utils.Infinite_Time ? (int) (operationTimeMs / Time.MsPerSec) : (int) operationTimeMs);
        value.putShort(accountId);
        value.putShort(containerId);
        value.position(0);
        indexValue = new IndexValue(offset.getName(), value, persistentIndexVersion);
        break;
      case PersistentIndex.VERSION_3:
      case PersistentIndex.VERSION_4:
        value = ByteBuffer.allocate(IndexValue.INDEX_VALUE_SIZE_IN_BYTES_V3_V4);
        value.putLong(size);
        value.putLong(offset.getOffset());
        value.put(flags);
        value.putInt(expiresAtMs != Utils.Infinite_Time ? (int) (expiresAtMs / Time.MsPerSec) : (int) expiresAtMs);
        value.putLong(originalMessageOffset);
        value.putInt(
            operationTimeMs != Utils.Infinite_Time ? (int) (operationTimeMs / Time.MsPerSec) : (int) operationTimeMs);
        value.putShort(accountId);
        value.putShort(containerId);
        value.putShort(lifeVersion);
        value.position(0);
        indexValue = new IndexValue(offset.getName(), value, persistentIndexVersion);
        break;
      default:
        throw new IllegalArgumentException("Unrecognized version: " + persistentIndexVersion);
    }
    return indexValue;
  }
Constructs IndexValue based on the args passed in version {@link PersistentIndex#VERSION_0}
@param size the size of the blob that this index value refers to
@param offset the {@link Offset} in the {@link Log} where the blob that this index value refers to resides
@param expiresAtMs the expiration time in ms at which the blob expires
@param originalMessageOffset the original message offset
@param operationTimeMs the time of the operation in ms (irrelevant to V0)
@param accountId the account that the blob represented by this value belongs to (irrelevant to V0)
@param containerId the container that the blob represented by this value belongs to (irrelevant to V0)
@param lifeVersion the update version of the Index value
@return the {@link IndexValue} thus constructed
ambry-store/src/test/java/com/github/ambry/store/IndexValueTest.java