|
|
@@ -96,6 +96,16 @@ struct FileInfo {
|
|
|
std::map<std::string, std::string> metadata;
|
|
|
};
|
|
|
|
|
|
+// A read-only projection over a collection, enforced by the server. Querying the
|
|
|
+// view by name returns only the included fields, so the database never ships the
|
|
|
+// rest over the wire (upstream >= 2.4).
|
|
|
+struct ViewInfo {
|
|
|
+ std::string name;
|
|
|
+ std::string collection;
|
|
|
+ std::vector<std::string> include;
|
|
|
+ std::vector<std::string> exclude;
|
|
|
+};
|
|
|
+
|
|
|
// Adapter over smartbotic::database::Client. Public surface unchanged from the
|
|
|
// pre-1.0 internal-DB version; PIMPL hides the upstream client.
|
|
|
class StorageClient {
|
|
|
@@ -151,6 +161,17 @@ public:
|
|
|
int32_t limit = 100,
|
|
|
int32_t offset = 0);
|
|
|
|
|
|
+ // Views. Unlike QueryOptions::fields, which the adapter applies after the
|
|
|
+ // documents arrive, a view projects server-side.
|
|
|
+ common::Result<void> createView(const std::string& name,
|
|
|
+ const std::string& collection,
|
|
|
+ const std::vector<std::string>& include,
|
|
|
+ const std::vector<std::string>& exclude = {});
|
|
|
+
|
|
|
+ common::Result<void> dropView(const std::string& name);
|
|
|
+
|
|
|
+ std::vector<ViewInfo> listViews();
|
|
|
+
|
|
|
// File store. Kept separate from documents: images and other binaries do not
|
|
|
// belong inline in a document, and upstream deduplicates by checksum.
|
|
|
common::Result<FileUploadInfo> uploadFile(const std::vector<uint8_t>& data,
|