@Override
  public int compareTo(StoreKey o) {
    if (this == o) {
      return 0;
    }
    BlobId other = (BlobId) o;
    int result = Short.compare(getVersionComparisonGroup(), other.getVersionComparisonGroup());
    if (result == 0) {
      switch (version) {
        case BLOB_ID_V1:
          result = partitionId.compareTo(other.partitionId);
          if (result == 0) {
            result = uuidStr.compareTo(other.uuidStr);
          }
          break;
        case BLOB_ID_V2:
          result = type.compareTo(other.type);
          if (result == 0) {
            result = Byte.compare(datacenterId, other.datacenterId);
            if (result == 0) {
              result = Short.compare(accountId, other.accountId);
              if (result == 0) {
                result = Short.compare(containerId, other.containerId);
                if (result == 0) {
                  result = partitionId.compareTo(other.partitionId);
                  if (result == 0) {
                    result = uuidStr.compareTo(other.uuidStr);
                  }
                }
              }
            }
          }
          break;
        case BLOB_ID_V3:
        case BLOB_ID_V4:
        case BLOB_ID_V5:
          result = uuidStr.compareTo(other.uuidStr);
          break;
        case BLOB_ID_V6:
          result = uuid.compareTo(other.uuid);
          break;
        default:
          throw new IllegalArgumentException("Unrecognized blobId version " + version);
      }
    }
    return result;
  }
Compare two BlobIds.
<br>
<br>
Starting with V3, only UUIDs will be used for comparison. UUID is the component ensuring uniqueness of
different blob ids. Rest of the information embedded in the BlobId is really the associated "metadata"
and is not meant for distinguishing blobs.
<br>
@param o the StoreKey to compare with.
@return 0 if this key is equal to the given key; a value less than 0 if this key is less than the given key;
        and a value greater than 0 if this key is greater than the given key.
ambry-commons/src/main/java/com/github/ambry/commons/BlobId.java