]> git.proxmox.com Git - ceph.git/blame - ceph/src/mds/snap.h
update sources to v12.2.5
[ceph.git] / ceph / src / mds / snap.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 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
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 CEPH_MDS_SNAP_H
16#define CEPH_MDS_SNAP_H
17
94b18763
FG
18#include <boost/utility/string_view.hpp>
19
7c673cae
FG
20#include "mdstypes.h"
21#include "common/snap_types.h"
22
23/*
24 * generic snap descriptor.
25 */
26struct SnapInfo {
27 snapid_t snapid;
28 inodeno_t ino;
29 utime_t stamp;
30 string name;
31
32 string long_name; ///< cached _$ino_$name
33
34 void encode(bufferlist &bl) const;
35 void decode(bufferlist::iterator &bl);
36 void dump(Formatter *f) const;
37 static void generate_test_instances(list<SnapInfo*>& ls);
38
94b18763 39 boost::string_view get_long_name();
7c673cae
FG
40};
41WRITE_CLASS_ENCODER(SnapInfo)
42
43ostream& operator<<(ostream& out, const SnapInfo &sn);
44
45
46/*
47 * SnapRealm - a subtree that shares the same set of snapshots.
48 */
49struct SnapRealm;
50class CInode;
51class MDCache;
52
53
54
55#include "Capability.h"
56
57struct snaplink_t {
58 inodeno_t ino;
59 snapid_t first;
60
61 void encode(bufferlist &bl) const;
62 void decode(bufferlist::iterator &bl);
63 void dump(Formatter *f) const;
64 static void generate_test_instances(list<snaplink_t*>& ls);
65};
66WRITE_CLASS_ENCODER(snaplink_t)
67
68ostream& operator<<(ostream& out, const snaplink_t &l);
69
70
71// carry data about a specific version of a SnapRealm
72struct sr_t {
73 snapid_t seq; // basically, a version/seq # for changes to _this_ realm.
74 snapid_t created; // when this realm was created.
75 snapid_t last_created; // last snap created in _this_ realm.
76 snapid_t last_destroyed; // seq for last removal
77 snapid_t current_parent_since;
78 map<snapid_t, SnapInfo> snaps;
79 map<snapid_t, snaplink_t> past_parents; // key is "last" (or NOSNAP)
80
81 sr_t()
82 : seq(0), created(0),
83 last_created(0), last_destroyed(0),
84 current_parent_since(1)
85 {}
86
87 void encode(bufferlist &bl) const;
88 void decode(bufferlist::iterator &bl);
89 void dump(Formatter *f) const;
90 static void generate_test_instances(list<sr_t*>& ls);
91};
92WRITE_CLASS_ENCODER(sr_t)
93
94#endif