// 使用的语法版本
syntax = "proto3";

// 生成的go文件包
option go_package = ".;hub";//grpc这里生效了



message ExecuteIOPlanReq {
    string Plan = 1;
}

message ExecuteIOPlanResp {
}

enum StreamDataPacketType {
    EOF = 0;
    Data = 1;
    SendArgs = 2;
}
// 文件数据。注意：只在Type为Data或EOF的时候，Data字段才能有数据
message FileDataPacket {
    StreamDataPacketType Type = 1;
    bytes Data = 2;
}

// 注：EOF时data也可能有数据
message StreamDataPacket {
    StreamDataPacketType Type = 1;
    string PlanID = 2;
    int32 VarID = 3;
    bytes Data = 4;
}

message SendStreamResp {}

message GetStreamReq {
    string PlanID = 1;
    int32 VarID = 2;
    int32 SignalID = 3;
    string Signal = 4;
}

message SendVarReq {
    string PlanID = 1;
    int32 VarID = 2;
    string VarValue = 3;
}
message SendVarResp {}

message GetVarReq {
    string PlanID = 1;
    int32 VarID = 2;
    int32 SignalID = 3;
    string Signal = 4;
}
message GetVarResp {
    string Var = 1;
}

message PingReq {}
message PingResp {}

service Hub {
    rpc ExecuteIOPlan(ExecuteIOPlanReq) returns(ExecuteIOPlanResp){}

    rpc SendStream(stream StreamDataPacket)returns(SendStreamResp){}
    rpc GetStream(GetStreamReq)returns(stream StreamDataPacket){}

    rpc SendVar(SendVarReq)returns(SendVarResp){}
    rpc GetVar(GetVarReq)returns(GetVarResp){}

    rpc Ping(PingReq) returns(PingResp){}
}

