function processBytesToWrite(apiMethod, bucket, versionId, contentLength, objMD, destObjMD = null) {
    // Get the size of "hot" data. Object being restored are _considered_ hot, as we "reserve" the
    // space for them as soon as restore is requested: therefore we must 'free' it immediately on
    // delete as well.
    const isCold = objMD => objMD.archive && !objMD.archive.restoreRequestedAt;
    const getHotContentLength = objMD => {
        if (isCold(objMD)) {
            return 0;
        }
        return Number.parseInt(objMD['content-length'], 10);
    };

    let bytes = contentLength;
    if (apiMethod === 'objectRestore') {
        // object is being restored
        bytes = Number.parseInt(objMD['content-length'], 10);
    } else if (!bytes && objMD?.['content-length']) {
        if (apiMethod === 'objectCopy' || apiMethod === 'objectPutCopyPart') {
            // object is being copied, increases the storage...
            bytes = Number.parseInt(objMD['content-length'], 10);

            if (destObjMD && !bucket.isVersioningEnabled()) {
                // but it also replaces the target, which decreases storage
                bytes -= getHotContentLength(destObjMD);
            }
        } else if (!bucket.isVersioningEnabled() || bucket.isVersioningEnabled() && versionId) {
            // object is being deleted (non versioned) or hard-deleted (versioned, as indicated by
            // the `versionId` field)
            bytes = -getHotContentLength(objMD);
        }
    } else if (bytes && objMD?.['content-length'] && !bucket.isVersioningEnabled()) {
        // object is being replaced: store the diff, if the bucket is not versioned
        bytes = bytes - getHotContentLength(objMD);
    }
    return bytes || 0;
}
Process the bytes to write based on the request and object metadata
@param {string} apiMethod - api method
@param {BucketInfo} bucket - bucket info
@param {string} versionId - version id of the object
@param {number} contentLength - content length of the object
@param {object} objMD - object metadata
@param {object} destObjMD - destination object metadata
@return {number} processed content length