irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

rsFileUnlink.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See fileUnlink.h for a description of this API call.*/
5 
6 #include "fileUnlink.h"
7 #include "miscServerFunct.hpp"
8 #include "rsFileUnlink.hpp"
9 
10 // =-=-=-=-=-=-=-
11 #include "irods_log.hpp"
12 #include "irods_file_object.hpp"
13 #include "irods_stacktrace.hpp"
15 
16 int
17 rsFileUnlink( rsComm_t *rsComm, fileUnlinkInp_t *fileUnlinkInp ) {
19  int remoteFlag;
20  int status;
21 
22  //remoteFlag = resolveHost (&fileUnlinkInp->addr, &rodsServerHost);
23  irods::error ret = irods::get_host_for_hier_string( fileUnlinkInp->rescHier, remoteFlag, rodsServerHost );
24  if ( !ret.ok() ) {
25  irods::log( PASSMSG( "failed in call to irods::get_host_for_hier_string", ret ) );
26  return -1;
27  }
28  if ( remoteFlag == LOCAL_HOST ) {
29  status = _rsFileUnlink( rsComm, fileUnlinkInp );
30  }
31  else if ( remoteFlag == REMOTE_HOST ) {
32  status = remoteFileUnlink( rsComm, fileUnlinkInp, rodsServerHost );
33  }
34  else {
35  if ( remoteFlag < 0 ) {
36  return remoteFlag;
37  }
38  else {
40  "rsFileUnlink: resolveHost returned unrecognized value %d",
41  remoteFlag );
43  }
44  }
45 
46  /* Manually insert call-specific code here */
47 
48  return status;
49 }
50 
51 int
52 remoteFileUnlink( rsComm_t *rsComm, fileUnlinkInp_t *fileUnlinkInp,
54  int status;
55 
56  if ( rodsServerHost == NULL ) {
58  "remoteFileUnlink: Invalid rodsServerHost" );
60  }
61 
62  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
63  return status;
64  }
65 
66 
67  status = rcFileUnlink( rodsServerHost->conn, fileUnlinkInp );
68 
69  if ( status < 0 ) {
71  "remoteFileUnlink: rcFileUnlink failed for %s, status = %d",
72  fileUnlinkInp->fileName, status );
73  }
74 
75  return status;
76 }
77 
78 // =-=-=-=-=-=-=-
79 // local function for calling unlink via resource plugin
81  rsComm_t* _comm,
82  fileUnlinkInp_t* _unlink_inp ) {
83  if ( _unlink_inp->objPath[0] == '\0' ) {
84  std::stringstream msg;
85  msg << __FUNCTION__;
86  msg << " - empty logical path.";
87  irods::log( LOG_ERROR, msg.str() );
89  }
90 
91  // =-=-=-=-=-=-=-
92  // call unlink via resource plugin
93  irods::file_object_ptr file_obj(
95  _comm,
96  _unlink_inp->objPath,
97  _unlink_inp->fileName,
98  _unlink_inp->rescHier,
99  0, 0, 0 ) );
100  file_obj->in_pdmo( _unlink_inp->in_pdmo );
101 
102  irods::error unlink_err = fileUnlink( _comm, file_obj );
103 
104  // =-=-=-=-=-=-=-
105  // log potential error message
106  if ( unlink_err.code() < 0 ) {
107  std::stringstream msg;
108  msg << "fileRead failed for [";
109  msg << _unlink_inp->fileName;
110  msg << "]";
111  msg << unlink_err.code();
112  irods::error ret_err = PASSMSG( msg.str(), unlink_err );
113  irods::log( ret_err );
114  }
115 
116  return unlink_err.code();
117 
118 } // _rsFileUnlink
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
SYS_UNRECOGNIZED_REMOTE_FLAG
@ SYS_UNRECOGNIZED_REMOTE_FLAG
Definition: rodsErrorTable.h:88
irods_file_object.hpp
irods_stacktrace.hpp
fileUnlink
irods::error fileUnlink(rsComm_t *, irods::first_class_object_ptr)
Definition: fileDriver.cpp:177
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
rcFileUnlink
int rcFileUnlink(rcComm_t *conn, fileUnlinkInp_t *fileUnlinkInp)
Definition: rcFileUnlink.cpp:23
irods_resource_backport.hpp
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
fileUnlinkInp_t::fileName
char fileName[(1024+64)]
Definition: fileUnlink.h:9
irods::error::code
long long code() const
Definition: irods_error.cpp:194
irods::get_host_for_hier_string
error get_host_for_hier_string(const std::string &, int &, rodsServerHost_t *&)
Definition: irods_resource_backport.cpp:581
fileUnlinkInp_t::rescHier
char rescHier[(1024+64)]
Definition: fileUnlink.h:10
SYS_INVALID_SERVER_HOST
@ SYS_INVALID_SERVER_HOST
Definition: rodsErrorTable.h:89
svrToSvrConnect
int svrToSvrConnect(rsComm_t *rsComm, rodsServerHost_t *rodsServerHost)
Definition: miscServerFunct.cpp:106
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
irods::log
void log(const error &)
Definition: irods_log.cpp:13
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
fileUnlinkInp_t::objPath
char objPath[(1024+64)]
Definition: fileUnlink.h:11
fileUnlinkInp_t::in_pdmo
char in_pdmo[(1024+64)]
Definition: fileUnlink.h:12
irods::file_object
Definition: irods_file_object.hpp:19
rodsServerHost
Definition: rodsConnect.h:62
irods::file_object_ptr
boost::shared_ptr< file_object > file_object_ptr
Definition: irods_file_object.hpp:145
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
fileUnlinkInp_t
Definition: fileUnlink.h:7
irods_log.hpp