4#include "Attachment.hpp"
5#include "AttachmentFetchEvent.hpp"
6#include "AttachmentFetcher.hpp"
7#include "AttachmentToken.hpp"
8#include "Collection.hpp"
9#include "DiskUsage.hpp"
11#include "PendingCollectionsOperation.hpp"
12#include "QueryResult.hpp"
13#include "StoreObserver.hpp"
14#include "WriteTransaction.hpp"
15#include "WriteTransactionResult.hpp"
25class DittoHandleWrapper;
38 static bool finalize_attachment_fetcher(
39 std::shared_ptr<AttachmentFetcher>
const &,
40 std::shared_ptr<std::set<std::shared_ptr<AttachmentFetcher>>>
const
41 &attachment_fetchers);
43 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper;
45 Store(std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper);
46 void set_weak_ditto_fields(std::weak_ptr<Ditto::Fields> weak_ditto_fields);
47 std::weak_ptr<Ditto::Fields> weak_ditto_fields;
50 std::shared_ptr<std::mutex> attachment_fetchers_lock;
51 mutable std::shared_ptr<std::set<std::shared_ptr<AttachmentFetcher>>>
54 bool unregister_observer(std::shared_ptr<StoreObserver>);
91 std::vector<std::unique_ptr<WriteTransactionResult>>
138 std::shared_ptr<StoreObserver>
157 std::shared_ptr<StoreObserver>
172 std::shared_ptr<StoreObserver>
190 std::shared_ptr<StoreObserver>
230 std::map<std::string, std::string> metadata =
231 std::map<std::string, std::string>())
const;
263 std::shared_ptr<AttachmentFetcher>
297 std::shared_ptr<AttachmentFetcher>
These objects are returned by calls to Store::fetch_attachment.
Definition AttachmentFetcher.hpp:28
Represents an attachment and can be used to insert the associated attachment into a document at a spe...
Definition Attachment.hpp:22
A reference to a collection in a Store.
Definition Collection.hpp:27
Provides an interface to be able to monitor local files.
Definition DiskUsage.hpp:65
The entrypoint to the Ditto SDK.
Definition Ditto.hpp:32
These objects are returned when calling collections() on Store objects.
Definition PendingCollectionsOperation.hpp:58
Represents the returned results when executing a DQL query, containing a QueryResultItem for each mat...
Definition QueryResult.hpp:104
Provides access to Collections and a write transaction API.
Definition Store.hpp:29
Attachment new_attachment(std::string path, std::map< std::string, std::string > metadata=std::map< std::string, std::string >()) const
Creates a new attachment, which can then be inserted into a document.
Definition Store.cpp:114
DiskUsage get_disk_usage() const
Provides access to the Store's disk usage.
Definition Store.cpp:49
std::vector< std::unique_ptr< WriteTransactionResult > > write(std::function< void(WriteTransaction &)> fn) const
Allows you to group multiple operations together that affect multiple documents, potentially across m...
Definition Store.cpp:52
std::set< std::shared_ptr< AttachmentFetcher > > get_attachment_fetchers() const
Returns a copy of all currently active attachment fetchers.
Definition Store.cpp:190
PendingCollectionsOperation collections() const
Returns an object that lets you fetch or observe the collections in the store.
Definition Store.cpp:45
std::shared_ptr< StoreObserver > register_observer(std::string query, StoreObservationHandler change_handler)
Installs and returns a change observer for a query, configuring Ditto to call the provided change han...
Definition Store.cpp:83
std::set< std::shared_ptr< StoreObserver > > observers
Returns a copy of all currently active store observers.
Definition Store.hpp:62
std::shared_ptr< StoreObserver > register_observer(std::string query, nlohmann::json query_args, StoreObservationHandlerWithNextSignal change_handler)
Installs and returns a change observer for a query, configuring Ditto to call the provided change han...
QueryResult execute(std::string query, nlohmann::json query_args=nullptr)
Executes a DQL query and returns matching items as a query result.
Definition Store.cpp:64
std::shared_ptr< AttachmentFetcher > fetch_attachment(std::shared_ptr< AttachmentToken > token, AttachmentFetcherEventHandler event_handler) const
Trigger an attachment to be downloaded locally to the device and observe its progress as it does so.
Definition Store.cpp:140
Collection collection(std::string name) const
Returns a Collection with the provided name.
Definition Store.cpp:41
std::shared_ptr< StoreObserver > register_observer(std::string query, nlohmann::json query_args, StoreObservationHandler change_handler)
Installs and returns a change observer for a query, configuring Ditto to call the provided in change ...
Definition StoreObserver.hpp:44
WriteTransaction exposes functionality that allows you to perform multiple operations on the store wi...
Definition WriteTransaction.hpp:25
basic_json<> json
default JSON class
Definition json.hpp:2933
A thin wrapper around a function that will get called when there are updates relating to an attempt t...
Definition AttachmentFetcher.hpp:19