19 const std::string& exportName,
21 const std::shared_ptr<Processors>& filters) :
23 DiskMemoryItemMixin(p, exportName, id),
24 MongoDBStorageMixin(
s, exportName, id)
52 auto& dictConverter =
processors->defaultObjectConverter;
60 std::string dataFilename = (
DATA_FILENAME + dictConverter.suffix);
62 std::filesystem::path dataPath =
getFullPath() / dataFilename;
63 std::filesystem::path metadataPath =
getFullPath() / metadataFilename;
69 auto dataaron = dictConverter.convert({datafilecontent,
""}, {});
74 ARMARX_ERROR <<
"Could not find the data file '" << dataPath.string()
75 <<
"'. Continuing without data.";
82 auto metadataaron = dictConverter.convert({metadatafilecontent,
""}, {});
87 ARMARX_ERROR <<
"Could not find the metadata file '" << metadataPath.string()
88 <<
"'. Continuing without metadata.";
94 for (
const auto& [key, m] : datadict->getElements())
101 for (
const auto& filepath : allFilesInIndexFolder)
106 std::string mode = simox::alg::remove_suffix(
107 simox::alg::remove_prefix(filepath.filename(), key), f->suffix);
110 auto memberaron = f->convert(
111 {memberfilecontent, mode},
113 datadict->setElement(key, memberaron);
127 if (
id().instanceIndex < 0)
130 <<
"During storage of segment '" << e.
id().
str()
131 <<
"' I noticed that the corresponding LTM has no id set. "
132 <<
"I set the id of the LTM to the same name, however this should not happen!";
136 auto& dictConverter =
processors->defaultObjectConverter;
147 auto dataAron = std::make_shared<aron::data::Dict>();
148 auto metadataAron = std::make_shared<aron::data::Dict>();
149 to_aron(metadataAron, dataAron, e);
151 std::shared_ptr<aron::data::Dict>
source;
153 bool saveAndExtract =
false;
159 source = dataAron->clone();
174 auto dataExt =
c->extractor->extract(
source);
176 for (
const auto& [memberName, var] : dataExt.extraction)
180 auto [memberDataVec, memberDataModeSuffix] =
c->convert(var);
182 std::string
filename = (memberName + memberDataModeSuffix +
c->suffix);
190 auto [dataVec, dataVecModeSuffix] = dictConverter.convert(dataAron);
191 auto [metadataVec, metadataVecModeSuffix] = dictConverter.convert(metadataAron);
195 auto dataToReturn = nlohmann::json::parse(std::string(dataVec.begin(), dataVec.end()));
198 std::string dataFilename = (
DATA_FILENAME + dictConverter.suffix);
200 std::filesystem::path dataPath =
getFullPath() / dataFilename;
201 std::filesystem::path metadataPath =
getFullPath() / metadataFilename;