Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
26679af
wip
danovaro Jan 10, 2025
6a3e405
wip
danovaro Jan 13, 2025
91f076d
Merge branch 'develop' into remoteWipeIterator
danovaro Jan 15, 2025
4f48991
Merge branch 'develop' into remoteWipeIterator
danovaro Jan 24, 2025
e1db49e
wip
danovaro Jan 24, 2025
d792902
Merge branch 'develop' into remoteWipeIterator
danovaro Jan 24, 2025
0a7ac2f
Merge branch 'develop' into remoteWipeIterator
danovaro Feb 11, 2025
b18250f
Merge branch 'develop' into remoteWipeIterator
danovaro May 28, 2025
a31be04
wip
danovaro Jun 11, 2025
0ec4821
Merge branch 'develop' into remoteWipeIterator
danovaro Jun 25, 2025
2fca1ef
Merge branch 'develop' into remoteWipeIterator
danovaro Jun 30, 2025
32579fb
wip
danovaro Jul 9, 2025
494321d
wip
danovaro Jul 9, 2025
f90f3e0
Merge branch 'develop' into remoteWipeIterator
danovaro Jul 14, 2025
a00d02b
FDB-508 remote wipe
danovaro Aug 2, 2025
846f3ed
FDB-508 cleanup
danovaro Aug 2, 2025
def603e
FDB-508 committed missing test
danovaro Aug 3, 2025
6788d08
FDB-508 cleanup
danovaro Aug 3, 2025
49cb9bf
FDB-508 wipe: added checks for unexpected files
danovaro Aug 4, 2025
8cfe905
FDB-508 wipe: added checks for unexpected files
danovaro Aug 4, 2025
b3023d0
disabled DAOS tests
danovaro Aug 5, 2025
8103bcc
format
danovaro Aug 5, 2025
6b1bcea
missing include
danovaro Aug 5, 2025
e89e31c
version
danovaro Aug 5, 2025
7e92f92
FDB-508 fix wipe (map of stores & data files)
danovaro Aug 5, 2025
f737567
version
danovaro Aug 5, 2025
0438e94
Merge branch 'develop' into remoteWipeIterator
danovaro Sep 15, 2025
76aff85
Update src/fdb5/api/helpers/WipeIterator.h
simondsmart Sep 24, 2025
8ac4d7d
Merge branch 'develop' into remoteWipeIterator
danovaro Sep 28, 2025
6aa48d3
wip
ChrisspyB Oct 6, 2025
01dac30
wip
ChrisspyB Oct 7, 2025
18f834d
wip
ChrisspyB Oct 14, 2025
9e81642
Move most of the wipe logic logic outside of the visitor
ChrisspyB Oct 14, 2025
ddcc68d
Move wipe logic into WipeCoordinator
ChrisspyB Oct 14, 2025
914ab55
Use WipeState with RemoteFDB
ChrisspyB Oct 19, 2025
41a90a5
Wipe api selectfdb and distfdb
ChrisspyB Oct 19, 2025
59bb4b7
Wipe tidy up
ChrisspyB Oct 20, 2025
0d4ad4a
tidy
ChrisspyB Oct 20, 2025
2c9ad59
Mask indexes, split up dowipe
ChrisspyB Oct 20, 2025
c297270
Update remote comms (wip)
ChrisspyB Oct 20, 2025
bdba7ba
Catalogue signs wipestate (wip)
ChrisspyB Oct 22, 2025
c31d511
Return WipeStateIterator on Wipe API
ChrisspyB Nov 4, 2025
fe35a4e
Tidy WipeState
ChrisspyB Nov 4, 2025
befe491
FDB-508 Reduce use of WipeElements
ChrisspyB Nov 11, 2025
a9be554
FDB-508 Refactor WipeCoordinator::wipe into several functions
ChrisspyB Nov 11, 2025
358dae0
FDB-508 Refactor WipeCoordinator into its own files
ChrisspyB Nov 11, 2025
54aafb6
FDB-508 Update remote wipe to not use wipe elements
ChrisspyB Nov 11, 2025
328c40a
FDB-508 Return wipe elements only on the outer FDB API
ChrisspyB Nov 13, 2025
ad547b3
FDB-508 Refactor and remove redundant code
ChrisspyB Nov 14, 2025
d783fbc
FDB-508 Refactor to reduce copying of URIs
ChrisspyB Nov 17, 2025
36dab9f
FDB-508 Simplify StoreWipeState
ChrisspyB Nov 17, 2025
d55ad01
FDB-508 Send aux and unknown URIs from Store servers
ChrisspyB Nov 18, 2025
f4b9e99
Remove unused headers
ChrisspyB Nov 18, 2025
2f20669
FDB-508 Add MaskIndexEntries
ChrisspyB Nov 18, 2025
7bdd826
FDB-508 Add virtual dtor to WipeState
ChrisspyB Nov 18, 2025
b402724
FDB-508 Remove URIIterator
ChrisspyB Nov 19, 2025
53a16bf
FDB-508 Move URIBelongs logic from wipestate into store/catalogue
ChrisspyB Nov 19, 2025
611eecd
FDB-508 Lock database on wipe when doit=true
ChrisspyB Nov 19, 2025
141d37a
Work around issue serialising uint64
ChrisspyB Dec 1, 2025
d91790b
FDB-508 Use CatalogueWipeState directly instead of a pointer
ChrisspyB Dec 1, 2025
0b10a6f
FDB-508 Use server environment variable to salt wipe hash
ChrisspyB Dec 2, 2025
a292ce3
Merge branch 'develop' into wipe-select
danovaro Dec 2, 2025
252e577
reverted RemoteStore::config_
danovaro Dec 2, 2025
1c499b9
format
danovaro Dec 2, 2025
11c27d8
FDB-508 Tidy up and document
ChrisspyB Dec 2, 2025
d68fb80
disable DistFDB wipe test
danovaro Dec 2, 2025
9c826b1
Merge branch 'wipe-select' into wipe-changes
ChrisspyB Dec 2, 2025
580de82
FDB-508 Add wipe secret to remote test
ChrisspyB Dec 2, 2025
d975a92
FDB-508 Tidy up and document
ChrisspyB Dec 2, 2025
8fa245d
FDB-508 Tidy up and document
ChrisspyB Dec 2, 2025
e96f5bf
FDB-508 Tidy up and document
ChrisspyB Dec 3, 2025
4a0258b
FDB-508 Add missing Wipstate::encode logic
ChrisspyB Dec 4, 2025
c0ba9c4
FDB-508 Remote Wipe: Cache multiple WipeStates at once
ChrisspyB Dec 5, 2025
ccbec81
FDB-508 Extend remote api test to cover wiping of auxiliary files
ChrisspyB Dec 5, 2025
04e0bd7
FDB-508 Fix store not deleting its directory
ChrisspyB Dec 5, 2025
1054d73
FDB-508 Extend remote api test to cover wiping of masked files
ChrisspyB Dec 5, 2025
64757c3
FDB-508 Extend wipe tests to include second-level wipes
ChrisspyB Dec 8, 2025
9ed96bb
FDB-508 (remotefdb) Fix hang on over-specified wipe requests
ChrisspyB Dec 8, 2025
f1f0f2b
FDB-508 Prevent marking URIs for deletion if they were previously mar…
ChrisspyB Dec 9, 2025
1f2437b
FDB-508 Respond to review comments
ChrisspyB Dec 12, 2025
1f0289c
First draft of wipe refactor on DAOS.
nicolau-manubens Jan 8, 2026
7260ecb
Fixes in wipe on DAOS plus updates to DAOS unit tests after wipe refa…
nicolau-manubens Jan 9, 2026
c769ca9
Code formatting.
nicolau-manubens Jan 10, 2026
663a362
Merge branch 'develop' into wipe-changes
danovaro Jan 13, 2026
834ca2f
wip
danovaro Jan 13, 2026
c9d3adc
Merge branch 'develop' into wipe-changes-merge
danovaro Jan 13, 2026
c6cdd59
fix merge
danovaro Jan 13, 2026
643cd83
Improve fdb-wipe error message.
nicolau-manubens Dec 3, 2025
3be36e9
Code format.
nicolau-manubens Dec 3, 2025
e9761e3
Deprecate NonCopyable in favour of explicitly deleted ctors
marcosbento Dec 4, 2025
e282ab7
Fix broken z3fdb wheel
Ozaq Dec 5, 2025
3591542
Add Ubuntu rolling build env container
Ozaq Dec 9, 2025
e2463d6
Merge branch 'wipe-changes-merge' into wipe-changes
danovaro Jan 13, 2026
046ab35
fix merge
danovaro Jan 13, 2026
fd08a83
Merge branch 'wipe-changes' into feature/FDB-614-daos-wipe-refactor
danovaro Jan 13, 2026
b3e13ae
fix merge
danovaro Jan 14, 2026
207e186
format
danovaro Jan 14, 2026
b6ceb1e
Merge pull request #214 from ecmwf/feature/FDB-614-daos-wipe-refactor
ChrisspyB Jan 21, 2026
51e1f9d
FDB-508 minor refactor of fdb wipe internals
ChrisspyB Jan 21, 2026
cb95171
FDB-508 Modify wipe tool tests to test single and separate cat/store …
ChrisspyB Jan 26, 2026
ea166e7
FDB-508 do not report missing URIs on remote wipe
ChrisspyB Jan 26, 2026
61a0211
Merge branch 'develop' into wipe-changes
ChrisspyB Jan 28, 2026
f207c73
FDB-508 throw exception if Store receieves invalid URIs
ChrisspyB Jan 28, 2026
c043de2
FDB-508 Restore catalogue control state after wipe
ChrisspyB Jan 28, 2026
a1f44e2
FDB-508 Add asserts and formatting
ChrisspyB Jan 28, 2026
92774ed
FDB-508 Update wipe api test to count wipe elements
ChrisspyB Jan 30, 2026
a699b2a
FDB-508 Test that selectfdb.wipe fails on matching multiple lanes
ChrisspyB Jan 30, 2026
c9f472a
FDB-508 Minor improvements
ChrisspyB Feb 3, 2026
fe573fa
FDB-508 Fix syscall error when wiping stores with missing directories
ChrisspyB Feb 4, 2026
43c3893
FDB-508 Make WipeState moveable
ChrisspyB Feb 5, 2026
0f7a1c0
Enabling wipe api test with catalogue and store on separate roots. A …
nicolau-manubens Feb 5, 2026
ce91924
Merge branch 'wipe-changes' of https://github.com/ecmwf/fdb into wipe…
nicolau-manubens Feb 5, 2026
e75feaa
FDB-508 Cache ptr to StoreWipeState on StoreHandler
ChrisspyB Feb 5, 2026
2fa8cd4
Merge branch 'develop' into wipe-changes
danovaro Feb 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/dummy_daos/dummy_daos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const PathName& dummy_daos_root() {

static PathName tmpdir = eckit::Resource<PathName>("$TMPDIR", "/tmp");
static PathName daos_root = eckit::Resource<PathName>("$DUMMY_DAOS_DATA_ROOT", tmpdir / "fdb5_dummy_daos");
daos_root = daos_root.realName();
return daos_root;
}

