Interface AsyncKeyedStateBackend<K>

    • Method Detail

      • setup

        void setup​(@Nonnull
                   StateRequestHandler stateRequestHandler)
        Initializes with some contexts.
        Parameters:
        stateRequestHandler - which handles state request.
      • createState

        @Nonnull
        <N,​S extends State,​SV> S createState​(@Nonnull
                                                         N defaultNamespace,
                                                         @Nonnull
                                                         TypeSerializer<N> namespaceSerializer,
                                                         @Nonnull
                                                         StateDescriptor<SV> stateDesc)
                                                  throws Exception
        Creates and returns a new state.
        Type Parameters:
        N - the type of namespace for partitioning.
        S - The type of the public API state.
        SV - The type of the stored state value.
        Parameters:
        defaultNamespace - the default namespace for this state.
        namespaceSerializer - the serializer for namespace.
        stateDesc - The StateDescriptor that contains the name of the state.
        Throws:
        Exception - Exceptions may occur during initialization of the state.
      • createStateExecutor

        @Nonnull
        StateExecutor createStateExecutor()
        Creates a StateExecutor which supports to execute a batch of state requests asynchronously.

        Notice that the AsyncKeyedStateBackend is responsible for shutting down the StateExecutors created by itself when they are no longer in use.

        Returns:
        a StateExecutor which supports to execute a batch of state requests asynchronously.
      • dispose

        void dispose()
        Description copied from interface: Disposable
        Disposes the object and releases all resources. After calling this method, calling any methods on the object may result in undefined behavior.
        Specified by:
        dispose in interface Disposable