Skip to content

Commit

Permalink
Merge branch 'hotfix/5.13.1' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Sep 16, 2024
2 parents eeee27b + 3330451 commit f52bf03
Show file tree
Hide file tree
Showing 25 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.13.0
5.13.1
4 changes: 2 additions & 2 deletions src/fdb5/api/helpers/Callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ namespace fdb5 {

class FDB;

using ArchiveCallback = std::function<void(const Key& key, const void* data, size_t length, std::future<std::shared_ptr<FieldLocation>>)>;
using ArchiveCallback = std::function<void(const Key& key, const void* data, size_t length, std::future<std::shared_ptr<const FieldLocation>>)>;
using FlushCallback = std::function<void()>;
using ConstructorCallback = std::function<void(FDB&)>;

static const ArchiveCallback CALLBACK_NOOP = [](const Key& key, const void* data, size_t length, std::future<std::shared_ptr<FieldLocation>>) {};
static const ArchiveCallback CALLBACK_NOOP = [](const Key& key, const void* data, size_t length, std::future<std::shared_ptr<const FieldLocation>>) {};
static const FlushCallback CALLBACK_FLUSH_NOOP = []() {};
static const ConstructorCallback CALLBACK_CONSTRUCTOR_NOOP = [](FDB&) {};

Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/daos/DaosCatalogueWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const Index& DaosCatalogueWriter::currentIndex() {
/// @todo: other writers may be simultaneously updating the axes KeyValues in DAOS. Should these
/// new updates be retrieved and put into in-memory axes from time to time, e.g. every
/// time a value is put in an axis KeyValue?
void DaosCatalogueWriter::archive(const Key& key, std::shared_ptr<FieldLocation> fieldLocation) {
void DaosCatalogueWriter::archive(const Key& key, std::shared_ptr<const FieldLocation> fieldLocation) {

if (current_.null()) {
ASSERT(!currentIndexKey_.empty());
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/daos/DaosCatalogueWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DaosCatalogueWriter : public DaosCatalogue, public CatalogueWriter {
void clean() override;
void close() override;

void archive(const Key& key, std::shared_ptr<FieldLocation> fieldLocation) override;
void archive(const Key& key, std::shared_ptr<const FieldLocation> fieldLocation) override;

virtual void print( std::ostream &out ) const override { NOTIMP; }

Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/daos/DaosFieldLocation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ DaosFieldLocation::DaosFieldLocation(const eckit::URI &uri, eckit::Offset offset
DaosFieldLocation::DaosFieldLocation(eckit::Stream& s) :
FieldLocation(s) {}

std::shared_ptr<FieldLocation> DaosFieldLocation::make_shared() const {
std::shared_ptr<const FieldLocation> DaosFieldLocation::make_shared() const {
return std::make_shared<DaosFieldLocation>(std::move(*this));
}

Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/daos/DaosFieldLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DaosFieldLocation : public FieldLocation {

eckit::DataHandle* dataHandle() const override;

virtual std::shared_ptr<FieldLocation> make_shared() const override;
virtual std::shared_ptr<const FieldLocation> make_shared() const override;

virtual void visit(FieldLocationVisitor& visitor) const override;

Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/daos/DaosLazyFieldLocation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DaosLazyFieldLocation::DaosLazyFieldLocation(const fdb5::DaosLazyFieldLocation&
DaosLazyFieldLocation::DaosLazyFieldLocation(const fdb5::DaosKeyValueName& index, const std::string& key) :
FieldLocation(), index_(index), key_(key) {}

std::shared_ptr<FieldLocation> DaosLazyFieldLocation::make_shared() const {
std::shared_ptr<const FieldLocation> DaosLazyFieldLocation::make_shared() const {
return std::make_shared<DaosLazyFieldLocation>(std::move(*this));
}

Expand All @@ -42,7 +42,7 @@ void DaosLazyFieldLocation::visit(FieldLocationVisitor& visitor) const {
realise()->visit(visitor);
}

std::shared_ptr<FieldLocation> DaosLazyFieldLocation::stableLocation() const {
std::shared_ptr<const FieldLocation> DaosLazyFieldLocation::stableLocation() const {
return realise()->make_shared();
}

Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/daos/DaosLazyFieldLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class DaosLazyFieldLocation : public FieldLocation {

eckit::DataHandle* dataHandle() const override;

virtual std::shared_ptr<FieldLocation> make_shared() const override;
virtual std::shared_ptr<const FieldLocation> make_shared() const override;

virtual void visit(FieldLocationVisitor& visitor) const override;

virtual std::shared_ptr<FieldLocation> stableLocation() const override;
virtual std::shared_ptr<const FieldLocation> stableLocation() const override;

private: // methods

Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/database/Catalogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class CatalogueReader {
class CatalogueWriter {
public:
virtual const Index& currentIndex() = 0;
virtual void archive(const Key& key, std::shared_ptr<FieldLocation> fieldLocation) = 0;
virtual void archive(const Key& key, std::shared_ptr<const FieldLocation> fieldLocation) = 0;
virtual void overlayDB(const Catalogue& otherCatalogue, const std::set<std::string>& variableKeys, bool unmount) = 0;
virtual void index(const Key& key, const eckit::URI& uri, eckit::Offset offset, eckit::Length length) = 0;
virtual void reconsolidate() = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/database/DB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ void DB::archive(const Key& key, const void* data, eckit::Length length, const K

const Index& idx = cat->currentIndex();

std::shared_ptr<FieldLocation> location(store().archive(idx.key(), data, length));
std::shared_ptr<const FieldLocation> location(store().archive(idx.key(), data, length));

// In anticipaton of store().archive() working asynchronously in later FDB versions.
std::promise<std::shared_ptr<FieldLocation>> promise;
std::promise<std::shared_ptr<const FieldLocation>> promise;
promise.set_value(location);

callback(field, data, length, promise.get_future());
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/database/Field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace fdb5 {

Field::Field() {}

Field::Field(std::shared_ptr<FieldLocation> location, time_t timestamp, const FieldDetails& details):
Field::Field(std::shared_ptr<const FieldLocation> location, time_t timestamp, const FieldDetails& details):
location_(std::move(location)),
timestamp_(timestamp),
details_(details) {
Expand Down
6 changes: 3 additions & 3 deletions src/fdb5/database/Field.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Field {

Field();

Field(std::shared_ptr<FieldLocation> location, time_t timestamp, const FieldDetails& details = FieldDetails());
Field(std::shared_ptr<const FieldLocation> location, time_t timestamp, const FieldDetails& details = FieldDetails());
Field(const FieldLocation&& location, time_t timestamp, const FieldDetails& details = FieldDetails());

eckit::DataHandle* dataHandle() const { return location_->dataHandle(); }
Expand All @@ -54,14 +54,14 @@ class Field {

/// stableLocation is an object with validity that extends longer than that of the
/// owning DB. May need converting to a more static form --- or not.
std::shared_ptr<FieldLocation> stableLocation() const {
std::shared_ptr<const FieldLocation> stableLocation() const {
return location_->stableLocation();
}
const FieldDetails& details() const { return details_; }

private: // members

std::shared_ptr<FieldLocation> location_;
std::shared_ptr<const FieldLocation> location_;

time_t timestamp_;

Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/database/FieldLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class FieldLocation : public eckit::OwnedLock, public eckit::Streamable {
virtual eckit::DataHandle *dataHandle() const = 0;

/// Create a (shared) copy of the current object, for storage in a general container.
virtual std::shared_ptr<FieldLocation> make_shared() const = 0;
virtual std::shared_ptr<const FieldLocation> make_shared() const = 0;

virtual std::shared_ptr<FieldLocation> stableLocation() const { return make_shared(); }
virtual std::shared_ptr<const FieldLocation> stableLocation() const { return make_shared(); }

virtual void visit(FieldLocationVisitor& visitor) const = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/pmem/PMemFieldLocation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ PMemFieldLocation::PMemFieldLocation(const ::pmem::PersistentPtr<PDataNode>& dat
dataPool_(pool) {}


std::shared_ptr<FieldLocation> PMemFieldLocation::make_shared() const {
std::shared_ptr<const FieldLocation> PMemFieldLocation::make_shared() const {
return std::make_shared<PMemFieldLocation>(*this);
}

std::shared_ptr<FieldLocation> PMemFieldLocation::stableLocation() const {
std::shared_ptr<const FieldLocation> PMemFieldLocation::stableLocation() const {
return std::make_shared<TocFieldLocation>(url(), node().offset(), node()->length());
}

Expand Down
4 changes: 2 additions & 2 deletions src/fdb5/pmem/PMemFieldLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class PMemFieldLocation : public FieldLocation {
virtual eckit::DataHandle *dataHandle() const;
virtual eckit::DataHandle *dataHandle(const Key& remapKey) const;

virtual std::shared_ptr<FieldLocation> make_shared() const;
virtual std::shared_ptr<const FieldLocation> make_shared() const;

// The PMemFieldLocation only has validity equal to that of the PMemDB.
// This is a problem with any async API functions.
// --> For visibility purposes return something more stable (currently a
// TocFieldLocation....)
virtual std::shared_ptr<FieldLocation> stableLocation() const;
virtual std::shared_ptr<const FieldLocation> stableLocation() const;

virtual void visit(FieldLocationVisitor& visitor) const;

Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/rados/RadosFieldLocation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RadosFieldLocation::RadosFieldLocation(eckit::Stream& s) :
FieldLocation(s) {}


std::shared_ptr<FieldLocation> RadosFieldLocation::make_shared() const {
std::shared_ptr<const FieldLocation> RadosFieldLocation::make_shared() const {
return std::make_shared<RadosFieldLocation>(std::move(*this));
}

Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/rados/RadosFieldLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class RadosFieldLocation : public FieldLocation {

// eckit::URI uri() const override;

virtual std::shared_ptr<FieldLocation> make_shared() const override;
virtual std::shared_ptr<const FieldLocation> make_shared() const override;

virtual void visit(FieldLocationVisitor& visitor) const override;

Expand Down
8 changes: 4 additions & 4 deletions src/fdb5/remote/RemoteFieldLocation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ RemoteFieldLocation::RemoteFieldLocation(RemoteFDB* remoteFDB, const FieldLocati

RemoteFieldLocation::RemoteFieldLocation(const eckit::URI& uri) :
FieldLocation(eckit::URI("fdb://" + uri.hostport())),
internal_(std::shared_ptr<FieldLocation>(FieldLocationFactory::instance().build(uri.scheme(), uri))) {}
internal_(std::shared_ptr<const FieldLocation>(FieldLocationFactory::instance().build(uri.scheme(), uri))) {}

RemoteFieldLocation::RemoteFieldLocation(const eckit::URI& uri, const eckit::Offset& offset, const eckit::Length& length, const Key& remapKey) :
FieldLocation(eckit::URI("fdb://" + uri.hostport())),
internal_(std::shared_ptr<FieldLocation>(FieldLocationFactory::instance().build(uri.scheme(), uri, offset, length, remapKey))) {}
internal_(std::shared_ptr<const FieldLocation>(FieldLocationFactory::instance().build(uri.scheme(), uri, offset, length, remapKey))) {}

RemoteFieldLocation::RemoteFieldLocation(eckit::Stream& s) :
FieldLocation(s),
internal_(std::shared_ptr<FieldLocation>(eckit::Reanimator<FieldLocation>::reanimate(s))) {}
internal_(std::shared_ptr<const FieldLocation>(eckit::Reanimator<FieldLocation>::reanimate(s))) {}

RemoteFieldLocation::RemoteFieldLocation(const RemoteFieldLocation& rhs) :
FieldLocation(rhs.uri_),
remoteFDB_(rhs.remoteFDB_),
internal_(rhs.internal_) {}


std::shared_ptr<FieldLocation> RemoteFieldLocation::make_shared() const {
std::shared_ptr<const FieldLocation> RemoteFieldLocation::make_shared() const {
return std::make_shared<RemoteFieldLocation>(std::move(*this));
}

Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/remote/RemoteFieldLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RemoteFieldLocation : public FieldLocation {

virtual eckit::DataHandle *dataHandle() const override;

virtual std::shared_ptr<FieldLocation> make_shared() const override;
virtual std::shared_ptr<const FieldLocation> make_shared() const override;
virtual void visit(FieldLocationVisitor& visitor) const override;

public: // For Streamable
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/toc/TocCatalogueWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ bool TocCatalogueWriter::enabled(const ControlIdentifier& controlIdentifier) con
return TocCatalogue::enabled(controlIdentifier);
}

void TocCatalogueWriter::archive(const Key& key, std::shared_ptr<FieldLocation> fieldLocation) {
void TocCatalogueWriter::archive(const Key& key, std::shared_ptr<const FieldLocation> fieldLocation) {
dirty_ = true;

if (current_.null()) {
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/toc/TocCatalogueWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class TocCatalogueWriter : public TocCatalogue, public CatalogueWriter {
void clean() override;
void close() override;

void archive(const Key& key, std::shared_ptr<FieldLocation> fieldLocation) override;
void archive(const Key& key, std::shared_ptr<const FieldLocation> fieldLocation) override;
void reconsolidateIndexesAndTocs();

virtual void print( std::ostream &out ) const override;
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/toc/TocFieldLocation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ TocFieldLocation::TocFieldLocation(const UriStore &store, const FieldRef &ref) :
TocFieldLocation::TocFieldLocation(eckit::Stream& s) :
FieldLocation(s) {}

std::shared_ptr<FieldLocation> TocFieldLocation::make_shared() const {
std::shared_ptr<const FieldLocation> TocFieldLocation::make_shared() const {
return std::make_shared<TocFieldLocation>(std::move(*this));
}

Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/toc/TocFieldLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class TocFieldLocation : public FieldLocation {

eckit::DataHandle* dataHandle() const override;

virtual std::shared_ptr<FieldLocation> make_shared() const override;
virtual std::shared_ptr<const FieldLocation> make_shared() const override;

virtual void visit(FieldLocationVisitor& visitor) const override;

Expand Down
4 changes: 2 additions & 2 deletions tests/fdb/api/test_auxiliary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ eckit::PathName writeAuxiliaryData(const eckit::PathName datapath, const std::st
std::set<eckit::PathName> setup(FDB& fdb) {
// Setup: Write data, generating auxiliary files using the archive callback
std::set<eckit::PathName> auxPaths;
fdb.registerArchiveCallback([&auxPaths] (const Key& key, const void* data, size_t length, std::future<std::shared_ptr<FieldLocation>> future) {
std::shared_ptr<FieldLocation> location = future.get();
fdb.registerArchiveCallback([&auxPaths] (const Key& key, const void* data, size_t length, std::future<std::shared_ptr<const FieldLocation>> future) {
std::shared_ptr<const FieldLocation> location = future.get();
for (const auto& ext : extensions) {
auxPaths.insert(writeAuxiliaryData(location->uri().path(), ext));
}
Expand Down
4 changes: 2 additions & 2 deletions tests/fdb/api/test_callback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ CASE("Archive and flush callback") {
std::vector<Key> keys;
bool flushCalled = false;

fdb.registerArchiveCallback([&map] (const Key& key, const void* data, size_t length, std::future<std::shared_ptr<FieldLocation>> future) {
std::shared_ptr<FieldLocation> location = future.get();
fdb.registerArchiveCallback([&map] (const Key& key, const void* data, size_t length, std::future<std::shared_ptr<const FieldLocation>> future) {
std::shared_ptr<const FieldLocation> location = future.get();
map[key] = location->fullUri();
});

Expand Down

0 comments on commit f52bf03

Please sign in to comment.