28 #include <MemoryX/interface/core/EntityBase.h>
29 #include <MemoryX/interface/core/GridFileInterface.h>
30 #include <MemoryX/interface/components/CommonStorageInterface.h>
68 GridFileManager(
const CommonStorageInterfacePrx& databasePrx,
const std::string& cachePath);
85 bool getFileStream(GridFileInterfacePrx& filePrx, std::ifstream& fs);
95 bool getFileStream(
const EntityAttributeBasePtr& fileAttr, std::ifstream& fs);
109 bool ensureFileInCache(GridFileInterfacePrx& filePrx, std::string& cacheFileName,
110 bool preserveOriginalName =
false);
124 bool ensureFileInCache(
const EntityAttributeBasePtr& fileAttr, std::string& cacheFileName,
125 bool preserveOriginalName =
false);
139 bool ensureFilesInCache(
const EntityAttributeBasePtr& fileAttr, std::vector<std::string>& cacheFileNames,
bool preserveOriginalNames =
false);
152 bool ensureFilesInCache(
const EntityAttributeBasePtr& fileAttr,
bool preserveOriginalNames =
false);
165 std::string
storeFileToAttr(
const std::string& filesDBName,
const std::string& localFileName,
166 EntityAttributeBasePtr& fileAttr,
const std::string& gridFSName =
"");
179 std::string
addFileToAttr(
const std::string& filesDBName,
const std::string& localFileName,
180 EntityAttributeBasePtr& fileAttr,
const std::string& gridFSName =
"");
192 bool storeDirectoryToAttr(
const std::string& filesDBName,
const std::string& localDirectoryName,
193 EntityAttributeBasePtr& fileAttr, std::string excludeFilter =
".svn");
208 const std::string& localBaseDirectoryName,
209 const std::vector<std::string>& localFiles,
210 EntityAttributeBasePtr& fileAttr);
212 bool removeAttrFile(
const EntityAttributeBasePtr& fileAttr,
unsigned int fileIndex);
238 void init(std::string cachePath);
240 std::filesystem::path fileCachePath;
241 CommonStorageInterfacePrx databasePrx;
243 GridFileInterfacePrx getFileProxyFromAttr(
const AttributeBasePtr& attr)
const;
244 GridFileList getFileProxiesFromAttr(
const AttributeBasePtr& attr)
const;
246 MongoDBRefPtr extractMongoDBRef(
const AttributeBasePtr& attr)
const;
249 std::string makeRelativePath(
const std::filesystem::path& directory,
const std::filesystem::path& basePath);