web indexing prefs: display the current cache size
This commit is contained in:
@@ -787,6 +787,29 @@ bool CirCache::open(OpMode mode)
|
||||
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 {
|
||||
public:
|
||||
virtual status takeone(int64_t offs, const string& udi,
|
||||
|
||||
@@ -37,8 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class ConfSimple;
|
||||
@@ -63,6 +62,8 @@ public:
|
||||
enum OpMode {CC_OPREAD, CC_OPWRITE};
|
||||
virtual bool open(OpMode mode);
|
||||
|
||||
virtual int64_t size();
|
||||
|
||||
virtual std::string getpath();
|
||||
|
||||
// Set data to 0 if you just want the header
|
||||
|
||||
Reference in New Issue
Block a user