diff options
Diffstat (limited to 'sinksh')
-rw-r--r-- | sinksh/syntax_modules/sink_inspect.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sinksh/syntax_modules/sink_inspect.cpp b/sinksh/syntax_modules/sink_inspect.cpp index da62250..251acda 100644 --- a/sinksh/syntax_modules/sink_inspect.cpp +++ b/sinksh/syntax_modules/sink_inspect.cpp | |||
@@ -157,7 +157,11 @@ bool inspect(const QStringList &args, State &state) | |||
157 | 157 | ||
158 | //Print rest of db | 158 | //Print rest of db |
159 | bool findSubstringKeys = !filter.isEmpty(); | 159 | bool findSubstringKeys = !filter.isEmpty(); |
160 | int keySizeTotal = 0; | ||
161 | int valueSizeTotal = 0; | ||
160 | auto count = db.scan(filter, [&] (const QByteArray &key, const QByteArray &data) { | 162 | auto count = db.scan(filter, [&] (const QByteArray &key, const QByteArray &data) { |
163 | keySizeTotal += key.size(); | ||
164 | valueSizeTotal += data.size(); | ||
161 | if (isMainDb) { | 165 | if (isMainDb) { |
162 | Sink::EntityBuffer buffer(const_cast<const char *>(data.data()), data.size()); | 166 | Sink::EntityBuffer buffer(const_cast<const char *>(data.data()), data.size()); |
163 | if (!buffer.isValid()) { | 167 | if (!buffer.isValid()) { |
@@ -167,7 +171,9 @@ bool inspect(const QStringList &args, State &state) | |||
167 | state.printLine("Key: " + key | 171 | state.printLine("Key: " + key |
168 | + " Operation: " + QString::number(metadata->operation()) | 172 | + " Operation: " + QString::number(metadata->operation()) |
169 | + " Replay: " + (metadata->replayToSource() ? "true" : "false") | 173 | + " Replay: " + (metadata->replayToSource() ? "true" : "false") |
170 | + ((metadata->modifiedProperties() && metadata->modifiedProperties()->size() != 0) ? (" [" + Sink::BufferUtils::fromVector(*metadata->modifiedProperties()).join(", ")) + "]": "")); | 174 | + ((metadata->modifiedProperties() && metadata->modifiedProperties()->size() != 0) ? (" [" + Sink::BufferUtils::fromVector(*metadata->modifiedProperties()).join(", ")) + "]": "") |
175 | + " Value size: " + QString::number(data.size()) | ||
176 | ); | ||
171 | } | 177 | } |
172 | } else { | 178 | } else { |
173 | state.printLine("Key: " + key + " Value: " + QString::fromUtf8(data)); | 179 | state.printLine("Key: " + key + " Value: " + QString::fromUtf8(data)); |
@@ -180,6 +186,8 @@ bool inspect(const QStringList &args, State &state) | |||
180 | findSubstringKeys); | 186 | findSubstringKeys); |
181 | 187 | ||
182 | state.printLine("Found " + QString::number(count) + " entries"); | 188 | state.printLine("Found " + QString::number(count) + " entries"); |
189 | state.printLine("Keys take up " + QString::number(keySizeTotal) + " bytes"); | ||
190 | state.printLine("Values take up " + QString::number(valueSizeTotal) + " bytes"); | ||
183 | } | 191 | } |
184 | return false; | 192 | return false; |
185 | } | 193 | } |