Skip to content

Commit f30a6a8

Browse files
committed
RGW - zipper - Remove target from get_obj_attrs()
The target argument to get_obj_attrs() was only used internally to RadosStore and DBStore, and never by callers of the API. Remove it entirely, to reduce API complexity. Signed-off-by: Daniel Gryniewicz <[email protected]>
1 parent 69def10 commit f30a6a8

File tree

12 files changed

+35
-48
lines changed

12 files changed

+35
-48
lines changed

src/rgw/driver/d4n/rgw_sal_d4n.cc

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,8 +1456,7 @@ bool D4NFilterObject::check_head_exists_in_cache_get_oid(const DoutPrefixProvide
14561456
return found_in_cache;
14571457
}
14581458

1459-
int D4NFilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp,
1460-
rgw_obj* target_obj)
1459+
int D4NFilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp)
14611460
{
14621461
bool is_latest_version = true;
14631462
if (this->have_instance()) {
@@ -1476,17 +1475,14 @@ int D4NFilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* d
14761475
rgw::sal::Attrs attrs;
14771476
std::string version;
14781477
ldpp_dout(dpp, 10) << "D4NFilterObject::" << __func__ << "(): Fetching attrs from backend store." << dendl;
1479-
auto ret = next->get_obj_attrs(y, dpp, target_obj);
1480-
if (ret < 0 || !target_obj) {
1481-
if (!target_obj) {
1482-
ret = -ENOENT;
1483-
}
1478+
auto ret = next->get_obj_attrs(y, dpp);
1479+
if (ret < 0) {
14841480
ldpp_dout(dpp, 0) << "D4NFilterObject::" << __func__ << "(): Failed to fetching attrs from backend store with ret: " << ret << dendl;
14851481
return ret;
14861482
}
14871483

14881484
this->load_obj_state(dpp, y);
1489-
this->obj = *target_obj;
1485+
this->obj = next->get_obj();
14901486
if (!this->obj.key.instance.empty()) {
14911487
this->set_instance(this->obj.key.instance);
14921488
}
@@ -2221,8 +2217,7 @@ int D4NFilterObject::D4NFilterReadOp::get_attr(const DoutPrefixProvider* dpp, co
22212217
{
22222218
rgw::sal::Attrs& attrs = source->get_attrs();
22232219
if (attrs.empty()) {
2224-
rgw_obj obj = source->get_obj();
2225-
auto ret = source->get_obj_attrs(y, dpp, &obj);
2220+
auto ret = source->get_obj_attrs(y, dpp);
22262221
if (ret < 0) {
22272222
ldpp_dout(dpp, 0) << "D4NFilterObject::" << __func__ << "(): Error: failed to fetch attrs, ret=" << ret << dendl;
22282223
return ret;

src/rgw/driver/d4n/rgw_sal_d4n.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@ class D4NFilterObject : public FilterObject {
251251
bool follow_olh = true) override;
252252
virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs,
253253
Attrs* delattrs, optional_yield y, uint32_t flags) override;
254-
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp,
255-
rgw_obj* target_obj = NULL) override;
254+
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp) override;
256255
virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val,
257256
optional_yield y, const DoutPrefixProvider* dpp,
258257
uint32_t flags = rgw::sal::FLAG_LOG_OP) override;

src/rgw/driver/posix/rgw_sal_posix.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,8 +2951,7 @@ int POSIXObject::set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs,
29512951
return 0;
29522952
}
29532953

2954-
int POSIXObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp,
2955-
rgw_obj* target_obj)
2954+
int POSIXObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp)
29562955
{
29572956
//int fd;
29582957

src/rgw/driver/posix/rgw_sal_posix.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,7 @@ class POSIXObject : public StoreObject {
669669
virtual int load_obj_state(const DoutPrefixProvider* dpp, optional_yield y, bool follow_olh = true) override;
670670
virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs,
671671
Attrs* delattrs, optional_yield y, uint32_t flags) override;
672-
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp,
673-
rgw_obj* target_obj = NULL) override;
672+
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp) override;
674673
virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val,
675674
optional_yield y, const DoutPrefixProvider* dpp,
676675
uint32_t flags = rgw::sal::FLAG_LOG_OP) override;

src/rgw/driver/rados/rgw_sal_rados.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,19 +2727,22 @@ int RadosObject::set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs, A
27272727
y, log_op, mtime);
27282728
}
27292729

