github.com/polarismesh/polaris@v1.17.8/common/api/l5/cl5.proto (about)

     1  syntax = "proto2";
     2  
     3  package l5;
     4  
     5  enum CL5_CMD
     6  {
     7    //------------------------------------------------
     8    CL5_SYNC_BY_AGENT_CMD = 100;    // 该命令号标示请求需要根据agent IP和Sid列表同步相关信息
     9    CL5_SYNC_BY_AGENT_ACK_CMD = 101;    // 请求CL5_SYNC_BY_AGENT_CMD对应的应答包命令号
    10    CL5_REGISTER_BY_ID_CMD = 102;    // 已经废弃
    11    CL5_REGISTER_BY_ID_ACK_CMD = 103;    // 已经废弃
    12    CL5_REGISTER_BY_NAME_CMD = 104;    // 该命令号的请求表示需要根据Name获取对应的Sid信息
    13    CL5_REGISTER_BY_NAME_ACK_CMD = 105;    // CL5_REGISTER_BY_NAME_CMD对应的应答包命令号
    14  }
    15  
    16  // IP配置信息,用于实现就近访问。L5 server从表t_ip_config读取,由OSS从CMDB查询IP相关信息写入表中
    17  message cl5_ipc_obj
    18  {
    19    required int32  ip = 1;
    20    required int32  area_id = 2;  // 区域编号
    21    required int32  city_id = 3;  // 城市编号
    22    required int32  idc_id = 4;  // IDC编号
    23  }
    24  
    25  // IP配置信息列表
    26  message cl5_ipc_list
    27  {
    28    repeated cl5_ipc_obj  ipc = 1;
    29  }
    30  
    31  // Sid属性
    32  message cl5_sid_obj
    33  {
    34    required int32  mod_id = 1;
    35    required int32  cmd_id = 2;
    36    optional string  name = 3;  // 名字,可用于实现通过name查询sid
    37    optional int32  policy = 4;  // 就近访问标志, 0:不开启就近访问; 1:开启就近访问
    38  }
    39  
    40  // Sid属性列表
    41  message cl5_sid_list
    42  {
    43    repeated cl5_sid_obj  sid = 1;
    44  }
    45  
    46  // Sid
    47  message cl5_opt_obj
    48  {
    49    required int32  mod_id = 1;
    50    required int32  cmd_id = 2;
    51  }
    52  
    53  // Sid列表,用于CL5_SYNC_BY_AGENT_CMD请求包
    54  message cl5_opt_list
    55  {
    56    repeated cl5_opt_obj  opt = 1;
    57  }
    58  
    59  // Sid名字列表,用于CL5_REGISTER_BY_NAME_CMD请求包
    60  message cl5_name_list
    61  {
    62    repeated string  name = 1;
    63  }
    64  
    65  // l5 server列表,用于agent实现在连接l5 server失败时重试其他l5 server
    66  message cl5_l5svr_list
    67  {
    68    repeated int32    ip = 1;
    69  }
    70  
    71  // 被调server
    72  message cl5_serv_obj
    73  {
    74    required int32  mod_id = 1;
    75    required int32  cmd_id = 2;
    76    required int32  ip = 3;
    77    required int32  port = 4;
    78    required int32  weight = 5;
    79  }
    80  
    81  // 被调server列表
    82  message cl5_serv_list
    83  {
    84    repeated cl5_serv_obj  serv = 1;
    85  }
    86  
    87  // 有状态规则配置
    88  message cl5_poly_obj
    89  {
    90    required int32  mod_id = 1;
    91    required int32  div = 2;
    92    required int32  mod = 3;
    93  }
    94  
    95  // 有状态规则分段信息
    96  message cl5_sect_obj
    97  {
    98    required int32  mod_id = 1;
    99    required int32  from = 2;
   100    required int32  to = 3;
   101    required int32  cmd_id = 4;
   102  }
   103  
   104  // 有状态规则列表
   105  message cl5_rule_list
   106  {
   107    repeated cl5_poly_obj  poly = 1;
   108    repeated cl5_sect_obj  sect = 2;
   109  }
   110  
   111  // CL5_SYNC_BY_AGENT_CMD请求包
   112  message cl5_sync_by_agent_cmd
   113  {
   114    required int32 agent_ip = 1;  // agent ip,在就近访问开启时,会在cl5_ipc_list中返回agent的ip配置信息
   115    required int32 sync_flow = 2;  // 流水号
   116    optional cl5_opt_list  opt_list = 3;  // 需要同步信息的Sid列表
   117  }
   118  
   119  // CL5_SYNC_BY_AGENT_CMD应答包
   120  message cl5_sync_by_agent_ack_cmd
   121  {
   122    required int32 agent_ip = 1;
   123    required int32 sync_flow = 2;
   124    optional cl5_serv_list  serv_list = 3;  // 被调信息列表
   125    optional cl5_sid_list   sid_list = 4;  // sid信息列表
   126    optional cl5_ipc_list   ipc_list = 5;  // ip信息列表
   127    optional cl5_rule_list  rule_list = 6;  // 有状态规则列表
   128    optional cl5_l5svr_list  l5svr_list = 7;       // l5 server列表
   129  }
   130  
   131  // 已经废弃
   132  message cl5_register_by_id_cmd
   133  {
   134    required int32 caller_ip = 1;
   135    optional cl5_opt_list  opt_list = 2;
   136  }
   137  
   138  // 已经废弃
   139  message cl5_register_by_id_ack_cmd
   140  {
   141    required int32 caller_ip = 1;
   142    optional cl5_serv_list  serv_list = 2;
   143    optional cl5_sid_list  sid_list = 3;
   144    optional cl5_ipc_list  ipc_list = 4;
   145  }
   146  
   147  // CL5_REGISTER_BY_NAME_CMD 请求包
   148  message cl5_register_by_name_cmd
   149  {
   150    required int32 caller_ip = 1;
   151    optional cl5_name_list  name_list = 2;
   152  }
   153  
   154  // CL5_REGISTER_BY_NAME_ACK_CMD 应答包
   155  message cl5_register_by_name_ack_cmd
   156  {
   157    required int32 caller_ip = 1;
   158    optional cl5_serv_list  serv_list = 2;  // 被调信息列表
   159    optional cl5_sid_list  sid_list = 3;  // sid信息列表
   160    optional cl5_ipc_list  ipc_list = 4;  // ip信息列表
   161  }
   162  
   163  // 包格式
   164  message cl5_pkg
   165  {
   166    required int32  seqno = 1;  // 序列号
   167    required int32  cmd = 2;  // 命令字
   168    optional int32  result = 3;  // 结果
   169    optional string  error = 4;  // 调用
   170    optional int32  ip = 5;  // 调用者IP
   171  
   172    optional cl5_sync_by_agent_cmd  sync_by_agent_cmd = 10;
   173    optional cl5_sync_by_agent_ack_cmd  sync_by_agent_ack_cmd = 11;
   174    optional cl5_register_by_id_cmd  register_by_id_cmd = 12;
   175    optional cl5_register_by_id_ack_cmd  register_by_id_ack_cmd = 13;
   176    optional cl5_register_by_name_cmd  register_by_name_cmd = 14;
   177    optional cl5_register_by_name_ack_cmd  register_by_name_ack_cmd = 15;
   178  }