From c828c398b111899433fa620399ce0c4bf66b40c3 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 30 Jan 2016 15:09:43 +0800 Subject: [PATCH] librados: add `inconsistent_snapset_t` type for presenting the inconsistent snapsets found in scrub Signed-off-by: Kefu Chai --- src/include/rados/rados_types.hpp | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/include/rados/rados_types.hpp b/src/include/rados/rados_types.hpp index 3eab5e7d0b97a..2e3477bef1d46 100644 --- a/src/include/rados/rados_types.hpp +++ b/src/include/rados/rados_types.hpp @@ -118,6 +118,48 @@ struct inconsistent_obj_t : err_t { std::map shards; }; +struct inconsistent_snapset_t { + inconsistent_snapset_t() = default; + inconsistent_snapset_t(const object_id_t& head) + : object{head} + {} + enum { + ATTR_MISSING = 1 << 0, + ATTR_CORRUPTED = 1 << 1, + CLONE_MISSING = 1 << 2, + SNAP_MISMATCH = 1 << 3, + HEAD_MISMATCH = 1 << 4, + HEADLESS_CLONE = 1 << 5, + SIZE_MISMATCH = 1 << 6, + }; + uint64_t errors = 0; + object_id_t object; + std::vector clones; + std::vector missing; + + bool ss_attr_missing() const { + return errors & ATTR_MISSING; + } + bool ss_attr_corrupted() const { + return errors & ATTR_CORRUPTED; + } + bool clone_missing() const { + return errors & CLONE_MISSING; + } + bool snapset_mismatch() const { + return errors & SNAP_MISMATCH; + } + bool head_mismatch() const { + return errors & HEAD_MISMATCH; + } + bool headless() const { + return errors & HEADLESS_CLONE; + } + bool size_mismatch() const { + return errors & SIZE_MISMATCH; + } +}; + /** * @var all_nspaces * Pass as nspace argument to IoCtx::set_namespace() -- 2.39.5