proxy.proto 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright 2019 The Eggroll Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. syntax = "proto3";
  17. import "basic-meta.proto";
  18. package com.webank.ai.eggroll.api.networking.proxy;
  19. // metadata of event
  20. message Model {
  21. string name = 1;
  22. string dataKey = 2;
  23. }
  24. // metadata of task
  25. message Task {
  26. string taskId = 1;
  27. Model model = 2;
  28. }
  29. message Topic {
  30. string name = 1;
  31. string partyId = 2;
  32. string role = 3;
  33. com.webank.ai.eggroll.api.core.Endpoint callback = 4; // implication of pub/sub model, necessary for http-based senario
  34. }
  35. // task admin command
  36. message Command {
  37. string name = 1;
  38. }
  39. message Conf {
  40. int64 overallTimeout = 1; // total timeout, in ms
  41. int64 completionWaitTimeout = 2; // timeout for waiting for complete, in ms
  42. int64 packetIntervalTimeout = 3; // timeout for packet interval, in ms
  43. int32 maxRetries = 4;
  44. }
  45. // metadata used for network data transfer
  46. message Metadata {
  47. Task task = 1; // task description
  48. Topic src = 2; // source topic
  49. Topic dst = 3; // destincation topic
  50. Command command = 4; // task managing command (if any)
  51. string operator = 5; // model operator
  52. int64 seq = 6; // stream seq (reserved)
  53. int64 ack = 7; // stream ack (reserved)
  54. Conf conf = 8; // operation config
  55. bytes ext = 9;
  56. string version = 100;
  57. }
  58. // includes key and value field, supporting sequential and random data transfer
  59. message Data {
  60. string key = 1; // compatible with list / dict
  61. bytes value = 2; // actual value
  62. }
  63. // data streaming packet
  64. message Packet {
  65. Metadata header = 1; // packet header
  66. Data body = 2; // packet body
  67. }
  68. // returned by service heartbeat to decide next operation
  69. enum Operation {
  70. START = 0;
  71. RUN = 1;
  72. STOP = 2;
  73. KILL = 3;
  74. GET_DATA = 4;
  75. PUT_DATA = 5;
  76. }
  77. // response of heartbeat
  78. message HeartbeatResponse {
  79. Metadata header = 1;
  80. Operation operation = 2;
  81. }
  82. message PollingFrame {
  83. string method = 1;
  84. int64 seq = 2;
  85. Metadata metadata = 10;
  86. Packet packet = 20;
  87. string desc = 30;
  88. }
  89. // data transfer service
  90. service DataTransferService {
  91. rpc push (stream Packet) returns (Metadata);
  92. rpc pull (Metadata) returns (stream Packet);
  93. rpc unaryCall (Packet) returns (Packet);
  94. rpc polling (stream PollingFrame) returns (stream PollingFrame);
  95. }
  96. service RouteService {
  97. rpc query (Topic) returns (com.webank.ai.eggroll.api.core.Endpoint);
  98. }