Skip to content

Commit

Permalink
Add write once option to toc store to avoid creating very large datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
Toutou98 committed Aug 28, 2024
1 parent 99bb7b4 commit baa146f
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/fdb5/toc/TocStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,30 @@ bool TocStore::exists() const {
eckit::DataHandle* TocStore::retrieve(Field& field) const {
return field.dataHandle();
}

#define write_once
bool written_once = false;
long len = 0;
eckit::Offset position = 0;
std::unique_ptr<FieldLocation> TocStore::archive(const Key &key, const void *data, eckit::Length length) {
dirty_ = true;

eckit::PathName dataPath = getDataPath(key);

eckit::DataHandle &dh = getDataHandle(dataPath);

eckit::Offset position = dh.position();


long len = dh.write( data, length );
#ifdef write_once
// michalis hack
if (written_once == false){
position = dh.position();
len = dh.write( data, length );
written_once = true;
}
#else

eckit::Offset position = dh.position();
#endif

ASSERT(len == length);

Expand Down

0 comments on commit baa146f

Please sign in to comment.