<commit_before>package io.reactors
package protocol






trait ServerProtocols {
  /** A server channel accepts tuples with the request event and channel to reply on.
   */
  type Server[T, S] = Channel[(T, Channel[S])]

  implicit class ServerSystemOps(val system: ReactorSystem) {
    /** Open a new server channel.
     */
    def server[T, S](name: String = ""): Connector[(T, Channel[S])] =
      system.channels.named(name).open[(T, Channel[S])]
  }

  implicit class ServerChannelOps[T, @specialized(Int, Long, Double) S: Arrayable](
    val server: Server[T, S]
  ) {
    /** Request a single reply from the server channel.
     *
     *  Returns an `IVar` with the server response.
     *  If the server responds with multiple events, only the first event is returned.
     *
     *  @param x     request event
     *  @return      the single assignment variable with the reply
     */
    def ?(x: T): IVar[S] = {
      val connector = Reactor.self.system.channels.open[S]
      val result = connector.events.toIVar
      result.onDone(connector.seal())
      server ! ((x, connector.channel))
      result
    }
  }
}
<commit_msg>Add stub for `stream` to server protocols.<commit_after>package io.reactors
package protocol






trait ServerProtocols {
  /** A server channel accepts tuples with the request event and channel to reply on.
   */
  type Server[T, S] = Channel[(T, Channel[S])]

  implicit class ServerSystemOps(val system: ReactorSystem) {
    /** Open a new server channel.
     */
    def server[T, S](name: String = ""): Connector[(T, Channel[S])] =
      system.channels.named(name).open[(T, Channel[S])]
  }

  implicit class ServerChannelOps[T, @specialized(Int, Long, Double) S: Arrayable](
    val server: Server[T, S]
  ) {
    /** Request a single reply from the server channel.
     *
     *  Returns an `IVar` with the server response.
     *  If the server responds with multiple events, only the first event is returned.
     *
     *  @param x     request event
     *  @return      the single assignment variable with the reply
     */
    def ?(x: T): IVar[S] = {
      val connector = Reactor.self.system.channels.open[S]
      val result = connector.events.toIVar
      result.onDone(connector.seal())
      server ! ((x, connector.channel))
      result
    }

    /** Request a stream of replies from the server channel.
     *
     *  Server can reply with multiple events.
     *
     *  @param x     request event
     *  @return      an event stream with the server replies
     */
    def stream(x: T): Events[S] = {
      ???
    }
  }
}

{'fraction_non_alphanumeric': 0.11381172839506173, 'fraction_numerical': 0.0, 'mean_word_length': 2.616457461645746, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6274848', 'n_tokens_mistral': 794, 'n_tokens_neox': 774, 'n_words': 257}