Skip to content

Commit 339e289

Browse files
committed
MGM: Remove unused members of the Recycle class
1 parent 2986cfc commit 339e289

2 files changed

Lines changed: 30 additions & 54 deletions

File tree

mgm/recycle/Recycle.cc

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,13 @@ EOSMGMNAMESPACE_BEGIN
9494
// /eos/<instance>/proc/recycle/
9595
std::string Recycle::gRecyclingPrefix = "/recycle/";
9696
std::string Recycle::gRecyclingAttribute = "sys.recycle";
97-
std::string Recycle::gRecyclingTimeAttribute = "sys.recycle.keeptime";
98-
std::string Recycle::gRecyclingKeepRatio = "sys.recycle.keepratio";
99-
std::string Recycle::gRecyclingCollectInterval = "sys.recycle.collectinterval";
100-
std::string Recycle::gRecyclingRemoveInterval = "sys.recycle.removeinterval";
101-
std::string Recycle::gRecyclingDryRunAttribute = "sys.recycle.dryrun";
97+
std::string Recycle::gRecyclingPostFix = ".d";
10298
std::string Recycle::gRecyclingVersionKey = "sys.recycle.version.key";
10399
std::string Recycle::gRecycleIdXattrKey = "sys.forced.recycleid";
104-
std::string Recycle::gRecyclingPostFix = ".d";
105100
eos::common::VirtualIdentity Recycle::mRootVid =
106101
eos::common::VirtualIdentity::Root();
107102
std::chrono::seconds Recycle::mLastRemoveTs = std::chrono::seconds(0);
108103

109-
//------------------------------------------------------------------------------
110-
// Default constructor
111-
//------------------------------------------------------------------------------
112-
Recycle::Recycle(bool fake_clock) :
113-
mPath(""), mRecycleDir(""), mRecyclePath(""), mOwnerUid(DAEMONUID),
114-
mOwnerGid(DAEMONGID), mId(0), mClock(fake_clock)
115-
{}
116-
117104
//------------------------------------------------------------------------------
118105
// Collect entries to recycle based on the current policy
119106
//------------------------------------------------------------------------------
@@ -714,45 +701,32 @@ Recycle::Print(std::string& std_out, std::string& std_err,
714701
unsigned long long used_inodes = map_quotas[SpaceQuota::kGroupFilesIs];
715702
unsigned long long max_inodes = map_quotas[SpaceQuota::kGroupFilesTarget];
716703
char sline[4096];
717-
eos::IContainerMD::XAttrMap attrmap;
718-
XrdOucErrInfo error;
719-
720-
// Check if this path has a recycle attribute
721-
if (gOFS->_attr_ls(Recycle::gRecyclingPrefix.c_str(), error, mRootVid, "",
722-
attrmap)) {
723-
eos_static_err("msg=\"unable to get attribute on recycle path\" "
724-
"recycle-path=%s", Recycle::gRecyclingPrefix.c_str());
725-
}
726704

727705
if (!monitoring) {
728706
oss_out << "# _________________________________________________________"
729707
<< "___________________________________________________________"
730708
<< "___________________________" << std::endl;
731709
snprintf(sline, sizeof(sline) - 1, "# used %s out of %s (%.02f%% volume) "
732-
"used %llu out of %llu (%.02f%% inodes used) Object-Lifetime %s [s] Keep-Ratio %s",
710+
"used %llu out of %llu (%.02f%% inodes used) Object-Lifetime %lu [s] Keep-Ratio %.02f",
733711
StringConversion::GetReadableSizeString(used_bytes, "B").c_str(),
734712
StringConversion::GetReadableSizeString(max_bytes, "B").c_str(),
735713
used_bytes * 100.0 / max_bytes,
736714
used_inodes, max_inodes, used_inodes * 100.0 / max_inodes,
737-
attrmap.count(Recycle::gRecyclingTimeAttribute) ?
738-
attrmap[Recycle::gRecyclingTimeAttribute].c_str() : "not configured",
739-
attrmap.count(Recycle::gRecyclingKeepRatio) ?
740-
attrmap[Recycle::gRecyclingKeepRatio].c_str() : "not configured");
715+
gOFS->mRecycler->GetKeepTime(),
716+
gOFS->mRecycler->GetKeepRatio());
741717
oss_out << sline << std::endl
742718
<< "# _________________________________________________________"
743719
<< "___________________________________________________________"
744720
<< "___________________________" << std::endl;
745721
} else {
746722
snprintf(sline, sizeof(sline) - 1, "recycle-bin=%s usedbytes=%llu "
747723
"maxbytes=%llu volumeusage=%.02f%% usedinodes=%llu "
748-
"maxinodes=%llu inodeusage=%.02f%% lifetime=%s ratio=%s",
724+
"maxinodes=%llu inodeusage=%.02f%% lifetime=%lu ratio=%.02f",
749725
Recycle::gRecyclingPrefix.c_str(),
750726
used_bytes, max_bytes, used_bytes * 100.0 / max_bytes,
751727
used_inodes, max_inodes, used_inodes * 100.0 / max_inodes,
752-
attrmap.count(Recycle::gRecyclingTimeAttribute) ?
753-
attrmap[Recycle::gRecyclingTimeAttribute].c_str() : "-1",
754-
attrmap.count(Recycle::gRecyclingKeepRatio) ?
755-
attrmap[Recycle::gRecyclingKeepRatio].c_str() : "-1");
728+
gOFS->mRecycler->GetKeepTime(),
729+
gOFS->mRecycler->GetKeepRatio());
756730
oss_out << sline << std::endl;
757731
}
758732
}

