OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
DocumentManager.h
Go to the documentation of this file.
1#pragma once
2#include <iostream>
3#include <string>
4#include <map>
5#include <vector>
6
8#include "bsoncxx/types/value.hpp"
9#include "bsoncxx/builder/basic/document.hpp"
10#include "bsoncxx/document/view_or_value.hpp"
11
12#pragma warning (disable:4996)
13
14using Document = bsoncxx::builder::basic::document;
15using string = std::string;
16using value = bsoncxx::types::value;
17using BsonViewOrValue = bsoncxx::document::view_or_value;
18
19namespace DataStorageAPI
20{
21 class __declspec(dllexport) DocumentManager
22 {
23 public:
24
25 DataStorageResponse InsertDocumentToDatabase(unsigned long long entityId, int version, string collectionName,
26 Document& jsonData, bool allowQueueing);
27
28 DataStorageResponse InsertDocumentToFileStorage(unsigned long long entityId, int version, string collectionName,
29 Document& fileMetaData, string filePath, bool allowQueueing);
30
31 DataStorageResponse InsertDocumentToFileStorage(unsigned long long entityId, int version, string collectionName, std::ifstream * source,
32 Document& fileMetaData, bool allowQueueing);
33
34 DataStorageResponse InsertDocumentToDatabaseOrFileStorage(unsigned long long entityId, unsigned long long version,
35 string collectionName, Document& jsonData, bool checkForExistence, bool allowQueueing);
36
37 DataStorageResponse GetAllDocument(string collectionName, std::map<string, value> filterPairs, std::vector<string> columnNames,
38 bool includeDocumentId, int limit);
39 DataStorageResponse GetDocument(string collectionName, std::map<string, value> filterPairs, std::vector<string> columnNames,
40 bool includeDocumentId);
41
42 static const int MaxDocumentLength = 16776216;
43
44 private:
45 string GetDocumentLocalFilePath(int siteId, string relativePath);
46 DataStorageResponse CheckDocumentEntityExists(unsigned long long entityId, unsigned long long version, string collectionName);
47 string SaveDocumentToFileStorage(std::ifstream * source);
48 string SaveDocumentToFileStorage(bsoncxx::document::view view, string fileExtension);
49 };
50}
51
bsoncxx::document::view_or_value BsonViewOrValue
Definition DocumentAccess.h:12
std::string string
Definition DocumentAccess.h:13
bsoncxx::builder::basic::document Document
Definition DocumentManager.h:14
bsoncxx::types::value value
Definition DocumentManager.h:16
Definition ArrayBinaryConverter.h:3