Class InboundCompression<T>

  • Direct Known Subclasses:
    InboundActorRefCompression, InboundManifestCompression

    public abstract class InboundCompression<T>
    extends java.lang.Object
    INTERNAL API Handles counting and detecting of heavy-hitters and compressing them via a table lookup.

    Access to this class must be externally synchronised (e.g. by accessing it from only Actors or a GraphStage etc).

    • Method Detail

      • KeepOldTablesNumber

        public static final int KeepOldTablesNumber()
      • originUid

        public long originUid()
      • decompress

        public abstract OptionVal<T> decompress​(byte incomingTableVersion,
                                                int idx)
        Override and specialize if needed, for default compression logic delegate to 3-param overload
      • decompressInternal

        public final OptionVal<T> decompressInternal​(byte incomingTableVersion,
                                                     int idx,
                                                     int attemptCounter)
        Decompress given identifier into its original representation. Passed in tableIds must only ever be in not-decreasing order (as old tables are dropped), tableIds must not have gaps. If an "old" tableId is received the value will fail to be decompressed.

        UnknownCompressedIdException - if given id is not known, this may indicate a bug – such situation should not happen.
      • confirmAdvertisement

        public final void confirmAdvertisement​(byte tableVersion,
                                               boolean gaveUp)
      • increment

        public void increment​(Address remoteAddress,
                              T value,
                              long n)
        Add n occurrence for the given key and call heavyHittedDetected if element has become a heavy hitter. Empty keys are omitted.
      • runNextTableAdvertisement

        public void runNextTableAdvertisement()
        Entry point to advertising a new compression table.

        [1] First we must *hand the new table over to the Incoming compression side on this system*, so it will not be used by someone else before "we" know about it in the Decoder. [2] Then the table must be *advertised to the remote system*, and MAY start using it immediately

        It must be advertised to the other side so it can start using it in its outgoing compression. Triggers compression table advertisement. May be triggered by schedule or manually, i.e. for testing.

      • advertiseCompressionTable

        protected abstract void advertiseCompressionTable​(OutboundContext association,
                                                          CompressionTable<T> table)
        Must be implemented by extending classes in order to send a ControlMessage of appropriate type to the remote system in order to advertise the compression table to it.
      • buildTableForAdvertisement

        protected scala.collection.immutable.Map<T,​java.lang.Object> buildTableForAdvertisement​(scala.collection.Iterator<T> elements)
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object