@@ -129,37 +129,52 @@ service ExperimentalService {
129129}
130130
131131message ExperimentalRegisterRelationshipCounterRequest {
132+ // name is the name of the counter being registered.
133+ string name = 1 [ (validate.rules ).string = {
134+ pattern : "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$" ,
135+ max_bytes : 64 ,
136+ } ];
137+
132138 // relationship_filter defines the filter to be applied to the relationships
133139 // to be counted.
134- RelationshipFilter relationship_filter = 1
140+ RelationshipFilter relationship_filter = 2
135141 [ (validate.rules ) .message.required = true ];
136142}
137143
138144message ExperimentalRegisterRelationshipCounterResponse {}
139145
140146message ExperimentalCountRelationshipsRequest {
141- // consistency defines the consistency level for the count operation. If the
142- // requested consistency is fully consistent or represents a zedtoken that is
143- // not stored in the system, the count will be performed synchronously, which
144- // can be *quite slow* for large datasets.
145- Consistency consistency = 1 ;
146-
147- // relationship_filter defines the filter to be applied to the relationships
148- // to be counted.
149- RelationshipFilter relationship_filter = 2
150- [ (validate.rules ) .message.required = true ];
147+ // name is the name of the counter whose count is being requested.
148+ string name = 1 [ (validate.rules ).string = {
149+ pattern : "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$" ,
150+ max_bytes : 64 ,
151+ } ];
151152}
152153
153154message ExperimentalCountRelationshipsResponse {
154- // read_at is the ZedToken at which the relationship count was performed
155- ZedToken read_at = 1 [ (validate.rules ) .message.required = true ];
155+ oneof counter_result {
156+ // counter_still_calculating is true if the counter is still calculating the count.
157+ bool counter_still_calculating = 1 ;
156158
157- uint64 relationship_count = 2 ;
159+ // read_counter_value is the value of the counter at the time of the read.
160+ ReadCounterValue read_counter_value = 2 ;
161+ }
162+ }
163+
164+ message ReadCounterValue {
165+ // relationship_count is the count of relationships that match the filter.
166+ uint64 relationship_count = 1 ;
167+
168+ // read_at is the ZedToken at which the relationship count applies.
169+ ZedToken read_at = 2 [ (validate.rules ) .message.required = true ];
158170}
159171
160172message ExperimentalUnregisterRelationshipCounterRequest {
161- RelationshipFilter relationship_filter = 1
162- [ (validate.rules ) .message.required = true ];
173+ // name is the name of the counter being unregistered.
174+ string name = 1 [ (validate.rules ).string = {
175+ pattern : "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$" ,
176+ max_bytes : 64 ,
177+ } ];
163178}
164179
165180message ExperimentalUnregisterRelationshipCounterResponse {}
0 commit comments