Skip to content

Commit

Permalink
update proto
Browse files Browse the repository at this point in the history
  • Loading branch information
csenet committed Sep 16, 2023
1 parent ac82103 commit 3d5d947
Show file tree
Hide file tree
Showing 17 changed files with 2,927 additions and 404 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
buf:
buf generate --path=./proto/spec
rm -Rf ./backend/proto
buf generate --path=./proto/
cd ./backend/proto && go mod init github.com/ueckoken/plarail2023/backend/proto
cd ./backend/proto && go mod tidy
34 changes: 34 additions & 0 deletions backend/command/server/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

import (
"context"
"net/http"

"github.com/bufbuild/connect-go"
trainv1 "github.com/ueckoken/plarail2023/backend/proto/train/v1"
"github.com/ueckoken/plarail2023/backend/proto/train/v1/trainv1connect"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
)

type TrainServer struct{}

func (s *TrainServer) NotifyTrainArrival(
ctx context.Context,
req *connect.Request[trainv1.NotifyTrainArrivalRequest],
) (*connect.Response[trainv1.NotifyTrainArrivalResponse], error) {
res := connect.NewResponse(&trainv1.NotifyTrainArrivalResponse{
Success: true,
})
return res, nil
}

func main() {
server := &TrainServer{}
mux := http.NewServeMux()
path, handler := trainv1connect.NewTrainServiceHandler(server)
mux.Handle(path, handler)
http.ListenAndServe("localhost:8080",
h2c.NewHandler(mux, &http2.Server{}),
)
}
Binary file removed backend/mqtt-handler/device-manager
Binary file not shown.
1 change: 1 addition & 0 deletions backend/mqtt-handler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ func main() {
return
}
}

}
8 changes: 8 additions & 0 deletions backend/proto/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/ueckoken/plarail2023/backend/proto

go 1.21.1

require (
github.com/bufbuild/connect-go v1.10.0
google.golang.org/protobuf v1.31.0
)
10 changes: 10 additions & 0 deletions backend/proto/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github.com/bufbuild/connect-go v1.10.0 h1:QAJ3G9A1OYQW2Jbk3DeoJbkCxuKArrvZgDt47mjdTbg=
github.com/bufbuild/connect-go v1.10.0/go.mod h1:CAIePUgkDR5pAFaylSMtNK45ANQjp9JvpluG20rhpV8=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
287 changes: 0 additions & 287 deletions backend/proto/spec/v1/grpcconnect/state.connect.go

This file was deleted.

107 changes: 0 additions & 107 deletions backend/proto/spec/v1/grpcconnect/virtual_state.connect.go

This file was deleted.

Loading

0 comments on commit 3d5d947

Please sign in to comment.