1 #pragma once 2 3 #include <map> 4 #include <mutex> 5 6 #include "page_mapper.h" 7 8 9 10 /* Mapping type from accessors to page mappers. */ 11 12 typedef std::map<fileid_t, PageMapper *> FileMapping; 13 typedef std::pair<fileid_t, PageMapper *> FileMappingEntry; 14 15 16 17 /* A registry of mappers for accessors. */ 18 19 class Paging 20 { 21 protected: 22 FileMapping _mappers; 23 std::mutex _lock; 24 25 public: 26 bool reserve(fileid_t fileid); 27 28 PageMapper *get(fileid_t fileid); 29 30 void set(fileid_t fileid, PageMapper *mapper); 31 }; 32 33 // vim: tabstop=4 expandtab shiftwidth=4