MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / ListChunkFiles

Function ListChunkFiles

oneflow/core/embedding/persistent_table.cpp:106–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106void ListChunkFiles(const std::string& base, const std::string& prefix,
107 std::unordered_map<uint64_t, std::string>* chunks) {
108 DIR* dir = opendir(base.c_str());
109 PCHECK(dir != nullptr);
110 struct dirent* ent = nullptr;
111 while ((ent = readdir(dir)) != nullptr) {
112 if (strlen(ent->d_name) != prefix.size() + kChunkNameSuffixLength) { continue; }
113 if (strncmp(ent->d_name, prefix.c_str(), prefix.size()) != 0) { continue; }
114 const uint64_t chunk_id = GetChunkId(ent->d_name + prefix.size());
115 CHECK(chunks->emplace(chunk_id, PosixFile::JoinPath(base, ent->d_name)).second);
116 }
117 PCHECK(closedir(dir) == 0);
118}
119
120uint32_t GetLogicalBlockSize(uint32_t physical_block_size, uint32_t value_size) {
121 return physical_block_size >= value_size ? physical_block_size

Callers 1

PersistentTableImplMethod · 0.85

Calls 3

GetChunkIdFunction · 0.85
JoinPathFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected