载入中...
搜索中...
未找到
PreparedFile.cpp
浏览该文件的文档.
20 void adopt(Resource& replacement) override { bytes.swap(static_cast<FileSnapshot&>(replacement).bytes); }
42 Register() { cap::addListener<caps::IAssetReloader>(&loader, caps::IAssetReloader::kCache - 1); }
45 if (path.empty() || path.find('?') != std::string::npos) throw Exception("Invalid prepared file path");
63 return R::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, "Invalid prepared file size limit"));
69 Diagnostic::error(DiagnosticCode::InvalidArgument, "Prepared file exceeds caller size limit", path));
76 cls.addFunc("requestPreparedFile", [vm = cls.getHandle()](Filesystem*, const std::string& path) {
Capability for submitting CPU work onto a worker pool.
The single Squirrel projection for common Result, Status and Value.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
ResultRef< Resource > waitFor(std::string key)
Block until key is cached, failed, or unclaimed.
Definition Resource.cpp:226
eve::Result< void > request(std::string key)
Queue a cache miss load without blocking for decode to finish.
Definition Resource.cpp:149
static std::string pathOfKey(const std::string &key)
The path part of a cache key (everything before the first '?').
Definition Resource.cpp:46
static std::string makeKey(const std::string &path, const std::string &query="")
Build a cache key from a path and optional ?query parameters.
Definition Resource.cpp:37
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
@ Exception
@ Resource
Definition File.cpp:17
void exposePreparedFileBindings(ssq::Class &cls)
Install game-thread script submission bindings; retains no class borrow.
Definition PreparedFile.cpp:75
Result< void > requestPreparedFile(const std::string &path)
Queue immutable file bytes in the canonical ResourceManager cache.
Definition PreparedFile.cpp:49
Result< std::shared_ptr< const FileData > > readPreparedFile(const std::string &path, size_t limit)
Join a queued read or synchronously read an immutable file snapshot.
Definition PreparedFile.cpp:59
@ InvalidArgument
@ Unsupported
@ Failed
Definition Container.h:602