MCPcopy Create free account
hub / github.com/UbiquitousLearning/mllm / create

Method create

mllm/engine/prefix_cache/ZenFS.cpp:19–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17namespace mllm::prefix_cache {
18
19ZenFSBlobMMAPFile::ptr_t ZenFSBlobMMAPFile::create(size_t size, ZenFSMMAPMode mode, const std::string& fpath,
20 std::error_code& ec) {
21 // Not throw std::bad_alloc but return nullptr
22 auto ptr = std::shared_ptr<ZenFSBlobMMAPFile>(new (std::nothrow) ZenFSBlobMMAPFile);
23 if (!ptr) {
24 ec = std::make_error_code(std::errc::not_enough_memory);
25 return nullptr;
26 }
27 bool ok = false;
28 if (mode == ZenFSMMAPMode::kAnonymous) {
29 ok = ptr->initAnonymous(size, ec);
30 } else {
31 ok = ptr->initFileBacked(size, mode, fpath, ec);
32 }
33 if (!ok) { ptr.reset(); }
34 return ptr;
35}
36
37#if !defined(_WIN32)
38

Callers

nothing calls this directly

Calls 3

initAnonymousMethod · 0.80
initFileBackedMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected