Class DecorationOnlyDeltaCompressor

  • All Implemented Interfaces:
    DeltaCompressor

    public class DecorationOnlyDeltaCompressor
    extends ExternalizableHelper
    implements DeltaCompressor
    DecorationOnlyDeltaCompressor is a DeltaCompressor which optimizes for "decoration-only" updates. A decoration-only update is a one where the intrinsic value does not change, but the "decorations" may. An example of such an update could be generated by the ReadWriteBackingMap after successful write-behind operations to indicate that the store has been completed. Updates to the intrinsic value are not optimized/compressed at all.

    While this compressor does not produce any compression/optimization in the general case, it allows for optimizing decoration changes while avoiding the need to "read" the old value when applying an actual intrinsic change. This could be used to defer/avoid unnecessary access to a potentially expensive backup map.

     DecorationOnlyBinaryDelta:
       DecorationDelta
       Value  // the new value in "whole" form (possibly decorated)
       null
    
     DecorationDelta:
       BIN_DECO_ONLY (decorated)    // apply the decorations to the old value
       BIN_DECO_ONLY (undecorated)  // undecorate the old value
     

    Since:
    Coherence 3.7.1
    Author:
    rhl 2011.08.09
    • Field Detail

      • BIN_DECO_ONLY

        protected static Binary BIN_DECO_ONLY
        A place-holder Binary value used by the compressor to indicate a decoration-only update.
    • Constructor Detail

      • DecorationOnlyDeltaCompressor

        public DecorationOnlyDeltaCompressor()
    • Method Detail

      • extractDelta

        public ReadBuffer extractDelta​(ReadBuffer bufOld,
                                       ReadBuffer bufNew)
        Compare an old value to a new value and generate a delta that represents the changes that must be made to the old value in order to transform it into the new value. The generated delta must be a ReadBuffer of non-zero length.

        If the old value is null, the generated delta must be a "replace", meaning that applying it to any value must produce the specified new value.

        Specified by:
        extractDelta in interface DeltaCompressor
        Parameters:
        bufOld - the old value
        bufNew - the new value; must not be null
        Returns:
        the changes that must be made to the old value in order to transform it into the new value, or null to indicate no change