Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
rgw/sfs: RGW_ATTR_OBJECT_RETENTION, avoid redundant copy in writer.cc
Browse files Browse the repository at this point in the history
In SFSAtomicWriter::complete(), when put RGW_ATTR_OBJECT_RETENTION
attribute in attrs, directly encode RGWObjectRetention object in the
map.

Signed-off-by: Giuseppe Baccini <[email protected]>
  • Loading branch information
Giuseppe Baccini committed Nov 23, 2023
1 parent d4b05d4 commit b13b9dc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/rgw/driver/sfs/writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,11 @@ int SFSAtomicWriter::complete(
bucketref->get_info().obj_lock.has_rule()) {
auto iter = attrs.find(RGW_ATTR_OBJECT_RETENTION);
if (iter == attrs.end()) {
real_time lock_until_date =
ceph::real_time lock_until_date =
bucketref->get_info().obj_lock.get_lock_until_date(now);
string mode = bucketref->get_info().obj_lock.get_mode();
std::string mode = bucketref->get_info().obj_lock.get_mode();
RGWObjectRetention obj_retention(mode, lock_until_date);
bufferlist bl;
obj_retention.encode(bl);
attrs[RGW_ATTR_OBJECT_RETENTION] = bl;
encode(obj_retention, attrs[RGW_ATTR_OBJECT_RETENTION]);
}
}

Expand Down

0 comments on commit b13b9dc

Please sign in to comment.