zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2k stars 592 forks source link

Refactor dispatch pipeline in Swift #2269

Closed bernardnormier closed 1 month ago

bernardnormier commented 1 month ago

This PR refactors the dispatch pipeline in Swift.

Disp is replaced by a Dispatcher protocol with a public dispatch method. It's similar to the dispatch in C++ and C#:

/// A dispatcher accepts incoming requests and returns outgoing responses.
public protocol Dispatcher {
    /// Dispatches an incoming request and returns the corresponding outgoing response.
    /// - Parameter request: The incoming request.
    /// - Returns: The outgoing response, wrapped in a Promise.
    func dispatch(_ request: IncomingRequest) -> Promise<OutgoingResponse>
}

A large part of this PR updates the slice2swift generated code to implement Dispatcher (instead of Disp). I kept the name Ice.Disp as an alias for Ice.Dispatcher for source compatibility.