package virtdb.interface.pb;
import "common.proto";

message Config { // REQ-REP, PUB-SUB channel: "Name"
  required string    Name            = 1;
  repeated KeyValue  ConfigData      = 2;
  optional uint64    ValidForMs      = 3;
}

enum ServiceType {
  NONE              = 0;   // 
  QUERY             = 1;   // PUSH
  COLUMN            = 2;   // PUB-SUB
  META_DATA         = 3;   // REQ-REP, PUB-SUB
  DB_CONFIG         = 4;   // REQ_REP
  // was DB_CONFIG_QUERY here
  LOG_RECORD        = 6;   // PUSH, PUB-SUB
  // was GET_LOGS here
  CONFIG            = 8;   // REQ-REP, PUB-SUB
  ENDPOINT          = 9;   // REQ-REP, PUB-SUB
  IP_DISCOVERY      = 10;  // RAW_UDP
  OTHER             = 11;  // UNSPEC
  CERT_STORE        = 12;  // REQ-REP
  USER_MGR          = 13;  // REQ-REP
  SRCSYS_CRED_MGR   = 14;  // REQ-REP
  MONITORING        = 15;  // REQ-REP
}

enum ConnectionType {
  REQ_REP    = 1;
  PUSH_PULL  = 2;
  PUB_SUB    = 3;
  RAW_UDP    = 4;
}

message Connection {
  required ConnectionType  Type      = 1;
  repeated string          Address   = 2;
}

message EndpointData {
  enum Command {
    ADD     = 1;
    REMOVE  = 2;
    LIST    = 3;
  }
  required string           Name          = 1;
  required ServiceType      SvcType       = 2;
  repeated Connection       Connections   = 3;
  optional string           SubType       = 4;
  optional uint64           ValidForMs    = 5;
  optional Command          Cmd           = 6 [ default = ADD ];
}

message Endpoint { // REQ-REP, PUB-SUB channel: "#ServiceType EndpointName"
  repeated EndpointData  Endpoints = 1;
}

