Class: Google::Cloud::Firestore::QueryListener
- Inherits:
-
Object
- Object
- Google::Cloud::Firestore::QueryListener
- Includes:
- MonitorMixin
- Defined in:
- lib/google/cloud/firestore/query_listener.rb
Overview
QueryListener
An ongoing listen operation on a query. This is returned by calling Google::Cloud::Firestore::Query#listen.
Instance Method Summary collapse
-
#last_error ⇒ Exception?
The most recent unhandled error to occur while listening for changes.
-
#on_error {|callback| ... } ⇒ Object
Register to be notified of errors when raised.
-
#stop ⇒ Object
Stops the client listening for changes.
-
#stopped? ⇒ Boolean
Whether the client has stopped listening for changes.
Instance Method Details
#last_error ⇒ Exception?
The most recent unhandled error to occur while listening for changes.
If an unhandled error has occurred the listener will attempt to recover from the error and resume listening.
184 185 186 |
# File 'lib/google/cloud/firestore/query_listener.rb', line 184 def last_error synchronize { @last_error } end |
#on_error {|callback| ... } ⇒ Object
Register to be notified of errors when raised.
If an unhandled error has occurred the listener will attempt to recover from the error and resume listening.
Multiple error handlers can be added.
152 153 154 155 |
# File 'lib/google/cloud/firestore/query_listener.rb', line 152 def on_error &block raise ArgumentError, "on_error must be called with a block" unless block_given? synchronize { @error_callbacks << block } end |
#stop ⇒ Object
Stops the client listening for changes.
87 88 89 |
# File 'lib/google/cloud/firestore/query_listener.rb', line 87 def stop @listener.stop end |
#stopped? ⇒ Boolean
Whether the client has stopped listening for changes.
116 117 118 |
# File 'lib/google/cloud/firestore/query_listener.rb', line 116 def stopped? @listener.stopped? end |