mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-09 22:47:24 +00:00
In my mind this is "don't make grpc any weirder than it has to be." We definitely don't need to export this type: if you're using gRPC for ABCI you *probably* don't want to also depend on the huge swath of the code that The ideal case is you generate the proto yourself, standup a gRPC service on your own (presumably because your application has other gRPC services that you want to expose,) and then your application doesn't need to interact with the types package at all. This is definitely the case for anyone who uses gRPC and doesn't use Go (which is likely the predominant use case.) If you're using Go, and want to use tendermint's service runner for running your gRPC service, you can, but at this point (as before,) you're already importing the `types` package (and you were before,) I've just eliminated an intermediate type that you shouldn't need to think about. Reviewers: I think the change is pretty rote, but the logic/user-story above would definitely be better for being validated by someone other than me. :)
32 lines
684 B
Go
32 lines
684 B
Go
/*
|
|
Package server is used to start a new ABCI server.
|
|
|
|
It contains two server implementation:
|
|
* gRPC server
|
|
* socket server
|
|
|
|
*/
|
|
package server
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/tendermint/tendermint/abci/types"
|
|
"github.com/tendermint/tendermint/libs/log"
|
|
"github.com/tendermint/tendermint/libs/service"
|
|
)
|
|
|
|
func NewServer(logger log.Logger, protoAddr, transport string, app types.Application) (service.Service, error) {
|
|
var s service.Service
|
|
var err error
|
|
switch transport {
|
|
case "socket":
|
|
s = NewSocketServer(logger, protoAddr, app)
|
|
case "grpc":
|
|
s = NewGRPCServer(logger, protoAddr, app)
|
|
default:
|
|
err = fmt.Errorf("unknown server type %s", transport)
|
|
}
|
|
return s, err
|
|
}
|