File: access_rx_cache.h

package info (click to toggle)
plocate 1.1.8-2%2Bdeb11u1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 468 kB
  • sloc: cpp: 5,341; sh: 106; makefile: 4
file content (31 lines) | stat: -rw-r--r-- 744 bytes parent folder | download | duplicates (3)
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
#ifndef _ACCESS_RX_CACHE_H
#define _ACCESS_RX_CACHE_H 1

#include <functional>
#include <map>
#include <mutex>
#include <string>
#include <unordered_map>
#include <vector>

class IOUringEngine;

class AccessRXCache {
public:
	AccessRXCache(IOUringEngine *engine, bool check_visibility)
		: engine(engine), check_visibility(check_visibility) {}
	void check_access(const char *filename, bool allow_async, std::function<void(bool)> cb);

private:
	std::unordered_map<std::string, bool> cache;
	struct PendingStat {
		std::string filename;
		std::function<void(bool)> cb;
	};
	std::map<std::string, std::vector<PendingStat>> pending_stats;
	IOUringEngine *engine;
	std::mutex mu;
	bool check_visibility;
};

#endif  // !defined(_ACCESS_RX_CACHE_H)