3#include "IAssetAccessor.h"
4#include "IAssetRequest.h"
5#include "ICacheDatabase.h"
40 const std::shared_ptr<spdlog::logger>& pLogger,
41 const std::shared_ptr<IAssetAccessor>& pAssetAccessor,
42 const std::shared_ptr<ICacheDatabase>& pCacheDatabase,
43 int32_t requestsPerCachePrune = 10000);
50 const
std::
string& url,
55 const
std::
string& verb,
56 const
std::
string& url,
58 const
std::span<const
std::
byte>& contentPayload) override;
61 virtual
void tick() noexcept override;
64 int32_t _requestsPerCachePrune;
65 std::atomic<int32_t> _requestSinceLastPrune;
66 std::shared_ptr<spdlog::logger> _pLogger;
70 CESIUM_TRACE_DECLARE_TRACK_SET(_pruneSlots, "Prune cache database")
A system for managing asynchronous requests and tasks.
A decorator for an IAssetAccessor that caches requests and responses in an ICacheDatabase.
virtual void tick() noexcept override
Ticks the asset accessor system while the main thread is blocked.
virtual Future< std::shared_ptr< IAssetRequest > > request(const AsyncSystem &asyncSystem, const std::string &verb, const std::string &url, const std::vector< THeader > &headers, const std::span< const std::byte > &contentPayload) override
Starts a new request to the given URL, using the provided HTTP verb and the provided content payload.
virtual Future< std::shared_ptr< IAssetRequest > > get(const AsyncSystem &asyncSystem, const std::string &url, const std::vector< THeader > &headers) override
Starts a new request for the asset with the given URL. The request proceeds asynchronously without bl...
CachingAssetAccessor(const std::shared_ptr< spdlog::logger > &pLogger, const std::shared_ptr< IAssetAccessor > &pAssetAccessor, const std::shared_ptr< ICacheDatabase > &pCacheDatabase, int32_t requestsPerCachePrune=10000)
Constructs a new instance.
A value that will be available in the future, as produced by AsyncSystem.
Provides asynchronous access to assets, usually files downloaded via HTTP.
std::pair< std::string, std::string > THeader
An HTTP header represented as a key/value pair.
An asynchronous request for an asset, usually a file downloaded via HTTP.
Provides database storage interface to cache completed request.
A thread pool created by AsyncSystem::createThreadPool.
Classes that support asynchronous operations.