1 | #pragma once |
2 | |
3 | #include <optional> |
4 | |
5 | namespace Poco { class Path; } |
6 | |
7 | namespace DB |
8 | { |
9 | |
10 | /** Creates a local (at the same mount point) backup (snapshot) directory. |
11 | * |
12 | * In the specified destination directory, it creates a hard links on all source-directory files |
13 | * and in all nested directories, with saving (creating) all relative paths; |
14 | * and also `chown`, removing the write permission. |
15 | * |
16 | * This protects data from accidental deletion or modification, |
17 | * and is intended to be used as a simple means of protection against a human or program error, |
18 | * but not from a hardware failure. |
19 | * |
20 | * If max_level is specified, than only files which depth relative source_path less or equal max_level will be copied. |
21 | * So, if max_level=0 than only direct file child are copied. |
22 | */ |
23 | void localBackup(const Poco::Path & source_path, const Poco::Path & destination_path, std::optional<size_t> max_level = {}); |
24 | |
25 | } |
26 | |