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)  

rsSubStructFileRename.cpp
Go to the documentation of this file.
1 
3 #include "subStructFileRename.h"
4 #include "miscServerFunct.hpp"
5 #include "dataObjOpr.hpp"
7 
9 
10 
11 int
12 rsSubStructFileRename( rsComm_t *rsComm, subStructFileRenameInp_t *subStructFileRenameInp ) {
14  int remoteFlag;
15  int status;
16 
17  remoteFlag = resolveHost( &subStructFileRenameInp->subFile.addr, &rodsServerHost );
18 
19  if ( remoteFlag == LOCAL_HOST ) {
20  status = _rsSubStructFileRename( rsComm, subStructFileRenameInp );
21  }
22  else if ( remoteFlag == REMOTE_HOST ) {
23  status = remoteSubStructFileRename( rsComm, subStructFileRenameInp, rodsServerHost );
24  }
25  else {
26  if ( remoteFlag < 0 ) {
27  return remoteFlag;
28  }
29  else {
31  "rsSubStructFileRename: resolveHost returned unrecognized value %d",
32  remoteFlag );
34  }
35  }
36 
37  return status;
38 }
39 
40 int
43  int status;
44 
45  if ( rodsServerHost == NULL ) {
47  "remoteSubStructFileRename: Invalid rodsServerHost" );
49  }
50 
51  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
52  return status;
53  }
54 
55  status = rcSubStructFileRename( rodsServerHost->conn, subStructFileRenameInp );
56 
57  if ( status < 0 ) {
59  "remoteSubStructFileRename: rcSubStructFileRename failed for %s, status = %d",
60  subStructFileRenameInp->subFile.subFilePath, status );
61  }
62 
63  return status;
64 }
65 
66 int
68  subStructFileRenameInp_t* _rename_inp ) {
69  // =-=-=-=-=-=-=-
70  // create first class structured object
73  _rename_inp->subFile ) );
74  struct_obj->comm( _comm );
75  struct_obj->resc_hier( _rename_inp->resc_hier );
76 
77  // =-=-=-=-=-=-=-
78  // call abstrcated interface to rename
79  irods::error rename_err = fileRename( _comm, struct_obj, _rename_inp->newSubFilePath );
80  if ( !rename_err.ok() ) {
81  std::stringstream msg;
82  msg << "failed on call to fileRename for [";
83  msg << struct_obj->physical_path();
84  msg << "]";
85  irods::log( PASSMSG( msg.str(), rename_err ) );
86  return rename_err.code();
87 
88  }
89  else {
90  return rename_err.code();
91 
92  }
93 
94 }
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
Subfile::subFilePath
char subFilePath[(1024+64)]
Definition: objInfo.h:318
rsSubStructFileRename
int rsSubStructFileRename(rsComm_t *rsComm, subStructFileRenameInp_t *subStructFileRenameInp)
Definition: rsSubStructFileRename.cpp:12
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
SubStructFileRenameInp
Definition: subStructFileRename.h:7
_rsSubStructFileRename
int _rsSubStructFileRename(rsComm_t *_comm, subStructFileRenameInp_t *_rename_inp)
Definition: rsSubStructFileRename.cpp:67
irods::error::code
long long code() const
Definition: irods_error.cpp:194
fileRename
irods::error fileRename(rsComm_t *, irods::first_class_object_ptr, const std::string &)
Definition: fileDriver.cpp:453
remoteSubStructFileRename
int remoteSubStructFileRename(rsComm_t *rsComm, subStructFileRenameInp_t *subStructFileRenameInp, rodsServerHost_t *rodsServerHost)
Definition: rsSubStructFileRename.cpp:41
SubStructFileRenameInp::newSubFilePath
char newSubFilePath[(1024+64)]
Definition: subStructFileRename.h:9
irods::structured_object
Definition: irods_structured_object.hpp:15
rsSubStructFileRename.hpp
SYS_INVALID_SERVER_HOST
@ SYS_INVALID_SERVER_HOST
Definition: rodsErrorTable.h:89
Subfile::addr
rodsHostAddr_t addr
Definition: objInfo.h:317
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
irods::structured_object_ptr
boost::shared_ptr< structured_object > structured_object_ptr
Definition: irods_structured_object.hpp:107
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
SubStructFileRenameInp::subFile
subFile_t subFile
Definition: subStructFileRename.h:8
rodsServerHost
Definition: rodsConnect.h:62
irods_structured_object.hpp
rcSubStructFileRename
int rcSubStructFileRename(rcComm_t *conn, subStructFileRenameInp_t *subStructFileRenameInp)
Definition: rcSubStructFileRename.cpp:23
dataObjOpr.hpp
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
subStructFileRename.h
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375
SubStructFileRenameInp::resc_hier
char resc_hier[(1024+64)]
Definition: subStructFileRename.h:10