mirror of
https://github.com/ceph/ceph
synced 2025-01-19 09:32:00 +00:00
common: expose internal StackStringStream via deref
This makes it much easier to use and works similar to a smart ptr. Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
This commit is contained in:
parent
38044113a1
commit
e4bd6c114d
@ -128,14 +128,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
sss& get_stream() {
|
||||
sss& operator*() {
|
||||
return *osp;
|
||||
}
|
||||
const sss& get_stream() const {
|
||||
sss const& operator*() const {
|
||||
return *osp;
|
||||
}
|
||||
std::string_view strv() const {
|
||||
return osp->strv();
|
||||
sss* operator->() {
|
||||
return osp.get();
|
||||
}
|
||||
sss const* operator->() const {
|
||||
return osp.get();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -62,14 +62,14 @@ public:
|
||||
~MutableEntry() override = default;
|
||||
|
||||
std::ostream& get_ostream() {
|
||||
return cos.get_stream();
|
||||
return *cos;
|
||||
}
|
||||
|
||||
std::string_view strv() const override {
|
||||
return cos.get_stream().strv();
|
||||
return cos->strv();
|
||||
}
|
||||
std::size_t size() const override {
|
||||
return cos.get_stream().strv().size();
|
||||
return cos->strv().size();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -2948,9 +2948,9 @@ bool MDSRank::command_dirfrag_ls(
|
||||
f->open_object_section("frag");
|
||||
f->dump_int("value", leaf.value());
|
||||
f->dump_int("bits", leaf.bits());
|
||||
CachedStackStringStream ss;
|
||||
ss.get_stream() << std::hex << leaf.value() << "/" << std::dec << leaf.bits();
|
||||
f->dump_string("str", ss.strv());
|
||||
CachedStackStringStream css;
|
||||
*css << std::hex << leaf.value() << "/" << std::dec << leaf.bits();
|
||||
f->dump_string("str", css->strv());
|
||||
f->close_section();
|
||||
}
|
||||
f->close_section();
|
||||
@ -3199,12 +3199,11 @@ bool MDSRank::evict_client(int64_t session_id,
|
||||
|
||||
auto& addr = session->info.inst.addr;
|
||||
{
|
||||
CachedStackStringStream _ss;
|
||||
auto& ss = _ss.get_stream();
|
||||
ss << "Evicting " << (blacklist ? "(and blacklisting) " : "")
|
||||
<< "client session " << session_id << " (" << addr << ")";
|
||||
dout(1) << ss.strv() << dendl;
|
||||
clog->info() << ss.strv();
|
||||
CachedStackStringStream css;
|
||||
*css << "Evicting " << (blacklist ? "(and blacklisting) " : "")
|
||||
<< "client session " << session_id << " (" << addr << ")";
|
||||
dout(1) << css->strv() << dendl;
|
||||
clog->info() << css->strv();
|
||||
}
|
||||
|
||||
dout(4) << "Preparing blacklist command... (wait=" << wait << ")" << dendl;
|
||||
|
Loading…
Reference in New Issue
Block a user