5 #include "vocab/flat_mapset.h"
12 struct ContentIdentifier;
19 class UnixFsPathResolver;
46 std::string
const& body,
56 bool Store(std::string headers, std::string
const& body,
PbDag&& block);
57 bool Store(std::string
const& cid, std::string headers, std::string body);
58 bool Store(std::string cid_str,
64 std::string
const& body,
113 std::function<void(std::string, std::string, std::string)>;
125 std::time_t last_access = 0L;
126 std::
string cid_str = {};
128 std::string headers = {};
130 std::list<Record> records_ = std::list<Record>(0xFFUL);
131 using Iter = decltype(records_)::iterator;
132 flat_map<std::string, Record*> cid2record_;
133 flat_set<UnixFsPathResolver*> listening_;
134 bool checking_ =
false;
135 std::vector<SerializedStorageHook> hooks_;
137 Record
const* GetInternal(std::string
const&);
138 Record* FindFree(std::time_t);
140 Record* StoreIdentity(std::string
const&, Cid
const&);
Immediate access to recently-accessed blocks.
Definition: block_storage.h:26
void AddListening(UnixFsPathResolver *)
Indicate that a particular path resolver is waiting on a CID to become available.
std::string const * GetHeaders(std::string const &cid)
Get HTTP headers associated with the block.
void AddStorageHook(SerializedStorageHook)
Register a callback that will be called when any new block goes into storage.
PbDag const * Get(std::string const &cid)
Get a block!
void CheckListening()
Normally called internally.
bool Store(std::string cid_str, Cid const &cid, std::string headers, std::string const &body, PbDag &&block)
Store a Block for later access.
std::function< void(std::string, std::string, std::string)> SerializedStorageHook
Type for callbacks about new blocks.
Definition: block_storage.h:113
void StopListening(UnixFsPathResolver *)
Indicate that a particular path resolver is no longer waiting.
Something to which a CID may refer directly.
Definition: pb_dag.h:24
Definition: block_storage.h:11