forked from irods/irods
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The replica_truncate API is meant to act as a replacement for rcDataObjTruncate. The interface is very similar to rcDataObjTruncate, but the result is different. The API only targets one replica to be truncated, and will trigger fileModified as if the file had been modified via an open/write/close.
- Loading branch information
Showing
12 changed files
with
356 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef IRODS_REPLICA_TRUNCATE_H | ||
#define IRODS_REPLICA_TRUNCATE_H | ||
|
||
struct RcComm; | ||
struct DataObjInp; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/// Truncate a replica for the specified data object to the specified size. | ||
/// | ||
/// \parblock | ||
/// This API selects a replica to truncate according to the rules of POSIX truncate(2). The caller may provide keywords | ||
/// via condInput in order to influence the hierarchy resolution for selecting a replica to truncate. | ||
/// \endparblock | ||
/// | ||
/// \param[in] _comm A pointer to a RcComm. | ||
/// \param[in] _inp \parblock | ||
/// DataObjInp structure which requires the following inputs: | ||
/// objPath - The full logical path to the target data object. | ||
/// dataSize - The desired size of the replica after truncating. | ||
/// | ||
/// The condInput supports the following keywords for hierarchy resolution for a "write" operation: | ||
/// replNum - The replica number of the replica to truncate. | ||
/// rescName / destRescName - The name of the resource with the replica to truncate. Must be a root resource. | ||
/// \endparblock | ||
/// | ||
/// \return An integer representing an iRODS error code, or 0. | ||
/// \retval 0 on success. | ||
/// \retval <0 on failure; an iRODS error code. | ||
/// | ||
/// \since 4.3.2 | ||
int rc_replica_truncate(RcComm* _comm, DataObjInp* _inp); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif | ||
|
||
#endif // IRODS_REPLICA_TRUNCATE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "irods/replica_truncate.h" | ||
|
||
#include "irods/apiNumber.h" | ||
#include "irods/procApiRequest.h" | ||
#include "irods/rodsErrorTable.h" | ||
|
||
auto rc_replica_truncate(RcComm* _comm, DataObjInp* _inp) -> int | ||
{ | ||
if (!_comm || !_inp) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
return procApiRequest(_comm, REPLICA_TRUNCATE_AN, _inp, nullptr, nullptr, nullptr); | ||
} // rc_replica_truncate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef IRODS_RS_REPLICA_TRUNCATE_HPP | ||
#define IRODS_RS_REPLICA_TRUNCATE_HPP | ||
|
||
struct RsComm; | ||
struct DataObjInp; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/// Truncate a replica for the specified data object to the specified size. | ||
/// | ||
/// \parblock | ||
/// This API selects a replica to truncate according to the rules of POSIX truncate(2). The caller may provide keywords | ||
/// via condInput in order to influence the hierarchy resolution for selecting a replica to truncate. | ||
/// \endparblock | ||
/// | ||
/// \param[in] _comm A pointer to a RsComm. | ||
/// \param[in] _inp \parblock | ||
/// DataObjInp structure which requires the following inputs: | ||
/// objPath - The full logical path to the target data object. | ||
/// dataSize - The desired size of the replica after truncating. Follows the rules of POSIX truncate(2). | ||
/// | ||
/// The condInput supports the following keywords for hierarchy resolution for a "write" operation: | ||
/// replNum - The replica number of the replica to truncate. | ||
/// rescName / destRescName - The name of the resource with the replica to truncate. Must be a root resource. | ||
/// \endparblock | ||
/// | ||
/// \return An integer representing an iRODS error code, or 0. | ||
/// \retval 0 on success. | ||
/// \retval <0 on failure; an iRODS error code. | ||
/// | ||
/// \since 4.3.2 | ||
int rs_replica_truncate(RsComm* _comm, DataObjInp* _inp); | ||
|
||
#ifdef __cplusplus | ||
} // extern "C" | ||
#endif | ||
|
||
#endif // IRODS_RS_REPLICA_TRUNCATE_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.