filter->get_xattr(),
&bl);
dout(0) << "getattr (sobj=" << sobj << ", attr=" << filter->get_xattr() << ") returned " << ret << dendl;
- if (ret < 0)
- return false;
+ if (ret < 0) {
+ if (ret != -ENODATA || filter->reject_empty_xattr()) {
+ return false;
+ }
+ }
}
return filter->filter(sobj, bl, outdata);
virtual ~PGLSFilter();
virtual bool filter(const hobject_t &obj, bufferlist& xattr_data,
bufferlist& outdata) = 0;
- virtual string& get_xattr() { return xattr; }
+
+ /**
+ * xattr key, or empty string. If non-empty, this xattr will be fetched
+ * and the value passed into ::filter
+ */
+ virtual string& get_xattr() { return xattr; }
+
+ /**
+ * If true, objects without the named xattr (if xattr name is not empty)
+ * will be rejected without calling ::filter
+ */
+ virtual bool reject_empty_xattr() { return true; }
};
class PGLSPlainFilter : public PGLSFilter {