}
+class PGLSHelloFilter : public PGLSFilter {
+ string val;
+public:
+ PGLSHelloFilter(bufferlist::iterator& params) {
+ ::decode(xattr, params);
+ ::decode(val, params);
+ }
+ virtual ~PGLSHelloFilter() {}
+ virtual bool filter(const hobject_t &obj, bufferlist& xattr_data,
+ bufferlist& outdata)
+ {
+ if (val.size() != xattr_data.length())
+ return false;
+
+ if (memcmp(val.c_str(), xattr_data.c_str(), val.size()))
+ return false;
+
+ return true;
+ }
+};
+
+
+PGLSFilter *hello_filter(bufferlist::iterator *q)
+{
+ assert(q);
+ return new PGLSHelloFilter(*q);
+}
+
+
/**
* initialize class
*
bad_reader, &h_bad_reader);
cls_register_cxx_method(h_class, "bad_writer", CLS_METHOD_RD,
bad_writer, &h_bad_writer);
+
+ // A PGLS filter
+ cls_register_cxx_filter(h_class, "hello", hello_filter);
}