MCPcopy Create free account
hub / github.com/apache/kvrocks / MkdirRecursively

Function MkdirRecursively

src/storage/storage.cc:1332–1347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1330}
1331
1332Status MkdirRecursively(rocksdb::Env *env, const std::string &dir) {
1333 if (env->CreateDirIfMissing(dir).ok()) return Status::OK();
1334
1335 std::string parent;
1336 for (auto pos = dir.find('/', 1); pos != std::string::npos; pos = dir.find('/', pos + 1)) {
1337 parent = dir.substr(0, pos);
1338 if (auto s = env->CreateDirIfMissing(parent); !s.ok()) {
1339 ERROR("[storage] Failed to create directory '{}' recursively. Error: {}", parent, s.ToString());
1340 return {Status::NotOK};
1341 }
1342 }
1343
1344 if (env->CreateDirIfMissing(dir).ok()) return Status::OK();
1345
1346 return {Status::NotOK};
1347}
1348
1349std::unique_ptr<rocksdb::WritableFile> Storage::ReplDataManager::NewTmpFile(Storage *storage, const std::string &dir,
1350 const std::string &repl_file) {

Callers 1

NewTmpFileMethod · 0.85

Calls 1

ToStringMethod · 0.45

Tested by

no test coverage detected