Ditto 5.0.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ditto::StoreObserver Class Reference

Public Member Functions

 StoreObserver (StoreObserver &&)
 
StoreObserveroperator= (StoreObserver &&)
 
 StoreObserver (const StoreObserver &)=delete
 
StoreObserveroperator= (const StoreObserver &)=delete
 
bool operator< (const StoreObserver &other) const
 
void cancel ()
 Cancels the observation. The handler that was passed in when registering this store observer will no longer be called. No-op if this store observer is already cancelled or the owning Ditto object goes out of scope.
 
bool is_cancelled ()
 Convenience property, returns true if the store observer has been cancelled, otherwise returns false. Also, a store observer is considered cancelled if the owning Ditto object goes out of scope.
 
std::string get_query () const
 Returns the query string that was used to create the observer.
 
nlohmann::json get_query_arguments () const
 Returns the query arguments that were used to create the observer.
 
std::vector< uint8_t > get_query_arguments_cbor_data () const
 Returns the query arguments that were used to create the observer, as a CBOR-encoded byte vector.
 
std::string get_query_arguments_json_string () const
 Returns the query arguments that were used to create the observer, as a JSON-encoded string.
 

Detailed Description

A store observer invokes a change handler whenever results for its query change.

Create a store observer by calling Store::register_observer.

Member Function Documentation

◆ get_query_arguments()

nlohmann::json ditto::StoreObserver::get_query_arguments ( ) const

Returns the query arguments that were used to create the observer.

Note
The returned value is not guaranteed to be strictly equal to the value provided when making the call to Store::register_observer, as the arguments will have gone through a serialization roundtrip. This might affect equality checks, particularly for non-primitive values. If you want to have more control over how to deserialize the query arguments then use get_query_arguments_cbor_data or get_query_arguments_json_string.