github.com/emcfarlane/larking@v0.0.0-20220605172417-1704b45ee6c3/apipb/workerpb/worker.proto (about)

     1  // Copyright 2022 Edward McFarlane. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  syntax = "proto3";
     6  
     7  package larking.api.worker;
     8  
     9  import "google/api/annotations.proto";
    10  import "google/rpc/status.proto";
    11  
    12  option go_package = "github.com/emcfarlane/larking/apipb/workerpb;workerpb";
    13  
    14  message Command {
    15    string name = 1;
    16    oneof exec {
    17      string input = 2;
    18      string complete = 3;
    19      string format = 4;
    20    }
    21  }
    22  
    23  message Output {
    24    string output = 1; // printed output
    25    google.rpc.Status status = 2;
    26  }
    27  
    28  message Completion {
    29    repeated string completions = 3; // completions
    30  }
    31  
    32  message Result {
    33    oneof result {
    34      Output output = 1;
    35      Completion completion = 2;
    36    }
    37  }
    38  
    39  message RunThreadRequest { string name = 1; }
    40  message TestThreadRequest { string name = 1; }
    41  
    42  service Worker {
    43    rpc RunOnThread(stream Command) returns (stream Result) {
    44      option (google.api.http) = {
    45        custom : {kind : "websocket" path : "/v1/{name=threads/*}:run"}
    46        body : "*"
    47      };
    48    }
    49    rpc RunThread(RunThreadRequest) returns (Output) {
    50      option (google.api.http) = {
    51        post : "/v1/{name=threads/*}:run"
    52        body : ""
    53      };
    54    }
    55    rpc TestThread(TestThreadRequest) returns (Output) {
    56      option (google.api.http) = {
    57        post : "/v1/{name=threads/*}:test"
    58        body : ""
    59      };
    60    }
    61  }