Skip to content

Commit 4b2a1f0

Browse files
committed
fix(remoteFDB): cleanup remote/client
1 parent 83ab66d commit 4b2a1f0

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

src/fdb5/remote/client/Client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ eckit::Buffer Client::controlWriteReadResponse(const Message msg,
9090
return eckit::Buffer{f.get()};
9191
}
9292

93-
void Client::dataWrite(remote::Message msg, uint32_t requestID, PayloadList payloads) {
93+
void Client::dataWrite(Message msg, uint32_t requestID, PayloadList payloads) {
9494
connection_.dataWrite(*this, msg, requestID, std::move(payloads));
9595
}
9696

src/fdb5/remote/client/Client.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ class RemoteFDBException : public eckit::RemoteException {
3434
//----------------------------------------------------------------------------------------------------------------------
3535

3636
class Client : eckit::NonCopyable {
37+
public: // types
3738
using PayloadList = Connection::PayloadList;
3839

39-
public:
40+
public: // methods
4041
Client(const eckit::net::Endpoint& endpoint, const std::string& defaultEndpoint);
4142

4243
Client(const std::vector<std::pair<eckit::net::Endpoint, std::string>>& endpoints);

src/fdb5/remote/client/RemoteCatalogue.cc

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ namespace fdb5::remote {
3030

3131
namespace {
3232

33-
constexpr size_t archivePayloadSize = 8192;
34-
constexpr size_t keyPayloadSize = 4096;
35-
33+
constexpr size_t archiveBufferSize = 8192;
34+
constexpr size_t keyBufferSize = 4096;
3635
}
3736

3837
//----------------------------------------------------------------------------------------------------------------------
@@ -66,13 +65,13 @@ void RemoteCatalogue::archive(const Key& idxKey, const Key& datumKey, std::share
6665
numLocations_++;
6766
}
6867

69-
Buffer buffer(archivePayloadSize);
68+
Buffer buffer(archiveBufferSize);
7069
MemoryStream stream(buffer);
7170
stream << idxKey;
7271
stream << datumKey;
7372
stream << *fieldLocation;
7473

75-
std::vector<Payload> payloads;
74+
PayloadList payloads;
7675
payloads.emplace_back(stream.position(), buffer.data());
7776

7877
dataWrite(Message::Blob, id, payloads);
@@ -141,7 +140,7 @@ void RemoteCatalogue::loadSchema() {
141140
LOG_DEBUG_LIB(LibFdb5) << "RemoteCatalogue::loadSchema()" << std::endl;
142141

143142
// send dbkey to remote.
144-
eckit::Buffer keyBuffer(keyPayloadSize);
143+
eckit::Buffer keyBuffer(keyBufferSize);
145144
eckit::MemoryStream keyStream(keyBuffer);
146145
keyStream << dbKey_;
147146

@@ -180,18 +179,14 @@ void RemoteCatalogue::print( std::ostream &out ) const {
180179
out << "RemoteCatalogue(endpoint=" << controlEndpoint() << ",clientID=" << clientId() << ")";
181180
}
182181

183-
std::string RemoteCatalogue::type() const {
184-
return "remote";
185-
}
186-
187182
bool RemoteCatalogue::open() {
188183
return true;
189184
}
190185

191186
//----------------------------------------------------------------------------------------------------------------------
192187

193-
static CatalogueReaderBuilder<RemoteCatalogue> reader("remote");
194-
static CatalogueWriterBuilder<RemoteCatalogue> writer("remote");
188+
static CatalogueReaderBuilder<RemoteCatalogue> reader(RemoteCatalogue::typeName());
189+
static CatalogueWriterBuilder<RemoteCatalogue> writer(RemoteCatalogue::typeName());
195190

196191
//----------------------------------------------------------------------------------------------------------------------
197192

src/fdb5/remote/client/RemoteCatalogue.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ namespace fdb5::remote {
2424

2525
class RemoteCatalogue : public CatalogueReader, public CatalogueWriter, public CatalogueImpl, public Client {
2626

27-
public:
27+
public: // types
28+
static const char* typeName() { return "remote"; }
2829

30+
public: // methods
2931
RemoteCatalogue(const Key& key, const Config& config);
3032
RemoteCatalogue(const eckit::URI& uri, const Config& config);
3133

32-
~RemoteCatalogue() override = default;
33-
3434
// From CatalogueWriter
3535
const Index& currentIndex() override;
3636
void archive(const Key& idxKey, const Key& datumKey, std::shared_ptr<const FieldLocation> fieldLocation) override;
@@ -59,8 +59,10 @@ class RemoteCatalogue : public CatalogueReader, public CatalogueWriter, public C
5959
std::vector<fdb5::Index> indexes(bool sorted=false) const override;
6060
void maskIndexEntry(const Index& index) const override;
6161
void allMasked(std::set<std::pair<eckit::URI, eckit::Offset>>& metadata, std::set<eckit::URI>& data) const override;
62-
void print( std::ostream &out ) const override;
63-
std::string type() const override;
62+
void print(std::ostream& out) const override;
63+
64+
std::string type() const override { return typeName(); }
65+
6466
bool open() override;
6567
void flush(size_t archivedFields) override;
6668
void clean() override;

src/fdb5/remote/client/RemoteStore.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ void RemoteStore::archive(const Key& key, const void *data, eckit::Length length
270270
keyStream << dbKey_;
271271
keyStream << key;
272272

273-
std::vector<Payload> payloads;
273+
PayloadList payloads;
274274
payloads.emplace_back(keyStream.position(), keyBuffer.data());
275275
payloads.emplace_back(length, data);
276276

0 commit comments

Comments
 (0)