]> git.proxmox.com Git - ceph.git/blame - ceph/src/librbd/api/Image.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / librbd / api / Image.h
CommitLineData
7c673cae
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3
4#ifndef LIBRBD_API_IMAGE_H
5#define LIBRBD_API_IMAGE_H
6
11fdf7f2
TL
7#include "include/rbd/librbd.hpp"
8#include "include/rados/librados_fwd.hpp"
7c673cae
FG
9#include "librbd/Types.h"
10#include <map>
11#include <set>
12#include <string>
13
7c673cae
FG
14namespace librbd {
15
11fdf7f2
TL
16class ImageOptions;
17class ProgressContext;
18
7c673cae
FG
19struct ImageCtx;
20
21namespace api {
22
23template <typename ImageCtxT = librbd::ImageCtx>
24struct Image {
7c673cae
FG
25 typedef std::map<std::string, std::string> ImageNameToIds;
26
11fdf7f2
TL
27 static int get_op_features(ImageCtxT *ictx, uint64_t *op_features);
28
7c673cae 29 static int list_images(librados::IoCtx& io_ctx,
11fdf7f2
TL
30 std::vector<image_spec_t> *images);
31 static int list_images_v2(librados::IoCtx& io_ctx,
32 ImageNameToIds *images);
33
34 static int get_parent(ImageCtxT *ictx,
35 librbd::linked_image_spec_t *parent_image,
36 librbd::snap_spec_t *parent_snap);
37
38 static int list_children(ImageCtxT *ictx,
39 std::vector<librbd::linked_image_spec_t> *images);
40 static int list_children(ImageCtxT *ictx,
41 const cls::rbd::ParentImageSpec &parent_spec,
42 std::vector<librbd::linked_image_spec_t> *images);
43
44 static int list_descendants(IoCtx& io_ctx, const std::string &image_id,
45 const std::optional<size_t> &max_level,
46 std::vector<librbd::linked_image_spec_t> *images);
47 static int list_descendants(ImageCtxT *ictx,
48 const std::optional<size_t> &max_level,
49 std::vector<librbd::linked_image_spec_t> *images);
50 static int list_descendants(ImageCtxT *ictx,
51 const cls::rbd::ParentImageSpec &parent_spec,
52 const std::optional<size_t> &max_level,
53 std::vector<librbd::linked_image_spec_t> *images);
54
55 static int deep_copy(ImageCtxT *ictx, librados::IoCtx& dest_md_ctx,
56 const char *destname, ImageOptions& opts,
57 ProgressContext &prog_ctx);
58 static int deep_copy(ImageCtxT *src, ImageCtxT *dest, bool flatten,
59 ProgressContext &prog_ctx);
60
61 static int snap_set(ImageCtxT *ictx,
62 const cls::rbd::SnapshotNamespace &snap_namespace,
63 const char *snap_name);
64 static int snap_set(ImageCtxT *ictx, uint64_t snap_id);
7c673cae 65
11fdf7f2
TL
66 static int remove(librados::IoCtx& io_ctx, const std::string &image_name,
67 ProgressContext& prog_ctx);
7c673cae
FG
68
69};
70
71} // namespace api
72} // namespace librbd
73
74extern template class librbd::api::Image<librbd::ImageCtx>;
75
76#endif // LIBRBD_API_IMAGE_H