stub out some initial work and go generate
This commit is contained in:
commit
39385bc8b2
9 changed files with 3343 additions and 0 deletions
45
main.go
Normal file
45
main.go
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/barakmich/go_raylet/ray_rpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
var (
|
||||
gRPCPort = flag.Int("grpc-port", 50000, "The gRPC server port")
|
||||
httpPort = flag.Int("http-port", 8080, "The HTTP server port")
|
||||
)
|
||||
|
||||
var log grpclog.LoggerV2
|
||||
|
||||
func init() {
|
||||
log = grpclog.NewLoggerV2(os.Stdout, ioutil.Discard, ioutil.Discard)
|
||||
grpclog.SetLoggerV2(log)
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
addr := fmt.Sprintf("0.0.0.0:%d", *gRPCPort)
|
||||
lis, err := net.Listen("tcp", addr)
|
||||
if err != nil {
|
||||
log.Fatalln("Failed to listen:", err)
|
||||
}
|
||||
s := grpc.NewServer(
|
||||
grpc.Creds(insecure.NewCredentials()),
|
||||
)
|
||||
ray_rpc.RegisterRayletDriverServer(s, NewRayletServicer())
|
||||
|
||||
// Serve gRPC Server
|
||||
log.Info("Serving gRPC on https://", addr)
|
||||
go func() {
|
||||
log.Fatal(s.Serve(lis))
|
||||
}()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue