xref: /aosp_15_r20/external/grpc-grpc/test/core/promise/promise_fuzzer.proto (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1// Copyright 2021 gRPC authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package promise_fuzzer;
18
19message Seq {
20    Promise first = 1;
21    repeated PromiseFactory promise_factories = 2;
22}
23
24message Join {
25    repeated Promise promises = 1;
26}
27
28message Race {
29    repeated Promise promises = 1;
30}
31
32message Last {}
33
34message PromiseFactory {
35    oneof promise_factory_type {
36        // Return a specific promise
37        Promise promise = 1;
38        // Return the result of the last thing
39        Last last = 2;
40    }
41}
42
43message Never {}
44
45message ScheduleWaker {
46  bool owning = 1;
47  int32 waker = 2;
48}
49
50message Promise {
51    oneof promise_type {
52        // Seq combinator
53        Seq seq = 1;
54        // Join combinator
55        Join join = 2;
56        // Race combinator
57        Race race = 3;
58        // Never complete
59        Never never = 4;
60        // Sleep n times, then wakeup
61        int32 sleep_first_n = 5;
62        // Cancel and be pending
63        Cancel cancel_from_inside = 6;
64        // Wait for waker n, then continue
65        ScheduleWaker wait_once_on_waker = 7;
66    }
67}
68
69message Cancel {}
70
71message Wakeup {}
72
73message Action {
74    oneof action_type {
75        // Activity::ForceWakeup
76        Wakeup force_wakeup = 1;
77        // Cancel the activity
78        Cancel cancel = 2;
79        // Flush any pending scheduled wakeups
80        Wakeup flush_wakeup = 3;
81        // Awake waker n if it exists
82        int32 awake_waker = 4;
83        // Drop waker n if it exists
84        int32 drop_waker = 5;
85    }
86}
87
88message Msg {
89    Promise promise = 1;
90    repeated Action actions = 2;
91}
92