From 1502c32f718fae7ffdd267310bf7e838fe3174ed Mon Sep 17 00:00:00 2001 From: Michal Jarzabek Date: Mon, 16 May 2016 21:43:21 +0100 Subject: [PATCH] osd/HitSet: remove unneeded #include - Formatter Signed-off-by: Michal Jarzabek --- src/osd/HitSet.cc | 37 +++++++++++++++++++++++++++++++++++++ src/osd/HitSet.h | 32 ++++---------------------------- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/osd/HitSet.cc b/src/osd/HitSet.cc index 597b1f7d8f560..c5f7cd5bf3969 100644 --- a/src/osd/HitSet.cc +++ b/src/osd/HitSet.cc @@ -13,6 +13,7 @@ */ #include "HitSet.h" +#include "common/Formatter.h" // -- HitSet -- @@ -213,3 +214,39 @@ ostream& operator<<(ostream& out, const HitSet::Params& p) { out << "}"; return out; } + + +void ExplicitHashHitSet::dump(Formatter *f) const { + f->dump_unsigned("insert_count", count); + f->open_array_section("hash_set"); + for (ceph::unordered_set::const_iterator p = hits.begin(); + p != hits.end(); + ++p) + f->dump_unsigned("hash", *p); + f->close_section(); +} + +void ExplicitObjectHitSet::dump(Formatter *f) const { + f->dump_unsigned("insert_count", count); + f->open_array_section("set"); + for (ceph::unordered_set::const_iterator p = hits.begin(); + p != hits.end(); + ++p) { + f->open_object_section("object"); + p->dump(f); + f->close_section(); + } + f->close_section(); +} + +void BloomHitSet::Params::dump(Formatter *f) const { + f->dump_float("false_positive_probability", get_fpp()); + f->dump_int("target_size", target_size); + f->dump_int("seed", seed); +} + +void BloomHitSet::dump(Formatter *f) const { + f->open_object_section("bloom_filter"); + bloom.dump(f); + f->close_section(); +} diff --git a/src/osd/HitSet.h b/src/osd/HitSet.h index 42292970f9730..ecb613363a729 100644 --- a/src/osd/HitSet.h +++ b/src/osd/HitSet.h @@ -21,7 +21,6 @@ #include "include/unordered_set.h" #include "common/bloom_filter.hpp" #include "common/hobject.h" -#include "common/Formatter.h" /** * generic container for a HitSet @@ -234,13 +233,7 @@ public: ::decode(hits, bl); DECODE_FINISH(bl); } - void dump(Formatter *f) const { - f->dump_unsigned("insert_count", count); - f->open_array_section("hash_set"); - for (ceph::unordered_set::const_iterator p = hits.begin(); p != hits.end(); ++p) - f->dump_unsigned("hash", *p); - f->close_section(); - } + void dump(Formatter *f) const; static void generate_test_instances(list& o) { o.push_back(new ExplicitHashHitSet); o.push_back(new ExplicitHashHitSet); @@ -311,16 +304,7 @@ public: ::decode(hits, bl); DECODE_FINISH(bl); } - void dump(Formatter *f) const { - f->dump_unsigned("insert_count", count); - f->open_array_section("set"); - for (ceph::unordered_set::const_iterator p = hits.begin(); p != hits.end(); ++p) { - f->open_object_section("object"); - p->dump(f); - f->close_section(); - } - f->close_section(); - } + void dump(Formatter *f) const; static void generate_test_instances(list& o) { o.push_back(new ExplicitObjectHitSet); o.push_back(new ExplicitObjectHitSet); @@ -386,11 +370,7 @@ public: ::decode(seed, bl); DECODE_FINISH(bl); } - void dump(Formatter *f) const { - f->dump_float("false_positive_probability", get_fpp()); - f->dump_int("target_size", target_size); - f->dump_int("seed", seed); - } + void dump(Formatter *f) const; void dump_stream(ostream& o) const { o << "false_positive_probability: " << get_fpp() << ", target_size: " << target_size @@ -459,11 +439,7 @@ public: ::decode(bloom, bl); DECODE_FINISH(bl); } - void dump(Formatter *f) const { - f->open_object_section("bloom_filter"); - bloom.dump(f); - f->close_section(); - } + void dump(Formatter *f) const; static void generate_test_instances(list& o) { o.push_back(new BloomHitSet); o.push_back(new BloomHitSet(10, .1, 1)); -- 2.39.5