All possible request changes from D9#146 are done

This commit is contained in:
Marko Budiselic
2016-11-30 11:05:48 +01:00
parent 5eb90f9e52
commit cfd36be2e0
9 changed files with 57 additions and 29 deletions

View File

@@ -19,15 +19,19 @@ class DbTransaction : public Loggable
friend DbAccessor;
public:
DbTransaction(Db &db);
DbTransaction(Db &db, tx::Transaction &trans)
: Loggable("DbTransaction"), db(db), trans(trans)
{
}
DbTransaction() = delete;
~DbTransaction() = default;
DbTransaction(const DbTransaction& other) = delete;
DbTransaction(DbTransaction&& other) = default;
DbTransaction &operator=(const DbTransaction &) = delete;
DbTransaction &operator=(DbTransaction &&) = default;
DbTransaction(Db &db);
DbTransaction(Db &db, tx::Transaction &trans)
: Loggable("DbTransaction"), db(db), trans(trans) {}
// Global transactional algorithms,operations and general methods meant for
// internal use should be here or should be routed through this object.
// This should provide cleaner hierarchy of operations on database.

View File

@@ -8,6 +8,14 @@ class LabelsWriter
public:
LabelsWriter(Buffer &buffer) : buffer_(buffer) {}
~LabelsWriter() = default;
LabelsWriter(const LabelsWriter &) = delete;
LabelsWriter(LabelsWriter &&) = delete;
LabelsWriter &operator=(const LabelsWriter &) = delete;
LabelsWriter &operator=(LabelsWriter &&) = delete;
void handle(const Label& label);
private:

View File

@@ -56,10 +56,9 @@ public:
template <typename Stream>
void stream_repr(Stream& stream) const
{
if (this->record != nullptr)
this->record->stream_repr(stream);
else
std::cout << "TRACE: record is nullptr" << std::endl;
if (!this->record)
return;
this->record->stream_repr(stream);
}
};

View File

@@ -102,7 +102,7 @@ public:
// Relases all memory.
void free()
{
while (allocated_blocks.size() > 0)
while (allocated_blocks.size())
{
blocks.release(allocated_blocks.back());
allocated_blocks.pop_back();

View File

@@ -8,6 +8,25 @@ namespace utils
class StringBuffer
{
public:
StringBuffer() = default;
~StringBuffer() = default;
StringBuffer(const StringBuffer &) = delete;
StringBuffer(StringBuffer &&) = default;
StringBuffer &operator=(const StringBuffer &) = delete;
StringBuffer &operator=(StringBuffer &&) = default;
StringBuffer(std::string::size_type count)
{
resize(count);
}
void resize(std::string::size_type count)
{
data.resize(count);
}
StringBuffer &operator<<(const std::string &str)
{
data += str;