@@ -35,7 +35,6 @@ lazy_static! {
3535 vec![
3636 Box :: new( UniqueOperationNames :: new( ) ) ,
3737 Box :: new( LoneAnonymousOperation :: new( ) ) ,
38- Box :: new( SingleFieldSubscriptions :: new( ) ) ,
3938 Box :: new( KnownTypeNames :: new( ) ) ,
4039 Box :: new( FragmentsOnCompositeTypes :: new( ) ) ,
4140 Box :: new( VariablesAreInputTypes :: new( ) ) ,
@@ -69,12 +68,6 @@ pub enum ComplexityError {
6968 CyclicalFragment ( String ) ,
7069}
7170
72- #[ derive( Copy , Clone ) ]
73- enum Kind {
74- Query ,
75- Subscription ,
76- }
77-
7871/// Helper to log the fields in a `SelectionSet` without cloning. Writes
7972/// a list of field names from the selection set separated by ';'. Using
8073/// ';' as a separator makes parsing the log a little easier since slog
@@ -130,8 +123,6 @@ pub struct Query {
130123
131124 start : Instant ,
132125
133- kind : Kind ,
134-
135126 /// Used only for logging; if logging is configured off, these will
136127 /// have dummy values
137128 pub query_text : Arc < String > ,
@@ -226,14 +217,14 @@ impl Query {
226217 let operation = operation. ok_or ( QueryExecutionError :: OperationNameRequired ) ?;
227218
228219 let variables = coerce_variables ( schema. as_ref ( ) , & operation, query. variables ) ?;
229- let ( kind, selection_set) = match operation {
230- q:: OperationDefinition :: Query ( q:: Query { selection_set, .. } ) => {
231- ( Kind :: Query , selection_set)
232- }
220+ let selection_set = match operation {
221+ q:: OperationDefinition :: Query ( q:: Query { selection_set, .. } ) => selection_set,
233222 // Queries can be run by just sending a selection set
234- q:: OperationDefinition :: SelectionSet ( selection_set) => ( Kind :: Query , selection_set) ,
235- q:: OperationDefinition :: Subscription ( q:: Subscription { selection_set, .. } ) => {
236- ( Kind :: Subscription , selection_set)
223+ q:: OperationDefinition :: SelectionSet ( selection_set) => selection_set,
224+ q:: OperationDefinition :: Subscription ( _) => {
225+ return Err ( vec ! [ QueryExecutionError :: NotSupported (
226+ "Subscriptions are not supported" . to_owned( ) ,
227+ ) ] )
237228 }
238229 q:: OperationDefinition :: Mutation ( _) => {
239230 return Err ( vec ! [ QueryExecutionError :: NotSupported (
@@ -243,10 +234,8 @@ impl Query {
243234 } ;
244235
245236 let start = Instant :: now ( ) ;
246- let root_type = match kind {
247- Kind :: Query => schema. query_type . as_ref ( ) ,
248- Kind :: Subscription => schema. subscription_type . as_ref ( ) . unwrap ( ) ,
249- } ;
237+ let root_type = schema. query_type . as_ref ( ) ;
238+
250239 // Use an intermediate struct so we can modify the query before
251240 // enclosing it in an Arc
252241 let raw_query = RawQuery {
@@ -269,7 +258,6 @@ impl Query {
269258 schema,
270259 selection_set : Arc :: new ( selection_set) ,
271260 shape_hash : query. shape_hash ,
272- kind,
273261 network,
274262 logger,
275263 start,
@@ -345,23 +333,6 @@ impl Query {
345333 Ok ( bcs)
346334 }
347335
348- /// Return `true` if this is a query, and not a subscription or
349- /// mutation
350- pub fn is_query ( & self ) -> bool {
351- match self . kind {
352- Kind :: Query => true ,
353- Kind :: Subscription => false ,
354- }
355- }
356-
357- /// Return `true` if this is a subscription, not a query or a mutation
358- pub fn is_subscription ( & self ) -> bool {
359- match self . kind {
360- Kind :: Subscription => true ,
361- Kind :: Query => false ,
362- }
363- }
364-
365336 /// Log details about the overall execution of the query
366337 pub fn log_execution ( & self , block : BlockNumber ) {
367338 if ENV_VARS . log_gql_timing ( ) {
0 commit comments