mirror of
https://github.com/ceph/ceph
synced 2025-01-18 09:02:08 +00:00
rgw_file: add pretty-print for RGWFileHandle
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
This commit is contained in:
parent
df2e1fd84e
commit
ef330f385d
@ -720,6 +720,31 @@ namespace rgw {
|
||||
} while (! (stop || shutdown));
|
||||
} /* RGWLibFS::gc */
|
||||
|
||||
std::ostream& operator<<(std::ostream &os,
|
||||
RGWFileHandle const &rgw_fh)
|
||||
{
|
||||
const auto& fhk = rgw_fh.get_key();
|
||||
const auto& fh = const_cast<RGWFileHandle&>(rgw_fh).get_fh();
|
||||
os << "<RGWFileHandle:";
|
||||
os << "addr=" << &rgw_fh;
|
||||
switch (fh->fh_type) {
|
||||
case RGW_FS_TYPE_DIRECTORY:
|
||||
os << "type=DIRECTORY;";
|
||||
break;
|
||||
case RGW_FS_TYPE_FILE:
|
||||
os << "type=FILE;";
|
||||
break;
|
||||
default:
|
||||
os << "type=UNKNOWN;";
|
||||
break;
|
||||
};
|
||||
os << "fid=" << fhk.fh_hk.bucket << ":" << fhk.fh_hk.object << ";";
|
||||
os << "name=" << rgw_fh.object_name() << ";";
|
||||
os << "refcnt=" << rgw_fh.get_refcnt() << ";";
|
||||
os << ">";
|
||||
return os;
|
||||
}
|
||||
|
||||
RGWFileHandle::~RGWFileHandle() {
|
||||
if (parent && (! parent->is_root())) {
|
||||
/* safe because if parent->unref causes its deletion,
|
||||
|
@ -642,6 +642,9 @@ namespace rgw {
|
||||
|
||||
virtual ~RGWFileHandle();
|
||||
|
||||
friend std::ostream& operator<<(std::ostream &os,
|
||||
RGWFileHandle const &rgw_fh);
|
||||
|
||||
class Factory : public cohort::lru::ObjectFactory
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user