Skip to content

Commit

Permalink
[7229] Refactor startup/shutdown logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Oct 25, 2024
1 parent 8e51ce5 commit 80df3ee
Show file tree
Hide file tree
Showing 272 changed files with 91,486 additions and 7,009 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ set(IRODS_VERSION_PATCH "0")
set(IRODS_VERSION "${IRODS_VERSION_MAJOR}.${IRODS_VERSION_MINOR}.${IRODS_VERSION_PATCH}")
set(IRODS_PACKAGE_REVISION "0")

# Bump this variable anytime the catalog schema is modified.
set(IRODS_CATALOG_SCHEMA_VERSION "12")
# Bump this variable anytime a JSON schema is modified.
set(IRODS_CONFIGURATION_SCHEMA_VERSION "5")

project(irods
VERSION ${IRODS_VERSION}
LANGUAGES C CXX)
Expand Down
4 changes: 4 additions & 0 deletions lib/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ foreach(variant IN ITEMS client server)
"${CMAKE_CURRENT_SOURCE_DIR}/src/rc_check_auth_credentials.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/rc_data_object_finalize.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/rc_data_object_modify_info.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/rc_delay_rule_tag.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/rc_delay_rule_tag_clear.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/rc_genquery2.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/rc_get_delay_rule_info.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/rc_get_file_descriptor_info.cpp"
Expand Down Expand Up @@ -249,6 +251,8 @@ install(
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/dataPut.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/data_object_finalize.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/data_object_modify_info.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/delay_rule_tag.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/delay_rule_tag_clear.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/endTransaction.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/execCmd.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/execMyRule.h"
Expand Down
3 changes: 3 additions & 0 deletions lib/api/include/irods/apiHeaderAll.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,7 @@

#include "irods/replica_truncate.h"

#include "irods/delay_rule_tag.h"
#include "irods/delay_rule_tag_clear.h"

#endif // API_HEADER_ALL_H__
2 changes: 2 additions & 0 deletions lib/api/include/irods/apiNumberData.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,7 @@ API_NUMBER(CLIENT_HINTS_AN, 10215)

API_NUMBER(GET_RESOURCE_INFO_FOR_OPERATION_AN, 10220)
API_NUMBER(GENQUERY2_AN, 10221)
API_NUMBER(DELAY_RULE_TAG_AN, 10222)
API_NUMBER(DELAY_RULE_TAG_CLEAR_AN, 10223)

// clang-format on
18 changes: 18 additions & 0 deletions lib/api/include/irods/apiTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@
# include "irods/rsUserAdmin.hpp"
# include "irods/rsZoneReport.hpp"
# include "irods/rs_check_auth_credentials.hpp"
# include "irods/rs_delay_rule_tag.hpp"
# include "irods/rs_delay_rule_tag_clear.hpp"
# include "irods/rs_genquery2.hpp"
# include "irods/rs_get_library_features.hpp"
# include "irods/rs_get_resource_info_for_operation.hpp"
Expand Down Expand Up @@ -205,6 +207,8 @@
#define RS_DATA_OBJ_UNLOCK NULLPTR_FOR_CLIENT_TABLE(rsDataObjUnlock)
#define RS_DATA_OBJ_WRITE NULLPTR_FOR_CLIENT_TABLE(rsDataObjWrite)
#define RS_DATA_PUT NULLPTR_FOR_CLIENT_TABLE(rsDataPut)
#define RS_DELAY_RULE_TAG NULLPTR_FOR_CLIENT_TABLE(rs_delay_rule_tag)
#define RS_DELAY_RULE_TAG_CLEAR NULLPTR_FOR_CLIENT_TABLE(rs_delay_rule_tag_clear)
#define RS_END_TRANSACTION NULLPTR_FOR_CLIENT_TABLE(rsEndTransaction)
#define RS_EXEC_CMD NULLPTR_FOR_CLIENT_TABLE(rsExecCmd)
#define RS_EXEC_MY_RULE NULLPTR_FOR_CLIENT_TABLE(rsExecMyRule)
Expand Down Expand Up @@ -1299,6 +1303,20 @@ static irods::apidef_t client_api_table_inp[] = {
boost::any(std::function<int(rsComm_t*, Genquery2Input*, char**)>(RS_GENQUERY2)),
"api_genquery2", clearGenquery2Input, irods::clearOutStruct_noop,
(funcPtr) CALL_GENQUERY2_INOUT
},
{
DELAY_RULE_TAG_AN, RODS_API_VERSION, LOCAL_PRIV_USER_AUTH, LOCAL_PRIV_USER_AUTH,
"DelayRuleTagInput_PI", 0, nullptr, 0,
boost::any(std::function<int(rsComm_t*, DelayRuleTagInput*)>(RS_DELAY_RULE_TAG)),
"api_delay_rule_tag", clearDelayRuleTagInput, irods::clearOutStruct_noop,
(funcPtr) CALL_DELAY_RULE_TAG
},
{
DELAY_RULE_TAG_CLEAR_AN, RODS_API_VERSION, LOCAL_PRIV_USER_AUTH, LOCAL_PRIV_USER_AUTH,
"DelayRuleTagClearInput_PI", 0, nullptr, 0,
boost::any(std::function<int(rsComm_t*, DelayRuleTagClearInput*)>(RS_DELAY_RULE_TAG_CLEAR)),
"api_delay_rule_tag_clear", clearDelayRuleTagClearInput, irods::clearOutStruct_noop,
(funcPtr) CALL_DELAY_RULE_TAG_CLEAR
}
// clang-format on
}; // _api_table_inp
Expand Down
2 changes: 2 additions & 0 deletions lib/api/include/irods/api_pack_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ inline const packInstruct_t api_pack_table_init[] = {
{"ExecRuleExpression_PI", ExecRuleExpression_PI, irods::clearInStruct_noop},
{"CheckAuthCredentialsInput_PI", CheckAuthCredentialsInput_PI, irods::clearInStruct_noop},
{"Genquery2Input_PI", Genquery2Input_PI, irods::clearInStruct_noop},
{"DelayRuleTagInput_PI", DelayRuleTagInput_PI, irods::clearInStruct_noop},
{"DelayRuleTagClearInput_PI", DelayRuleTagClearInput_PI, irods::clearInStruct_noop},
{PACK_TABLE_END_PI, nullptr, irods::clearInStruct_noop},
};

