Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / tools / rados / RadosImport.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4  * Ceph - scalable distributed file system
5  *
6  * Copyright (C) 2015 Red Hat
7  *
8  * This is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License version 2.1, as published by the Free Software
11  * Foundation.  See file COPYING.
12  *
13  */
14
15 #ifndef RADOS_IMPORT_H_
16 #define RADOS_IMPORT_H_
17
18 #include <string>
19
20 #include "include/rados/librados.hpp"
21 #include "include/buffer_fwd.h"
22
23 #include "tools/RadosDump.h"
24
25 /**
26  * Specialization of RadosDump that adds
27  * methods for importing objects from a stream
28  * to a live cluster.
29  */
30 class RadosImport : public RadosDump
31 {
32   protected:
33     uint64_t align;
34     int get_object_rados(librados::IoCtx &ioctx, bufferlist &bl, bool no_overwrite);
35
36   public:
37     RadosImport(int file_fd_, uint64_t align_, bool dry_run_)
38       : RadosDump(file_fd_, dry_run_), align(align_)
39     {}
40
41     int import(std::string pool, bool no_overwrite);
42     int import(librados::IoCtx &io_ctx, bool no_overwrite);
43 };
44
45 #endif // RADOS_IMPORT_H_