aboutsummaryrefslogtreecommitdiff
path: root/cast/cast_core/api/runtime/runtime_service.proto
blob: 0ea47daa6794feb1681144d8b1d2ed035539fff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// **** DO NOT EDIT - this file was automatically generated. ****
syntax = "proto3";

package cast.runtime;

import "google/protobuf/duration.proto";
import "cast/cast_core/api/common/application_config.proto";
import "cast/cast_core/api/common/service_info.proto";
import "cast/cast_core/api/v2/url_rewrite.proto";

option optimize_for = LITE_RUNTIME;

// Runtime service is hosted in Runtime.
//
// This service is called by CastCore after Runtime starts up.
service RuntimeService {
  // Loads a Cast application. The runtime must start its
  // RuntimeApplicationService on runtime_application_service_info.
  rpc LoadApplication(LoadApplicationRequest) returns (LoadApplicationResponse);

  // Launches a Cast application. The application must connect to the
  // CoreApplicationService via core_application_service_info.
  rpc LaunchApplication(LaunchApplicationRequest)
      returns (LaunchApplicationResponse);

  // Stops a Cast application identified by the app_id, cast_session_id.
  // If both app_id and cast_session_id are omitted, the current, "foreground"
  // application is stopped.
  rpc StopApplication(StopApplicationRequest) returns (StopApplicationResponse);

  // Requests runtime to send a heartbeat in a stream. The use of server-side
  // streaming allows Core to know for sure that runtime is still running. In
  // case of a crash, the gRPC stream will error with UNAVAILABLE error. Cast
  // Core calls this API if the runtime supports heartbeat in
  // RuntimeCapabilities.
  rpc Heartbeat(HeartbeatRequest) returns (stream HeartbeatResponse);

  // Provides information need by the runtime to start recording metrics via
  // the core.
  rpc StartMetricsRecorder(StartMetricsRecorderRequest)
      returns (StartMetricsRecorderResponse);

  // Stops the metrics recorder, which may also attempt to flush.
  rpc StopMetricsRecorder(StopMetricsRecorderRequest)
      returns (StopMetricsRecorderResponse);
}

message LoadApplicationRequest {
  // Cast application config.
  cast.common.ApplicationConfig application_config = 1;
  // Initial rules to rewrite URLs and headers.
  cast.v2.UrlRequestRewriteRules url_rewrite_rules = 2;
  // Cast session id used to setup a connection and pull the config from core
  // application service.
  string cast_session_id = 3;
  // RuntimeApplication service info. The endpoint is generated by Cast Core and
  // must be used by the Runtime to bind the RuntimeApplication service.
  cast.common.ServiceInfo runtime_application_service_info = 4;
}

// Info relevant to a V2 channel between the runtime and cast core.
message V2ChannelInfo {
  // If set, only messages within these namespaces will be sent to the runtime.
  // If empty, all V2 messages will be sent to the runtime regardless of
  // namespace.
  repeated string requested_namespaces = 1;
}

// Info relevant to a MessagePort channel between the runtime and cast core.
message MessagePortInfo {}

message LoadApplicationResponse {
  // One of these fields must be set. This specifies what type of communication
  // channel should be used to communicate between the runtime and cast core for
  // the given application.
  oneof channel_type {
    V2ChannelInfo v2_info = 1;
    MessagePortInfo message_port_info = 2;
  }
}

message LaunchApplicationRequest {
  // CoreApplication service info.
  cast.common.ServiceInfo core_application_service_info = 1;
  // DEPRECATED
  string cast_session_id = 2 [deprecated = true];
  // DEPRECATED
  cast.common.ServiceInfo runtime_application_service_info = 3
      [deprecated = true];
  // CastMedia service info for this application in CastCore.
  cast.common.ServiceInfo cast_media_service_info = 4;
}

// Returned by the runtime in response to a launch application request.
message LaunchApplicationResponse {}

message StopApplicationRequest {
  // Application id.
  string app_id = 1;
  // Application session id.
  string cast_session_id = 2;
}

message StopApplicationResponse {
  // If stop application was successful, the application ID that was stopped.
  string app_id = 1;
  // If stop application was successful, the Cast session ID that was stopped.
  string cast_session_id = 2;
}

message HeartbeatRequest {
  // Period between two heartbeat responses. The Core will wait for double of
  // this time to avoid network glitches. The minimum value is 5 seconds.
  google.protobuf.Duration heartbeat_period = 1;
}

message HeartbeatResponse {}

message StartMetricsRecorderRequest {
  // Metrics service info.
  cast.common.ServiceInfo metrics_recorder_service_info = 1;
}

message StartMetricsRecorderResponse {}

message StopMetricsRecorderRequest {}

message StopMetricsRecorderResponse {}