Expand Down
12 changes: 6 additions & 6 deletions src/fdb5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ list( APPEND fdb5_srcs
api/helpers/LockIterator.h
api/helpers/MoveIterator.h
api/helpers/StatusIterator.h
api/helpers/WipeIterator.cc
api/helpers/WipeIterator.h
api/helpers/PurgeIterator.h
api/helpers/StatsIterator.cc
Expand Down Expand Up @@ -112,14 +113,17 @@ list( APPEND fdb5_srcs
database/IndexStats.h
database/Inspector.cc
database/Inspector.h
database/Signature.h
database/StatsReportVisitor.cc
database/StatsReportVisitor.h
database/Store.cc
database/Store.h
database/PurgeVisitor.cc
database/PurgeVisitor.h
database/WipeVisitor.cc
database/WipeVisitor.h
database/WipeCoordinator.cc
database/WipeCoordinator.h
database/WipeState.cc
database/WipeState.h
database/MoveVisitor.cc
database/MoveVisitor.h
database/IndexAxis.cc
Expand Down Expand Up @@ -322,8 +326,6 @@ if( HAVE_TOCFDB )
toc/TocPurgeVisitor.h
toc/TocSerialisationVersion.cc
toc/TocSerialisationVersion.h
toc/TocWipeVisitor.cc
toc/TocWipeVisitor.h
toc/TocMoveVisitor.cc
toc/TocMoveVisitor.h
toc/TocRecord.cc
Expand Down Expand Up @@ -393,8 +395,6 @@ if( HAVE_DAOSFDB )
daos/DaosIndexLocation.cc
daos/DaosCommon.h
daos/DaosCommon.cc
daos/DaosWipeVisitor.h
daos/DaosWipeVisitor.cc
daos/DaosArrayPartHandle.h
daos/DaosArrayPartHandle.cc
daos/DaosLazyFieldLocation.h
Expand Down
8 changes: 4 additions & 4 deletions src/fdb5/api/DistFDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "fdb5/api/helpers/FDBToolRequest.h"
#include "fdb5/api/helpers/ListIterator.h"
#include "fdb5/database/Notifier.h"
#include "fdb5/database/WipeState.h"
#include "fdb5/io/HandleGatherer.h"

using eckit::Log;
Expand Down Expand Up @@ -190,11 +191,10 @@ StatusIterator DistFDB::status(const FDBToolRequest& request) {
return queryInternal(request, [](FDB& fdb, const FDBToolRequest& request) { return fdb.status(request); });
}

WipeIterator DistFDB::wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) {
// DIST FDB WILL BE REMOVED IN A FUTURE UPDATE
WipeStateIterator DistFDB::wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) {
LOG_DEBUG_LIB(LibFdb5) << "DistFDB::wipe() : " << request << std::endl;
return queryInternal(request, [doit, porcelain, unsafeWipeAll](FDB& fdb, const FDBToolRequest& request) {
return fdb.wipe(request, doit, porcelain, unsafeWipeAll);
});
NOTIMP;
}

PurgeIterator DistFDB::purge(const FDBToolRequest& request, bool doit, bool porcelain) {
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/api/DistFDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DistFDB : public FDBBase {

StatusIterator status(const FDBToolRequest& request) override;

WipeIterator wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) override;
WipeStateIterator wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) override;

PurgeIterator purge(const FDBToolRequest& request, bool doit, bool porcelain) override;

Expand Down
22 changes: 21 additions & 1 deletion src/fdb5/api/FDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@
#include "fdb5/api/helpers/FDBToolRequest.h"
#include "fdb5/api/helpers/ListElement.h"
#include "fdb5/api/helpers/ListIterator.h"
#include "fdb5/api/helpers/WipeIterator.h"
#include "fdb5/database/FieldLocation.h"
#include "fdb5/database/Key.h"
#include "fdb5/database/WipeCoordinator.h"
#include "fdb5/database/WipeState.h"
#include "fdb5/io/FieldHandle.h"
#include "fdb5/io/HandleGatherer.h"
#include "fdb5/message/MessageDecoder.h"
Expand Down Expand Up @@ -254,7 +257,24 @@ StatusIterator FDB::status(const FDBToolRequest& request) {
}

WipeIterator FDB::wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) {
return internal_->wipe(request, doit, porcelain, unsafeWipeAll);

auto async = [this, request, doit, porcelain, unsafeWipeAll](eckit::Queue<WipeElement>& queue) {
// Visit the catalogues to determine what they would wipe
WipeStateIterator it = internal_->wipe(request, doit, porcelain, unsafeWipeAll);

// Coordinate the wipe across catalogues and stores
WipeCoordinator coordinator{internal_->config()};
CatalogueWipeState catalogueWipeState;
while (it.next(catalogueWipeState)) {

auto elements = coordinator.wipe(catalogueWipeState, doit, unsafeWipeAll);
for (auto& el : elements) {
queue.emplace(el);
}
}
};

return WipeIterator(new APIAsyncIterator<WipeElement>(internal_->shared(), async));
}

