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)  

rsSubStructFileWrite.cpp
Go to the documentation of this file.
1 
3 #include "subStructFileWrite.h"
4 #include "miscServerFunct.hpp"
5 #include "dataObjOpr.hpp"
7 
8 // =-=-=-=-=-=-=-
10 
11 
12 int
13 rsSubStructFileWrite( rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileWriteInp,
14  bytesBuf_t *subStructFileWriteOutBBuf ) {
16  int remoteFlag;
17  int status;
18 
19  remoteFlag = resolveHost( &subStructFileWriteInp->addr, &rodsServerHost );
20 
21  if ( remoteFlag == LOCAL_HOST ) {
22  status = _rsSubStructFileWrite( rsComm, subStructFileWriteInp, subStructFileWriteOutBBuf );
23  }
24  else if ( remoteFlag == REMOTE_HOST ) {
25  status = remoteSubStructFileWrite( rsComm, subStructFileWriteInp, subStructFileWriteOutBBuf,
27  }
28  else {
29  if ( remoteFlag < 0 ) {
30  return remoteFlag;
31  }
32  else {
34  "rsSubStructFileWrite: resolveHost returned unrecognized value %d",
35  remoteFlag );
37  }
38  }
39 
40  return status;
41 }
42 
43 int
45  bytesBuf_t *subStructFileWriteOutBBuf, rodsServerHost_t *rodsServerHost ) {
46  int status;
47 
48  if ( rodsServerHost == NULL ) {
50  "remoteSubStructFileWrite: Invalid rodsServerHost" );
52  }
53 
54  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
55  return status;
56  }
57 
58  status = rcSubStructFileWrite( rodsServerHost->conn, subStructFileWriteInp,
59  subStructFileWriteOutBBuf );
60 
61  if ( status < 0 ) {
63  "remoteSubStructFileWrite: rcFileWrite failed for fd %d",
64  subStructFileWriteInp->fd );
65  }
66 
67  return status;
68 }
69 
71  rsComm_t* _comm,
72  subStructFileFdOprInp_t* _write_inp,
73  bytesBuf_t* _out_buf ) {
74  // =-=-=-=-=-=-=-
75  // create first class structured object
77  new irods::structured_object( *_write_inp ) );
78  struct_obj->comm( _comm );
79  struct_obj->resc_hier( _write_inp->resc_hier );
80  struct_obj->file_descriptor( _write_inp->fd );
81  struct_obj->addr( _write_inp->addr );
82 
83  // =-=-=-=-=-=-=-
84  // call abstrcated interface to write
85  irods::error write_err = fileWrite(
86  _comm,
87  struct_obj,
88  _out_buf->buf,
89  _out_buf->len );
90  if ( !write_err.ok() ) {
91  std::stringstream msg;
92  msg << "failed on call to fileWrite for [";
93  msg << struct_obj->physical_path();
94  msg << "]";
95  irods::log( PASSMSG( msg.str(), write_err ) );
96  return write_err.code();
97 
98  }
99  else {
100  return write_err.code();
101 
102  }
103 
104 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
SubStructFileFdOpr::addr
rodsHostAddr_t addr
Definition: subStructFileRead.h:9
rsComm_t
Definition: rcConnect.h:145
BytesBuf::buf
void * buf
Definition: rodsDef.h:199
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
SYS_UNRECOGNIZED_REMOTE_FLAG
@ SYS_UNRECOGNIZED_REMOTE_FLAG
Definition: rodsErrorTable.h:88
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
rsSubStructFileWrite
int rsSubStructFileWrite(rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileWriteInp, bytesBuf_t *subStructFileWriteOutBBuf)
Definition: rsSubStructFileWrite.cpp:13
SubStructFileFdOpr
Definition: subStructFileRead.h:8
BytesBuf::len
int len
Definition: rodsDef.h:198
_rsSubStructFileWrite
int _rsSubStructFileWrite(rsComm_t *_comm, subStructFileFdOprInp_t *_write_inp, bytesBuf_t *_out_buf)
Definition: rsSubStructFileWrite.cpp:70
subStructFileWrite.h
irods::error::code
long long code() const
Definition: irods_error.cpp:194
fileWrite
irods::error fileWrite(rsComm_t *, irods::first_class_object_ptr, void *, int)
Definition: fileDriver.cpp:113
rsSubStructFileWrite.hpp
irods::structured_object
Definition: irods_structured_object.hpp:15
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
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
BytesBuf
Definition: rodsDef.h:197
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
SubStructFileFdOpr::resc_hier
char resc_hier[(1024+64)]
Definition: subStructFileRead.h:13
SubStructFileFdOpr::fd
int fd
Definition: subStructFileRead.h:11
rcSubStructFileWrite
int rcSubStructFileWrite(rcComm_t *conn, subStructFileFdOprInp_t *subStructFileWriteInp, bytesBuf_t *subStructFileWriteOutBBuf)
Definition: rcSubStructFileWrite.cpp:24
rodsServerHost
Definition: rodsConnect.h:62
remoteSubStructFileWrite
int remoteSubStructFileWrite(rsComm_t *rsComm, subStructFileFdOprInp_t *subStructFileWriteInp, bytesBuf_t *subStructFileWriteOutBBuf, rodsServerHost_t *rodsServerHost)
Definition: rsSubStructFileWrite.cpp:44
irods_structured_object.hpp
dataObjOpr.hpp
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375