protocol.proto 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright 2020 gorse Project Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. option go_package = "github.com/zhenghaoz/gorse/protocol";
  16. package protocol;
  17. enum NodeType {
  18. ServerNode = 0;
  19. WorkerNode = 1;
  20. ClientNode = 2;
  21. }
  22. service Master {
  23. /* meta distribute */
  24. rpc GetMeta(NodeInfo) returns (Meta) {}
  25. /* data distribute */
  26. rpc GetRankingModel(VersionInfo) returns (stream Fragment) {}
  27. rpc GetClickModel(VersionInfo) returns (stream Fragment) {}
  28. rpc PushProgress(PushProgressRequest) returns (PushProgressResponse) {}
  29. }
  30. message Meta {
  31. string config = 1;
  32. int64 ranking_model_version = 3;
  33. int64 click_model_version = 4;
  34. string me = 5;
  35. repeated string servers = 6;
  36. repeated string workers = 7;
  37. }
  38. message Fragment {
  39. bytes data = 1;
  40. }
  41. message VersionInfo {
  42. int64 version = 1;
  43. }
  44. message NodeInfo {
  45. NodeType node_type = 1;
  46. string node_name = 2;
  47. int64 http_port = 3;
  48. string binary_version = 4;
  49. }
  50. message Progress {
  51. string tracer = 1;
  52. string name = 2;
  53. string status = 3;
  54. string error = 4;
  55. int64 count = 5;
  56. int64 total = 6;
  57. int64 start_time = 7;
  58. int64 finish_time = 8;
  59. }
  60. message PushProgressRequest {
  61. repeated Progress progress = 1;
  62. }
  63. message PushProgressResponse {}