Class MultimapUserState<K,​V>


  • public class MultimapUserState<K,​V>
    extends java.lang.Object
    An implementation of a multimap user state that utilizes the Beam Fn State API to fetch, clear and persist values.

    Calling asyncClose() schedules any required persistence changes. This object should no longer be used after it is closed.

    TODO: Move to an async persist model where persistence is signalled based upon cache memory pressure and its need to flush.

    • Constructor Summary

      Constructors 
      Constructor Description
      MultimapUserState​(Cache<?,​?> cache, BeamFnStateClient beamFnStateClient, java.lang.String instructionId, org.apache.beam.model.fnexecution.v1.BeamFnApi.StateKey stateKey, org.apache.beam.sdk.coders.Coder<K> mapKeyCoder, org.apache.beam.sdk.coders.Coder<V> valueCoder)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void asyncClose()  
      void clear()  
      org.apache.beam.sdk.fn.stream.PrefetchableIterable<V> get​(K key)  
      org.apache.beam.sdk.fn.stream.PrefetchableIterable<K> keys()  
      void put​(K key, V value)  
      void remove​(K key)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MultimapUserState

        public MultimapUserState​(Cache<?,​?> cache,
                                 BeamFnStateClient beamFnStateClient,
                                 java.lang.String instructionId,
                                 org.apache.beam.model.fnexecution.v1.BeamFnApi.StateKey stateKey,
                                 org.apache.beam.sdk.coders.Coder<K> mapKeyCoder,
                                 org.apache.beam.sdk.coders.Coder<V> valueCoder)
    • Method Detail

      • clear

        public void clear()
      • get

        public org.apache.beam.sdk.fn.stream.PrefetchableIterable<V> get​(K key)
      • keys

        public org.apache.beam.sdk.fn.stream.PrefetchableIterable<K> keys()
      • put

        public void put​(K key,
                        V value)
      • remove

        public void remove​(K key)
      • asyncClose

        public void asyncClose()
                        throws java.lang.Exception
        Throws:
        java.lang.Exception