]> git.proxmox.com Git - ceph.git/blame - ceph/src/journal/Entry.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / journal / Entry.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 CEPH_JOURNAL_ENTRY_H
5#define CEPH_JOURNAL_ENTRY_H
6
7#include "include/int_types.h"
8#include "include/buffer.h"
9#include "include/encoding.h"
10#include <iosfwd>
11#include <string>
12
13namespace ceph {
14class Formatter;
15}
16
17namespace journal {
18
19class Entry {
20public:
21 Entry() : m_tag_tid(0), m_entry_tid() {}
22 Entry(uint64_t tag_tid, uint64_t entry_tid, const bufferlist &data)
23 : m_tag_tid(tag_tid), m_entry_tid(entry_tid), m_data(data)
24 {
25 }
26
27 static uint32_t get_fixed_size();
28
29 inline uint64_t get_tag_tid() const {
30 return m_tag_tid;
31 }
32 inline uint64_t get_entry_tid() const {
33 return m_entry_tid;
34 }
35 inline const bufferlist &get_data() const {
36 return m_data;
37 }
38
39 void encode(bufferlist &bl) const;
11fdf7f2 40 void decode(bufferlist::const_iterator &iter);
7c673cae
FG
41 void dump(ceph::Formatter *f) const;
42
43 bool operator==(const Entry& rhs) const;
44
11fdf7f2 45 static bool is_readable(bufferlist::const_iterator iter, uint32_t *bytes_needed);
7c673cae
FG
46 static void generate_test_instances(std::list<Entry *> &o);
47
48private:
49 static const uint64_t preamble = 0x3141592653589793;
50
51 uint64_t m_tag_tid;
52 uint64_t m_entry_tid;
53 bufferlist m_data;
54};
55
56std::ostream &operator<<(std::ostream &os, const Entry &entry);
11fdf7f2 57WRITE_CLASS_ENCODER(journal::Entry)
7c673cae
FG
58
59} // namespace journal
60
7c673cae
FG
61
62#endif // CEPH_JOURNAL_ENTRY_H