mgm/recycle/Recycle.hh

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,7 @@ public:
5757
static std::string gRecyclingPrefix;
5858
//! Attribute key defining a recycling location
5959
static std::string gRecyclingAttribute;
60-
//! Attribute key defining the max. time a file stays in the garbage directory
61-
static std::string gRecyclingTimeAttribute;
62-
//! Ratio from 0 ..1.0 defining a threshold when the recycle bin is not yet
63-
//! cleaned even if files have expired their lifetime attributel.
64-
static std::string gRecyclingKeepRatio;
65-
//! Postfix which identifies a name in the garbage bin as a bulk deletion of a directory
6660
static std::string gRecyclingPostFix;
67-
//! Attribute defining how often the collection of entries is attempted
68-
static std::string gRecyclingCollectInterval;
69-
//! Attribute defining how often the removeal of collected entries is attempted
70-
static std::string gRecyclingRemoveInterval;
71-
//! Attribute key defining whether the recycler runs in dry-run mode or not
72-
static std::string gRecyclingDryRunAttribute;
7361
//! Attribute key storing the recycling key of the version directory
7462
//! belonging to a given file
7563
static std::string gRecyclingVersionKey;
@@ -158,6 +146,26 @@ public:
158146
bool force_orig_name, bool restore_versions,
159147
bool make_path = false);
160148

149+
//----------------------------------------------------------------------------
150+
//! Get the configured keep time
151+
//!
152+
//! @return keep time in seconds
153+
//----------------------------------------------------------------------------
154+
inline uint64_t GetKeepTime() const
155+
{
156+
return mPolicy.mKeepTimeSec.load();
157+
}
158+
159+
//----------------------------------------------------------------------------
160+
//! Get the configured keep ratio
161+
//!
162+
//! @return keep ratio
163+
//----------------------------------------------------------------------------
164+
inline double GetKeepRatio() const
165+
{
166+
return mPolicy.mSpaceKeepRatio.load();
167+
}
168+
161169
//----------------------------------------------------------------------------
162170
//! Get recycle bin path from the given restore key information
163171
//!
@@ -237,7 +245,9 @@ public:
237245
//----------------------------------------------------------------------------
238246
//! Default constructor
239247
//----------------------------------------------------------------------------
240-
Recycle(bool fake_clock = false);
248+
Recycle(bool fake_clock = false):
249+
mClock(fake_clock)
250+
{}
241251

242252
//----------------------------------------------------------------------------
243253
//! Destructor
@@ -315,19 +325,11 @@ public:
315325
return mPolicy.mEnforced.load();
316326
}
317327

318-
319-
320328
private:
321329
#ifdef IN_TEST_HARNESS
322330
public:
323331
#endif
324332
AssistedThread mThread; ///< Thread doing the recycling
325-
std::string mPath; ///< Path of file to be recycled
326-
std::string mRecycleDir;
327-
std::string mRecyclePath; ///< Final path of file in the recycle bin
328-
uid_t mOwnerUid;
329-
gid_t mOwnerGid;
330-
unsigned long long mId;
331333
RecyclePolicy mPolicy;
332334
//! Map holding the container identifier and the full path of the directories
333335
//! to be deleted.

0 commit comments

Comments
 (0)