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)  

rcDataObjPut.cpp
Go to the documentation of this file.
1 
6 
8 /* This is script-generated code. */
9 /* See dataObjPut.h for a description of this API call.*/
10 
11 #include "dataObjPut.h"
12 #include "procApiRequest.h"
13 #include "apiNumber.h"
14 #include "rcPortalOpr.h"
15 #include "oprComplete.h"
16 #include "sockComm.h"
17 #include "rcMisc.h"
18 
19 // =-=-=-=-=-=-=-
21 
99 int
100 rcDataObjPut( rcComm_t *conn, dataObjInp_t *dataObjInp, char *locFilePath ) {
101  int status;
103  bytesBuf_t dataObjInpBBuf;
104 
105  if ( dataObjInp->dataSize <= 0 ) {
106  dataObjInp->dataSize = getFileSize( locFilePath );
107  if ( dataObjInp->dataSize < 0 ) {
109  }
110  }
111 
112  memset( &conn->transStat, 0, sizeof( transStat_t ) );
113  memset( &dataObjInpBBuf, 0, sizeof( dataObjInpBBuf ) );
114 
115  rodsEnv rods_env;
116  if ( int status = getRodsEnv( &rods_env ) ) {
117  rodsLog( LOG_ERROR, "getRodsEnv failed in %s with status %s", __FUNCTION__, status );
118  return status;
119  }
120  int single_buff_sz = rods_env.irodsMaxSizeForSingleBuffer * 1024 * 1024;
121  if ( getValByKey( &dataObjInp->condInput, DATA_INCLUDED_KW ) != NULL ) {
122  if ( dataObjInp->dataSize > single_buff_sz ) {
123  rmKeyVal( &dataObjInp->condInput, DATA_INCLUDED_KW );
124  }
125  else {
126  status = fillBBufWithFile( conn, &dataObjInpBBuf, locFilePath,
127  dataObjInp->dataSize );
128  if ( status < 0 ) {
130  "rcDataObjPut: fileBBufWithFile error for %s", locFilePath );
131  return status;
132  }
133  }
134  }
135  else if ( dataObjInp->dataSize <= single_buff_sz ) {
136  addKeyVal( &dataObjInp->condInput, DATA_INCLUDED_KW, "" );
137  status = fillBBufWithFile( conn, &dataObjInpBBuf, locFilePath,
138  dataObjInp->dataSize );
139  if ( status < 0 ) {
141  "rcDataObjPut: fileBBufWithFile error for %s", locFilePath );
142  return status;
143  }
144  }
145 
146  dataObjInp->oprType = PUT_OPR;
147 
148  status = _rcDataObjPut( conn, dataObjInp, &dataObjInpBBuf, &portalOprOut );
149 
150  clearBBuf( &dataObjInpBBuf );
151 
152  if ( status < 0 ||
153  getValByKey( &dataObjInp->condInput, DATA_INCLUDED_KW ) != NULL ) {
154  if ( portalOprOut != NULL ) {
155  free( portalOprOut );
156  }
157  return status;
158  }
159 
160  if ( portalOprOut->numThreads <= 0 ) {
162  locFilePath, dataObjInp->objPath, dataObjInp->dataSize );
163  }
164  else if ( getUdpPortFromPortList( &portalOprOut->portList ) != 0 ) {
165  int veryVerbose;
166  /* rbudp transfer */
167  /* some sanity check */
168  if ( portalOprOut->numThreads != 1 ) {
170  free( portalOprOut );
171  return SYS_INVALID_PORTAL_OPR;
172  }
174  if ( getValByKey( &dataObjInp->condInput, VERY_VERBOSE_KW ) != NULL ) {
175  printf( "From server: NumThreads=%d, addr:%s, port:%d, cookie=%d\n",
178  veryVerbose = 2;
179  }
180  else {
181  veryVerbose = 0;
182  }
183 
185  // =-=-=-=-=-=-=-
186  // if a secret has been negotiated then we must be using
187  // encryption. given that RBUDP is not supported in an
188  // encrypted capacity this is considered an error
189  rodsLog(
190  LOG_ERROR,
191  "putFileToPortal: Encryption is not supported with RBUDP" );
192  return SYS_INVALID_PORTAL_OPR;
193 
194  }
195  else {
197  portalOprOut,
198  locFilePath,
199  -1,
200  veryVerbose,
201  0, 0 );
202  }
203  }
204  else {
205  if ( getValByKey( &dataObjInp->condInput, VERY_VERBOSE_KW ) != NULL ) {
206  printf( "From server: NumThreads=%d, addr:%s, port:%d, cookie=%d\n",
209  }
210  /* some sanity check */
211  rodsEnv rods_env;
212  if ( int status = getRodsEnv( &rods_env ) ) {
213  rodsLog( LOG_ERROR, "getRodsEnv failed in %s with status %s", __FUNCTION__, status );
214  return status;
215  }
218  free( portalOprOut );
219  return SYS_INVALID_PORTAL_OPR;
220  }
221 
223  status = putFileToPortal( conn, portalOprOut, locFilePath,
224  dataObjInp->objPath, dataObjInp->dataSize );
225  }
226 
227  /* just send a complete msg */
228  if ( status < 0 ) {
229  rcOprComplete( conn, status );
230  }
231  else {
233  }
234  free( portalOprOut );
235 
236  if ( status >= 0 && conn->fileRestart.info.numSeg > 0 ) { /* file restart */
238  }
239 
240  return status;
241 }
242 
243 int
244 _rcDataObjPut( rcComm_t *conn, dataObjInp_t *dataObjInp,
245  bytesBuf_t *dataObjInpBBuf, portalOprOut_t **portalOprOut ) {
246  int status;
247 
248  status = procApiRequest( conn, DATA_OBJ_PUT_AN, dataObjInp,
249  dataObjInpBBuf, ( void ** ) portalOprOut, NULL );
250 
251  if ( *portalOprOut != NULL && ( *portalOprOut )->l1descInx < 0 ) {
252  status = ( *portalOprOut )->l1descInx;
253  }
254 
255  return status;
256 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
getValByKey
char * getValByKey(const keyValPair_t *condInput, const char *keyWord)
Definition: rcMisc.cpp:675
DataObjInp::objPath
char objPath[(1024+64)]
Definition: dataObjInpOut.h:66
rcComm_t
Definition: rcConnect.h:95
NULL
#define NULL
Definition: rodsDef.h:70
fileRestart_t::info
fileRestartInfo_t info
Definition: rcConnect.h:85
addKeyVal
int addKeyVal(keyValPair_t *condInput, const char *keyWord, const char *value)
Definition: rcMisc.cpp:789
getRodsEnv
int getRodsEnv(rodsEnv *myRodsEnv)
Definition: getRodsEnv.cpp:112
portalOprOut
Definition: dataObjInpOut.h:114
fillBBufWithFile
int fillBBufWithFile(rcComm_t *conn, bytesBuf_t *myBBuf, char *locFilePath, rodsLong_t dataSize)
Definition: rcPortalOpr.cpp:93
DataObjInp::dataSize
rodsLong_t dataSize
Definition: dataObjInpOut.h:70
fileRestartInfo_t::numSeg
int numSeg
Definition: rcConnect.h:75
rcMisc.h
PUT_OPR
#define PUT_OPR
Definition: dataObjInpOut.h:167
getUdpPortFromPortList
int getUdpPortFromPortList(portList_t *thisPortList)
Definition: sockComm.cpp:1475
USER_FILE_DOES_NOT_EXIST
@ USER_FILE_DOES_NOT_EXIST
Definition: rodsErrorTable.h:241
putFileToPortal
int putFileToPortal(rcComm_t *conn, portalOprOut_t *portalOprOut, char *locFilePath, char *objPath, rodsLong_t dataSize)
Definition: rcPortalOpr.cpp:136
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
portList_t::portNum
int portNum
Definition: dataObjInpOut.h:30
transferStat_t::numThreads
int numThreads
Definition: objInfo.h:292
DATA_INCLUDED_KW
#define DATA_INCLUDED_KW
Definition: rodsKeyWdDef.h:36
procApiRequest.h
VERY_VERBOSE_KW
#define VERY_VERBOSE_KW
Definition: rodsKeyWdDef.h:77
irods::CS_NEG_USE_SSL
const std::string CS_NEG_USE_SSL("CS_NEG_USE_SSL")
DataObjInp
Definition: dataObjInpOut.h:65
putFileToPortalRbudp
int putFileToPortalRbudp(portalOprOut_t *portalOprOut, char *locFilePath, int locFd, int veryVerbose, int sendRate, int packetSize)
Definition: rcPortalOpr.cpp:1210
rmKeyVal
int rmKeyVal(keyValPair_t *condInput, const char *keyWord)
Definition: rcMisc.cpp:710
portalOprOut::portList
portList_t portList
Definition: dataObjInpOut.h:119
rcOprComplete
int rcOprComplete(rcComm_t *conn, int retval)
Definition: rcOprComplete.cpp:32
transStat_t
Definition: objInfo.h:286
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
putFile
int putFile(rcComm_t *conn, int l1descInx, char *locFilePath, char *objPath, rodsLong_t dataSize)
Definition: rcPortalOpr.cpp:528
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
rcPortalOpr.h
getFileSize
rodsLong_t getFileSize(char *path)
Definition: rcMisc.cpp:74
rcComm_t::fileRestart
fileRestart_t fileRestart
Definition: rcConnect.h:135
BytesBuf
Definition: rodsDef.h:197
dataObjPut.h
portalOprOut::l1descInx
int l1descInx
Definition: dataObjInpOut.h:116
apiNumber.h
procApiRequest
int procApiRequest(rcComm_t *conn, int apiNumber, void *inputStruct, bytesBuf_t *inputBsBBuf, void **outStruct, bytesBuf_t *outBsBBuf)
Definition: procApiRequest.cpp:55
DataObjInp::oprType
int oprType
Definition: dataObjInpOut.h:72
SYS_INVALID_PORTAL_OPR
@ SYS_INVALID_PORTAL_OPR
Definition: rodsErrorTable.h:101
portalOprOut::numThreads
int numThreads
Definition: dataObjInpOut.h:117
DATA_OBJ_PUT_AN
#define DATA_OBJ_PUT_AN
Definition: apiNumber.h:44
rcComm_t::transStat
transferStat_t transStat
Definition: rcConnect.h:108
oprComplete.h
sockComm.h
rodsEnv::irodsMaxSizeForSingleBuffer
int irodsMaxSizeForSingleBuffer
Definition: getRodsEnv.h:55
rcDataObjPut
int rcDataObjPut(rcComm_t *conn, dataObjInp_t *dataObjInp, char *locFilePath)
Definition: rcDataObjPut.cpp:100
rodsEnv::irodsDefaultNumberTransferThreads
int irodsDefaultNumberTransferThreads
Definition: getRodsEnv.h:56
_rcDataObjPut
int _rcDataObjPut(rcComm_t *conn, dataObjInp_t *dataObjInp, bytesBuf_t *dataObjInpBBuf, portalOprOut_t **portalOprOut)
Definition: rcDataObjPut.cpp:244
DataObjInp::condInput
keyValPair_t condInput
Definition: dataObjInpOut.h:74
portList_t::cookie
int cookie
Definition: dataObjInpOut.h:31
rodsEnv
Definition: getRodsEnv.h:8
clearBBuf
int clearBBuf(bytesBuf_t *myBBuf)
Definition: rcMisc.cpp:101
portList_t::hostAddr
char hostAddr[256]
Definition: dataObjInpOut.h:34
irods_client_server_negotiation.hpp
rcComm_t::negotiation_results
char negotiation_results[(1024+64)]
Definition: rcConnect.h:125
clearLfRestartFile
int clearLfRestartFile(fileRestart_t *fileRestart)
Definition: rcPortalOpr.cpp:1535