Ditto 3.0.11
|
These objects are returned when calling collections()
on Store
objects.
More...
#include <PendingCollectionsOperation.hpp>
Public Member Functions | |
PendingCollectionsOperation & | limit (uint32_t limit) |
Limit the number of collections that get returned. | |
PendingCollectionsOperation & | offset (uint32_t offset) |
Offset the resulting set of collections. | |
PendingCollectionsOperation & | sort (std::string query, SortDirection direction) |
Sort the collections based on a property of the collection. | |
std::vector< Collection > | exec () const |
Return the list of collections requested based on the preceding function chaining. | |
std::shared_ptr< Subscription > | subscribe () const |
Subscribes the device to updates about collections that other devices know about. | |
std::shared_ptr< LiveQuery > | observe_local (CollectionsEventCallback event_callback) const |
Enables you to listen for changes that occur in relation to the collections that are known about locally. | |
std::shared_ptr< LiveQuery > | observe_local_with_next_signal (CollectionsEventWithNextSignalCallback event_callback) const |
Enables you to listen for changes that occur in relation to the collections that are known about locally. You can signal when you are ready for the next event to be delivered. | |
These objects are returned when calling collections()
on Store
objects.
They allow chaining of further collections-related functions. You can either call exec on the object to get an array of Collection
s as an immediate return value, or you can establish either a live query or a subscription, which both work over time.
A live query, established by calling observe_local, will notify you every time there's a change in the collections that the device knows about.
A subscription, established by calling subscribe, will act as a signal to other peers that the device connects to that you would like to receive updates from them about the collections that they know about.
If you want to observe changes in such a way that you can signal when you're ready for the live query to deliver a new update then you can call observe_local_with_next_signal.
std::vector< Collection > ditto::PendingCollectionsOperation::exec | ( | ) | const |
Return the list of collections requested based on the preceding function chaining.
Collection
s based on the preceding function chaining. PendingCollectionsOperation & ditto::PendingCollectionsOperation::limit | ( | uint32_t | limit | ) |
Limit the number of collections that get returned.
[in] | limit | the maximum number of collections that will be returned. |
std::shared_ptr< LiveQuery > ditto::PendingCollectionsOperation::observe_local | ( | CollectionsEventCallback | event_callback | ) | const |
Enables you to listen for changes that occur in relation to the collections that are known about locally.
The returned LiveQuery
object must be kept in scope for as long as you want the provided handler
to be called when an update occurs.
[in] | event_callback | a lambda that will be called every time there is an update about the list of known about collections. |
LiveQuery
object that must be kept in scope for as long as you want to keep receiving updates. std::shared_ptr< LiveQuery > ditto::PendingCollectionsOperation::observe_local_with_next_signal | ( | CollectionsEventWithNextSignalCallback | event_callback | ) | const |
Enables you to listen for changes that occur in relation to the collections that are known about locally. You can signal when you are ready for the next event to be delivered.
The returned LiveQuery
object must be kept in scope for as long as you want the provided handler
to be called when an update occurs.
[in] | event_callback | a lambda that will be called every time there is an update about the list of known about collections. |
LiveQuery
object that must be kept in scope for as long as you want to keep receiving updates. PendingCollectionsOperation & ditto::PendingCollectionsOperation::offset | ( | uint32_t | offset | ) |
Offset the resulting set of collections.
This is useful if you aren't interested in the first N collections for one reason or another. For example, you might already have obtained the first 20 collections and so you might want to get the next 20 collections, and that is when you would use offset.
[in] | offset | the number of collections that you want the eventual resulting set of collections to be offset by (and thus not include). |
PendingCollectionsOperation
that you can chain further function calls to. PendingCollectionsOperation & ditto::PendingCollectionsOperation::sort | ( | std::string | query, |
SortDirection | direction | ||
) |
Sort the collections based on a property of the collection.
[in] | query | the query specifies the logic to be used when sorting the collections. |
[in] | direction | specify whether you want the sorting order to be ascending or descending. |
PendingCollectionsOperation
that you can chain further function calls to. std::shared_ptr< Subscription > ditto::PendingCollectionsOperation::subscribe | ( | ) | const |
Subscribes the device to updates about collections that other devices know about.
The returned Subscription
object must be kept in scope for as long as you want to keep receiving updates.
Subscription
object that must be kept in scope for as long as you want to keep receiving updates from other devices about the collections that they know about.