Skip to content

Commit

Permalink
osd: share PGLSPlainFilter with crimson.
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslaw Zarzynski <[email protected]>
  • Loading branch information
rzarzynski committed Aug 24, 2019
1 parent 2c0f089 commit 9c01ab5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/osd/PrimaryLogPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -752,27 +752,6 @@ void PrimaryLogPG::maybe_force_recovery()
maybe_kick_recovery(soid);
}

class PGLSPlainFilter : public PGLSFilter {
string val;
public:
int init(bufferlist::const_iterator &params) override
{
try {
decode(xattr, params);
decode(val, params);
} catch (buffer::error &e) {
return -EINVAL;
}

return 0;
}
~PGLSPlainFilter() override {}
bool filter(const hobject_t& obj,
const bufferlist& xattr_data) const override {
return xattr_data.contents_equal(val.c_str(), val.size());
}
};

bool PrimaryLogPG::pgls_filter(const PGLSFilter& filter, const hobject_t& sobj)
{
bufferlist bl;
Expand Down
17 changes: 17 additions & 0 deletions src/osd/osd_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6700,3 +6700,20 @@ PGLSFilter::PGLSFilter() : cct(nullptr)
PGLSFilter::~PGLSFilter()
{
}

int PGLSPlainFilter::init(ceph::bufferlist::const_iterator &params)
{
try {
decode(xattr, params);
decode(val, params);
} catch (buffer::error &e) {
return -EINVAL;
}
return 0;
}

bool PGLSPlainFilter::filter(const hobject_t& obj,
const ceph::bufferlist& xattr_data) const
{
return xattr_data.contents_equal(val.c_str(), val.size());
}
10 changes: 10 additions & 0 deletions src/osd/osd_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -6126,4 +6126,14 @@ class PGLSFilter {
virtual bool reject_empty_xattr() const { return true; }
};

class PGLSPlainFilter : public PGLSFilter {
std::string val;
public:
int init(ceph::bufferlist::const_iterator &params) override;
~PGLSPlainFilter() override {}
bool filter(const hobject_t& obj,
const ceph::bufferlist& xattr_data) const override;
};


#endif

0 comments on commit 9c01ab5

Please sign in to comment.