Now update the quota stats when completing specific operations.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
return 0;
}
+
+ virtual void update_stats(rgw_bucket& bucket, int obj_delta, uint64_t added_bytes, uint64_t removed_bytes) {
+ stats_cache.adjust_bucket_stats(bucket, obj_delta, added_bytes, removed_bytes);
+ };
};
class RGWQuotaHandler {
public:
+ RGWQuotaHandler() {}
virtual ~RGWQuotaHandler() {}
virtual int check_quota(rgw_bucket& bucket, RGWQuotaInfo& bucket_quota,
uint64_t num_objs, uint64_t size) = 0;
+ virtual void update_stats(rgw_bucket& bucket, int obj_delta, uint64_t added_bytes, uint64_t removed_bytes) = 0;
+
static RGWQuotaHandler *generate_handler(RGWRados *store);
static void free_handler(RGWQuotaHandler *handler);
};
*mtime = set_mtime;
}
+ if (state) {
+ /* update quota cache */
+ quota_handler->update_stats(bucket, (state->exists ? 0 : 1), size, state->size);
+ }
+
return 0;
done_cancel:
if (ret_not_existed)
return -ENOENT;
+ if (state) {
+ /* update quota cache */
+ quota_handler->update_stats(bucket, -1, 0, state->size);
+ }
+
return 0;
}