forked from PolymerLabs/arcs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
recipe.proto
173 lines (151 loc) · 3.76 KB
/
recipe.proto
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
syntax = "proto3";
package arcs;
option java_package = "arcs.core.data.proto";
option java_multiple_files = true;
// Holds a single plan and particle specs used by it.
message RecipeEnvelopeProto {
RecipeProto recipe = 1;
repeated ParticleSpecProto particle_specs = 2;
}
// Plan: A resolved recipe that can be instantiated.
message RecipeProto {
// Optional recipe name.
string name = 1;
repeated HandleProto handles = 2;
repeated ParticleProto particles = 3;
}
// Recipe-level representation of a store.
message HandleProto {
enum Fate {
CREATE = 0;
USE = 1;
MAP = 2;
COPY = 3;
JOIN = 4;
}
// Identifies a handle in a recipe.
string name = 1;
Fate fate = 2;
string storage_key = 3;
TypeProto type = 4;
// Only present for fate = JOIN handles.
repeated string associated_handles = 5;
}
// A single particle instance in a recipe.
message ParticleProto {
// Refers to envelope.particle_specs.name
string spec_name = 1;
repeated HandleConnectionProto connections = 2;
}
// A connection between a handle instance and a particle instance.
message HandleConnectionProto {
// Refers to envelope.particle_specs.connections.name
string name = 1;
// Refers to envelope.recipe.handles.name
string handle = 2;
}
// Defines a particle contract and links it with implementation.
// A single spec can be instantiated multiple times in a recipe.
message ParticleSpecProto {
// Identifies a particle spec in an envelope.
string name = 1;
repeated HandleConnectionSpecProto connections = 2;
// Location of the implementation.
string location = 3;
}
// Defines a single connection of a particle spec.
message HandleConnectionSpecProto {
enum Direction {
READS = 0;
WRITES = 1;
READS_WRITES = 2;
}
// Identifies a connection in a particle spec.
string name = 1;
Direction direction = 2;
TypeProto type = 3;
}
// Representation of a type in Arcs.
message TypeProto {
oneof data {
PrimitiveTypeProto primitive = 1;
EntityTypeProto entity = 2;
CollectionTypeProto collection = 3;
ReferenceTypeProto reference = 4;
TupleTypeProto tuple = 5;
TypeVariableProto variable = 6;
}
bool optional = 10;
RefinementExpressionProto refinement = 11;
}
enum PrimitiveTypeProto {
TEXT = 0;
NUMBER = 1;
BOOLEAN = 2;
}
message EntityTypeProto {
SchemaProto schema = 1;
}
message CollectionTypeProto {
TypeProto collection_type = 1;
}
message TupleTypeProto {
repeated TypeProto elements = 1;
}
message ReferenceTypeProto {
TypeProto referred_type = 1;
}
message TypeVariableProto {
// Identifies a type variable in a recipe or a particle spec.
// Type variables with the same name are linked together.
string name = 1;
}
message SchemaProto {
repeated string names = 1;
map<string, TypeProto> fields = 2;
string hash = 3;
}
enum OPERATOR {
AND = 0;
OR = 1;
LESS_THAN = 2;
GREATER_THAN = 3;
LESS_THAN_OR_EQUALS = 4;
GREATER_THAN_OR_EQUALS = 5;
ADD = 6;
SUBTRACT = 7;
MULTIPLY = 8;
DIVIDE = 9;
NOT = 10;
NEGATE = 11;
EQUALS = 12;
NOT_EQUALS = 13;
}
message RefinementExpressionProto {
oneof expression {
// E.g. "age > 18"
BinaryExpressionProto binary = 1;
// E.g. "-duration"
UnaryExpressionProto unary = 2;
// Name of a schema field.
string field = 3;
// Value to be substituted at query time.
// String value identifies a query argument in a refinement.
string query_argument = 4;
// E.g. 18
double number = 5;
// E.g. true
bool boolean = 6;
// E.g. "Sydney"
string text = 7;
}
}
message BinaryExpressionProto {
RefinementExpressionProto left_expr = 1;
RefinementExpressionProto right_expr = 2;
OPERATOR operator = 3;
}
message UnaryExpressionProto {
RefinementExpressionProto expr = 1;
OPERATOR operator = 2;
}