You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

pcmcore.go 2.0 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. Copyright (c) [2023] [pcm]
  3. [pcm-coordinator] is licensed under Mulan PSL v2.
  4. You can use this software according to the terms and conditions of the Mulan PSL v2.
  5. You may obtain a copy of Mulan PSL v2 at:
  6. http://license.coscl.org.cn/MulanPSL2
  7. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  8. EITHER EXPaRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  9. MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  10. See the Mulan PSL v2 for more details.
  11. */
  12. package main
  13. import (
  14. "flag"
  15. "github.com/zeromicro/go-zero/core/conf"
  16. "github.com/zeromicro/go-zero/core/logx"
  17. "github.com/zeromicro/go-zero/core/service"
  18. "github.com/zeromicro/go-zero/zrpc"
  19. "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/helper/interceptor/rpcserver"
  20. "gitlink.org.cn/JointCloud/pcm-coordinator/rpc/internal/config"
  21. participantserviceServer "gitlink.org.cn/JointCloud/pcm-coordinator/rpc/internal/server/participantservice"
  22. pcmcoreServer "gitlink.org.cn/JointCloud/pcm-coordinator/rpc/internal/server/pcmcore"
  23. "gitlink.org.cn/JointCloud/pcm-coordinator/rpc/internal/svc"
  24. "gitlink.org.cn/JointCloud/pcm-coordinator/rpc/pcmCore"
  25. "google.golang.org/grpc"
  26. "google.golang.org/grpc/reflection"
  27. )
  28. var configFile = flag.String("f", "rpc/etc/pcmcore.yaml", "the config file")
  29. func main() {
  30. flag.Parse()
  31. var c config.Config
  32. conf.MustLoad(*configFile, &c)
  33. ctx := svc.NewServiceContext(c)
  34. s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
  35. pcmCore.RegisterPcmCoreServer(grpcServer, pcmcoreServer.NewPcmCoreServer(ctx))
  36. pcmCore.RegisterParticipantServiceServer(grpcServer, participantserviceServer.NewParticipantServiceServer(ctx))
  37. if c.Mode == service.DevMode || c.Mode == service.TestMode {
  38. reflection.Register(grpcServer)
  39. }
  40. })
  41. //rpc log
  42. s.AddUnaryInterceptors(rpcserver.LoggerInterceptor)
  43. defer s.Stop()
  44. logx.Infof("Starting rpc server at %s...\n", c.ListenOn)
  45. s.Start()
  46. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.