]>
git.proxmox.com Git - ceph.git/blob - ceph/src/mds/JournalPointer.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
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.
16 #ifndef JOURNAL_POINTER_H
17 #define JOURNAL_POINTER_H
19 #include "include/encoding.h"
25 // This always lives in the same location for a given MDS
26 // instance, it tells the daemon where to look for the journal.
27 class JournalPointer
{
33 std::string
get_object_id() const;
36 // The currently active journal
38 // The backup journal, if any (may be 0)
41 void encode(bufferlist
&bl
) const {
42 ENCODE_START(1, 1, bl
);
48 void decode(bufferlist::iterator
&bl
) {
55 JournalPointer(int node_id_
, int64_t pool_id_
) : node_id(node_id_
), pool_id(pool_id_
),
58 JournalPointer() : node_id(-1), pool_id(-1), front(0), back(0) {}
60 int load(Objecter
*objecter
);
61 int save(Objecter
*objecter
) const;
62 void save(Objecter
*objecter
, Context
*completion
) const;
64 bool is_null() const {
65 return front
== 0 && back
== 0;
68 void dump(Formatter
*f
) const {
69 f
->open_object_section("journal_pointer");
71 f
->dump_unsigned("front", front
);
72 f
->dump_unsigned("back", back
);
74 f
->close_section(); // journal_header
77 static void generate_test_instances(std::list
<JournalPointer
*> &ls
)
79 ls
.push_back(new JournalPointer());
80 ls
.push_back(new JournalPointer());
81 ls
.back()->front
= 0xdeadbeef;
82 ls
.back()->back
= 0xfeedbead;
85 WRITE_CLASS_ENCODER(JournalPointer
)
87 #endif // JOURNAL_POINTER_H