aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/cachetracking.h
blob: d4bd8da259876d4df6624cc0c40b4dd1ea8aeea2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include <zencore/iohash.h>

#include <filesystem>
#include <functional>
#include <stdint.h>

namespace zen {

class CbObject;

/**
 */

class ZenCacheTracker
{
public:
	ZenCacheTracker(std::filesystem::path StateDirectory);
	~ZenCacheTracker();

	void TrackAccess(std::string_view BucketSegment, const IoHash& HashKey);
	void SaveSnapshot();
	void IterateSnapshots(std::function<void(uint64_t TimeStamp, CbObject Snapshot)>&& Callback);

private:
	struct Impl;

	Impl* m_Impl = nullptr;
};

void cachetracker_forcelink();

}  // namespace zen