1 #ifndef CACHE_REQUESTOR_H_
2 #define CACHE_REQUESTOR_H_
4 #include <net/base/cache_type.h>
5 #include <net/base/io_buffer.h>
6 #include <net/disk_cache/disk_cache.h>
8 #include <base/memory/raw_ref.h>
9 #include <base/memory/scoped_refptr.h>
10 #include <base/time/time.h>
12 #include <ipfs_client/gw/requestor.h>
13 #include <ipfs_client/ipld/block_source.h>
15 #include <vocab/byte_view.h>
22 class InterRequestState;
30 void Store(std::string key, std::string headers, ByteView body);
31 void Expire(std::string
const& key);
33 std::string_view
name()
const override;
41 ipld::BlockSource::Clock::time_point start =
42 ipld::BlockSource::Clock::now();
45 scoped_refptr<net::IOBufferWithSize> buf;
46 std::shared_ptr<disk_cache::Entry> entry;
47 gw::RequestPtr request;
48 ipld::BlockSource orig_src;
50 raw_ref<InterRequestState> state_;
51 std::unique_ptr<disk_cache::Backend> cache_;
52 bool startup_pending_ = false;
57 void StartFetch(Task& t, net::RequestPriority priority);
58 void Assign(disk_cache::BackendResult);
59 void OnOpen(Task, disk_cache::EntryResult);
60 void OnHeaderRead(Task,
int);
61 void OnBodyRead(Task,
int);
63 void OnEntryCreated(std::
string c,
66 disk_cache::EntryResult);
67 void OnHeaderWritten(scoped_refptr<net::StringIOBuffer> buf,
69 std::shared_ptr<disk_cache::Entry> entry,
72 HandleOutcome handle(RequestPtr) override;
Definition: cache_requestor.h:26
std::string_view name() const override
Definition: requestor.h:22