PurgeIterator FDB::purge(const FDBToolRequest& request, bool doit, bool porcelain) {
Expand Down
8 changes: 8 additions & 0 deletions src/fdb5/api/FDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class MarsRequest;

namespace fdb5 {

namespace remote {
struct WipeHelper;
}

class FDBBase;
class FDBToolRequest;
class Key;
Expand Down Expand Up @@ -291,6 +295,10 @@ class FDB {

bool sorted(const metkit::mars::MarsRequest& request);

private:

friend struct remote::WipeHelper;

private: // members

/// @brief The FDBBase instance is held in a shared_ptr so that it can be kept alive by any Iterator instances
Expand Down
6 changes: 4 additions & 2 deletions src/fdb5/api/FDBFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#include "fdb5/api/helpers/PurgeIterator.h"
#include "fdb5/api/helpers/StatsIterator.h"
#include "fdb5/api/helpers/StatusIterator.h"
#include "fdb5/api/helpers/WipeIterator.h"
#include "fdb5/config/Config.h"
#include "fdb5/database/WipeState.h"

namespace eckit::message {

Expand Down Expand Up @@ -68,6 +68,8 @@ class FDBBase : public std::enable_shared_from_this<FDBBase>, public CallbackReg

virtual ~FDBBase() = default;

std::shared_ptr<FDBBase> shared() { return shared_from_this(); }

// -------------- Primary API functions ----------------------------

virtual void archive(const Key& key, const void* data, size_t length) = 0;
Expand All @@ -84,7 +86,7 @@ class FDBBase : public std::enable_shared_from_this<FDBBase>, public CallbackReg

virtual StatusIterator status(const FDBToolRequest& request) = 0;

virtual WipeIterator wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) = 0;
virtual WipeStateIterator wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) = 0;

virtual PurgeIterator purge(const FDBToolRequest& request, bool doit, bool porcelain) = 0;

Expand Down
5 changes: 3 additions & 2 deletions src/fdb5/api/LocalFDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "fdb5/api/local/StatusVisitor.h"
#include "fdb5/api/local/WipeVisitor.h"
#include "fdb5/database/Archiver.h"
#include "fdb5/database/Catalogue.h"
#include "fdb5/database/EntryVisitMechanism.h"
#include "fdb5/database/Inspector.h"
#include "fdb5/database/Key.h"
Expand Down Expand Up @@ -103,9 +104,9 @@ StatusIterator LocalFDB::status(const FDBToolRequest& request) {
return queryInternal<StatusVisitor>(request);
}

WipeIterator LocalFDB::wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) {
WipeStateIterator LocalFDB::wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) {
LOG_DEBUG_LIB(LibFdb5) << "LocalFDB::wipe() : " << request << std::endl;
return queryInternal<fdb5::api::local::WipeVisitor>(request, doit, porcelain, unsafeWipeAll);
return queryInternal<WipeCatalogueVisitor>(request, doit);
}

MoveIterator LocalFDB::move(const FDBToolRequest& request, const eckit::URI& dest) {
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/api/LocalFDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class LocalFDB : public FDBBase {

StatusIterator status(const FDBToolRequest& request) override;

WipeIterator wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) override;
WipeStateIterator wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) override;

PurgeIterator purge(const FDBToolRequest& request, bool doit, bool porcelain) override;

Expand Down
40 changes: 34 additions & 6 deletions src/fdb5/api/RemoteFDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "fdb5/api/helpers/ListElement.h"
#include "fdb5/database/Archiver.h"
#include "fdb5/database/Inspector.h"
#include "fdb5/database/WipeState.h"

#include "fdb5/remote/RemoteFieldLocation.h"
#include "fdb5/remote/client/ClientConnectionRouter.h"
Expand Down Expand Up @@ -49,9 +50,11 @@ struct ListHelper : BaseAPIHelper<fdb5::ListElement, fdb5::remote::Message::List

if (elem.hasLocation()) {

eckit::Log::debug<fdb5::LibFdb5>() << "ListHelper::valueFromStream - original location: ";
elem.location().dump(eckit::Log::debug<fdb5::LibFdb5>());
eckit::Log::debug<fdb5::LibFdb5>() << std::endl;
if (fdb5::LibFdb5::instance().debug()) {
eckit::Log::debug<fdb5::LibFdb5>() << "ListHelper::valueFromStream - original location: ";
elem.location().dump(eckit::Log::debug<fdb5::LibFdb5>());
eckit::Log::debug<fdb5::LibFdb5>() << std::endl;
}

// TODO move the endpoint replacement to the server side ()
if (elem.location().uri().scheme() == "fdb") {
Expand Down Expand Up @@ -92,9 +95,11 @@ struct InspectHelper : BaseAPIHelper<fdb5::ListElement, fdb5::remote::Message::I
static fdb5::ListElement valueFromStream(eckit::Stream& s, fdb5::RemoteFDB* fdb) {
fdb5::ListElement elem(s);

eckit::Log::debug<fdb5::LibFdb5>() << "InspectHelper::valueFromStream - original location: ";
elem.location().dump(eckit::Log::debug<fdb5::LibFdb5>());
eckit::Log::debug<fdb5::LibFdb5>() << std::endl;
if (fdb5::LibFdb5::instance().debug()) {
eckit::Log::debug<fdb5::LibFdb5>() << "InspectHelper::valueFromStream - original location: ";
elem.location().dump(eckit::Log::debug<fdb5::LibFdb5>());
eckit::Log::debug<fdb5::LibFdb5>() << std::endl;
}

if (elem.location().uri().scheme() == "fdb") {
eckit::net::Endpoint fieldLocationEndpoint{elem.location().uri().host(), elem.location().uri().port()};
Expand All @@ -111,6 +116,25 @@ struct InspectHelper : BaseAPIHelper<fdb5::ListElement, fdb5::remote::Message::I
}
};

struct WipeHelper : BaseAPIHelper<fdb5::CatalogueWipeState, fdb5::remote::Message::Wipe> {

WipeHelper(bool doit, bool porcelain, bool unsafeWipeAll) : doit_(doit), unsafeWipeAll_(unsafeWipeAll) {}

void encodeExtra(eckit::Stream& s) const {
s << doit_;
s << unsafeWipeAll_;
}

static fdb5::CatalogueWipeState valueFromStream(eckit::Stream& s, fdb5::RemoteFDB* fdb) {
return fdb5::CatalogueWipeState(s);
}

private:

bool doit_;
bool unsafeWipeAll_;
};

} // namespace

namespace fdb5 {
Expand Down Expand Up @@ -281,6 +305,10 @@ StatsIterator RemoteFDB::stats(const FDBToolRequest& request) {
return forwardApiCall(StatsHelper(), request);
}

WipeStateIterator RemoteFDB::wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) {
return forwardApiCall(WipeHelper(doit, porcelain, unsafeWipeAll), request);
}

void RemoteFDB::print(std::ostream& s) const {
s << "RemoteFDB(...)";
}
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/api/RemoteFDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RemoteFDB : public LocalFDB, public remote::Client {

StatusIterator status(const FDBToolRequest& request) override { NOTIMP; }

WipeIterator wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) override { NOTIMP; }
WipeStateIterator wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) override;

PurgeIterator purge(const FDBToolRequest& request, bool doit, bool porcelain) override { NOTIMP; }

Expand Down
34 changes: 30 additions & 4 deletions src/fdb5/api/SelectFDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@
*/

#include "fdb5/api/SelectFDB.h"
#include <sstream>
#include <vector>
#include "eckit/log/CodeLocation.h"
#include "eckit/log/Log.h"
#include "fdb5/LibFdb5.h"
#include "fdb5/api/FDB.h"
#include "fdb5/api/FDBFactory.h"
#include "fdb5/api/helpers/FDBToolRequest.h"
#include "fdb5/api/helpers/ListIterator.h"
#include "fdb5/api/helpers/WipeIterator.h"
#include "fdb5/database/Key.h"
#include "fdb5/database/WipeState.h"
#include "fdb5/rules/SelectMatcher.h"

using namespace eckit;
Expand Down Expand Up @@ -138,11 +145,30 @@ StatusIterator SelectFDB::status(const FDBToolRequest& request) {
return queryInternal(request, [](FDBBase& fdb, const FDBToolRequest& request) { return fdb.status(request); });
}

WipeIterator SelectFDB::wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) {
WipeStateIterator SelectFDB::wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) {
LOG_DEBUG_LIB(LibFdb5) << "SelectFDB::wipe() >> " << request << std::endl;
return queryInternal(request, [doit, porcelain, unsafeWipeAll](FDBBase& fdb, const FDBToolRequest& request) {
return fdb.wipe(request, doit, porcelain, unsafeWipeAll);
});

FDBLane* matchingLane = nullptr;
for (auto& lane : subFdbs_) {
if (lane.matches(request.request(), Matcher::MatchOnMissing)) {
if (matchingLane != nullptr) {
std::stringstream ss;
ss << "Multiple matching lanes for request " << request.request();
ss << " - wipe request must not match multiple SelectFDB lanes.";
throw eckit::UserError(ss.str(), Here());
}

matchingLane = &lane;
}
}

if (matchingLane == nullptr) {
std::stringstream ss;
ss << "No matching lane for request " << request.request();
throw eckit::UserError(ss.str(), Here());
}

return matchingLane->get().wipe(request, doit, porcelain, unsafeWipeAll);
}

