Interface Gate<TWrite,​TRead>

  • All Superinterfaces:
    GateI<TWrite>, io.aether.utils.interfaces.ObjectFind, io.aether.utils.ToString
    All Known Implementing Classes:
    FGate.OutSideGate

    public interface Gate<TWrite,​TRead>
    extends GateI<TWrite>
    The Gate interface represents a bidirectional communication channel between nodes in a reactive stream. It provides methods for data transformation, filtering, buffering, and connecting to remote APIs. A Gate has two directions: - Upstream (write): For sending data to the connected node - Downstream (read): For receiving data from the connected node The interface supports various operations including: - Data transformation (map, mapAsync) - Buffering (buffer, bufferAutoFlush) - Filtering (filter) - Logging (log) - Connecting to APIs (toApi, toMethod) - Consumer/producer patterns (toConsumer, ofFunction)
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default Gate<TWrite,​TRead> buffer()
      Creates a buffered version of this gate.
      default Gate<TWrite,​TRead> bufferAutoFlush()  
      default Gate<TWrite,​TRead> distinctRead​(java.lang.String name)  
      default Gate<TWrite,​TRead> distinctWrite​(java.lang.String name)  
      default Gate<TWrite,​TRead> filter​(java.lang.String name, io.aether.utils.interfaces.APredicate<TRead> filterRead, io.aether.utils.interfaces.APredicate<TWrite> filterWrite)  
      default void insertBuffer()
      Inserts a buffer into the current gate connection if one doesn't already exist.
      Gate<TRead,​TWrite> link()
      Gets the linked gate on the other side of this connection.
      void link​(Gate<TRead,​TWrite> side)
      Links this gate to another gate instance.
      void link0​(Gate<TRead,​TWrite> g)
      Internal method for setting the link without notification.
      default void linkFGate​(FGate<TRead,​TWrite> side)
      Links this gate to another FGate instance.
      default Gate<TWrite,​TRead> log​(java.lang.String title, java.lang.String directLeft, java.lang.String directRight)  
      default Gate<TWrite,​TRead> log​(java.lang.String title, java.lang.String directLeft, java.lang.String directRight, io.aether.utils.interfaces.AConsumer<Value<TWrite>> directLeftFun, io.aether.utils.interfaces.AConsumer<Value<TRead>> directRightFun)  
      default <LT,​RT>
      Gate<LT,​RT>
      map​(io.aether.net.fastMeta.FastMetaType<LT> metaLt, io.aether.net.fastMeta.FastMetaType<RT> metaRt)
      Maps data types between the gate's current types and new types using MetaType information.
      default <TWrite2,​TRead2>
      Gate<TRead2,​TWrite2>
      map​(java.lang.String name, io.aether.utils.interfaces.AFunction<TRead,​TWrite2> f1, io.aether.utils.interfaces.AFunction<TRead2,​TWrite> f2)  
      default <TWrite2,​TRead2>
      Gate<TRead2,​TWrite2>
      mapAsync​(java.lang.String name, io.aether.utils.interfaces.AFunction<TRead,​io.aether.utils.futures.ARFuture<TWrite2>> f1, io.aether.utils.interfaces.AFunction<TRead2,​io.aether.utils.futures.ARFuture<TWrite>> f2)  
      default <TRead2> Gate<TRead2,​TRead> mapAsyncRead​(java.lang.String name, io.aether.utils.interfaces.AFunction<TRead2,​io.aether.utils.futures.ARFuture<TWrite>> f2)  
      default <TWrite2> Gate<TWrite,​TWrite2> mapAsyncWrite​(java.lang.String name, io.aether.utils.interfaces.AFunction<TRead,​io.aether.utils.futures.ARFuture<TWrite2>> f1)  
      default <TRead2> Gate<TRead2,​TRead> mapRead​(java.lang.String name, io.aether.utils.interfaces.AFunction<TRead2,​TWrite> f2)  
      default <TWrite2> Gate<TWrite,​TWrite2> mapWrite​(java.lang.String name, io.aether.utils.interfaces.AFunction<TRead,​TWrite2> f1)  
      default GateI<TWrite> ofBiConsumer​(java.lang.String name, io.aether.utils.interfaces.ABiConsumer<Value<TRead>,​GateI<TWrite>> consumer)  
      default GateI<TWrite> ofCollection​(java.lang.String name, java.util.Queue<TRead> q)  
      default GateI<TWrite> ofDataOut​(java.lang.String name, io.aether.utils.dataio.DataOut consumer)  
      default GateI<TWrite> ofFunction​(java.lang.String name, io.aether.utils.interfaces.AFunction<TRead,​TWrite> acceptor)  
      default GateI<TWrite> ofFuture​(java.lang.String name, io.aether.utils.futures.ARFuture<TRead> consumer)  
      default GateI<TWrite> ofSideTryFuture​(java.lang.String name, io.aether.utils.futures.ARFuture<TRead> consumer)  
      default GateI<TWrite> toAcceptor​(java.lang.String name, AcceptorI<TWrite,​TRead> g)  
      default GateI<TWrite> toConsumer​(java.lang.String name, io.aether.utils.interfaces.AConsumer<TRead> consumer)
      Links this gate to a consumer that will process the data received through this gate.
      default GateI<TWrite> toConsumerValue​(java.lang.String name, io.aether.utils.interfaces.AConsumer<Value<TRead>> consumer)  
      void unlink()
      Unlinks this gate from its connected peer.
      • Methods inherited from interface io.aether.utils.interfaces.ObjectFind

        find, find, getOwners
      • Methods inherited from interface io.aether.utils.ToString

        toString, toString2
    • Method Detail

      • map

        default <LT,​RT> Gate<LT,​RT> map​(io.aether.net.fastMeta.FastMetaType<LT> metaLt,
                                                    io.aether.net.fastMeta.FastMetaType<RT> metaRt)
        Maps data types between the gate's current types and new types using MetaType information. This is useful for serialization/deserialization scenarios.
        Type Parameters:
        LT - The new local type
        RT - The new remote type
        Parameters:
        metaLt - Metadata describing the local type
        metaRt - Metadata describing the remote type
        Returns:
        A new Gate with transformed data types
      • unlink

        void unlink()
        Unlinks this gate from its connected peer. After unlinking, the gate cannot send or receive data until reconnected.
      • link

        Gate<TRead,​TWrite> link()
        Gets the linked gate on the other side of this connection.
        Returns:
        The linked gate, or null if not connected
      • link0

        void link0​(Gate<TRead,​TWrite> g)
        Internal method for setting the link without notification.
        Parameters:
        g - The gate to link to
      • buffer

        default Gate<TWrite,​TRead> buffer()
        Creates a buffered version of this gate. The buffer will store incoming data when the downstream is not ready to process it.
        Returns:
        A new buffered Gate
      • insertBuffer

        default void insertBuffer()
        Inserts a buffer into the current gate connection if one doesn't already exist.
      • linkFGate

        default void linkFGate​(FGate<TRead,​TWrite> side)
        Links this gate to another FGate instance.
        Parameters:
        side - The FGate to link to
      • link

        void link​(Gate<TRead,​TWrite> side)
        Links this gate to another gate instance.
        Parameters:
        side - The gate to link to
      • mapWrite

        default <TWrite2> Gate<TWrite,​TWrite2> mapWrite​(java.lang.String name,
                                                              io.aether.utils.interfaces.AFunction<TRead,​TWrite2> f1)
      • mapRead

        default <TRead2> Gate<TRead2,​TRead> mapRead​(java.lang.String name,
                                                          io.aether.utils.interfaces.AFunction<TRead2,​TWrite> f2)
      • mapAsyncWrite

        default <TWrite2> Gate<TWrite,​TWrite2> mapAsyncWrite​(java.lang.String name,
                                                                   io.aether.utils.interfaces.AFunction<TRead,​io.aether.utils.futures.ARFuture<TWrite2>> f1)
      • mapAsyncRead

        default <TRead2> Gate<TRead2,​TRead> mapAsyncRead​(java.lang.String name,
                                                               io.aether.utils.interfaces.AFunction<TRead2,​io.aether.utils.futures.ARFuture<TWrite>> f2)
      • mapAsync

        default <TWrite2,​TRead2> Gate<TRead2,​TWrite2> mapAsync​(java.lang.String name,
                                                                           io.aether.utils.interfaces.AFunction<TRead,​io.aether.utils.futures.ARFuture<TWrite2>> f1,
                                                                           io.aether.utils.interfaces.AFunction<TRead2,​io.aether.utils.futures.ARFuture<TWrite>> f2)
      • map

        default <TWrite2,​TRead2> Gate<TRead2,​TWrite2> map​(java.lang.String name,
                                                                      io.aether.utils.interfaces.AFunction<TRead,​TWrite2> f1,
                                                                      io.aether.utils.interfaces.AFunction<TRead2,​TWrite> f2)
      • ofFunction

        default GateI<TWrite> ofFunction​(java.lang.String name,
                                         io.aether.utils.interfaces.AFunction<TRead,​TWrite> acceptor)
      • ofDataOut

        default GateI<TWrite> ofDataOut​(java.lang.String name,
                                        io.aether.utils.dataio.DataOut consumer)
      • ofFuture

        default GateI<TWrite> ofFuture​(java.lang.String name,
                                       io.aether.utils.futures.ARFuture<TRead> consumer)
      • ofSideTryFuture

        default GateI<TWrite> ofSideTryFuture​(java.lang.String name,
                                              io.aether.utils.futures.ARFuture<TRead> consumer)
      • toConsumer

        default GateI<TWrite> toConsumer​(java.lang.String name,
                                         io.aether.utils.interfaces.AConsumer<TRead> consumer)
        Links this gate to a consumer that will process the data received through this gate. The consumer will be called whenever data is available on this gate, allowing you to perform operations on it.
        Parameters:
        name - A descriptive name for the consumer, used for logging and debugging purposes.
        consumer - A consumer that takes a single parameter: a value received through this gate. The consumer will be called whenever data is available on this gate, allowing you to process it as needed.
        Returns:
        An GateI instance representing the input side of the newly created link. This can be used to send data through the linked consumer or to perform other operations on the gate.
      • toConsumerValue

        default GateI<TWrite> toConsumerValue​(java.lang.String name,
                                              io.aether.utils.interfaces.AConsumer<Value<TRead>> consumer)
      • ofCollection

        default GateI<TWrite> ofCollection​(java.lang.String name,
                                           java.util.Queue<TRead> q)
      • distinctWrite

        default Gate<TWrite,​TRead> distinctWrite​(java.lang.String name)
      • distinctRead

        default Gate<TWrite,​TRead> distinctRead​(java.lang.String name)
      • filter

        default Gate<TWrite,​TRead> filter​(java.lang.String name,
                                                io.aether.utils.interfaces.APredicate<TRead> filterRead,
                                                io.aether.utils.interfaces.APredicate<TWrite> filterWrite)
      • log

        default Gate<TWrite,​TRead> log​(java.lang.String title,
                                             java.lang.String directLeft,
                                             java.lang.String directRight,
                                             io.aether.utils.interfaces.AConsumer<Value<TWrite>> directLeftFun,
                                             io.aether.utils.interfaces.AConsumer<Value<TRead>> directRightFun)
      • log

        default Gate<TWrite,​TRead> log​(java.lang.String title,
                                             java.lang.String directLeft,
                                             java.lang.String directRight)