Determining whether a bucket is indexless starting with an
RGWBucketInfo object requires traversing multiple data structures and
"inside knowledge" blurring the line between interface and
implementation. The same applies for retrieving the current index for
non-indexless buckets.
This commit adds to the RGWBucketInfo interface to make this
information readily accessible.
Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
inline uint32_t current_num_shards(const BucketLayout& layout) {
return num_shards(layout.current_index);
}
+inline bool is_layout_indexless(const bucket_index_layout_generation& layout) {
+ return layout.layout.type == BucketIndexType::Indexless;
+}
} // namespace rgw
bool empty_sync_policy() const;
+ bool is_indexless() const {
+ return rgw::is_layout_indexless(layout.current_index);
+ }
+ const rgw::bucket_index_layout_generation& get_current_index() const {
+ return layout.current_index;
+ }
+ rgw::bucket_index_layout_generation& get_current_index() {
+ return layout.current_index;
+ }
+
RGWBucketInfo();
~RGWBucketInfo();
};