Warning, file /system/kjournald/lib/localjournal.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-License-Identifier: LGPL-2.1-or-later OR MIT
0003     SPDX-FileCopyrightText: 2021 Andreas Cord-Landwehr <cordlandwehr@kde.org>
0004 */
0005 
0006 #ifndef LOCALJOURNAL_H
0007 #define LOCALJOURNAL_H
0008 
0009 #include "ijournal.h"
0010 #include "kjournald_export.h"
0011 #include <QString>
0012 #include <memory>
0013 
0014 class LocalJournalPrivate;
0015 class sd_journal;
0016 
0017 /**
0018  * @brief The LocalJournal class encapsulates a local sd_journal object
0019  *
0020  * Local journal in this sense means a journald database that can be access via direct file access, i.e.
0021  * where operations can be performed directly on the database files.
0022  *
0023  * @note The journald documentation specifically says that using the same sd_journal object in multiple
0024  * queries (or models in this case) might have side effects; even though there are none at the moment. Thus,
0025  * ensure that the same Journal object is only used for one model.
0026  */
0027 class KJOURNALD_EXPORT LocalJournal : public IJournal
0028 {
0029 public:
0030     /**
0031      * @brief Construct journal object for system journald DB
0032      */
0033     explicit LocalJournal();
0034 
0035     /**
0036      * @brief Construct journal object from journald DB at path @p path
0037      * This path can be a directory or a file.
0038      */
0039     LocalJournal(const QString &path);
0040 
0041     /**
0042      * @brief Destroys the journal wrapper
0043      */
0044     ~LocalJournal() override;
0045 
0046     /**
0047      * @brief Getter for raw sd_journal pointer
0048      *
0049      * This pointer can be nullptr if an error during opening of journal occured. Test
0050      * with @s isValid() before using.
0051      */
0052     sd_journal *sdJournal() const override;
0053 
0054     /**
0055      * @brief returns true if and only if the sd_journal pointer is valid
0056      */
0057     bool isValid() const override;
0058 
0059     /**
0060      * @copydoc IJournal::currentBootId()
0061      */
0062     QString currentBootId() const override;
0063 
0064     /**
0065      * @brief Get file system usage of journal
0066      * @return size of journal in bytes
0067      */
0068     uint64_t usage() const;
0069 
0070 private
0071     Q_SLOT : void handleJournalDescriptorUpdate();
0072 
0073 private:
0074     std::unique_ptr<LocalJournalPrivate> d;
0075 };
0076 
0077 #endif // JOURNAL_H