Expand Down
43 changes: 43 additions & 0 deletions lib/api/include/irods/delay_rule_tag.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ifndef IRODS_DELAY_RULE_TAG_H
#define IRODS_DELAY_RULE_TAG_H

/// \file

#include "irods/objInfo.h"

struct RcComm;

/// TODO
///
/// \since 5.0.0
typedef struct DelayRuleTagInput
{
char rule_id[32]; // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
char tag[300]; // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
struct KeyValPair condInput;
} delayRuleTagInp_t;

// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define DelayRuleTagInput_PI "str rule_id[32]; str tag[300]; struct KeyValPair_PI;"

#ifdef __cplusplus
extern "C" {
#endif

/// TODO
///
/// \param[in] _comm A pointer to a RcComm.
/// \param[in] _input
///
/// \return An integer.
/// \retval 0 On success.
/// \retval non-zero On failure.
///
/// \since 5.0.0
int rc_delay_rule_tag(struct RcComm* _comm, struct DelayRuleTagInput* _input);

#ifdef __cplusplus
} // extern "C"
#endif

#endif // IRODS_DELAY_RULE_TAG_H
42 changes: 42 additions & 0 deletions lib/api/include/irods/delay_rule_tag_clear.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#ifndef IRODS_DELAY_RULE_TAG_CLEAR_H
#define IRODS_DELAY_RULE_TAG_CLEAR_H

/// \file

#include "irods/objInfo.h"

