MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / asyncCopy

Function asyncCopy

src/Disks/IDisk.cpp:144–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144static void asyncCopy(
145 IDisk & from_disk,
146 String from_path,
147 IDisk & to_disk,
148 String to_path,
149 ThreadPoolCallbackRunnerLocal<void> & runner,
150 const ReadSettings & read_settings,
151 const WriteSettings & write_settings,
152 const std::function<void()> & cancellation_hook)
153{
154 if (from_disk.existsFile(from_path))
155 {
156 runner.enqueueAndKeepTrack(
157 [&from_disk, from_path, &to_disk, to_path, &read_settings, &write_settings, &cancellation_hook] {
158 from_disk.copyFile(
159 from_path, to_disk, to_path, read_settings, write_settings, cancellation_hook);
160 });
161 }
162 else /// Directory
163 {
164 fs::path dest(to_path);
165 to_disk.createDirectories(dest);
166
167 /// Calling asyncCopy recursively is fine here. Each call will capture by reference what were already references
168 /// dest is an exception, but it's passed as value, not reference
169 for (auto it = from_disk.iterateDirectory(from_path); it->isValid(); it->next())
170 asyncCopy(from_disk, it->path(), to_disk, dest / it->name(), runner, read_settings, write_settings, cancellation_hook);
171 }
172}
173
174void IDisk::copyThroughBuffers(
175 const String & from_path,

Callers 1

copyThroughBuffersMethod · 0.85

Calls 9

enqueueAndKeepTrackMethod · 0.80
existsFileMethod · 0.45
copyFileMethod · 0.45
createDirectoriesMethod · 0.45
iterateDirectoryMethod · 0.45
isValidMethod · 0.45
nextMethod · 0.45
pathMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected