Module: check_mk
Branch: master
Commit: 41ec9d1dc20a9800b2bfeb161a9ab2e67c2c60fb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=41ec9d1dc20a98…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Aug 31 10:27:11 2018 +0200
Removed dead code. Made fields/methods as private as possible.
Change-Id: I32eda6798a57a4688e2e4870bd66f937b2ae1b49
---
livestatus/src/Logfile.cc | 17 -----------------
livestatus/src/Logfile.h | 42 +++++++++++++++++++++---------------------
2 files changed, 21 insertions(+), 38 deletions(-)
diff --git a/livestatus/src/Logfile.cc b/livestatus/src/Logfile.cc
index 64c7288..be24cec 100644
--- a/livestatus/src/Logfile.cc
+++ b/livestatus/src/Logfile.cc
@@ -211,23 +211,6 @@ logfile_entries_t *Logfile::getEntriesFromQuery(const Query *
/*unused*/,
return &_entries;
}
-bool Logfile::answerQuery(Query *query, LogCache *logcache, time_t since,
- time_t until, unsigned logclasses) {
- // Make sure existing references to objects point to correct world
- updateReferences();
- // make sure all messages are present
- load(logcache, logclasses);
- uint64_t sincekey = makeKey(since, 0);
- for (auto it = _entries.lower_bound(sincekey); it != _entries.end(); ++it) {
- // end found or limit exceeded?
- if (it->second->_time >= until ||
- !query->processDataset(Row(it->second.get()))) {
- return false;
- }
- }
- return true;
-}
-
bool Logfile::answerQueryReverse(Query *query, LogCache *logcache, time_t since,
time_t until, unsigned logclasses) {
// Make sure existing references to objects point to correct world
diff --git a/livestatus/src/Logfile.h b/livestatus/src/Logfile.h
index 05db416..08e4dd7 100644
--- a/livestatus/src/Logfile.h
+++ b/livestatus/src/Logfile.h
@@ -48,51 +48,51 @@ class World;
using logfile_entries_t = std::map<uint64_t, std::unique_ptr<LogEntry>>;
class Logfile {
-private:
- MonitoringCore *_mc;
- fs::path _path;
- time_t _since; // time of first entry
- bool _watch; // true only for current logfile
- fpos_t _read_pos; // read until this position
- size_t _lineno; // read until this line
-
- logfile_entries_t _entries;
-#ifdef CMC
- World *_world; // CMC: world our references point into
-#endif
-
public:
Logfile(MonitoringCore *mc, fs::path path, bool watch);
std::string path() { return _path; }
#ifdef CMC
// Note: The buffer is 2 bytes larger then the file, containing a zero
- // character at both ends.
+ // character at both ends. For StateHistoryThread::processLogfile.
std::unique_ptr<std::vector<char>> readIntoBuffer();
#endif
- void load(LogCache *logcache, unsigned logclasses);
+
+ // for tricky protocol between LogCache::logLineHasBeenAdded and this class
void flush();
time_t since() { return _since; }
unsigned classesRead() { return _logclasses_read; }
size_t size() { return _entries.size(); }
+ long freeMessages(unsigned logclasses);
+
+ // for TableStateHistory
logfile_entries_t *getEntriesFromQuery(const Query *query,
LogCache *logcache,
unsigned logclasses);
- bool answerQuery(Query *query, LogCache *logcache, time_t since,
- time_t until, unsigned logclasses);
+
+ // for TableLog::answerQuery
bool answerQueryReverse(Query *query, LogCache *logcache, time_t since,
time_t until, unsigned logclasses);
- long freeMessages(unsigned logclasses);
- void updateReferences();
-
+private:
+ MonitoringCore *_mc;
+ fs::path _path;
+ time_t _since; // time of first entry
+ bool _watch; // true only for current logfile
+ fpos_t _read_pos; // read until this position
+ size_t _lineno; // read until this line
+ logfile_entries_t _entries;
+#ifdef CMC
+ World *_world; // CMC: world our references point into
+#endif
unsigned _logclasses_read; // only these types have been read
-private:
+ void load(LogCache *logcache, unsigned logclasses);
void loadRange(FILE *file, unsigned missing_types, LogCache *logcache,
unsigned logclasses);
bool processLogLine(size_t lineno, std::string line, unsigned logclasses);
uint64_t makeKey(time_t t, size_t lineno);
+ void updateReferences();
Logger *logger() const;
};