struct RcComm;

/// TODO
///
/// \since 5.0.0
typedef struct DelayRuleTagClearInput
{
char rule_id[32]; // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
struct KeyValPair condInput;
} delayRuleTagClearInp_t;

// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define DelayRuleTagClearInput_PI "str rule_id[32]; str tag[32]; struct KeyValPair_PI;"

#ifdef __cplusplus
extern "C" {
#endif

/// TODO
///
/// \param[in] _comm A pointer to a RcComm.
/// \param[in] _input
///
/// \return An integer.
/// \retval 0 On success.
/// \retval non-zero On failure.
///
/// \since 5.0.0
int rc_delay_rule_tag_clear(struct RcComm* _comm, struct DelayRuleTagClearInput* _input);

#ifdef __cplusplus
} // extern "C"
#endif

#endif // IRODS_DELAY_RULE_TAG_CLEAR_H
44 changes: 44 additions & 0 deletions lib/api/include/irods/get_active_agents.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef IRODS_GET_ACTIVE_AGENTS_H
#define IRODS_GET_ACTIVE_AGENTS_H

/// \file

#include "irods/objInfo.h"

struct RcComm;

/// TODO
///
/// \since 5.0.0
typedef struct GetActiveAgentsInput
{
char hostname[65]; // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
char zone[250]; // NOLINT(cppcoreguidelines-avoid-c-arrays, modernize-avoid-c-arrays)
struct KeyValPair condInput;
} getActiveAgentsInp_t;

// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
#define GetActiveAgentsInput_PI "str hostname[65]; str zone[250]; struct KeyValPair_PI;"

#ifdef __cplusplus
extern "C" {
#endif

/// TODO
///
/// \param[in] _comm A pointer to a RcComm.
/// \param[in] _input
/// \param[in,out] _info
///
/// \return An integer.
/// \retval 0 On success.
/// \retval non-zero On failure.
///
/// \since 5.0.0
int rc_get_active_agents(struct RcComm* _comm, struct GetActiveAgentsInput* _input, char** _info);

#ifdef __cplusplus
} // extern "C"
#endif

#endif // IRODS_GET_ACTIVE_AGENTS_H
14 changes: 14 additions & 0 deletions lib/api/src/rc_delay_rule_tag.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "irods/delay_rule_tag.h"

#include "irods/apiNumber.h"
#include "irods/procApiRequest.h"
#include "irods/rodsErrorTable.h"

auto rc_delay_rule_tag(RcComm* _comm, DelayRuleTagInput* _input) -> int
{
if (!_comm || !_input) {
return SYS_INVALID_INPUT_PARAM;
}

return procApiRequest(_comm, DELAY_RULE_TAG_AN, _input, nullptr, nullptr, nullptr);
} // rc_delay_rule_tag
14 changes: 14 additions & 0 deletions lib/api/src/rc_delay_rule_tag_clear.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "irods/delay_rule_tag_clear.h"

#include "irods/apiNumber.h"
#include "irods/procApiRequest.h"
#include "irods/rodsErrorTable.h"

auto rc_delay_rule_tag_clear(RcComm* _comm, DelayRuleTagClearInput* _input) -> int
{
if (!_comm || !_input) {
return SYS_INVALID_INPUT_PARAM;
}

return procApiRequest(_comm, DELAY_RULE_TAG_CLEAR_AN, _input, nullptr, nullptr, nullptr);
} // rc_delay_rule_tag_clear
14 changes: 14 additions & 0 deletions lib/core/include/irods/dns_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ namespace irods::experimental::net::dns_cache
/// \since 4.2.9
auto deinit() noexcept -> void;

/// Initializes the dns cache from an existing shared memory object.
///
/// This function should only be called on startup of the server.
///
/// \param[in] _shm_name The name of the shared memory to create.
///
/// \since 5.0.0
auto init_no_create(const std::string_view _shm_name) -> void;

