MCPcopy Create free account
hub / github.com/78/tenbox / Load

Method Load

src/daemon/vm_store.cpp:91–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91bool VmStore::Load(std::string* error) {
92 std::lock_guard<std::mutex> lock(mutex_);
93 vms_.clear();
94
95 std::error_code ec;
96 fs::create_directories(VmRoot(), ec);
97 if (ec) {
98 if (error) *error = "failed to create VM root: " + ec.message();
99 return false;
100 }
101
102 for (const auto& entry : fs::directory_iterator(VmRoot(), ec)) {
103 if (ec) break;
104 if (!entry.is_directory()) continue;
105 (void)LoadVmDir(entry.path(), error);
106 }
107 return true;
108}
109
110bool VmStore::LoadVmDir(const fs::path& vm_dir, std::string* error) {
111 const auto manifest = vm_dir / "vm.json";

Callers 1

mainFunction · 0.80

Calls 1

pathMethod · 0.45

Tested by

no test coverage detected