1 /*
2    Copyright 2015-2017 Skytechnology sp. z o.o.
3 
4    This file is part of LizardFS.
5 
6    LizardFS is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation, version 3.
9 
10    LizardFS is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with LizardFS. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 
21 #include "common/platform.h"
22 
23 #include "master/filesystem.h"
24 #include "master/fs_context.h"
25 
26 void fs_read_snapshot_config_file();
27 
28 /*! \brief Register snapshot task.
29  *
30  * \param context server context.
31  * \param inode_src number of inode to clone.
32  * \param parent_dst number of inode of the directory where source inode should be cloned to.
33  * \param name_dst clone name.
34  * \param can_overwrite if true then cloning process can overwrite existing nodes.
35  * \param callback function that should be executed on finish of snapshot task.
36  * \param job_id desired id for this snapshot request.
37  */
38 uint8_t fs_snapshot(const FsContext &context, uint32_t inode_src, uint32_t parent_dst,
39 		const HString &name_dst, uint8_t can_overwrite, uint8_t ignore_missing_src, uint32_t initial_batch_size,
40 		const std::function<void(int)> &callback, uint32_t job_id);
41 
42 /*! \brief Clone one inode.
43  *
44  * \param context server context.
45  * \param inode_src number of inode to clone.
46  * \param parent_dst number of inode of the directory where source inode should be cloned to.
47  * \param inode_dst inode number that should be used for clone's inode.
48  * \param name_dst clone name.
49  * \param can_overwrite if true then cloning process can overwrite existing nodes.
50  */
51 uint8_t fs_clone_node(const FsContext &context, uint32_t inode_src, uint32_t parent_dst,
52 		uint32_t inode_dst, const HString &name_dst,
53 		uint8_t can_overwrite);
54