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)  

rsSubStructFileOpen.cpp
Go to the documentation of this file.
1 
3 #include "subStructFileOpen.h"
4 #include "miscServerFunct.hpp"
5 #include "dataObjOpr.hpp"
7 
9 
10 
11 
12 int
13 rsSubStructFileOpen( rsComm_t *rsComm, subFile_t *subFile ) {
15  int remoteFlag;
16  int fd;
17 
18  remoteFlag = resolveHost( &subFile->addr, &rodsServerHost );
19 
20  if ( remoteFlag == LOCAL_HOST ) {
21  fd = _rsSubStructFileOpen( rsComm, subFile );
22  }
23  else if ( remoteFlag == REMOTE_HOST ) {
24  fd = remoteSubStructFileOpen( rsComm, subFile, rodsServerHost );
25  }
26  else {
27  if ( remoteFlag < 0 ) {
28  return remoteFlag;
29  }
30  else {
32  "rsSubStructFileOpen: resolveHost returned unrecognized value %d",
33  remoteFlag );
35  }
36  }
37 
38  return fd;
39 }
40 
41 int
44  int fd;
45  int status;
46 
47  if ( rodsServerHost == NULL ) {
49  "remoteSubStructFileOpen: Invalid rodsServerHost" );
51  }
52 
53  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
54  return status;
55  }
56 
57  fd = rcSubStructFileOpen( rodsServerHost->conn, subFile );
58 
59  if ( fd < 0 ) {
61  "remoteSubStructFileOpen: rcSubStructFileOpen failed for %s, status = %d",
62  subFile->subFilePath, fd );
63  }
64 
65  return fd;
66 }
67 
68 int
70  rsComm_t* _comm,
71  subFile_t* _sub_file ) {
72  // =-=-=-=-=-=-=-
73  // create first class structured object
76  *_sub_file ) );
77  struct_obj->comm( _comm );
78  struct_obj->resc_hier( _sub_file->specColl->rescHier );
79 
80  // =-=-=-=-=-=-=-
81  // call abstrcated interface to open a file
82  irods::error open_err = fileOpen( _comm, struct_obj );
83  if ( !open_err.ok() ) {
84  std::stringstream msg;
85  msg << "failed on call to fileOpen for [";
86  msg << struct_obj->sub_file_path();
87  msg << "]";
88  irods::log( PASSMSG( msg.str(), open_err ) );
89  return open_err.code();
90 
91  }
92  else {
93  return open_err.code();
94 
95  }
96 
97 } // _rsSubStructFileOpen
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
Subfile
Definition: objInfo.h:316
SYS_UNRECOGNIZED_REMOTE_FLAG
@ SYS_UNRECOGNIZED_REMOTE_FLAG
Definition: rodsErrorTable.h:88
Subfile::subFilePath
char subFilePath[(1024+64)]
Definition: objInfo.h:318
remoteSubStructFileOpen
int remoteSubStructFileOpen(rsComm_t *rsComm, subFile_t *subFile, rodsServerHost_t *rodsServerHost)
Definition: rsSubStructFileOpen.cpp:42
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
Subfile::specColl
specColl_t * specColl
Definition: objInfo.h:322
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
irods::error::code
long long code() const
Definition: irods_error.cpp:194
rcSubStructFileOpen
int rcSubStructFileOpen(rcComm_t *conn, subFile_t *subFile)
Definition: rcSubStructFileOpen.cpp:23
irods::structured_object
Definition: irods_structured_object.hpp:15
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
rsSubStructFileOpen
int rsSubStructFileOpen(rsComm_t *rsComm, subFile_t *subFile)
Definition: rsSubStructFileOpen.cpp:13
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
SpecColl::rescHier
char rescHier[(1024+64)]
Definition: objInfo.h:84
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
fileOpen
irods::error fileOpen(rsComm_t *, irods::first_class_object_ptr)
Definition: fileDriver.cpp:49
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
rsSubStructFileOpen.hpp
rodsServerHost
Definition: rodsConnect.h:62
subStructFileOpen.h
irods_structured_object.hpp
dataObjOpr.hpp
_rsSubStructFileOpen
int _rsSubStructFileOpen(rsComm_t *_comm, subFile_t *_sub_file)
Definition: rsSubStructFileOpen.cpp:69
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375