Skip to content

Commit b10d205

Browse files
committed
Constructor/Flush callbacks. Fix merging of key parts
1 parent 1d6857d commit b10d205

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/fdb5/remote/server/StoreHandler.cc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ using metkit::mars::MarsRequest;
2121
namespace fdb5::remote {
2222

2323
StoreHandler::StoreHandler(eckit::net::TCPSocket& socket, const Config& config):
24-
ServerConnection(socket, config) {}
24+
ServerConnection(socket, config) {
25+
LibFdb5::instance().constructorCallback()(*this);
26+
}
2527

2628
StoreHandler::~StoreHandler() {}
2729

@@ -174,8 +176,11 @@ void StoreHandler::archiveBlob(const uint32_t clientID, const uint32_t requestID
174176
std::promise<std::shared_ptr<const FieldLocation>> promise;
175177
promise.set_value(location);
176178

177-
Key fullkey = Key::parseString(ss_key.str());
178-
archiveCallback_(fullkey, data, length, promise.get_future());
179+
eckit::StringDict dict = dbKey.keyDict();
180+
dict.insert(idxKey.keyDict().begin(), idxKey.keyDict().end());
181+
const Key fullkey(dict); /// @note: we do not have the third level of the key.
182+
183+
archiveCallback_(fullkey, charData + s.position(), length - s.position(), promise.get_future());
179184

180185
Log::status() << "Archiving done: " << ss_key.str() << std::endl;
181186

@@ -203,6 +208,8 @@ void StoreHandler::flush(uint32_t clientID, uint32_t requestID, const eckit::Buf
203208
auto it = stores_.find(clientID);
204209
ASSERT(it != stores_.end());
205210
it->second.store->flush();
211+
212+
flushCallback_();
206213
}
207214

208215
Log::info() << "Flush complete" << std::endl;

0 commit comments

Comments
 (0)