Class SharedBuffer<V>

  • Type Parameters:
    V - Type of the values

    public class SharedBuffer<V>
    extends Object
    A shared buffer implementation which stores values under according state. Additionally, the values can be versioned such that it is possible to retrieve their predecessor element in the buffer.

    The idea of the implementation is to have a buffer for incoming events with unique ids assigned to them. This way we do not need to deserialize events during processing and we store only one copy of the event.

    The entries in SharedBuffer are SharedBufferNode. The shared buffer node allows to store relations between different entries. A dewey versioning scheme allows to discriminate between different relations (e.g. preceding element).

    The implementation is strongly based on the paper "Efficient Pattern Matching over Event Streams".

    See Also:
    https://people.cs.umass.edu/~yanlei/publications/sase-sigmod08.pdf
    • Constructor Detail

      • SharedBuffer

        @VisibleForTesting
        public SharedBuffer​(org.apache.flink.api.common.state.KeyedStateStore stateStore,
                            org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer)
      • SharedBuffer

        public SharedBuffer​(org.apache.flink.api.common.state.KeyedStateStore stateStore,
                            org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer,
                            SharedBufferCacheConfig cacheConfig)
    • Method Detail

      • getAccessor

        public SharedBufferAccessor<V> getAccessor()
        Construct an accessor to deal with this sharedBuffer.
        Returns:
        an accessor to deal with this sharedBuffer.
      • isEmpty

        public boolean isEmpty()
                        throws Exception
        Checks if there is no elements in the buffer.
        Returns:
        true if there is no elements in the buffer
        Throws:
        Exception - Thrown if the system cannot access the state.
      • releaseCacheStatisticsTimer

        public void releaseCacheStatisticsTimer()
      • getEventsBufferCacheSize

        @VisibleForTesting
        public int getEventsBufferCacheSize()
      • getEventsBufferSize

        @VisibleForTesting
        public int getEventsBufferSize()
                                throws Exception
        Throws:
        Exception
      • getSharedBufferNodeSize

        @VisibleForTesting
        public int getSharedBufferNodeSize()
                                    throws Exception
        Throws:
        Exception
      • getSharedBufferNodeCacheSize

        @VisibleForTesting
        public int getSharedBufferNodeCacheSize()
                                         throws Exception
        Throws:
        Exception