static bool empty(std::unique_ptr<User>& u) { return (!u || u->info.user_id.id.empty()); }
/** Read the User attributes from the backing Store */
virtual int read_attrs(const DoutPrefixProvider* dpp, optional_yield y) = 0;
- /** Read the User stats from the backing Store, synchronous */
+ /** Set the attributes in attrs, leaving any other existing attrs set, and
+ * write them to the backing store; a merge operation */
+ virtual int merge_and_store_attrs(const DoutPrefixProvider* dpp, Attrs& new_attrs, optional_yield y) {
+ for(auto& it : new_attrs) {
+ attrs[it.first] = it.second;
+ }
+ return 0;
+ }
virtual int read_stats(const DoutPrefixProvider *dpp,
optional_yield y, RGWStorageStats* stats,
ceph::real_time* last_stats_sync = nullptr,
std::map<rgw_user_bucket, rgw_usage_log_entry>& usage) = 0;
/** Trim User usage stats to the given epoch range */
virtual int trim_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch) = 0;
-
- /** Load this User from the backing store. requires ID to be set, fills all other fields. */
- virtual int load_user(const DoutPrefixProvider* dpp, optional_yield y) = 0;
- /** Store this User to the backing store */
+ virtual RGWObjVersionTracker& get_version_tracker() { return objv_tracker; }
+ virtual Attrs& get_attrs() { return attrs; }
virtual int store_user(const DoutPrefixProvider* dpp, optional_yield y, bool exclusive, RGWUserInfo* old_info = nullptr) = 0;
/** Remove this User from the backing store */
virtual int remove_user(const DoutPrefixProvider* dpp, optional_yield y) = 0;
return store->ctl()->user->get_attrs_by_uid(dpp, get_id(), &attrs, y, &objv_tracker);
}
+int RadosUser::merge_and_store_attrs(const DoutPrefixProvider* dpp, Attrs& new_attrs, optional_yield y)
+{
+ User::merge_and_store_attrs(dpp, new_attrs, y);
+ return store_user(dpp, y, false);
+}
+
int RadosUser::read_stats(const DoutPrefixProvider *dpp,
optional_yield y, RGWStorageStats* stats,
ceph::real_time* last_stats_sync,
std::unique_ptr<Bucket>* bucket,
optional_yield y) override;
virtual int read_attrs(const DoutPrefixProvider* dpp, optional_yield y) override;
+ virtual int merge_and_store_attrs(const DoutPrefixProvider* dpp, Attrs& new_attrs, optional_yield y) override;
virtual int read_stats(const DoutPrefixProvider *dpp,
optional_yield y, RGWStorageStats* stats,
ceph::real_time* last_stats_sync = nullptr,