+----------------------------------------------------+----------+--------------------------------------------------------------+----------+-----------+----------+
| ``Request.Bucket.Id`` | string | bucket id | no | no | yes |
+----------------------------------------------------+----------+--------------------------------------------------------------+----------+-----------+----------+
-| ``Request.Bucket.Count`` | integer | number of objects in the bucket | no | no | yes |
-+----------------------------------------------------+----------+--------------------------------------------------------------+----------+-----------+----------+
-| ``Request.Bucket.Size`` | integer | total size of objects in the bucket | no | no | yes |
-+----------------------------------------------------+----------+--------------------------------------------------------------+----------+-----------+----------+
| ``Request.Bucket.ZoneGroupId`` | string | zone group of the bucket | no | no | yes |
+----------------------------------------------------+----------+--------------------------------------------------------------+----------+-----------+----------+
| ``Request.Bucket.CreationTime`` | time | creation time of the bucket | no | no | yes |
source->set_instance(it->second);
} else if (!std::strcmp(it->first.data(), "source_zone_short_id")) {
astate->zone_short_id = static_cast<uint32_t>(std::stoul(it->second));
- } else if (!std::strcmp(it->first.data(), "bucket_count")) {
- source->get_bucket()->set_count(std::stoull(it->second));
- } else if (!std::strcmp(it->first.data(), "bucket_size")) {
- source->get_bucket()->set_size(std::stoull(it->second));
} else if (!std::strcmp(it->first.data(), "user_quota.max_size")) {
quota_info.max_size = std::stoull(it->second);
} else if (!std::strcmp(it->first.data(), "user_quota.max_objects")) {
bl.clear();
}
- bl.append(std::to_string(obj->get_bucket()->get_count()));
- baseAttrs.insert({"bucket_count", bl});
- bl.clear();
-
- bl.append(std::to_string(obj->get_bucket()->get_size()));
- baseAttrs.insert({"bucket_size", bl});
- bl.clear();
-
RGWUserInfo info = obj->get_bucket()->get_owner()->get_info();
bl.append(std::to_string(info.quota.user_quota.max_size));
baseAttrs.insert({"user_quota.max_size", bl});
return ret;
}
-int DaosBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y,
- bool get_stats) {
+int DaosBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y) {
ldpp_dout(dpp, 20) << "DEBUG: load_bucket(): bucket name=" << get_name()
<< dendl;
int ret = open(dpp);
virtual RGWAccessControlPolicy& get_acl(void) override { return acls; }
virtual int set_acl(const DoutPrefixProvider* dpp,
RGWAccessControlPolicy& acl, optional_yield y) override;
- virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y,
- bool get_stats = false) override;
+ virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y) override;
virtual int read_stats(const DoutPrefixProvider* dpp,
const bucket_index_layout_generation& idx_layout,
int shard_id, std::string* bucket_ver,
return rc;
}
-int MotrBucket::load_bucket(const DoutPrefixProvider *dpp, optional_yield y, bool get_stats)
+int MotrBucket::load_bucket(const DoutPrefixProvider *dpp, optional_yield y)
{
// Get bucket instance using bucket's name (string). or bucket id?
bufferlist bl;
return 0;
}
-int MotrBucket::sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y)
+int MotrBucket::sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* ent)
{
return 0;
}
-int MotrBucket::check_bucket_shards(const DoutPrefixProvider *dpp)
+int MotrBucket::check_bucket_shards(const DoutPrefixProvider *dpp,
+ uint64_t num_objs)
{
return 0;
}
DoutPrefixProvider *dpp) override;
virtual RGWAccessControlPolicy& get_acl(void) override { return acls; }
virtual int set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy& acl, optional_yield y) override;
- virtual int load_bucket(const DoutPrefixProvider *dpp, optional_yield y, bool get_stats = false) override;
+ virtual int load_bucket(const DoutPrefixProvider *dpp, optional_yield y) override;
int link_user(const DoutPrefixProvider* dpp, User* new_user, optional_yield y);
int unlink_user(const DoutPrefixProvider* dpp, User* new_user, optional_yield y);
int create_bucket_index();
virtual int read_stats_async(const DoutPrefixProvider *dpp,
const bucket_index_layout_generation& idx_layout,
int shard_id, RGWGetBucketStats_CB* ctx) override;
- virtual int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y) override;
- virtual int check_bucket_shards(const DoutPrefixProvider *dpp) override;
+ int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* ent) override;
+ int check_bucket_shards(const DoutPrefixProvider *dpp,
+ uint64_t num_objs) override;
virtual int chown(const DoutPrefixProvider *dpp, User& new_user, optional_yield y) override;
virtual int put_info(const DoutPrefixProvider *dpp, bool exclusive, ceph::real_time mtime) override;
virtual bool is_owner(User* user) override;
return remove_bucket(dpp, true, false, nullptr, y);
}
-int POSIXBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y,
- bool get_stats)
+int POSIXBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y)
{
int ret;
return ret;
}
- bucket_statx_save(stx, ent, mtime);
- info.creation_time = ent.creation_time;
+ mtime = ceph::real_clock::from_time_t(stx.stx_mtime.tv_sec);
+ info.creation_time = ceph::real_clock::from_time_t(stx.stx_btime.tv_sec);
if (owner) {
info.owner = owner->get_id();
// TODO dang: fake info up (UID to owner conversion?)
}
- info.creation_time = ent.creation_time;
-
return 0;
}
return 0;
}
-int POSIXBucket::sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y)
+int POSIXBucket::sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* ent)
{
return 0;
}
-int POSIXBucket::check_bucket_shards(const DoutPrefixProvider* dpp, optional_yield y)
+int POSIXBucket::check_bucket_shards(const DoutPrefixProvider* dpp,
+ uint64_t num_objs, optional_yield y)
{
- return 0;
+ return 0;
}
int POSIXBucket::chown(const DoutPrefixProvider* dpp, User& new_user, optional_yield y)
ns(_ns)
{ }
- POSIXBucket(POSIXDriver *_dr, int _p_fd, const RGWBucketEnt& _e, User* _u)
- : StoreBucket(_e, _u),
- driver(_dr),
- parent_fd(_p_fd),
- acls()
- { }
-
POSIXBucket(POSIXDriver *_dr, int _p_fd, const RGWBucketInfo& _i, User* _u)
: StoreBucket(_i, _u),
driver(_dr),
bool keep_index_consistent,
optional_yield y,
const DoutPrefixProvider *dpp) override;
- virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y,
- bool get_stats = false) override;
+ virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y) override;
virtual RGWAccessControlPolicy& get_acl(void) override { return acls; }
virtual int set_acl(const DoutPrefixProvider* dpp, RGWAccessControlPolicy& acl,
optional_yield y) override;
virtual int read_stats_async(const DoutPrefixProvider *dpp,
const bucket_index_layout_generation& idx_layout,
int shard_id, RGWGetBucketStats_CB* ctx) override;
- virtual int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y) override;
- virtual int check_bucket_shards(const DoutPrefixProvider* dpp, optional_yield y) override;
+ virtual int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* ent) override;
+ virtual int check_bucket_shards(const DoutPrefixProvider* dpp,
+ uint64_t num_objs, optional_yield y) override;
virtual int chown(const DoutPrefixProvider* dpp, User& new_user, optional_yield y) override;
virtual int put_info(const DoutPrefixProvider* dpp, bool exclusive,
ceph::real_time mtime, optional_yield y) override;
}
int RGWRados::check_bucket_shards(const RGWBucketInfo& bucket_info,
- const rgw_bucket& bucket,
uint64_t num_objs,
const DoutPrefixProvider *dpp, optional_yield y)
{
return 0;
}
- ldpp_dout(dpp, 1) << "RGWRados::" << __func__ << " bucket " << bucket.name <<
+ ldpp_dout(dpp, 1) << "RGWRados::" << __func__ << " bucket " << bucket_info.bucket.name <<
" needs resharding; current num shards " << bucket_info.layout.current_index.layout.normal.num_shards <<
"; new num shards " << final_num_shards << " (suggested " <<
suggested_num_shards << ")" << dendl;
RGWQuota& quota, uint64_t obj_size,
optional_yield y, bool check_size_only = false);
- int check_bucket_shards(const RGWBucketInfo& bucket_info, const rgw_bucket& bucket,
- uint64_t num_objs, const DoutPrefixProvider *dpp, optional_yield y);
+ int check_bucket_shards(const RGWBucketInfo& bucket_info, uint64_t num_objs,
+ const DoutPrefixProvider *dpp, optional_yield y);
int add_bucket_to_reshard(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, uint32_t new_num_shards, optional_yield y);
return ret;
}
- sync_user_stats(dpp, y);
+ sync_user_stats(dpp, y, nullptr);
if (ret < 0) {
ldpp_dout(dpp, 1) << "WARNING: failed sync user stats before bucket delete. ret=" << ret << dendl;
}
return ret;
}
-int RadosBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y, bool get_stats)
+int RadosBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y)
{
int ret;
bucket_version = ep_ot.read_version;
- if (get_stats) {
- ret = store->ctl()->bucket->read_bucket_stats(info.bucket, &ent, y, dpp);
- }
-
return ret;
}
return store->getRados()->get_bucket_stats_async(dpp, get_info(), idx_layout, shard_id, ctx);
}
-int RadosBucket::sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y)
+int RadosBucket::sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* ent)
{
- return store->ctl()->bucket->sync_user_stats(dpp, owner->get_id(), info, y, &ent);
+ return store->ctl()->bucket->sync_user_stats(dpp, owner->get_id(), info, y, ent);
}
-int RadosBucket::check_bucket_shards(const DoutPrefixProvider* dpp, optional_yield y)
+int RadosBucket::check_bucket_shards(const DoutPrefixProvider* dpp,
+ uint64_t num_objs, optional_yield y)
{
- return store->getRados()->check_bucket_shards(info, info.bucket, get_count(), dpp, y);
+ return store->getRados()->check_bucket_shards(info, num_objs, dpp, y);
}
int RadosBucket::link(const DoutPrefixProvider* dpp, User* new_user, optional_yield y, bool update_entrypoint, RGWObjVersionTracker* objv)
acls() {
}
- RadosBucket(RadosStore *_st, const RGWBucketEnt& _e)
- : StoreBucket(_e),
- store(_st),
- acls() {
- }
-
RadosBucket(RadosStore *_st, const RGWBucketInfo& _i)
: StoreBucket(_i),
store(_st),
acls() {
}
- RadosBucket(RadosStore *_st, const RGWBucketEnt& _e, User* _u)
- : StoreBucket(_e, _u),
- store(_st),
- acls() {
- }
-
RadosBucket(RadosStore *_st, const RGWBucketInfo& _i, User* _u)
: StoreBucket(_i, _u),
store(_st),
DoutPrefixProvider *dpp) override;
virtual RGWAccessControlPolicy& get_acl(void) override { return acls; }
virtual int set_acl(const DoutPrefixProvider* dpp, RGWAccessControlPolicy& acl, optional_yield y) override;
- virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y, bool get_stats = false) override;
+ virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y) override;
virtual int read_stats(const DoutPrefixProvider *dpp,
const bucket_index_layout_generation& idx_layout,
int shard_id, std::string* bucket_ver, std::string* master_ver,
virtual int read_stats_async(const DoutPrefixProvider *dpp,
const bucket_index_layout_generation& idx_layout,
int shard_id, RGWGetBucketStats_CB* ctx) override;
- virtual int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y) override;
- virtual int check_bucket_shards(const DoutPrefixProvider* dpp, optional_yield y) override;
+ int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* ent) override;
+ int check_bucket_shards(const DoutPrefixProvider* dpp, uint64_t num_objs,
+ optional_yield y) override;
virtual int chown(const DoutPrefixProvider* dpp, User& new_user, optional_yield y) override;
virtual int put_info(const DoutPrefixProvider* dpp, bool exclusive, ceph::real_time mtime, optional_yield y) override;
virtual int check_empty(const DoutPrefixProvider* dpp, optional_yield y) override;
cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
- ret = bucket->sync_user_stats(dpp(), null_yield);
+ ret = bucket->sync_user_stats(dpp(), null_yield, nullptr);
if (ret < 0) {
cerr << "ERROR: could not sync bucket stats: " <<
cpp_strerror(-ret) << std::endl;
pushstring(L, bucket->get_marker());
} else if (strcasecmp(index, "Id") == 0) {
pushstring(L, bucket->get_bucket_id());
- } else if (strcasecmp(index, "Count") == 0) {
- lua_pushinteger(L, bucket->get_count());
- } else if (strcasecmp(index, "Size") == 0) {
- lua_pushinteger(L, bucket->get_size());
} else if (strcasecmp(index, "ZoneGroupId") == 0) {
pushstring(L, bucket->get_info().zonegroup);
} else if (strcasecmp(index, "CreationTime") == 0) {
}
}
- op_ret = s->bucket->sync_user_stats(this, y);
+ op_ret = s->bucket->sync_user_stats(this, y, nullptr);
if ( op_ret < 0) {
ldpp_dout(this, 1) << "WARNING: failed to sync user stats before bucket delete: op_ret= " << op_ret << dendl;
}
return r;
}
- r = bucket->sync_user_stats(dpp, y);
+ RGWBucketEnt ent;
+ r = bucket->sync_user_stats(dpp, y, &ent);
if (r < 0) {
ldpp_dout(dpp, 0) << "ERROR: sync_user_stats() for user=" << _u << ", bucket=" << bucket << " returned " << r << dendl;
return r;
}
- return bucket->check_bucket_shards(dpp, y);
+ return bucket->check_bucket_shards(dpp, ent.count, y);
}
int RGWUserStatsCache::sync_user(const DoutPrefixProvider *dpp, const rgw_user& _u, optional_yield y)
// XXXX hack
virtual void set_owner(rgw::sal::User* _owner) = 0;
- /** Load this bucket from the backing store. Requires the key to be set, fills other fields.
- * If @a get_stats is true, then statistics on the bucket are also looked up. */
- virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y, bool get_stats = false) = 0;
+ /** Load this bucket from the backing store. Requires the key to be set, fills other fields. */
+ virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y) = 0;
/** Read the bucket stats from the backing Store, synchronous */
virtual int read_stats(const DoutPrefixProvider *dpp,
const bucket_index_layout_generation& idx_layout,
const bucket_index_layout_generation& idx_layout,
int shard_id, RGWGetBucketStats_CB* ctx) = 0;
/** Sync this bucket's stats to the owning user's stats in the backing store */
- virtual int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y) = 0;
+ virtual int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* optional_ent) = 0;
/** Check if this bucket needs resharding, and schedule it if it does */
- virtual int check_bucket_shards(const DoutPrefixProvider* dpp, optional_yield y) = 0;
+ virtual int check_bucket_shards(const DoutPrefixProvider* dpp,
+ uint64_t num_objs, optional_yield y) = 0;
/** Change the owner of this bucket in the backing store. Current owner must be set. Does not
* change ownership of the objects in the bucket. */
virtual int chown(const DoutPrefixProvider* dpp, User& new_user, optional_yield y) = 0;
virtual int set_tag_timeout(const DoutPrefixProvider *dpp, uint64_t timeout) = 0;
/** Remove this specific bucket instance from the backing store. May be removed from API */
virtual int purge_instance(const DoutPrefixProvider* dpp, optional_yield y) = 0;
- /** Set the cached object count of this bucket */
- virtual void set_count(uint64_t _count) = 0;
- /** Set the cached size of this bucket */
- virtual void set_size(uint64_t _size) = 0;
/** Check if this instantiation is empty */
virtual bool empty() const = 0;
virtual const std::string& get_marker() const = 0;
/** Get the cached ID of this bucket */
virtual const std::string& get_bucket_id() const = 0;
- /** Get the cached size of this bucket */
- virtual size_t get_size() const = 0;
- /** Get the cached rounded size of this bucket */
- virtual size_t get_size_rounded() const = 0;
- /** Get the cached object count of this bucket */
- virtual uint64_t get_count() const = 0;
/** Get the cached placement rule of this bucket */
virtual rgw_placement_rule& get_placement_rule() = 0;
/** Get the cached creation time of this bucket */
return 0;
}
- int DBBucket::load_bucket(const DoutPrefixProvider *dpp, optional_yield y, bool get_stats)
+ int DBBucket::load_bucket(const DoutPrefixProvider *dpp, optional_yield y)
{
int ret = 0;
return 0;
}
- int DBBucket::sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y)
+ int DBBucket::sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* ent)
{
return 0;
}
- int DBBucket::check_bucket_shards(const DoutPrefixProvider *dpp, optional_yield y)
+ int DBBucket::check_bucket_shards(const DoutPrefixProvider *dpp,
+ uint64_t num_objs, optional_yield y)
{
return 0;
}
acls() {
}
- DBBucket(DBStore *_st, const RGWBucketEnt& _e)
- : StoreBucket(_e),
- store(_st),
- acls() {
- }
-
DBBucket(DBStore *_st, const RGWBucketInfo& _i)
: StoreBucket(_i),
store(_st),
acls() {
}
- DBBucket(DBStore *_st, const RGWBucketEnt& _e, User* _u)
- : StoreBucket(_e, _u),
- store(_st),
- acls() {
- }
-
DBBucket(DBStore *_st, const RGWBucketInfo& _i, User* _u)
: StoreBucket(_i, _u),
store(_st),
DoutPrefixProvider *dpp) override;
virtual RGWAccessControlPolicy& get_acl(void) override { return acls; }
virtual int set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy& acl, optional_yield y) override;
- virtual int load_bucket(const DoutPrefixProvider *dpp, optional_yield y, bool get_stats = false) override;
+ virtual int load_bucket(const DoutPrefixProvider *dpp, optional_yield y) override;
virtual int read_stats(const DoutPrefixProvider *dpp,
const bucket_index_layout_generation& idx_layout,
int shard_id,
std::string *max_marker = nullptr,
bool *syncstopped = nullptr) override;
virtual int read_stats_async(const DoutPrefixProvider *dpp, const bucket_index_layout_generation& idx_layout, int shard_id, RGWGetBucketStats_CB* ctx) override;
- virtual int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y) override;
- virtual int check_bucket_shards(const DoutPrefixProvider *dpp, optional_yield y) override;
+ int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* ent) override;
+ int check_bucket_shards(const DoutPrefixProvider *dpp,
+ uint64_t num_objs, optional_yield y) override;
virtual int chown(const DoutPrefixProvider *dpp, User& new_user, optional_yield y) override;
virtual int put_info(const DoutPrefixProvider *dpp, bool exclusive, ceph::real_time mtime, optional_yield y) override;
virtual int check_empty(const DoutPrefixProvider *dpp, optional_yield y) override;
return next->set_acl(dpp, acl, y);
}
-int FilterBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y,
- bool get_stats)
+int FilterBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y)
{
- return next->load_bucket(dpp, y, get_stats);
+ return next->load_bucket(dpp, y);
}
int FilterBucket::read_stats(const DoutPrefixProvider *dpp,
return next->read_stats_async(dpp, idx_layout, shard_id, ctx);
}
-int FilterBucket::sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y)
+int FilterBucket::sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* ent)
{
- return next->sync_user_stats(dpp, y);
+ return next->sync_user_stats(dpp, y, ent);
}
-int FilterBucket::check_bucket_shards(const DoutPrefixProvider* dpp, optional_yield y)
+int FilterBucket::check_bucket_shards(const DoutPrefixProvider* dpp,
+ uint64_t num_objs, optional_yield y)
{
- return next->check_bucket_shards(dpp, y);
+ return next->check_bucket_shards(dpp, num_objs, y);
}
int FilterBucket::chown(const DoutPrefixProvider* dpp, User& new_user, optional_yield y)
optional_yield y) override;
virtual void set_owner(rgw::sal::User* _owner) override { next->set_owner(_owner); }
- virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y,
- bool get_stats = false) override;
+ virtual int load_bucket(const DoutPrefixProvider* dpp, optional_yield y) override;
virtual int read_stats(const DoutPrefixProvider *dpp,
const bucket_index_layout_generation& idx_layout,
int shard_id, std::string* bucket_ver, std::string* master_ver,
virtual int read_stats_async(const DoutPrefixProvider *dpp,
const bucket_index_layout_generation& idx_layout,
int shard_id, RGWGetBucketStats_CB* ctx) override;
- virtual int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y) override;
- virtual int check_bucket_shards(const DoutPrefixProvider* dpp, optional_yield y) override;
+ int sync_user_stats(const DoutPrefixProvider *dpp, optional_yield y,
+ RGWBucketEnt* ent) override;
+ int check_bucket_shards(const DoutPrefixProvider* dpp,
+ uint64_t num_objs, optional_yield y) override;
virtual int chown(const DoutPrefixProvider* dpp, User& new_user,
optional_yield y) override;
virtual int put_info(const DoutPrefixProvider* dpp, bool exclusive,
virtual int rebuild_index(const DoutPrefixProvider *dpp) override;
virtual int set_tag_timeout(const DoutPrefixProvider *dpp, uint64_t timeout) override;
virtual int purge_instance(const DoutPrefixProvider* dpp, optional_yield y) override;
- virtual void set_count(uint64_t _count) override { return next->set_count(_count); }
- virtual void set_size(uint64_t _size) override { return next->set_size(_size); }
virtual bool empty() const override { return next->empty(); }
virtual const std::string& get_name() const override { return next->get_name(); }
virtual const std::string& get_tenant() const override { return next->get_tenant(); }
virtual const std::string& get_marker() const override { return next->get_marker(); }
virtual const std::string& get_bucket_id() const override { return next->get_bucket_id(); }
- virtual size_t get_size() const override { return next->get_size(); }
- virtual size_t get_size_rounded() const override { return next->get_size_rounded(); }
- virtual uint64_t get_count() const override { return next->get_count(); }
virtual rgw_placement_rule& get_placement_rule() override { return next->get_placement_rule(); }
virtual ceph::real_time& get_creation_time() override { return next->get_creation_time(); }
virtual ceph::real_time& get_modification_time() override { return next->get_modification_time(); }
class StoreBucket : public Bucket {
protected:
- RGWBucketEnt ent;
RGWBucketInfo info;
User* owner = nullptr;
Attrs attrs;
public:
StoreBucket() = default;
- StoreBucket(User* _u) :
- owner(_u) { }
- StoreBucket(const rgw_bucket& _b) { ent.bucket = _b; info.bucket = _b; }
- StoreBucket(const RGWBucketEnt& _e) : ent(_e) {
- info.bucket = ent.bucket;
- info.placement_rule = ent.placement_rule;
- info.creation_time = ent.creation_time;
- }
- StoreBucket(const RGWBucketInfo& _i) : info(_i) {
- ent.bucket = info.bucket;
- ent.placement_rule = info.placement_rule;
- ent.creation_time = info.creation_time;
- }
- StoreBucket(const rgw_bucket& _b, User* _u) :
- owner(_u) { ent.bucket = _b; info.bucket = _b; }
- StoreBucket(const RGWBucketEnt& _e, User* _u) : ent(_e), owner(_u) {
- info.bucket = ent.bucket;
- info.placement_rule = ent.placement_rule;
- info.creation_time = ent.creation_time;
- }
- StoreBucket(const RGWBucketInfo& _i, User* _u) : info(_i), owner(_u) {
- ent.bucket = info.bucket;
- ent.placement_rule = info.placement_rule;
- ent.creation_time = info.creation_time;
- }
+ StoreBucket(User* u) : owner(u) { }
+ StoreBucket(const rgw_bucket& b) { info.bucket = b; }
+ StoreBucket(const RGWBucketInfo& i) : info(i) {}
+ StoreBucket(const rgw_bucket& b, User* u) : owner(u) { info.bucket = b; }
+ StoreBucket(const RGWBucketInfo& i, User* u) : info(i), owner(u) {}
virtual ~StoreBucket() = default;
virtual Attrs& get_attrs(void) override { return attrs; }
owner = _owner;
info.owner = owner->get_id();
}
- virtual void set_count(uint64_t _count) override {
- ent.count = _count;
- }
- virtual void set_size(uint64_t _size) override {
- ent.size = _size;
- }
virtual User* get_owner(void) override { return owner; };
/* Make sure to call get_bucket_info() if you need it first */
virtual bool is_owner(User* user) override { return (info.owner.compare(user->get_id()) == 0); }
virtual const std::string& get_tenant() const override { return info.bucket.tenant; }
virtual const std::string& get_marker() const override { return info.bucket.marker; }
virtual const std::string& get_bucket_id() const override { return info.bucket.bucket_id; }
- virtual size_t get_size() const override { return ent.size; }
- virtual size_t get_size_rounded() const override { return ent.size_rounded; }
- virtual uint64_t get_count() const override { return ent.count; }
virtual rgw_placement_rule& get_placement_rule() override { return info.placement_rule; }
virtual ceph::real_time& get_creation_time() override { return info.creation_time; }
virtual ceph::real_time& get_modification_time() override { return mtime; }
optional_yield y, const DoutPrefixProvider *dpp) override {return 0;}
friend class BucketList;
-
- protected:
- virtual void set_ent(RGWBucketEnt& _ent) { ent = _ent; info.bucket = ent.bucket; info.placement_rule = ent.placement_rule; }
};
class StoreObject : public Object {
ldpp_dout(dpp, 0) << "ERROR: could not read bucket info: bucket=" << bucket << " ret=" << ret << dendl;
continue;
}
- ret = bucket->sync_user_stats(dpp, y);
+ ret = bucket->sync_user_stats(dpp, y, &ent);
if (ret < 0) {
ldpp_dout(dpp, 0) << "ERROR: could not sync bucket stats: ret=" << ret << dendl;
return ret;
}
- ret = bucket->check_bucket_shards(dpp, y);
+ ret = bucket->check_bucket_shards(dpp, ent.count, y);
if (ret < 0) {
ldpp_dout(dpp, 0) << "ERROR in check_bucket_shards: " << cpp_strerror(-ret)<< dendl;
}
EXPECT_EQ(storeObject->state.accounted_size, (uint64_t)200);
EXPECT_EQ(storeObject->state.epoch, (uint64_t)3);
EXPECT_EQ(storeObject->state.zone_short_id, (uint32_t)300);
- EXPECT_EQ(testObject_StoreGetMetadata->get_bucket()->get_count(), (uint64_t)10);
- EXPECT_EQ(testObject_StoreGetMetadata->get_bucket()->get_size(), (uint64_t)20);
EXPECT_EQ(info.quota.user_quota.max_size, (int64_t)0);
EXPECT_EQ(info.quota.user_quota.max_objects, (int64_t)0);
EXPECT_EQ(testObject_StoreGetMetadata->get_bucket()->get_owner()->get_max_buckets(), (int32_t)2000);
assert(Request.Bucket.Marker == "mymarker")
assert(Request.Bucket.Name == "myname")
assert(Request.Bucket.Tenant == "mytenant")
- assert(Request.Bucket.Count == 0)
- assert(Request.Bucket.Size == 0)
assert(Request.Bucket.ZoneGroupId)
assert(Request.Bucket.CreationTime)
assert(Request.Bucket.MTime)