1// Copyright 2021 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4// 5// **** DO NOT EDIT - this file was automatically generated. **** 6syntax = "proto3"; 7 8package cast.runtime; 9 10import "google/protobuf/duration.proto"; 11import "cast/cast_core/api/common/application_config.proto"; 12import "cast/cast_core/api/common/service_info.proto"; 13import "cast/cast_core/api/v2/url_rewrite.proto"; 14 15option optimize_for = LITE_RUNTIME; 16 17// Runtime service is hosted in Runtime. 18// 19// This service is called by CastCore after Runtime starts up. 20service RuntimeService { 21 // Loads a Cast application. The runtime must start its 22 // RuntimeApplicationService on runtime_application_service_info. 23 rpc LoadApplication(LoadApplicationRequest) returns (LoadApplicationResponse); 24 25 // Launches a Cast application. The application must connect to the 26 // CoreApplicationService via core_application_service_info. 27 rpc LaunchApplication(LaunchApplicationRequest) 28 returns (LaunchApplicationResponse); 29 30 // Stops a Cast application identified by the app_id, cast_session_id. 31 // If both app_id and cast_session_id are omitted, the current, "foreground" 32 // application is stopped. 33 rpc StopApplication(StopApplicationRequest) returns (StopApplicationResponse); 34 35 // Requests runtime to send a heartbeat in a stream. The use of server-side 36 // streaming allows Core to know for sure that runtime is still running. In 37 // case of a crash, the gRPC stream will error with UNAVAILABLE error. Cast 38 // Core calls this API if the runtime supports heartbeat in 39 // RuntimeCapabilities. 40 rpc Heartbeat(HeartbeatRequest) returns (stream HeartbeatResponse); 41 42 // Provides information need by the runtime to start recording metrics via 43 // the core. 44 rpc StartMetricsRecorder(StartMetricsRecorderRequest) 45 returns (StartMetricsRecorderResponse); 46 47 // Stops the metrics recorder, which may also attempt to flush. 48 rpc StopMetricsRecorder(StopMetricsRecorderRequest) 49 returns (StopMetricsRecorderResponse); 50} 51 52message LoadApplicationRequest { 53 // Cast application config. 54 cast.common.ApplicationConfig application_config = 1; 55 // Initial rules to rewrite URLs and headers. 56 cast.v2.UrlRequestRewriteRules url_rewrite_rules = 2; 57 // Cast session id used to setup a connection and pull the config from core 58 // application service. 59 string cast_session_id = 3; 60 // RuntimeApplication service info. The endpoint is generated by Cast Core and 61 // must be used by the Runtime to bind the RuntimeApplication service. 62 cast.common.ServiceInfo runtime_application_service_info = 4; 63} 64 65// Info relevant to a V2 channel between the runtime and cast core. 66message V2ChannelInfo { 67 // If set, only messages within these namespaces will be sent to the runtime. 68 // If empty, all V2 messages will be sent to the runtime regardless of 69 // namespace. 70 repeated string requested_namespaces = 1; 71} 72 73// Info relevant to a MessagePort channel between the runtime and cast core. 74message MessagePortInfo {} 75 76message LoadApplicationResponse { 77 // One of these fields must be set. This specifies what type of communication 78 // channel should be used to communicate between the runtime and cast core for 79 // the given application. 80 oneof channel_type { 81 V2ChannelInfo v2_info = 1; 82 MessagePortInfo message_port_info = 2; 83 } 84} 85 86message LaunchApplicationRequest { 87 // CoreApplication service info. 88 cast.common.ServiceInfo core_application_service_info = 1; 89 // DEPRECATED 90 string cast_session_id = 2 [deprecated = true]; 91 // DEPRECATED 92 cast.common.ServiceInfo runtime_application_service_info = 3 93 [deprecated = true]; 94 // CastMedia service info for this application in CastCore. 95 cast.common.ServiceInfo cast_media_service_info = 4; 96} 97 98// Returned by the runtime in response to a launch application request. 99message LaunchApplicationResponse {} 100 101message StopApplicationRequest { 102 // Application id. 103 string app_id = 1; 104 // Application session id. 105 string cast_session_id = 2; 106} 107 108message StopApplicationResponse { 109 // If stop application was successful, the application ID that was stopped. 110 string app_id = 1; 111 // If stop application was successful, the Cast session ID that was stopped. 112 string cast_session_id = 2; 113} 114 115message HeartbeatRequest { 116 // Period between two heartbeat responses. The Core will wait for double of 117 // this time to avoid network glitches. The minimum value is 5 seconds. 118 google.protobuf.Duration heartbeat_period = 1; 119} 120 121message HeartbeatResponse {} 122 123message StartMetricsRecorderRequest { 124 // Metrics service info. 125 cast.common.ServiceInfo metrics_recorder_service_info = 1; 126} 127 128message StartMetricsRecorderResponse {} 129 130message StopMetricsRecorderRequest {} 131 132message StopMetricsRecorderResponse {} 133