PurgeIterator SelectFDB::purge(const FDBToolRequest& request, bool doit, bool porcelain) {
Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/api/SelectFDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SelectFDB : public FDBBase {

StatusIterator status(const FDBToolRequest& request) override;

WipeIterator wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) override;
WipeStateIterator wipe(const FDBToolRequest& request, bool doit, bool porcelain, bool unsafeWipeAll) override;

PurgeIterator purge(const FDBToolRequest& request, bool doit, bool porcelain) override;

Expand Down
3 changes: 2 additions & 1 deletion src/fdb5/api/fdb_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ struct fdb_datareader_t {
};

// Wipe iterator
// To be removed / replaced by pybind impl.
struct fdb_wipe_iterator_t {

fdb_wipe_iterator_t(WipeIterator&& iter) : iter_(std::move(iter)) {}
Expand All @@ -241,7 +242,7 @@ struct fdb_wipe_element_t {

fdb_wipe_element_t(WipeElement&& e) : element_(std::move(e)) {}

const char* c_str() const { return element_.c_str(); }
const char* c_str() const { return element_.msg().c_str(); }

private:

Expand Down
1 change: 1 addition & 0 deletions src/fdb5/api/helpers/ListIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef fdb5_ListIterator_H
#define fdb5_ListIterator_H

#include <unordered_map>
#include <unordered_set>
#include <utility>

Expand Down
Loading
Loading