diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-09-06 21:58:51 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-09-06 21:58:51 +0200 |
commit | 634e22298b14a8ad09f0d0489cb1c08c97d1f73a (patch) | |
tree | 9a65cdbed85e24f1cd141c77e58ef7eecbf73551 /logic/net/HttpMetaCache.h | |
parent | d587e7ada4a325cff3974be11e1829fabd52a259 (diff) | |
download | MultiMC-634e22298b14a8ad09f0d0489cb1c08c97d1f73a.tar MultiMC-634e22298b14a8ad09f0d0489cb1c08c97d1f73a.tar.gz MultiMC-634e22298b14a8ad09f0d0489cb1c08c97d1f73a.tar.lz MultiMC-634e22298b14a8ad09f0d0489cb1c08c97d1f73a.tar.xz MultiMC-634e22298b14a8ad09f0d0489cb1c08c97d1f73a.zip |
Untested ETag cache class.
Yep.
Diffstat (limited to 'logic/net/HttpMetaCache.h')
-rw-r--r-- | logic/net/HttpMetaCache.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/logic/net/HttpMetaCache.h b/logic/net/HttpMetaCache.h new file mode 100644 index 00000000..161483ad --- /dev/null +++ b/logic/net/HttpMetaCache.h @@ -0,0 +1,36 @@ +#pragma once +#include <QString> +#include <QSharedPointer> +#include <QMap> + +struct MetaEntry +{ + QString base; + QString path; + QString md5sum; + QString etag; + quint64 last_changed_timestamp = 0; +}; + +typedef QSharedPointer<MetaEntry> MetaEntryPtr; + +class HttpMetaCache +{ +public: + // supply path to the cache index file + HttpMetaCache(QString path); + ~HttpMetaCache(); + MetaEntryPtr getEntryForResource(QString base, QString resource_path); + void addEntry(QString base, QString resource_path, QString etag); + void addBase(QString base, QString base_root); +private: + void Save(); + void Load(); + struct EntryMap + { + QString base_path; + QMap<QString, MetaEntryPtr> entry_list; + }; + QMap<QString, EntryMap> m_entries; + QString m_index_file; +};
\ No newline at end of file |