]> git.proxmox.com Git - ceph.git/blame - ceph/src/librbd/api/Snapshot.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / librbd / api / Snapshot.h
CommitLineData
11fdf7f2
TL
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3
4#ifndef CEPH_LIBRBD_API_SNAPSHOT_H
5#define CEPH_LIBRBD_API_SNAPSHOT_H
6
7#include "include/rbd/librbd.hpp"
9f95a23c 8#include "cls/rbd/cls_rbd_types.h"
11fdf7f2
TL
9#include <string>
10
11namespace librbd {
12
13struct ImageCtx;
14
15namespace api {
16
17template <typename ImageCtxT = librbd::ImageCtx>
18struct Snapshot {
19
20 static int get_group_namespace(ImageCtxT *ictx, uint64_t snap_id,
21 snap_group_namespace_t *group_snap);
22
23 static int get_trash_namespace(ImageCtxT *ictx, uint64_t snap_id,
24 std::string *original_name);
25
9f95a23c
TL
26 static int get_mirror_namespace(
27 ImageCtxT *ictx, uint64_t snap_id,
28 snap_mirror_namespace_t *mirror_snap);
29
11fdf7f2
TL
30 static int get_namespace_type(ImageCtxT *ictx, uint64_t snap_id,
31 snap_namespace_type_t *namespace_type);
32
33 static int remove(ImageCtxT *ictx, uint64_t snap_id);
34
9f95a23c
TL
35 static int get_name(ImageCtxT *ictx, uint64_t snap_id, std::string *snap_name);
36
37 static int get_id(ImageCtxT *ictx, const std::string& snap_name, uint64_t *snap_id);
38
39 static int list(ImageCtxT *ictx, std::vector<snap_info_t>& snaps);
40
41 static int exists(ImageCtxT *ictx, const cls::rbd::SnapshotNamespace& snap_namespace,
42 const char *snap_name, bool *exists);
43
44 static int remove(ImageCtxT *ictx, const char *snap_name, uint32_t flags, ProgressContext& pctx);
45
46 static int get_limit(ImageCtxT *ictx, uint64_t *limit);
47
48 static int set_limit(ImageCtxT *ictx, uint64_t limit);
49
50 static int get_timestamp(ImageCtxT *ictx, uint64_t snap_id, struct timespec *timestamp);
51
52 static int is_protected(ImageCtxT *ictx, const char *snap_name, bool *protect);
53
54 static int get_namespace(ImageCtxT *ictx, const char *snap_name,
55 cls::rbd::SnapshotNamespace *snap_namespace);
56
11fdf7f2
TL
57};
58
59} // namespace api
60} // namespace librbd
61
62extern template class librbd::api::Snapshot<librbd::ImageCtx>;
63
64#endif // CEPH_LIBRBD_API_SNAPSHOT_H