Ditto  3.0.4
Store.hpp
1 #ifndef _DITTO_STORE_
2 #define _DITTO_STORE_
3 
4 #include "Collection.hpp"
5 #include "DiskUsage.hpp"
6 #include "PendingCollectionsOperation.hpp"
7 #include "WriteTransaction.hpp"
8 #include "WriteTransactionResult.hpp"
9 
10 #include <functional>
11 #include <memory>
12 #include <string>
13 #include <vector>
14 
15 namespace ditto {
16 class DittoHandleWrapper;
17 
21 class Store {
22  friend class Ditto;
23 
24  std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper;
25  DiskUsage disk_usage;
26  Store(std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper);
27 
28 public:
29  Store();
30 
37  Collection collection(std::string name) const;
38 
48  std::vector<std::unique_ptr<WriteTransactionResult>>
49  write(std::function<void(WriteTransaction &)> fn) const;
50 
59 
65  DiskUsage get_disk_usage() const;
66 };
67 } // namespace ditto
68 #endif
A reference to a collection in a Store.
Definition: Collection.hpp:26
Provides an interface to be able to monitor local files.
Definition: DiskUsage.hpp:65
The entrypoint to the Ditto SDK.
Definition: Ditto.hpp:28
These objects are returned when calling collections() on Store objects.
Definition: PendingCollectionsOperation.hpp:58
Provides access to Collections and a write transaction API.
Definition: Store.hpp:21
DiskUsage get_disk_usage() const
Provides access to the Store's disk usage.
Definition: Store.cpp:26
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:29
PendingCollectionsOperation collections() const
Returns an object that lets you fetch or observe the collections in the store.
Definition: Store.cpp:22
Collection collection(std::string name) const
Returns a Collection with the provided name.
Definition: Store.cpp:18
WriteTransaction exposes functionality that allows you to perform multiple operations on the store wi...
Definition: WriteTransaction.hpp:25