service.proto 820 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. syntax = "proto3";//声明proto的版本 只能 是3,才支持 grpc
  2. //声明 包名
  3. package proto;
  4. //服务管理
  5. service Service {
  6. //注册服务
  7. rpc Registe(ServiceMeta)returns(StringRepData){}
  8. //注销服务
  9. rpc Destory(ServiceMeta)returns(StringRepData){}
  10. //申请服务
  11. rpc Apply(ApplyReqData)returns(ApplyRepData){}
  12. //释放服务
  13. rpc Release(StringReqData)returns(StringRepData){}
  14. }
  15. //服务参数
  16. message ServiceMeta{
  17. string name = 1;
  18. string ip = 2;
  19. int32 port = 3;
  20. int32 workers = 4;
  21. int32 balance = 5;
  22. }
  23. //标准字符串返回结果
  24. message StringRepData{
  25. string data = 1;
  26. }
  27. //标准字符串请求
  28. message StringReqData{
  29. string data = 1;
  30. }
  31. //
  32. message ApplyReqData{
  33. string name = 1;
  34. int32 balance = 2;
  35. }
  36. message ApplyRepData{
  37. string addr = 1;
  38. string resourceId = 2;
  39. }