Commit 0f684f7e authored by Matthieu Dorier's avatar Matthieu Dorier

enabled default constructor in WriteBatch and AsyncEngine

parent 943ecafc
......@@ -49,6 +49,8 @@ class AsyncEngine {
public:
AsyncEngine() = default;
/**
* @brief Constructor.
*
......
......@@ -52,6 +52,11 @@ class WriteBatch {
public:
/**
* @brief Default constructor.
*/
WriteBatch() = default;
/**
* @brief Constructor.
*
......
......@@ -8,11 +8,16 @@ AsyncEngine::AsyncEngine(DataStore& ds, size_t num_threads)
: m_impl(std::make_shared<AsyncEngineImpl>(ds.m_impl, num_threads)) {}
void AsyncEngine::wait() {
m_impl->wait();
if(m_impl)
m_impl->wait();
}
const std::vector<std::string>& AsyncEngine::errors() const {
return m_impl->m_errors;
static std::vector<std::string> _default;
if(m_impl)
return m_impl->m_errors;
else
return _default;
}
}
......@@ -18,10 +18,13 @@ WriteBatch::WriteBatch(AsyncEngine& async, unsigned max_batch_size)
WriteBatch::~WriteBatch() {}
void WriteBatch::flush() {
m_impl->flush();
if(m_impl)
m_impl->flush();
}
void WriteBatch::activateStatistics(bool activate) {
if(!m_impl)
throw Exception("Invalid WriteBatch");
if(activate) {
if(m_impl->m_stats) return;
m_impl->m_stats = std::make_unique<WriteBatchStatistics>();
......@@ -31,7 +34,8 @@ void WriteBatch::activateStatistics(bool activate) {
}
void WriteBatch::collectStatistics(WriteBatchStatistics& stats) const {
m_impl->collectStatistics(stats);
if(m_impl)
m_impl->collectStatistics(stats);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment