From: Radoslaw Zarzynski Date: Mon, 12 Aug 2019 13:32:38 +0000 (+0200) Subject: objclass, osd: dissect PGLSFilter into the osd_types.h header. X-Git-Tag: v15.1.0~1774^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2c0f0897100fe81b30d0248746bc849a3aa8636b;p=ceph.git objclass, osd: dissect PGLSFilter into the osd_types.h header. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/cls/cephfs/cls_cephfs.cc b/src/cls/cephfs/cls_cephfs.cc index d05fee1d6ea7..7207a6b4b849 100644 --- a/src/cls/cephfs/cls_cephfs.cc +++ b/src/cls/cephfs/cls_cephfs.cc @@ -17,6 +17,7 @@ #include #include "objclass/objclass.h" +#include "osd/osd_types.h" #include "cls_cephfs.h" diff --git a/src/cls/hello/cls_hello.cc b/src/cls/hello/cls_hello.cc index ac3beb3b6871..c2b71d270846 100644 --- a/src/cls/hello/cls_hello.cc +++ b/src/cls/hello/cls_hello.cc @@ -35,6 +35,7 @@ #include #include "objclass/objclass.h" +#include "osd/osd_types.h" using ceph::bufferlist; using std::string; diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index f243213810bd..e38bb9defd4a 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -51,14 +51,6 @@ namespace { using ceph::common::local_conf; using ceph::os::FuturizedStore; -PGLSFilter::PGLSFilter() : cct(nullptr) -{ -} - -PGLSFilter::~PGLSFilter() -{ -} - namespace ceph::osd { OSD::OSD(int id, uint32_t nonce, diff --git a/src/objclass/objclass.h b/src/objclass/objclass.h index ed8d2c525146..de43905e29fd 100644 --- a/src/objclass/objclass.h +++ b/src/objclass/objclass.h @@ -14,6 +14,7 @@ #include "include/rados/objclass.h" struct obj_list_watch_response_t; +class PGLSFilter; extern "C" { #endif @@ -74,36 +75,6 @@ extern void class_fini(void); #ifdef __cplusplus } -class PGLSFilter { - CephContext* cct; -protected: - std::string xattr; -public: - PGLSFilter(); - virtual ~PGLSFilter(); - virtual bool filter(const hobject_t &obj, - const ceph::buffer::list& xattr_data) const = 0; - - /** - * Arguments passed from the RADOS client. Implementations must - * handle any encoding errors, and return an appropriate error code, - * or 0 on valid input. - */ - virtual int init(ceph::buffer::list::const_iterator ¶ms) = 0; - - /** - * xattr key, or empty string. If non-empty, this xattr will be fetched - * and the value passed into ::filter - */ - virtual const std::string& get_xattr() const { 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() const { return true; } -}; - // Classes expose a filter constructor that returns a subclass of PGLSFilter typedef PGLSFilter* (*cls_cxx_filter_factory_t)(); diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index a1be37f2d084..5eed61a8b2cb 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -76,14 +76,6 @@ static ostream& _prefix(std::ostream *_dout, T *pg) { MEMPOOL_DEFINE_OBJECT_FACTORY(PrimaryLogPG, replicatedpg, osd); -PGLSFilter::PGLSFilter() : cct(nullptr) -{ -} - -PGLSFilter::~PGLSFilter() -{ -} - /** * The CopyCallback class defines an interface for completions to the * copy_start code. Users of the copy infrastructure must implement diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 37166a2386e4..f0311cc13a19 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -6692,3 +6692,11 @@ void init_pg_ondisk( encode(struct_v, values[string(infover_key)]); t.omap_setkeys(coll, pgmeta_oid, values); } + +PGLSFilter::PGLSFilter() : cct(nullptr) +{ +} + +PGLSFilter::~PGLSFilter() +{ +} diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 3755d14d5d1b..23962c34dd4a 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -6095,4 +6095,35 @@ struct omap_stat_t { int64_t omap_keys; }; +// filter for pg listings +class PGLSFilter { + CephContext* cct; +protected: + std::string xattr; +public: + PGLSFilter(); + virtual ~PGLSFilter(); + virtual bool filter(const hobject_t &obj, + const ceph::buffer::list& xattr_data) const = 0; + + /** + * Arguments passed from the RADOS client. Implementations must + * handle any encoding errors, and return an appropriate error code, + * or 0 on valid input. + */ + virtual int init(ceph::buffer::list::const_iterator ¶ms) = 0; + + /** + * xattr key, or empty string. If non-empty, this xattr will be fetched + * and the value passed into ::filter + */ + virtual const std::string& get_xattr() const { 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() const { return true; } +}; + #endif