/// TODO
///
/// \since 5.0.0
auto shared_memory_name() -> std::string_view;

/// Inserts a new mapping or updates an existing mapping within the DNS cache.
///
/// \param[in] _key The key that will be mapped to \p _info.
Expand Down
14 changes: 14 additions & 0 deletions lib/core/include/irods/hostname_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ namespace irods::experimental::net::hostname_cache
/// \since 4.2.9
auto deinit() noexcept -> void;

/// Initializes the dns cache from an existing shared memory object.
///
/// This function should only be called on startup of the server.
///
/// \param[in] _shm_name The name of the shared memory to create.
///
/// \since 5.0.0
auto init_no_create(const std::string_view _shm_name) -> void;

/// TODO
///
/// \since 5.0.0
auto shared_memory_name() -> std::string_view;

/// Inserts a new mapping or updates an existing mapping within the hostname cache.
///
/// \param[in] _key The key that will be mapped to \p _alias.
Expand Down
6 changes: 4 additions & 2 deletions lib/core/include/irods/irods_client_server_negotiation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace irods
/// =-=-=-=-=-=-=-
/// @brief function which determines if a client/server negotiation is needed
/// on the server side
bool do_client_server_negotiation_for_server();
bool do_client_server_negotiation_for_server(const char* _neg);

/// =-=-=-=-=-=-=-
/// @brief function which determines if a client/server negotiation is needed
Expand All @@ -68,7 +68,9 @@ namespace irods
/// @brief function which manages the TLS and Auth negotiations with the client
error client_server_negotiation_for_server(
irods::network_object_ptr, // server connection handle
std::string& ); // results of negotiation
std::string&, // results of negotiation
bool, // boolean indicating whether client-server negotiation is needed
RsComm* = nullptr); // optional RsComm initialized during agent startup (maintains compatibility with rodsAgent.cpp)

/// =-=-=-=-=-=-=-
/// @brief function which manages the TLS and Auth negotiations with the client
Expand Down
18 changes: 14 additions & 4 deletions lib/core/include/irods/irods_default_paths.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,34 @@

#include <boost/filesystem/path.hpp>

#define IRODS_DEFAULT_PATH_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
#define IRODS_DEFAULT_PATH_SYSCONFDIR "@CMAKE_INSTALL_SYSCONFDIR@"
#define IRODS_DEFAULT_PATH_HOMEDIR "@IRODS_HOME_DIRECTORY@"
#define IRODS_DEFAULT_PATH_PLUGINDIR "@IRODS_PLUGINS_DIRECTORY@"
#define IRODS_DEFAULT_PATH_SBINDIR "@CMAKE_INSTALL_SBINDIR@"
#define IRODS_DEFAULT_PATH_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
#define IRODS_DEFAULT_PATH_SYSCONFDIR "@CMAKE_INSTALL_SYSCONFDIR@"
#define IRODS_DEFAULT_PATH_RUNSTATEDIR "@CMAKE_INSTALL_RUNSTATEDIR@"
#define IRODS_DEFAULT_PATH_HOMEDIR "@IRODS_HOME_DIRECTORY@"
#define IRODS_DEFAULT_PATH_PLUGINDIR "@IRODS_PLUGINS_DIRECTORY@"

namespace irods
{
boost::filesystem::path get_irods_root_directory();

boost::filesystem::path get_irods_sbin_directory();

boost::filesystem::path get_irods_lib_directory();

boost::filesystem::path get_irods_config_directory();

boost::filesystem::path get_irods_runstate_directory();

boost::filesystem::path get_irods_home_directory();

boost::filesystem::path get_irods_default_plugin_directory();

boost::filesystem::path get_irods_stacktrace_directory();

boost::filesystem::path get_irods_proc_directory();

boost::filesystem::path get_irods_msiExecCmd_bin_directory();
} // namespace irods

#endif // IRODS_DEFAULT_PATHS_HPP
Loading

0 comments on commit 80df3ee

Please sign in to comment.