@Override
  public int storeRecord(@NotNull ByteArraySequence bytes) throws IOException {
    byte[] cryptoHash = PersistentFSContentAccessor.calculateHash(bytes);
    int hash = hashCodeOf(cryptoHash);
    ByteBuffer cryptoHashWrapped = ByteBuffer.wrap(cryptoHash);
    try {
      return hashToContentRecordIdMap.lookupOrInsert(
        hash,
        recordId -> {
          long storageId = contentIdToStorageId(recordId);
          Boolean recordHasSameCryptoHash = contentStorage.read(storageId, buffer -> {
            ByteBuffer cryptoHashSlice = buffer.slice(0, CONTENT_HASH_LENGTH);
            return cryptoHashSlice.equals(cryptoHashWrapped);
          });

          if (recordHasSameCryptoHash) {
            recordsDeduplicated.incrementAndGet();
          }

          return recordHasSameCryptoHash;
        },
        _hash -> {
          ByteArraySequence bytesToStore;
          int uncompressedSize;
          if (compressingAlgo.shouldCompress(bytes)) {
            //Since returned ByteArraySequence may wrap _reusable_ buffer => bytesToStore must NOT be used outside of this method
            bytesToStore = compressingAlgo.compress(bytes, /* mayReturnReusableBuffer: */ true);
            uncompressedSize = -bytes.length();//sign bit indicates 'compressed data'

            recordsStoredCompressed.incrementAndGet();
          }
          else {
            bytesToStore = bytes;
            uncompressedSize = bytes.length();
          }

          recordsStored.incrementAndGet();
          recordsUncompressedSize.addAndGet(bytes.length());
          recordsStoredSize.addAndGet(bytesToStore.length());


          //record: cryptoHash[CONTENT_HASH_LENGTH], uncompressedSize(int32), contentBytes[...]
          //  uncompressedSize >= 0 => not compressed data, size=uncompressedSize
          //  uncompressedSize < 0  => compressed data, uncompressed size = -uncompressedSize
          int totalSize = cryptoHash.length + Integer.BYTES + bytesToStore.length();

          long storageId = contentStorage.append(
            buffer -> buffer.put(cryptoHash)
              .putInt(uncompressedSize)
              .put(bytesToStore.getInternalBuffer(), bytesToStore.getOffset(), bytesToStore.length()),
            totalSize
          );
          return storageIdToContentId(storageId);
        }
      );
    }
    catch (IOException | IllegalArgumentException e) {
      //just add more diagnostic info
      e.addSuppressed(new IOException(
        "content[" + bytes.length() + "b], cryptoHash[" + IOUtil.toHexString(cryptoHash) + "], hash(=" + hash + ")"
      ));
      throw e;
    }
  }
@Override
  public int storeRecord(@NotNull ByteArraySequence bytes)