~ubuntu-branches/ubuntu/raring/ceph/raring

« back to all changes in this revision

Viewing changes to src/common/LogEntry.cc

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-06-08 15:54:37 UTC
  • mfrom: (0.3.9)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: package-import@ubuntu.com-20120608155437-30vek4y2gu92vhad
Tags: upstream-0.44.1
ImportĀ upstreamĀ versionĀ 0.44.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include "LogEntry.h"
 
3
#include "Formatter.h"
 
4
 
 
5
void LogEntryKey::encode(bufferlist& bl) const
 
6
{
 
7
  ::encode(who, bl);
 
8
  ::encode(stamp, bl);
 
9
  ::encode(seq, bl);
 
10
}
 
11
 
 
12
void LogEntryKey::decode(bufferlist::iterator& bl)
 
13
{
 
14
  ::decode(who, bl);
 
15
  ::decode(stamp, bl);
 
16
  ::decode(seq, bl);
 
17
}
 
18
 
 
19
void LogEntryKey::dump(Formatter *f) const
 
20
{
 
21
  f->dump_stream("who") << who;
 
22
  f->dump_stream("stamp") << stamp;
 
23
  f->dump_unsigned("seq", seq);
 
24
}
 
25
 
 
26
void LogEntryKey::generate_test_instances(list<LogEntryKey*>& o)
 
27
{
 
28
  o.push_back(new LogEntryKey);
 
29
  o.push_back(new LogEntryKey(entity_inst_t(), utime_t(1,2), 34));
 
30
}
 
31
 
 
32
// ----
 
33
 
 
34
void LogEntry::encode(bufferlist& bl) const
 
35
{
 
36
  ENCODE_START(2, 2, bl);
 
37
  __u16 t = type;
 
38
  ::encode(who, bl);
 
39
  ::encode(stamp, bl);
 
40
  ::encode(seq, bl);
 
41
  ::encode(t, bl);
 
42
  ::encode(msg, bl);
 
43
  ENCODE_FINISH(bl);
 
44
}
 
45
 
 
46
void LogEntry::decode(bufferlist::iterator& bl)
 
47
{
 
48
  DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
 
49
  __u16 t;
 
50
  ::decode(who, bl);
 
51
  ::decode(stamp, bl);
 
52
  ::decode(seq, bl);
 
53
  ::decode(t, bl);
 
54
  type = (clog_type)t;
 
55
  ::decode(msg, bl);
 
56
  DECODE_FINISH(bl);
 
57
}
 
58
 
 
59
void LogEntry::dump(Formatter *f) const
 
60
{
 
61
  f->dump_stream("who") << who;
 
62
  f->dump_stream("stamp") << stamp;
 
63
  f->dump_unsigned("seq", seq);
 
64
  f->dump_stream("type") << type;
 
65
  f->dump_string("message", msg);
 
66
}
 
67
 
 
68
void LogEntry::generate_test_instances(list<LogEntry*>& o)
 
69
{
 
70
  o.push_back(new LogEntry);
 
71
}
 
72
 
 
73
 
 
74
// -----
 
75
 
 
76
void LogSummary::encode(bufferlist& bl) const
 
77
{
 
78
  ENCODE_START(2, 2, bl);
 
79
  ::encode(version, bl);
 
80
  ::encode(tail, bl);
 
81
  ENCODE_FINISH(bl);
 
82
}
 
83
 
 
84
void LogSummary::decode(bufferlist::iterator& bl)
 
85
{
 
86
  DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
 
87
  ::decode(version, bl);
 
88
  ::decode(tail, bl);
 
89
  DECODE_FINISH(bl);
 
90
}
 
91
 
 
92
void LogSummary::dump(Formatter *f) const
 
93
{
 
94
  f->dump_unsigned("version", version);
 
95
  f->open_array_section("tail");
 
96
  for (list<LogEntry>::const_iterator p = tail.begin(); p != tail.end(); ++p) {
 
97
    f->open_object_section("entry");
 
98
    p->dump(f);
 
99
    f->close_section();
 
100
  }
 
101
  f->close_section();
 
102
}
 
103
 
 
104
void LogSummary::generate_test_instances(list<LogSummary*>& o)
 
105
{
 
106
  o.push_back(new LogSummary);
 
107
  // more!
 
108
}