diff --git a/src/fdb5/api/FDB.cc b/src/fdb5/api/FDB.cc index 54f1dd3c2..ec5059960 100644 --- a/src/fdb5/api/FDB.cc +++ b/src/fdb5/api/FDB.cc @@ -29,6 +29,7 @@ #include "fdb5/database/Key.h" #include "fdb5/io/HandleGatherer.h" #include "fdb5/message/MessageDecoder.h" +#include "fdb5/types/Type.h" namespace fdb5 { @@ -100,33 +101,24 @@ void FDB::archive(const Key& key, const void* data, size_t length) { eckit::Timer timer; timer.start(); -<<<<<<< HEAD - auto stepunit = key.find("stepunits"); - if (stepunit != key.end()) { - Key k; - for (auto it : key) { - if (it.first == "step" && stepunit->second.size()>0 && stepunit->second[0]!='h') { - // TODO - enable canonical representation of step (as soon as Metkit supports it) - std::string canonicalStep = it.second+stepunit->second; // k.registry().lookupType("step").toKey("step", it.second+stepunit->second); - k.set(it.first, canonicalStep); - } else { - if (it.first != "stepunits") { - k.set(it.first, it.second); - } - } - } - internal_->archive(k, data, length); - } else { - internal_->archive(key, data, length); - } -======= // This is the API entrypoint. Keys supplied by the user may not have type registry info attached (so // serialisation won't work properly...) Key keyInternal(key); keyInternal.registry(config().schema().registry()); + // step in archival requests from the model is just an integer. We need to include the stepunit + auto stepunit = keyInternal.find("stepunits"); + if (stepunit != keyInternal.end()) { + if (stepunit->second.size()>0 && stepunit->second[0]!='h') { + auto step = keyInternal.find("step"); + if (step != keyInternal.end()) { + std::string canonicalStep = keyInternal.registry().lookupType("step").toKey("step", step->second+stepunit->second); + } + } + keyInternal.unset("stepunits"); + } + internal_->archive(keyInternal, data, length); ->>>>>>> c062d99a (FDB-303: Remove Rule from the Key, and replace with TypesRegistry information) dirty_ = true; timer.stop();