2730-
int RadosObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, rgw_obj* target_obj)
2730+
int RadosObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp)
27312731
{
27322732
RGWRados::Object op_target(store->getRados(), bucket->get_info(), *rados_ctx, get_obj());
27332733
RGWRados::Object::Read read_op(&op_target);
27342734

2735-
return read_attrs(dpp, read_op, y, target_obj);
2735+
return read_attrs(dpp, read_op, y);
27362736
}
27372737

27382738
int RadosObject::modify_obj_attrs(const char* attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider* dpp, uint32_t flags)
27392739
{
27402740
rgw_obj target = get_obj();
27412741
rgw_obj save = get_obj();
2742-
int r = get_obj_attrs(y, dpp, &target);
2742+
RGWRados::Object op_target(store->getRados(), bucket->get_info(), *rados_ctx, get_obj());
2743+
RGWRados::Object::Read read_op(&op_target);
2744+
2745+
int r = read_attrs(dpp, read_op, y, &target);
27432746
if (r < 0) {
27442747
return r;
27452748
}

src/rgw/driver/rados/rgw_sal_rados.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ class RadosObject : public StoreObject {
611611
optional_yield y) override;
612612

613613
virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs, Attrs* delattrs, optional_yield y, uint32_t flags) override;
614-
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, rgw_obj* target_obj = NULL) override;
614+
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp) override;
615615
virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider* dpp,
616616
uint32_t flags = rgw::sal::FLAG_LOG_OP) override;
617617
virtual int delete_obj_attrs(const DoutPrefixProvider* dpp, const char* attr_name, optional_yield y) override;

src/rgw/rgw_sal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ class Object {
12311231
* deleted. @note the attribute APIs may be revisited in the future. */
12321232
virtual int set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs, Attrs* delattrs, optional_yield y, uint32_t flags) = 0;
12331233
/** Get attributes for this object */
1234-
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, rgw_obj* target_obj = NULL) = 0;
1234+
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp) = 0;
12351235
/** Modify attributes for this object. */
12361236
virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider* dpp,
12371237
uint32_t flags = rgw::sal::FLAG_LOG_OP) = 0;

src/rgw/rgw_sal_dbstore.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,18 +544,21 @@ namespace rgw::sal {
544544
return op_target.set_attrs(dpp, setattrs ? *setattrs : empty, delattrs);
545545
}
546546

547-
int DBObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, rgw_obj* target_obj)
547+
int DBObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp)
548548
{
549549
DB::Object op_target(store->getDB(), get_bucket()->get_info(), get_obj());
550550
DB::Object::Read read_op(&op_target);
551551

552-
return read_attrs(dpp, read_op, y, target_obj);
552+
return read_attrs(dpp, read_op, y, nullptr);
553553
}
554554

555555
int DBObject::modify_obj_attrs(const char* attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider* dpp, uint32_t flags)
556556
{
557557
rgw_obj target = get_obj();
558-
int r = get_obj_attrs(y, dpp, &target);
558+
DB::Object op_target(store->getDB(), get_bucket()->get_info(), get_obj());
559+
DB::Object::Read read_op(&op_target);
560+
561+
int r = read_attrs(dpp, read_op, y, &target);
559562
if (r < 0) {
560563
return r;
561564
}

src/rgw/rgw_sal_dbstore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ class DBNotification : public StoreNotification {
569569
bool is_sync_completed(const DoutPrefixProvider* dpp, optional_yield y,
570570
const ceph::real_time& obj_mtime) override;
571571
virtual int load_obj_state(const DoutPrefixProvider* dpp, optional_yield y, bool follow_olh = true) override;
572-
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp, rgw_obj* target_obj = NULL) override;
572+
virtual int get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp) override;
573573
virtual int modify_obj_attrs(const char* attr_name, bufferlist& attr_val, optional_yield y, const DoutPrefixProvider* dpp,
574574
uint32_t flags = rgw::sal::FLAG_LOG_OP) override;
575575
virtual int delete_obj_attrs(const DoutPrefixProvider* dpp, const char* attr_name, optional_yield y) override;

src/rgw/rgw_sal_filter.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,10 +1073,9 @@ int FilterObject::set_obj_attrs(const DoutPrefixProvider* dpp, Attrs* setattrs,
10731073
return next->set_obj_attrs(dpp, setattrs, delattrs, y, flags);
10741074
}
10751075

1076-
int FilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp,
1077-
rgw_obj* target_obj)
1076+
int FilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* dpp)
10781077
{
1079-
return next->get_obj_attrs(y, dpp, target_obj);
1078+
return next->get_obj_attrs(y, dpp);
10801079
}
10811080

10821081
int FilterObject::modify_obj_attrs(const char* attr_name, bufferlist& attr_val,

0 commit comments

Comments
 (0)