LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
networkdiskcachegc.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#pragma once
10
11
#include <functional>
12
#include <list>
13
#include <QObject>
14
#include <QMap>
15
#include <
util/sll/util.h
>
16
17
template
<
typename
T>
18
class
QFuture
;
19
20
namespace
LC::Util
21
{
30
class
NetworkDiskCacheGC :
public
QObject
31
{
32
using
CacheSizeGetters_t = std::list<std::function<int ()>>;
33
QMap<QString, CacheSizeGetters_t>
Directories_;
34
35
QMap<QString, qint64>
LastSizes_;
36
37
bool
IsCollecting_ =
false
;
38
39
NetworkDiskCacheGC ();
40
public
:
41
NetworkDiskCacheGC
(
const
NetworkDiskCacheGC&) =
delete
;
42
NetworkDiskCacheGC&
operator=
(
const
NetworkDiskCacheGC&) =
delete
;
43
48
static
NetworkDiskCacheGC&
Instance
();
49
60
QFuture<qint64>
GetCurrentSize
(
const
QString& path)
const
;
61
82
Util::DefaultScopeGuard
RegisterDirectory
(
const
QString& path,
83
const
std::function<
int
()>& sizeGetter);
84
private
:
85
void
UnregisterDirectory (
const
QString&, CacheSizeGetters_t::iterator);
86
void
HandleCollect ();
87
};
88
}
LC::Util::NetworkDiskCacheGC::RegisterDirectory
Util::DefaultScopeGuard RegisterDirectory(const QString &path, const std::function< int()> &sizeGetter)
Registers the given cache path.
Definition
networkdiskcachegc.cpp:71
LC::Util::NetworkDiskCacheGC::Instance
static NetworkDiskCacheGC & Instance()
Returns a single global instance of the GC manager.
Definition
networkdiskcachegc.cpp:33
LC::Util::NetworkDiskCacheGC::NetworkDiskCacheGC
NetworkDiskCacheGC(const NetworkDiskCacheGC &)=delete
LC::Util::NetworkDiskCacheGC::operator=
NetworkDiskCacheGC & operator=(const NetworkDiskCacheGC &)=delete
LC::Util::NetworkDiskCacheGC::GetCurrentSize
QFuture< qint64 > GetCurrentSize(const QString &path) const
Schedules calculation of the path total size.
Definition
networkdiskcachegc.cpp:66
QFuture
Definition
idownload.h:17
QMap
Definition
anutil.h:15
LC::Util
Definition
icoreproxy.h:34
LC::Util::DefaultScopeGuard
detail::ScopeGuard< detail::DefaultScopeGuardDeleter > DefaultScopeGuard
Definition
util.h:132
util.h
src
util
network
networkdiskcachegc.h
Generated by
1.17.0