Skip to content

Commit

Permalink
[irods#296] Remove user_name/zone_name from internal signatures
Browse files Browse the repository at this point in the history
All operations are done using the local server's service account
rodsadmin client environment and as such do not need to know which
user needs to execute policies.
  • Loading branch information
alanking committed Jan 23, 2025
1 parent 885a78d commit 9c50424
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 53 deletions.
12 changes: 0 additions & 12 deletions include/irods/private/storage_tiering/storage_tiering.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ namespace irods {

void migrate_object_to_minimum_restage_tier(
const std::string& _object_path,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _source_resource);

void schedule_storage_tiering_policy(
Expand All @@ -44,8 +42,6 @@ namespace irods {
void apply_tier_group_metadata_to_object(
const std::string& _group_name,
const std::string& _object_path,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _source_replica_number,
const std::string& _source_resource,
const std::string& _destination_resource);
Expand All @@ -54,20 +50,14 @@ namespace irods {

void set_migration_metadata_flag_for_object(
rcComm_t* _comm,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _object_path);

void unset_migration_metadata_flag_for_object(
rcComm_t* _comm,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _object_path);

bool object_has_migration_metadata_flag(
rcComm_t* _comm,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _object_path);

bool skip_object_in_lower_tier(
Expand Down Expand Up @@ -159,8 +149,6 @@ namespace irods {
const std::string& _plugin_instance_name,
const std::string& _group_name,
const std::string& _object_path,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _source_replica_number,
const std::string& _source_resource,
const std::string& _destination_resource,
Expand Down
22 changes: 2 additions & 20 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,6 @@ namespace {
rcComm_t* _comm,
const std::string& _instance_name,
const std::string& _object_path,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _source_replica_number,
const std::string& _source_resource,
const std::string& _destination_resource,
Expand Down Expand Up @@ -438,8 +436,7 @@ namespace {

irods::storage_tiering st{&comm, _rei, plugin_instance_name};

st.migrate_object_to_minimum_restage_tier(
object_path, _rei->rsComm->clientUser.userName, _rei->rsComm->clientUser.rodsZone, source_resource);
st.migrate_object_to_minimum_restage_tier(object_path, source_resource);
}
else if("pep_api_data_obj_open_post" == _rn ||
"pep_api_data_obj_create_post" == _rn) {
Expand Down Expand Up @@ -483,10 +480,7 @@ namespace {
RcComm& comm = static_cast<RcComm&>(conn);

irods::storage_tiering st{&comm, _rei, plugin_instance_name};
st.migrate_object_to_minimum_restage_tier(object_path,
_rei->rsComm->clientUser.userName,
_rei->rsComm->clientUser.rodsZone,
resource_name);
st.migrate_object_to_minimum_restage_tier(object_path, resource_name);
}
}
}
Expand All @@ -503,16 +497,12 @@ namespace {
irods::storage_tiering& _st,
const std::string& _group_name,
const std::string& _object_path,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _source_replica_number,
const std::string& _source_resource,
const std::string& _destination_resource) {
_st.apply_tier_group_metadata_to_object(
_group_name,
_object_path,
_user_name,
_user_zone,
_source_replica_number,
_source_resource,
_destination_resource);
Expand Down Expand Up @@ -742,10 +732,6 @@ irods::error exec_rule_expression(
irods::storage_tiering::policy::data_movement ==
rule_obj.at("rule-engine-operation")) {
try {
// proxy for provided user name and zone
const std::string& user_name = rule_obj["user-name"];
const std::string& user_zone = rule_obj["user-zone"];
auto& pin = plugin_instance_name;

irods::experimental::client_connection conn;
RcComm& comm = static_cast<RcComm&>(conn);
Expand All @@ -754,8 +740,6 @@ irods::error exec_rule_expression(
auto status = apply_data_movement_policy(&comm,
plugin_instance_name,
rule_obj["object-path"],
rule_obj["user-name"],
rule_obj["user-zone"],
rule_obj["source-replica-number"],
rule_obj["source-resource"],
rule_obj["destination-resource"],
Expand All @@ -767,8 +751,6 @@ irods::error exec_rule_expression(
status = apply_tier_group_metadata_policy(st,
rule_obj["group-name"],
rule_obj["object-path"],
rule_obj["user-name"],
rule_obj["user-zone"],
rule_obj["source-replica-number"],
rule_obj["source-resource"],
rule_obj["destination-resource"]);
Expand Down
24 changes: 3 additions & 21 deletions src/storage_tiering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,6 @@ namespace irods {
config_.instance_name,
_group_name,
object_path,
_results[2],
_results[3],
_results[4],
_source_resource,
_destination_resource,
Expand Down Expand Up @@ -727,19 +725,17 @@ namespace irods {
const std::string& _plugin_instance_name,
const std::string& _group_name,
const std::string& _object_path,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _source_replica_number,
const std::string& _source_resource,
const std::string& _destination_resource,
const std::string& _verification_type,
const bool _preserve_replicas,
const std::string& _data_movement_params) {
if(object_has_migration_metadata_flag(_comm, _user_name, _user_zone, _object_path)) {
if (object_has_migration_metadata_flag(_comm, _object_path)) {
return;
}

set_migration_metadata_flag_for_object(_comm, _user_name, _user_zone, _object_path);
set_migration_metadata_flag_for_object(_comm, _object_path);

nlohmann::json rule_obj =
{
Expand All @@ -750,8 +746,6 @@ namespace irods {
, {"rule-engine-instance-name", _plugin_instance_name}
, {"group-name", _group_name}
, {"object-path", _object_path}
, {"user-name", _user_name}
, {"user-zone", _user_zone}
, {"source-replica-number", _source_replica_number}
, {"source-resource", _source_resource}
, {"destination-resource", _destination_resource}
Expand Down Expand Up @@ -862,8 +856,6 @@ namespace irods {

void storage_tiering::migrate_object_to_minimum_restage_tier(
const std::string& _object_path,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _source_resource) {

try {
Expand Down Expand Up @@ -900,8 +892,6 @@ namespace irods {
config_.instance_name,
group_name,
_object_path,
_user_name,
_user_zone,
source_replica_number,
_source_resource,
low_tier_resource_name,
Expand Down Expand Up @@ -969,8 +959,6 @@ namespace irods {

void storage_tiering::set_migration_metadata_flag_for_object(
rcComm_t* _comm,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _object_path) {
auto access_time = get_metadata_for_data_object(
_comm,
Expand All @@ -996,8 +984,6 @@ namespace irods {

void storage_tiering::unset_migration_metadata_flag_for_object(
rcComm_t* _comm,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _object_path) {
auto access_time = get_metadata_for_data_object(
_comm,
Expand All @@ -1023,8 +1009,6 @@ namespace irods {

bool storage_tiering::object_has_migration_metadata_flag(
rcComm_t* _comm,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _object_path) {
boost::filesystem::path p{_object_path};
std::string coll_name = p.parent_path().string();
Expand All @@ -1045,13 +1029,11 @@ namespace irods {
void storage_tiering::apply_tier_group_metadata_to_object(
const std::string& _group_name,
const std::string& _object_path,
const std::string& _user_name,
const std::string& _user_zone,
const std::string& _source_replica_number,
const std::string& _source_resource,
const std::string& _destination_resource) {
try {
unset_migration_metadata_flag_for_object(comm_, _user_name, _user_zone, _object_path);
unset_migration_metadata_flag_for_object(comm_, _object_path);
}
catch(const exception&) {
}
Expand Down

0 comments on commit 9c50424

Please sign in to comment.