github.com/bhojpur/cache@v0.0.4/pkg/api/v1/cache.proto (about) 1 syntax = "proto3"; 2 3 package v1; 4 option go_package = "github.com/bhojpur/cache/pkg/api/v1"; 5 import "google/protobuf/timestamp.proto"; 6 7 service CacheService { 8 // StartLocalEngine starts a Cache Engine on the Bhojpur.NET Platform directly. 9 // The incoming requests are expected in the following order: 10 // 1. metadata 11 // 2. all bytes constituting the cache/config.yaml 12 // 3. all bytes constituting the Engine YAML that will be executed (that the config.yaml points to) 13 // 4. all bytes constituting the gzipped Bhojpur.NET Platform application tar stream 14 // 5. the Bhojpur.NET Platform application tar stream done marker 15 rpc StartLocalEngine(stream StartLocalEngineRequest) returns (StartEngineResponse) {}; 16 17 // StartFromPreviousEngine starts a new Engine based on a previous one. 18 // If the previous Engine does not have the can-replay condition set this call will result in an error. 19 rpc StartFromPreviousEngine(StartFromPreviousEngineRequest) returns (StartEngineResponse) {}; 20 21 // StartEngineRequest starts a new Engine based on its specification. 22 rpc StartEngine(StartEngineRequest) returns (StartEngineResponse) {}; 23 24 // Searches for Engine(s) known to this Engine 25 rpc ListEngines(ListEnginesRequest) returns (ListEnginesResponse) {}; 26 27 // Subscribe listens to new Engine(s) updates 28 rpc Subscribe(SubscribeRequest) returns (stream SubscribeResponse) {}; 29 30 // GetEngine retrieves details of a single Engine 31 rpc GetEngine(GetEngineRequest) returns (GetEngineResponse) {}; 32 33 // Listen listens to Engine updates and log output of a running Engine 34 rpc Listen(ListenRequest) returns (stream ListenResponse) {}; 35 36 // StopEngine stops a currently running Engine 37 rpc StopEngine(StopEngineRequest) returns (StopEngineResponse) {}; 38 } 39 40 message StartLocalEngineRequest { 41 oneof content { 42 EngineMetadata metadata = 1; 43 bytes config_yaml = 2; 44 bytes engine_yaml = 3; 45 bytes application_tar = 4; 46 bool application_tar_done = 5; 47 }; 48 } 49 50 message StartEngineResponse { 51 EngineStatus status = 1; 52 } 53 54 message StartEngineRequest { 55 EngineMetadata metadata = 1; 56 string engine_path = 2; 57 bytes engine_yaml = 3; 58 bytes sideload = 4; 59 google.protobuf.Timestamp wait_until = 5; 60 string name_suffix = 6; 61 } 62 63 message StartFromPreviousEngineRequest { 64 string previous_engine = 1; 65 string gitops_token = 2; 66 google.protobuf.Timestamp wait_until = 3; 67 } 68 69 message ListEnginesRequest { 70 repeated FilterExpression filter = 1; 71 repeated OrderExpression order = 2; 72 int32 start = 3; 73 int32 limit = 4; 74 } 75 76 message FilterExpression { 77 repeated FilterTerm terms = 1; 78 } 79 80 message FilterTerm { 81 string field = 1; 82 string value = 2; 83 FilterOp operation = 3; 84 bool negate = 4; 85 } 86 87 enum FilterOp { 88 OP_EQUALS = 0; 89 OP_STARTS_WITH = 1; 90 OP_ENDS_WITH = 2; 91 OP_CONTAINS = 3; 92 OP_EXISTS = 4; 93 } 94 95 message OrderExpression { 96 string field = 1; 97 bool ascending = 2; 98 } 99 100 message ListEnginesResponse { 101 int32 total = 1; 102 repeated EngineStatus result = 2; 103 } 104 105 message SubscribeRequest { 106 repeated FilterExpression filter = 1; 107 } 108 109 message SubscribeResponse { 110 EngineStatus result = 1; 111 } 112 113 message GetEngineRequest { 114 string name = 1; 115 } 116 117 message GetEngineResponse { 118 EngineStatus result = 1; 119 } 120 121 message ListenRequest { 122 string name = 1; 123 bool updates = 2; 124 ListenRequestLogs logs = 3; 125 } 126 127 enum ListenRequestLogs { 128 LOGS_DISABLED = 0; 129 LOGS_UNSLICED = 1; 130 LOGS_RAW = 2; 131 LOGS_HTML = 3; 132 } 133 134 message ListenResponse { 135 oneof content { 136 EngineStatus update = 1; 137 LogSliceEvent slice = 2; 138 }; 139 } 140 141 message EngineStatus { 142 string name = 1; 143 EngineMetadata metadata = 2; 144 EnginePhase phase = 3; 145 EngineConditions conditions = 4; 146 string details = 5; 147 repeated EngineResult results = 6; 148 } 149 150 message EngineMetadata { 151 string owner = 1; 152 Repository repository = 2; 153 EngineTrigger trigger = 3; 154 google.protobuf.Timestamp created = 4; 155 google.protobuf.Timestamp finished = 5; 156 repeated Annotation annotations = 6; 157 string engine_spec_name = 7; 158 } 159 160 message Repository { 161 string host = 1; 162 string owner = 2; 163 string repo = 3; 164 string ref = 4; 165 string revision = 5; 166 } 167 168 message Annotation { 169 string key = 1; 170 string value = 2; 171 } 172 173 enum EngineTrigger { 174 TRIGGER_UNKNOWN = 0; 175 TRIGGER_MANUAL = 1; 176 TRIGGER_PUSH = 2; 177 TRIGGER_DELETED = 3; 178 } 179 180 enum EnginePhase { 181 // Unknown means we don't know what state the Engine is in 182 PHASE_UNKNOWN = 0; 183 184 // Preparing means the Engine hasn't started yet and isn't consuming resources in the system 185 PHASE_PREPARING = 1; 186 187 // Starting means the Engine has been scheduled and is waiting to run. Things that might prevent it 188 // from running already are pod scheduling, image pull or container startup. 189 PHASE_STARTING = 2; 190 191 // Running means the Engine is actually running and doing work. 192 PHASE_RUNNING = 3; 193 194 // Done means the Engine has run and is finished 195 PHASE_DONE = 4; 196 197 // Cleaning means the Engine is in post-run cleanup 198 PHASE_CLEANUP = 5; 199 200 // Waiting means the Engine is waiting for its start time or some other condition to be met 201 PHASE_WAITING = 6; 202 } 203 204 message EngineConditions { 205 bool success = 1; 206 int32 failure_count = 2; 207 bool can_replay = 3; 208 google.protobuf.Timestamp wait_until = 4; 209 bool did_execute = 5; 210 } 211 212 message EngineResult { 213 string type = 1; 214 string payload = 2; 215 string description = 3; 216 repeated string channels = 4; 217 } 218 219 message LogSliceEvent { 220 string name = 1; 221 LogSliceType type = 2; 222 string payload = 3; 223 } 224 225 enum LogSliceType { 226 SLICE_ABANDONED = 0; 227 SLICE_PHASE = 1; 228 SLICE_START = 2; 229 SLICE_CONTENT = 3; 230 SLICE_DONE = 4; 231 SLICE_FAIL = 5; 232 SLICE_RESULT = 6; 233 } 234 235 message StopEngineRequest { 236 string name = 1; 237 } 238 239 message StopEngineResponse { }