Documentation ¶
Overview ¶
Package server implements a counterpart for serving incoming gRPC connections initiated by gRPC-based ReplicaConnector and connects it directly to an instance of MessageStreamHandler interface
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
func ListenAndServe(s ReplicaServer, addr string, serverOpts ...grpc.ServerOption) error
ListenAndServe helps to start a server on a TCP address. It starts listening on a given TCP address and serving incoming connections.
Types ¶
type ReplicaServer ¶
type ReplicaServer interface { Serve(lis net.Listener, serverOpts ...grpc.ServerOption) error Stop() }
ReplicaServer implements a gRPC server to serve incoming connections from ReplicaConnector of this package.
Server method serves incoming connection on the supplied listener. It blocks and returns either on error or if Stop method is called.
Stop method gracefully stops the server. It immediately closes all open connections and listeners.
func New ¶
func New(replica api.ConnectionHandler) ReplicaServer
New creates a new instance of ReplicaServer using the specified replica instance to connect incoming requests with.