web indexing prefs: display the current cache size
This commit is contained in:
parent
ce6c0edc91
commit
5e82af9798
@ -32,6 +32,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::set;
|
using std::set;
|
||||||
using std::string;
|
using std::string;
|
||||||
@ -43,6 +44,8 @@ using std::string;
|
|||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "execmd.h"
|
#include "execmd.h"
|
||||||
#include "rclconfig.h"
|
#include "rclconfig.h"
|
||||||
|
#include "webstore.h"
|
||||||
|
#include "circache.h"
|
||||||
|
|
||||||
static const int spacing = 3;
|
static const int spacing = 3;
|
||||||
static const int margin = 3;
|
static const int margin = 3;
|
||||||
@ -353,8 +356,12 @@ bool ConfIndexW::setupWebHistoryPanel(int idx)
|
|||||||
"file (only waste space at the end)."
|
"file (only waste space at the end)."
|
||||||
), -1, 1000*1000); // Max 1TB...
|
), -1, 1000*1000); // Max 1TB...
|
||||||
m_w->enableLink(bparam, cparam);
|
m_w->enableLink(bparam, cparam);
|
||||||
|
int64_t sz = -1;
|
||||||
|
auto ws = std::unique_ptr<WebStore>(new WebStore(m_rclconf));
|
||||||
|
sz = ws->cc()->size();
|
||||||
m_w->addBlurb(idx, tr("Note: old pages will be erased to make space for "
|
m_w->addBlurb(idx, tr("Note: old pages will be erased to make space for "
|
||||||
"new ones when the maximum size is reached"));
|
"new ones when the maximum size is reached. "
|
||||||
|
"Current size: %1").arg(u8s2qs(displayableBytes(sz))));
|
||||||
m_w->endOfList(idx);
|
m_w->endOfList(idx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -787,6 +787,29 @@ bool CirCache::open(OpMode mode)
|
|||||||
return m_d->readfirstblock();
|
return m_d->readfirstblock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t CirCache::size()
|
||||||
|
{
|
||||||
|
if (m_d == 0) {
|
||||||
|
LOGERR("CirCache::open: null data\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
struct stat st;
|
||||||
|
if (m_d->m_fd < 0) {
|
||||||
|
if (stat(m_d->datafn(m_dir).c_str(), &st) < 0) {
|
||||||
|
m_d->m_reason << "CirCache::size: stat(" << m_d->datafn(m_dir) <<
|
||||||
|
") failed " << "errno " << errno;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (fstat(m_d->m_fd, &st) < 0) {
|
||||||
|
m_d->m_reason << "CirCache::open: fstat(" << m_d->datafn(m_dir) <<
|
||||||
|
") failed " << "errno " << errno;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return st.st_size;
|
||||||
|
}
|
||||||
|
|
||||||
class CCScanHookDump : public CCScanHook {
|
class CCScanHookDump : public CCScanHook {
|
||||||
public:
|
public:
|
||||||
virtual status takeone(int64_t offs, const string& udi,
|
virtual status takeone(int64_t offs, const string& udi,
|
||||||
|
|||||||
@ -37,8 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdint.h>
|
#include <cstdint>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class ConfSimple;
|
class ConfSimple;
|
||||||
@ -63,6 +62,8 @@ public:
|
|||||||
enum OpMode {CC_OPREAD, CC_OPWRITE};
|
enum OpMode {CC_OPREAD, CC_OPWRITE};
|
||||||
virtual bool open(OpMode mode);
|
virtual bool open(OpMode mode);
|
||||||
|
|
||||||
|
virtual int64_t size();
|
||||||
|
|
||||||
virtual std::string getpath();
|
virtual std::string getpath();
|
||||||
|
|
||||||
// Set data to 0 if you just want the header
|
// Set data to 0 if you just want the header
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user