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)  

rsBulkDataObjPut.cpp
Go to the documentation of this file.
1 
3 /* rsBulkDataObjPut.c. See bulkDataObjReg.h for a description of
4  * this API call.*/
5 
6 #include "apiHeaderAll.h"
7 #include "objMetaOpr.hpp"
8 #include "resource.hpp"
9 #include "collection.hpp"
10 #include "specColl.hpp"
11 #include "dataObjOpr.hpp"
12 #include "physPath.hpp"
13 #include "miscServerFunct.hpp"
14 #include "rcGlobalExtern.h"
15 #include "rsApiHandler.hpp"
16 #include "irods_stacktrace.hpp"
17 #include "checksum.hpp"
18 #include "rsBulkDataObjPut.hpp"
19 #include "rsDataObjPut.hpp"
21 #include "rsBulkDataObjReg.hpp"
22 #include "rsDataObjCreate.hpp"
23 
25 
26 // =-=-=-=-=-=-=-
29 #include "irods_random.hpp"
30 
31 //#include "reFuncDefs.hpp"
32 #include <boost/filesystem/operations.hpp>
33 #include <boost/filesystem/convenience.hpp>
34 #include <boost/lexical_cast.hpp>
35 
36 using namespace boost::filesystem;
37 
38 
39 int
40 _rsBulkDataObjPut( rsComm_t *rsComm, bulkOprInp_t *bulkOprInp,
41  bytesBuf_t *bulkOprInpBBuf );
42 int
43 createBunDirForBulkPut( rsComm_t *rsComm, dataObjInp_t *dataObjInp,
44  const char*, specColl_t *specColl, char *phyBunDir );
45 int
46 initDataObjInpFromBulkOpr( dataObjInp_t *dataObjInp, bulkOprInp_t *bulkOprInp );
47 int
48 bulkRegUnbunSubfiles( rsComm_t *rsComm, const char*, const std::string& rescHier,
49  char *collection, char *phyBunDir, int flags,
50  genQueryOut_t *attriArray );
51 int
52 _bulkRegUnbunSubfiles( rsComm_t *rsComm, const char*, const std::string& rescHier,
53  char *collection, char *phyBunDir, int flags,
54  genQueryOut_t *bulkDataObjRegInp, renamedPhyFiles_t *renamedPhyFiles,
55  genQueryOut_t *attriArray );
56 int
57 bulkProcAndRegSubfile( rsComm_t *rsComm, const char*, const std::string& rescHier,
58  char *subObjPath, char *subfilePath, rodsLong_t dataSize,
59  int dataMode, int flags, genQueryOut_t *bulkDataObjRegInp,
60  renamedPhyFiles_t *renamedPhyFiles, genQueryOut_t *attriArray );
61 int
62 bulkRegSubfile( rsComm_t *rsComm, const char*, const std::string& rescHier,
63  char *subObjPath, char *subfilePath, rodsLong_t dataSize, int dataMode,
64  int modFlag, int replNum, char *chksum, genQueryOut_t *bulkDataObjRegInp,
65  renamedPhyFiles_t *renamedPhyFiles );
66 
67 int
69  char *subObjPath,
70  char *oldFileName,
71  char *newFileName,
72  renamedPhyFiles_t *renamedPhyFiles );
73 
74 int
76  rsComm_t *rsComm,
77  genQueryOut_t *bulkDataObjRegInp );
78 
79 int
81  rsComm_t *rsComm,
82  genQueryOut_t *bulkDataObjRegInp,
83  genQueryOut_t *bulkDataObjRegOut );
84 
85 int
87  renamedPhyFiles_t *renamedPhyFiles,
88  int regStatus );
89 
90 int
91 rsBulkDataObjPut( rsComm_t *rsComm, bulkOprInp_t *bulkOprInp,
92  bytesBuf_t *bulkOprInpBBuf ) {
93  int status;
94  int remoteFlag;
96  specCollCache_t *specCollCache = NULL;
97  dataObjInp_t dataObjInp;
98 
99  resolveLinkedPath( rsComm, bulkOprInp->objPath, &specCollCache,
100  &bulkOprInp->condInput );
101 
102  /* need to setup dataObjInp */
103  initDataObjInpFromBulkOpr( &dataObjInp, bulkOprInp );
104 
105  remoteFlag = getAndConnRemoteZone( rsComm, &dataObjInp, &rodsServerHost,
106  REMOTE_CREATE );
107 
108  if ( remoteFlag < 0 ) {
109  return remoteFlag;
110  }
111  else if ( remoteFlag == LOCAL_HOST ) {
112  int local = LOCAL_HOST;
113  rodsServerHost_t* host = 0;
114  if ( getValByKey( &dataObjInp.condInput, RESC_HIER_STR_KW ) == NULL ) {
115  std::string hier;
117  &dataObjInp, hier, host, local );
118  if ( !ret.ok() ) {
119  std::stringstream msg;
120  msg << "failed for [";
121  msg << dataObjInp.objPath << "]";
122  irods::log( PASSMSG( msg.str(), ret ) );
123  return ret.code();
124  }
125 
126  // =-=-=-=-=-=-=-
127  // we resolved the redirect and have a host, set the hier str for subsequent
128  // api calls, etc.
129  addKeyVal( &bulkOprInp->condInput, RESC_HIER_STR_KW, hier.c_str() );
130 
131  } // if keyword
132 
133  if ( LOCAL_HOST == local ) {
134  status = _rsBulkDataObjPut( rsComm, bulkOprInp, bulkOprInpBBuf );
135  }
136  else {
137  status = rcBulkDataObjPut( host->conn, bulkOprInp, bulkOprInpBBuf );
138 
139  }
140  }
141  else {
142  status = rcBulkDataObjPut( rodsServerHost->conn, bulkOprInp,
143  bulkOprInpBBuf );
144  }
145  return status;
146 }
147 
148 int
150  rsComm_t* rsComm,
151  dataObjInp_t* dataObjInp,
152  bulkOprInp_t *bulkOprInp,
153  bytesBuf_t *bulkBBuf ) {
154  sqlResult_t *objPath, *offset;
155  char *tmpObjPath;
156  char *bufPtr;
157  int status, i;
158  genQueryOut_t *attriArray = &bulkOprInp->attriArray;
159  int intOffset[MAX_NUM_BULK_OPR_FILES];
160  char phyBunPath[MAX_NAME_LEN];
161 
162  if ( bulkOprInp == NULL ) {
163  return USER__NULL_INPUT_ERR;
164  }
165 
166  if ( ( objPath = getSqlResultByInx( attriArray, COL_DATA_NAME ) ) == NULL ) {
168  "unbunBulkBuf: getSqlResultByInx for COL_DATA_NAME failed" );
169  return UNMATCHED_KEY_OR_INDEX;
170  }
171 
172  if ( ( offset = getSqlResultByInx( attriArray, OFFSET_INX ) ) == NULL ) {
174  "unbunBulkBuf: getSqlResultByInx for OFFSET_INX failed" );
175  return UNMATCHED_KEY_OR_INDEX;
176  }
177  if ( attriArray->rowCnt > MAX_NUM_BULK_OPR_FILES ) {
179  "unbunBulkBuf: rowCnt %d too large",
180  attriArray->rowCnt );
182  }
183 
184  for ( i = 0; i < attriArray->rowCnt; i++ ) {
185  intOffset[i] = atoi( &offset->value[offset->len * i] );
186  }
187 
188  addKeyVal( &dataObjInp->condInput, DATA_INCLUDED_KW, "" );
189  for ( i = 0; i < attriArray->rowCnt; i++ ) {
190  int size;
192  tmpObjPath = &objPath->value[objPath->len * i];
193  if ( i == 0 ) {
194  bufPtr = ( char * )bulkBBuf->buf;
195  size = intOffset[0];
196  }
197  else {
198  bufPtr = ( char * )bulkBBuf->buf + intOffset[i - 1];
199  size = intOffset[i] - intOffset[i - 1];
200  }
201  buffer.buf = bufPtr;
202  buffer.len = size;
203 
204  std::string collString = tmpObjPath;
205  std::size_t last_slash = collString.find_last_of( '/' );
206  collString.erase( last_slash );
207 
208  status = rsMkCollR( rsComm, "/", collString.c_str() );
209  if ( status < 0 ) {
210  std::stringstream msg;
211  msg << __FUNCTION__ << ": Unable to make collection \"" << collString << "\"";
212  irods::log( LOG_ERROR, msg.str() );
213  return status;
214  }
215 
216  // status = getPhyBunPath (bulkOprInp->objPath, tmpObjPath, baseDir.c_str(), phyBunPath);
217  // if (status < 0) return status;
218 
219  rstrcpy( dataObjInp->objPath, tmpObjPath, MAX_NAME_LEN );
220  status = _rsDataObjPut( rsComm, dataObjInp, &buffer, NULL );
221  if ( status < 0 ) {
222  std::stringstream msg;
223  msg << __FUNCTION__ << ": Failed to put data into file \"" << phyBunPath << "\"";
224  irods::log( LOG_NOTICE, msg.str() );
225  return status;
226  }
227  }
228  return 0;
229 }
230 
231 int
233  bytesBuf_t *bulkOprInpBBuf ) {
234  int status;
235  char phyBunDir[MAX_NAME_LEN];
236  std::string resc_name;
237  dataObjInp_t dataObjInp;
238  rodsObjStat_t *myRodsObjStat = NULL;
239 
240 
241  status = chkCollForExtAndReg( rsComm, bulkOprInp->objPath, &myRodsObjStat );
242  if ( status < 0 || myRodsObjStat == NULL ) {
243  return status; // JMC cppcheck
244  }
245 
246  /* query rcat for resource info and sort it */
247 
248  /* need to setup dataObjInp */
249  initDataObjInpFromBulkOpr( &dataObjInp, bulkOprInp );
250 
251  if ( myRodsObjStat->specColl != NULL ) {
252  /*status = resolveResc (myRodsObjStat->specColl->resource, &rescInfo);
253  if (status < 0) {
254  rodsLog( LOG_ERROR,"_rsBulkDataObjPut: resolveResc error for %s, status = %d",
255  myRodsObjStat->specColl->resource, status);
256  freeRodsObjStat (myRodsObjStat);
257  return status;
258  }*/
259 
260  resc_name = myRodsObjStat->specColl->resource;
261  }
262  else {
263  status = getRescForCreate( rsComm, &dataObjInp, resc_name );
264  if ( status < 0 || resc_name.empty() ) { // JMC cppcheck
265  freeRodsObjStat( myRodsObjStat );
266  return status;
267  }
268  }
269 
270  status = createBunDirForBulkPut( rsComm, &dataObjInp, resc_name.c_str(), myRodsObjStat->specColl, phyBunDir );
271  if ( status < 0 ) {
272  freeRodsObjStat( myRodsObjStat );
273 
274  std::stringstream msg;
275  msg << __FUNCTION__ << ": Unable to create BunDir";
276  irods::log( LOG_ERROR, msg.str() );
277  return status;
278  }
279 
280  status = rsMkCollR( rsComm, "/", bulkOprInp->objPath );
281  if ( status < 0 ) {
282  freeRodsObjStat( myRodsObjStat );
283 
284  std::stringstream msg;
285  msg << __FUNCTION__ << ": Unable to make collection \"" << bulkOprInp->objPath << "\"";
286  irods::log( LOG_ERROR, msg.str() );
287  return status;
288  }
289 
290  // addKeyVal(&dataObjInp.condInput, FORCE_FLAG_KW, getValByKey (&bulkOprInp->condInput, FORCE_FLAG_KW));
291  // addKeyVal(&dataObjInp.condInput, VERIFY_CHKSUM_KW, getValByKey (&bulkOprInp->condInput, VERIFY_CHKSUM_KW));
292 
293  status = unbunBulkBuf( rsComm, &dataObjInp, bulkOprInp, bulkOprInpBBuf );
294 
295  freeRodsObjStat( myRodsObjStat );
296 
297  if ( status < 0 ) {
299  "_rsBulkDataObjPut: unbunBulkBuf for dir %s. stat = %d",
300  phyBunDir, status );
301  return status;
302  }
303 
304  return status;
305 }
306 
307 int
309  const char *_resc_name, specColl_t *specColl, char *phyBunDir ) {
310  dataObjInfo_t dataObjInfo;
311  int status;
312 
313  if ( !dataObjInp || !_resc_name || !phyBunDir ) {
314  return USER__NULL_INPUT_ERR;
315  }
316 
317  bzero( &dataObjInfo, sizeof( dataObjInfo ) );
318  rstrcpy( dataObjInfo.objPath, dataObjInp->objPath, MAX_NAME_LEN );
319  rstrcpy( dataObjInfo.rescName, _resc_name, NAME_LEN );
320 
321  char* resc_hier = getValByKey( &dataObjInp->condInput, RESC_HIER_STR_KW );
322  if ( resc_hier ) {
323  rstrcpy( dataObjInfo.rescHier, resc_hier, MAX_NAME_LEN );
324  }
325  else {
326  rstrcpy( dataObjInfo.rescHier, _resc_name, NAME_LEN ); // in kw else
327  }
328 
329  irods::error ret = resc_mgr.hier_to_leaf_id(resc_hier,dataObjInfo.rescId);
330  if( !ret.ok() ) {
331  irods::log(PASS(ret));
332  }
333 
334  if ( specColl != NULL ) {
336  specColl->phyPath, dataObjInp->objPath, phyBunDir );
337  if ( status < 0 ) {
338  return status;
339  }
340  status = mkFileDirR( rsComm, 0, phyBunDir, dataObjInfo.rescHier, getDefDirMode() );
341  if ( status < 0 ) {
342  rodsLog( LOG_ERROR, "mkFileDirR failed in createBunDirForBulkPut with status %d", status );
343  }
344  return status;
345  }
346 
347  status = getFilePathName( rsComm, &dataObjInfo, dataObjInp );
348  if ( status < 0 ) {
350  "createBunDirForBulkPut: getFilePathName err for %s. status = %d",
351  dataObjInp->objPath, status );
352  return status;
353  }
354  do {
355  snprintf( phyBunDir, MAX_NAME_LEN, "%s/%s.%u", dataObjInfo.filePath,
356  TMP_PHY_BUN_DIR, irods::getRandom<unsigned int>() );
357  path p( phyBunDir );
358  if ( exists( p ) ) {
359  status = 0;
360  }
361  else {
362  status = -1;
363  }
364  }
365  while ( status == 0 );
366 
367  status = mkFileDirR( rsComm, 0, phyBunDir, dataObjInfo.rescHier, getDefDirMode() );
368  if ( status < 0 ) {
369  rodsLog( LOG_ERROR, "mkFileDirR failed in createBunDirForBulkPut with status %d", status );
370  }
371  return status;
372 
373 }
374 
375 int
377  if ( dataObjInp == NULL || bulkOprInp == NULL ) {
378  return USER__NULL_INPUT_ERR;
379  }
380 
381  bzero( dataObjInp, sizeof( dataObjInp_t ) );
382  rstrcpy( dataObjInp->objPath, bulkOprInp->objPath, MAX_NAME_LEN );
383  dataObjInp->condInput = bulkOprInp->condInput;
384 
385  return 0;
386 }
387 
388 int
389 bulkRegUnbunSubfiles( rsComm_t *rsComm, const char *_resc_name, const std::string& rescHier,
390  char *collection, char *phyBunDir, int flags,
391  genQueryOut_t *attriArray ) {
392  genQueryOut_t bulkDataObjRegInp;
393  renamedPhyFiles_t renamedPhyFiles;
394  int status = 0;
395 
396  bzero( &renamedPhyFiles, sizeof( renamedPhyFiles ) );
397  initBulkDataObjRegInp( &bulkDataObjRegInp );
398  /* the continueInx is used for the matching of objPath */
399  if ( attriArray != NULL ) {
400  attriArray->continueInx = 0;
401  }
402 
403  status = _bulkRegUnbunSubfiles( rsComm, _resc_name, rescHier, collection,
404  phyBunDir, flags, &bulkDataObjRegInp, &renamedPhyFiles, attriArray );
405 
406  if ( bulkDataObjRegInp.rowCnt > 0 ) {
407  int status1;
408  genQueryOut_t *bulkDataObjRegOut = NULL;
409  status1 = rsBulkDataObjReg( rsComm, &bulkDataObjRegInp,
410  &bulkDataObjRegOut );
411  if ( status1 < 0 ) {
412  status = status1;
414  "%s: rsBulkDataObjReg error for %s. stat = %d",
415  __FUNCTION__, collection, status1 );
416  cleanupBulkRegFiles( rsComm, &bulkDataObjRegInp );
417  }
418  postProcRenamedPhyFiles( &renamedPhyFiles, status );
419  postProcBulkPut( rsComm, &bulkDataObjRegInp, bulkDataObjRegOut );
420  freeGenQueryOut( &bulkDataObjRegOut );
421  }
422  clearGenQueryOut( &bulkDataObjRegInp );
423  return status;
424 }
425 
426 int
427 _bulkRegUnbunSubfiles( rsComm_t *rsComm, const char *_resc_name, const std::string& rescHier,
428  char *collection, char *phyBunDir, int flags,
429  genQueryOut_t *bulkDataObjRegInp, renamedPhyFiles_t *renamedPhyFiles,
430  genQueryOut_t *attriArray ) {
431  char subfilePath[MAX_NAME_LEN];
432  char subObjPath[MAX_NAME_LEN];
433  dataObjInp_t dataObjInp;
434  int status;
435  int savedStatus = 0;
436  int st_mode;
437  rodsLong_t st_size;
438 
439  path srcDirPath( phyBunDir );
440  if ( !exists( srcDirPath ) || !is_directory( srcDirPath ) ) {
442  "%s: opendir error for %s, errno = %d",
443  __FUNCTION__, phyBunDir, errno );
444  return UNIX_FILE_OPENDIR_ERR - errno;
445  }
446  bzero( &dataObjInp, sizeof( dataObjInp ) );
447  directory_iterator end_itr; // default construction yields past-the-end
448  for ( directory_iterator itr( srcDirPath ); itr != end_itr; ++itr ) {
449  path p = itr->path();
450  snprintf( subfilePath, MAX_NAME_LEN, "%s",
451  p.c_str() );
452 
453  if ( !exists( p ) ) {
455  "%s: stat error for %s, errno = %d",
456  __FUNCTION__, subfilePath, errno );
457  savedStatus = UNIX_FILE_STAT_ERR - errno;
458  unlink( subfilePath );
459  continue;
460  }
461 
462  path childPath = p.filename();
463  snprintf( subObjPath, MAX_NAME_LEN, "%s/%s",
464  collection, childPath.c_str() );
465  if ( is_directory( p ) ) {
466  status = rsMkCollR( rsComm, "/", subObjPath );
467  if ( status < 0 ) {
469  "%s: rsMkCollR of %s error. status = %d",
470  __FUNCTION__, subObjPath, status );
471  savedStatus = status;
472  continue;
473  }
474  status = _bulkRegUnbunSubfiles( rsComm, _resc_name, rescHier,
475  subObjPath, subfilePath, flags, bulkDataObjRegInp,
476  renamedPhyFiles, attriArray );
477  if ( status < 0 ) {
479  "%s: _bulkRegUnbunSubfiles of %s error. status=%d",
480  __FUNCTION__, subObjPath, status );
481  savedStatus = status;
482  continue;
483  }
484  }
485  else if ( is_regular_file( p ) ) {
486  st_mode = getPathStMode( p.c_str() );
487  st_size = file_size( p );
488  status = bulkProcAndRegSubfile( rsComm, _resc_name, rescHier,
489  subObjPath, subfilePath, st_size,
490  st_mode & 0777, flags, bulkDataObjRegInp,
491  renamedPhyFiles, attriArray );
492  unlink( subfilePath );
493  if ( status < 0 ) {
495  "%s:bulkProcAndRegSubfile of %s err.stat=%d",
496  __FUNCTION__, subObjPath, status );
497  savedStatus = status;
498  continue;
499  }
500  }
501  }
502  rmdir( phyBunDir );
503  return savedStatus;
504 }
505 
506 int
507 bulkProcAndRegSubfile( rsComm_t *rsComm, const char *_resc_name, const std::string& rescHier,
508  char *subObjPath, char *subfilePath, rodsLong_t dataSize,
509  int dataMode, int flags, genQueryOut_t *bulkDataObjRegInp,
510  renamedPhyFiles_t *renamedPhyFiles, genQueryOut_t *attriArray ) {
511  dataObjInfo_t dataObjInfo;
512  dataObjInp_t dataObjInp;
513  int status;
514  int modFlag = 0;
515  char *myChksum = NULL;
516  int myDataMode = dataMode;
517 
518  bzero( &dataObjInp, sizeof( dataObjInp ) );
519  bzero( &dataObjInfo, sizeof( dataObjInfo ) );
520  rstrcpy( dataObjInp.objPath, subObjPath, MAX_NAME_LEN );
521  rstrcpy( dataObjInfo.objPath, subObjPath, MAX_NAME_LEN );
522  rstrcpy( dataObjInfo.rescName, _resc_name, NAME_LEN );
523  rstrcpy( dataObjInfo.rescHier, rescHier.c_str(), MAX_NAME_LEN );
524  rstrcpy( dataObjInfo.dataType, "generic", NAME_LEN );
525  dataObjInfo.dataSize = dataSize;
526 
527  irods::error ret = resc_mgr.hier_to_leaf_id(rescHier,dataObjInfo.rescId);
528  if( !ret.ok() ) {
529  irods::log(PASS(ret));
530  }
531 
532  status = getFilePathName( rsComm, &dataObjInfo, &dataObjInp );
533  if ( status < 0 ) {
535  "regSubFile: getFilePathName err for %s. status = %d",
536  dataObjInp.objPath, status );
537  return status;
538  }
539 
540  path p( dataObjInfo.filePath );
541  if ( exists( p ) ) {
542  if ( is_directory( p ) ) {
543  return SYS_PATH_IS_NOT_A_FILE;
544  }
545  if ( chkOrphanFile( rsComm, dataObjInfo.filePath, _resc_name,
546  &dataObjInfo ) <= 0 ) {
547  /* not an orphan file */
548  if ( ( flags & FORCE_FLAG_FLAG ) != 0 && dataObjInfo.dataId > 0 &&
549  strcmp( dataObjInfo.objPath, subObjPath ) == 0 ) {
550  /* overwrite the current file */
551  modFlag = 1;
552  }
553  else {
556  "bulkProcAndRegSubfile: phypath %s is already in use. status = %d",
557  dataObjInfo.filePath, status );
558  return status;
559  }
560  }
561  /* rename it to the orphan dir */
562  fileRenameInp_t fileRenameInp;
563  bzero( &fileRenameInp, sizeof( fileRenameInp ) );
564  rstrcpy( fileRenameInp.oldFileName, dataObjInfo.filePath, MAX_NAME_LEN );
565  rstrcpy( fileRenameInp.rescHier, dataObjInfo.rescHier, MAX_NAME_LEN );
566  char new_fn[ MAX_NAME_LEN ];
568  &fileRenameInp, 1, new_fn );
569  if ( status < 0 ) {
571  "bulkProcAndRegSubfile: renameFilePathToNewDir err for %s. status = %d",
572  fileRenameInp.oldFileName, status );
573  return status;
574  }
575  if ( modFlag > 0 ) {
576  status = addRenamedPhyFile( subObjPath, fileRenameInp.oldFileName,
577  fileRenameInp.newFileName, renamedPhyFiles );
578  if ( status < 0 ) {
579  return status;
580  }
581  }
582  }
583  else {
584  /* make the necessary dir */
586  rsComm,
587  0,
588  dataObjInfo.filePath,
589  dataObjInfo.rescHier,
590  getDefDirMode() );
591  if ( status < 0 ) {
592  rodsLog( LOG_ERROR, "mkDirForFilePath failed in bulkProcAndRegSubfile with status %d", status );
593  return status;
594  }
595  }
596  /* add a link */
597 #ifndef windows_platform
598  status = link( subfilePath, dataObjInfo.filePath );
599  if ( status < 0 ) {
601  "bulkProcAndRegSubfile: link error %s to %s. errno = %d",
602  subfilePath, dataObjInfo.filePath, errno );
603  return UNIX_FILE_LINK_ERR - errno;
604  }
605 #endif
606 
607 
608  if ( attriArray != NULL ) {
609  /* dataMode in attriArray overwrites passed in value */
610  status = getAttriInAttriArray( subObjPath, attriArray, &myDataMode,
611  &myChksum );
612  if ( status < 0 ) {
614  "bulkProcAndRegSubfile: matchObjPath error for %s, stat = %d",
615  subObjPath, status );
616  }
617  else {
618  if ( ( flags & VERIFY_CHKSUM_FLAG ) != 0 && myChksum != NULL ) {
619  char chksumStr[NAME_LEN];
620  /* verify the chksum */
621  status = verifyChksumLocFile( dataObjInfo.filePath, myChksum, chksumStr );
622  if ( status < 0 ) {
624  "bulkProcAndRegSubfile: chksumLocFile error for %s ",
625  dataObjInfo.filePath );
626  return status;
627  }
628  if ( strcmp( myChksum, chksumStr ) != 0 ) {
630  "bulkProcAndRegSubfile: chksum of %s %s != input %s",
631  dataObjInfo.filePath, chksumStr, myChksum );
632  return USER_CHKSUM_MISMATCH;
633  }
634  }
635  }
636  }
637 
638  status = bulkRegSubfile( rsComm, _resc_name, rescHier,
639  subObjPath, dataObjInfo.filePath, dataSize, myDataMode, modFlag,
640  dataObjInfo.replNum, myChksum, bulkDataObjRegInp, renamedPhyFiles );
641 
642  return status;
643 }
644 
645 int
646 fillBulkDataObjRegInp( const char * rescName, const char* rescHier, char * objPath,
647  char * filePath, char * dataType, rodsLong_t dataSize, int dataMode,
648  int modFlag, int replNum, char * chksum, genQueryOut_t * bulkDataObjRegInp ) {
649 
650  int rowCnt;
651 
652  if ( bulkDataObjRegInp == NULL || rescName == NULL || objPath == NULL ||
653  filePath == NULL ) {
654  return USER__NULL_INPUT_ERR;
655  }
656 
657  rowCnt = bulkDataObjRegInp->rowCnt;
658 
659  if ( rowCnt >= MAX_NUM_BULK_OPR_FILES ) {
661  }
662 
663  rstrcpy( &bulkDataObjRegInp->sqlResult[0].value[MAX_NAME_LEN * rowCnt],
664  objPath, MAX_NAME_LEN );
665  rstrcpy( &bulkDataObjRegInp->sqlResult[1].value[NAME_LEN * rowCnt],
666  dataType, NAME_LEN );
667  snprintf( &bulkDataObjRegInp->sqlResult[2].value[NAME_LEN * rowCnt],
668  NAME_LEN, "%lld", dataSize );
669  rstrcpy( &bulkDataObjRegInp->sqlResult[3].value[NAME_LEN * rowCnt],
670  rescName, NAME_LEN );
671  rstrcpy( &bulkDataObjRegInp->sqlResult[4].value[MAX_NAME_LEN * rowCnt],
672  filePath, MAX_NAME_LEN );
673  snprintf( &bulkDataObjRegInp->sqlResult[5].value[NAME_LEN * rowCnt],
674  NAME_LEN, "%d", dataMode );
675  if ( modFlag == 1 ) {
676  rstrcpy( &bulkDataObjRegInp->sqlResult[6].value[NAME_LEN * rowCnt],
677  MODIFY_OPR, NAME_LEN );
678  }
679  else {
680  rstrcpy( &bulkDataObjRegInp->sqlResult[6].value[NAME_LEN * rowCnt],
682  }
683  snprintf( &bulkDataObjRegInp->sqlResult[7].value[NAME_LEN * rowCnt],
684  NAME_LEN, "%d", replNum );
685  if ( chksum != NULL && strlen( chksum ) > 0 ) {
686  rstrcpy( &bulkDataObjRegInp->sqlResult[8].value[NAME_LEN * rowCnt],
687  chksum, NAME_LEN );
688  }
689  else {
690  bulkDataObjRegInp->sqlResult[8].value[NAME_LEN * rowCnt] = '\0';
691  }
692 
693  rodsLong_t resc_id = 0;
694  irods::error ret = resc_mgr.hier_to_leaf_id(rescHier,resc_id);
695  if(!ret.ok()) {
696  irods::log(PASS(ret));
697  return ret.code();
698  }
699 
700  try {
701  std::string resc_id_str = boost::lexical_cast<std::string>(resc_id);
702  snprintf( &bulkDataObjRegInp->sqlResult[9].value[MAX_NAME_LEN * rowCnt],
703  MAX_NAME_LEN, "%s", resc_id_str.c_str() );
704  }
705  catch( boost::bad_lexical_cast& ) {
706  rodsLog(
707  LOG_ERROR,
708  "failed to cast [%Ld] to a string",
709  resc_id );
711  }
712 
713  bulkDataObjRegInp->rowCnt++;
714 
715  return 0;
716 }
717 
718 int
719 bulkRegSubfile( rsComm_t *rsComm, const char *rescName, const std::string& rescHier,
720  char *subObjPath, char *subfilePath, rodsLong_t dataSize, int dataMode,
721  int modFlag, int replNum, char *chksum, genQueryOut_t *bulkDataObjRegInp,
722  renamedPhyFiles_t *renamedPhyFiles ) {
723  int status;
724 
725  /* XXXXXXXX use NULL for chksum for now */
726  status = fillBulkDataObjRegInp( rescName, rescHier.c_str(), subObjPath,
727  subfilePath, "generic", dataSize, dataMode, modFlag,
728  replNum, chksum, bulkDataObjRegInp );
729  if ( status < 0 ) {
731  "bulkRegSubfile: fillBulkDataObjRegInp error for %s. status = %d",
732  subfilePath, status );
733  return status;
734  }
735 
736  if ( bulkDataObjRegInp->rowCnt >= MAX_NUM_BULK_OPR_FILES ) {
737  genQueryOut_t *bulkDataObjRegOut = NULL;
738  status = rsBulkDataObjReg( rsComm, bulkDataObjRegInp,
739  &bulkDataObjRegOut );
740  if ( status < 0 ) {
742  "bulkRegSubfile: rsBulkDataObjReg error for %s. status = %d",
743  subfilePath, status );
744  cleanupBulkRegFiles( rsComm, bulkDataObjRegInp );
745  }
746  postProcRenamedPhyFiles( renamedPhyFiles, status );
747  postProcBulkPut( rsComm, bulkDataObjRegInp, bulkDataObjRegOut );
748  freeGenQueryOut( &bulkDataObjRegOut );
749  bulkDataObjRegInp->rowCnt = 0;
750  }
751  return status;
752 }
753 
754 int
755 addRenamedPhyFile( char *subObjPath, char *oldFileName, char *newFileName,
756  renamedPhyFiles_t *renamedPhyFiles ) {
757  if ( subObjPath == NULL || oldFileName == NULL || newFileName == NULL ||
758  renamedPhyFiles == NULL ) {
759  return USER__NULL_INPUT_ERR;
760  }
761 
762  if ( renamedPhyFiles->count >= MAX_NUM_BULK_OPR_FILES ) {
764  "addRenamedPhyFile: count >= %d for %s", MAX_NUM_BULK_OPR_FILES,
765  subObjPath );
767  }
768  rstrcpy( &renamedPhyFiles->objPath[renamedPhyFiles->count][0],
769  subObjPath, MAX_NAME_LEN );
770  rstrcpy( &renamedPhyFiles->origFilePath[renamedPhyFiles->count][0],
771  oldFileName, MAX_NAME_LEN );
772  rstrcpy( &renamedPhyFiles->newFilePath[renamedPhyFiles->count][0],
773  newFileName, MAX_NAME_LEN );
774  renamedPhyFiles->count++;
775  return 0;
776 }
777 
778 int
779 postProcRenamedPhyFiles( renamedPhyFiles_t *renamedPhyFiles, int regStatus ) {
780  int i;
781  int status = 0;
782  int savedStatus = 0;
783 
784  if ( renamedPhyFiles == NULL ) {
785  return USER__NULL_INPUT_ERR;
786  }
787 
788  if ( regStatus >= 0 ) {
789  for ( i = 0; i < renamedPhyFiles->count; i++ ) {
790  unlink( &renamedPhyFiles->newFilePath[i][0] );
791  }
792  }
793  else {
794  /* restore the phy files */
795  for ( i = 0; i < renamedPhyFiles->count; i++ ) {
796  status = rename( &renamedPhyFiles->newFilePath[i][0],
797  &renamedPhyFiles->origFilePath[i][0] );
798  if ( status < 0 ) {
799  irods::log( status, "rename failed." );
800  }
801  savedStatus = UNIX_FILE_RENAME_ERR - errno;
803  "postProcRenamedPhyFiles: rename error from %s to %s, status=%d",
804  &renamedPhyFiles->newFilePath[i][0],
805  &renamedPhyFiles->origFilePath[i][0], savedStatus );
806  }
807  }
808  bzero( renamedPhyFiles, sizeof( renamedPhyFiles_t ) );
809 
810  return savedStatus;
811 }
812 
813 int
814 cleanupBulkRegFiles( rsComm_t *rsComm, genQueryOut_t *bulkDataObjRegInp ) {
815  sqlResult_t *filePath, *rescName;
816  char *tmpFilePath, *tmpRescName;
817  int i;
818 
819  if ( bulkDataObjRegInp == NULL ) {
820  return USER__NULL_INPUT_ERR;
821  }
822 
823  if ( ( filePath =
824  getSqlResultByInx( bulkDataObjRegInp, COL_D_DATA_PATH ) ) == NULL ) {
826  "cleanupBulkRegFiles: getSqlResultByInx for COL_D_DATA_PATH failed" );
827  return UNMATCHED_KEY_OR_INDEX;
828  }
829  if ( ( rescName =
830  getSqlResultByInx( bulkDataObjRegInp, COL_D_RESC_NAME ) ) == NULL ) {
832  "rsBulkDataObjReg: getSqlResultByInx for COL_D_RESC_NAME failed" );
833  return UNMATCHED_KEY_OR_INDEX;
834  }
835 
836  for ( i = 0; i < bulkDataObjRegInp->rowCnt; i++ ) {
837  tmpFilePath = &filePath->value[filePath->len * i];
838  tmpRescName = &rescName->value[rescName->len * i];
839  /* make sure it is an orphan file */
840  if ( chkOrphanFile( rsComm, tmpFilePath, tmpRescName, NULL ) > 0 ) {
841  unlink( tmpFilePath );
842  }
843  }
844 
845  return 0;
846 }
847 
848 int
849 postProcBulkPut( rsComm_t *rsComm, genQueryOut_t *bulkDataObjRegInp,
850  genQueryOut_t *bulkDataObjRegOut ) {
851  dataObjInfo_t dataObjInfo;
852  sqlResult_t *objPath, *dataType, *dataSize, *rescName, *filePath,
853  *dataMode, *oprType, *replNum, *chksum;
854  char *tmpObjPath, *tmpDataType, *tmpDataSize, *tmpFilePath,
855  *tmpDataMode, *tmpReplNum, *tmpChksum;
856  sqlResult_t *objId;
857  int status, i;
858  dataObjInp_t dataObjInp;
859  ruleExecInfo_t rei;
860  int savedStatus = 0;
861 
862  if ( bulkDataObjRegInp == NULL || bulkDataObjRegOut == NULL ) {
863  return USER__NULL_INPUT_ERR;
864  }
865 
866  initReiWithDataObjInp( &rei, rsComm, NULL );
867  status = applyRule( "acBulkPutPostProcPolicy", NULL, &rei, NO_SAVE_REI );
869  free(rei.condInputData);
870  if ( status < 0 ) {
872  "postProcBulkPut: acBulkPutPostProcPolicy error status = %d", status );
873  return status;
874  }
875 
876  if ( rei.status == POLICY_OFF ) {
877  return 0;
878  }
879 
880  if ( ( objPath =
881  getSqlResultByInx( bulkDataObjRegInp, COL_DATA_NAME ) ) == NULL ) {
883  "postProcBulkPut: getSqlResultByInx for COL_DATA_NAME failed" );
884  return UNMATCHED_KEY_OR_INDEX;
885  }
886 
887  if ( ( dataType =
888  getSqlResultByInx( bulkDataObjRegInp, COL_DATA_TYPE_NAME ) ) == NULL ) {
890  "postProcBulkPut: getSqlResultByInx for COL_DATA_TYPE_NAME failed" );
891  return UNMATCHED_KEY_OR_INDEX;
892  }
893  if ( ( dataSize =
894  getSqlResultByInx( bulkDataObjRegInp, COL_DATA_SIZE ) ) == NULL ) {
896  "postProcBulkPut: getSqlResultByInx for COL_DATA_SIZE failed" );
897  return UNMATCHED_KEY_OR_INDEX;
898  }
899  if ( ( rescName =
900  getSqlResultByInx( bulkDataObjRegInp, COL_D_RESC_NAME ) ) == NULL ) {
902  "postProcBulkPut: getSqlResultByInx for COL_D_RESC_NAME failed" );
903  return UNMATCHED_KEY_OR_INDEX;
904  }
905 
906  if ( ( filePath =
907  getSqlResultByInx( bulkDataObjRegInp, COL_D_DATA_PATH ) ) == NULL ) {
909  "postProcBulkPut: getSqlResultByInx for COL_D_DATA_PATH failed" );
910  return UNMATCHED_KEY_OR_INDEX;
911  }
912 
913  if ( ( dataMode =
914  getSqlResultByInx( bulkDataObjRegInp, COL_DATA_MODE ) ) == NULL ) {
916  "postProcBulkPut: getSqlResultByInx for COL_DATA_MODE failed" );
917  return UNMATCHED_KEY_OR_INDEX;
918  }
919 
920  if ( ( oprType =
921  getSqlResultByInx( bulkDataObjRegInp, OPR_TYPE_INX ) ) == NULL ) {
923  "postProcBulkPut: getSqlResultByInx for OPR_TYPE_INX failed" );
924  return UNMATCHED_KEY_OR_INDEX;
925  }
926 
927  if ( ( replNum =
928  getSqlResultByInx( bulkDataObjRegInp, COL_DATA_REPL_NUM ) ) == NULL ) {
930  "postProcBulkPut: getSqlResultByInx for COL_DATA_REPL_NUM failed" );
931  return UNMATCHED_KEY_OR_INDEX;
932  }
933  chksum = getSqlResultByInx( bulkDataObjRegInp, COL_D_DATA_CHECKSUM );
934 
935  /* the output */
936  if ( ( objId =
937  getSqlResultByInx( bulkDataObjRegOut, COL_D_DATA_ID ) ) == NULL ) {
939  "postProcBulkPut: getSqlResultByInx for COL_D_DATA_ID failed" );
940  return UNMATCHED_KEY_OR_INDEX;
941  }
942 
943  /* create a template */
944  bzero( &dataObjInfo, sizeof( dataObjInfo_t ) );
945  rstrcpy( dataObjInfo.rescName, rescName->value, NAME_LEN );
946  dataObjInfo.replStatus = NEWLY_CREATED_COPY;
947  /*status = resolveResc (rescName->value, &dataObjInfo.rescInfo);
948  if (status < 0) {
949  rodsLog( LOG_ERROR,"postProcBulkPut: resolveResc error for %s, status = %d",
950  rescName->value, status);
951  return status;
952  }*/
953 
954  bzero( &dataObjInp, sizeof( dataObjInp_t ) );
955  dataObjInp.openFlags = O_WRONLY;
956 
957  for ( i = 0; i < bulkDataObjRegInp->rowCnt; i++ ) {
958  dataObjInfo_t *tmpDataObjInfo;
959 
960  tmpDataObjInfo = ( dataObjInfo_t * )malloc( sizeof( dataObjInfo_t ) );
961  if ( tmpDataObjInfo == NULL ) {
962  return SYS_MALLOC_ERR;
963  }
964 
965  *tmpDataObjInfo = dataObjInfo;
966 
967  tmpObjPath = &objPath->value[objPath->len * i];
968  tmpDataType = &dataType->value[dataType->len * i];
969  tmpDataSize = &dataSize->value[dataSize->len * i];
970  tmpFilePath = &filePath->value[filePath->len * i];
971  tmpDataMode = &dataMode->value[dataMode->len * i];
972  tmpReplNum = &replNum->value[replNum->len * i];
973 
974  rstrcpy( tmpDataObjInfo->objPath, tmpObjPath, MAX_NAME_LEN );
975  rstrcpy( dataObjInp.objPath, tmpObjPath, MAX_NAME_LEN );
976  rstrcpy( tmpDataObjInfo->dataType, tmpDataType, NAME_LEN );
977  tmpDataObjInfo->dataSize = strtoll( tmpDataSize, 0, 0 );
978  rstrcpy( tmpDataObjInfo->filePath, tmpFilePath, MAX_NAME_LEN );
979  rstrcpy( tmpDataObjInfo->dataMode, tmpDataMode, NAME_LEN );
980  tmpDataObjInfo->replNum = atoi( tmpReplNum );
981  if ( chksum != NULL ) {
982  tmpChksum = &chksum->value[chksum->len * i];
983  if ( strlen( tmpChksum ) > 0 ) {
984  rstrcpy( tmpDataObjInfo->chksum, tmpChksum, NAME_LEN );
985  }
986  }
987  initReiWithDataObjInp( &rei, rsComm, &dataObjInp );
988  rei.doi = tmpDataObjInfo;
989 
990  // make resource properties available as rule session variables
992 
993  status = applyRule( "acPostProcForPut", NULL, &rei, NO_SAVE_REI );
995  free(rei.condInputData);
996  if ( status < 0 ) {
997  savedStatus = status;
998  }
999 
1000  freeAllDataObjInfo( rei.doi );
1001  }
1002  return savedStatus;
1003 }
COL_DATA_TYPE_NAME
#define COL_DATA_TYPE_NAME
Definition: rodsGenQuery.h:168
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
TMP_PHY_BUN_DIR
#define TMP_PHY_BUN_DIR
Definition: bulkDataObjPut.h:15
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
COL_DATA_REPL_NUM
#define COL_DATA_REPL_NUM
Definition: rodsGenQuery.h:166
getDefDirMode
int getDefDirMode()
Definition: physPath.cpp:1070
addKeyVal
int addKeyVal(keyValPair_t *condInput, const char *keyWord, const char *value)
Definition: rcMisc.cpp:789
DataObjInp::openFlags
int openFlags
Definition: dataObjInpOut.h:68
getFilePathName
int getFilePathName(rsComm_t *rsComm, dataObjInfo_t *dataObjInfo, dataObjInp_t *dataObjInp)
Definition: physPath.cpp:87
NEWLY_CREATED_COPY
#define NEWLY_CREATED_COPY
Definition: objInfo.h:115
bulkOprInp_t
Definition: bulkDataObjPut.h:17
irods_server_properties.hpp
specColl.hpp
RenamedPhyFiles::count
int count
Definition: bulkDataObjPut.h:24
bulkRegSubfile
int bulkRegSubfile(rsComm_t *rsComm, const char *, const std::string &rescHier, char *subObjPath, char *subfilePath, rodsLong_t dataSize, int dataMode, int modFlag, int replNum, char *chksum, genQueryOut_t *bulkDataObjRegInp, renamedPhyFiles_t *renamedPhyFiles)
Definition: rsBulkDataObjPut.cpp:719
OPR_TYPE_INX
#define OPR_TYPE_INX
Definition: bulkDataObjReg.h:9
BytesBuf::buf
void * buf
Definition: rodsDef.h:199
UNMATCHED_KEY_OR_INDEX
@ UNMATCHED_KEY_OR_INDEX
Definition: rodsErrorTable.h:244
SYS_MALLOC_ERR
@ SYS_MALLOC_ERR
Definition: rodsErrorTable.h:84
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
rsDataObjCreate.hpp
SpecColl::resource
char resource[64]
Definition: objInfo.h:83
_rsDataObjPut
int _rsDataObjPut(rsComm_t *rsComm, dataObjInp_t *dataObjInp, bytesBuf_t *dataObjInpBBuf, portalOprOut_t **portalOprOut)
Definition: rsDataObjPut.cpp:151
rcBulkDataObjPut
int rcBulkDataObjPut(rcComm_t *conn, bulkOprInp_t *bulkOprInp, bytesBuf_t *bulkOprInpBBuf)
Definition: rcBulkDataObjPut.cpp:143
_bulkRegUnbunSubfiles
int _bulkRegUnbunSubfiles(rsComm_t *rsComm, const char *, const std::string &rescHier, char *collection, char *phyBunDir, int flags, genQueryOut_t *bulkDataObjRegInp, renamedPhyFiles_t *renamedPhyFiles, genQueryOut_t *attriArray)
Definition: rsBulkDataObjPut.cpp:427
irods_stacktrace.hpp
RuleExecInfo::status
int status
Definition: irods_re_structs.hpp:19
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
resc_mgr
irods::resource_manager resc_mgr
Definition: irods_resource_manager.cpp:31
MAX_NUM_BULK_OPR_FILES
#define MAX_NUM_BULK_OPR_FILES
Definition: rodsDef.h:136
FORCE_FLAG_FLAG
#define FORCE_FLAG_FLAG
Definition: msParam.h:110
NO_SAVE_REI
#define NO_SAVE_REI
Definition: rodsDef.h:103
DataObjInfo::dataType
char dataType[64]
Definition: objInfo.h:133
SpecColl::phyPath
char phyPath[(1024+64)]
Definition: objInfo.h:85
irods::experimental::administration::client::v1::exists
auto exists(rcComm_t &conn, const user &user) -> bool
Definition: user_administration.cpp:359
SYS_RENAME_STRUCT_COUNT_EXCEEDED
@ SYS_RENAME_STRUCT_COUNT_EXCEEDED
Definition: rodsErrorTable.h:176
pid_age.p
p
Definition: pid_age.py:13
DataObjInfo::rescId
rodsLong_t rescId
Definition: objInfo.h:164
bulkOprInp_t::condInput
keyValPair_t condInput
Definition: bulkDataObjPut.h:20
checksum.hpp
DataObjInfo::rescHier
char rescHier[(1024+64)]
Definition: objInfo.h:132
DataObjInfo::replStatus
int replStatus
Definition: objInfo.h:141
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
renameFilePathToNewDir
int renameFilePathToNewDir(rsComm_t *rsComm, char *newDir, fileRenameInp_t *fileRenameInp, int renameFlag, char *)
Definition: physPath.cpp:652
fileRenameInp_t::newFileName
char newFileName[(1024+64)]
Definition: fileRename.h:10
UNIX_FILE_LINK_ERR
@ UNIX_FILE_LINK_ERR
Definition: rodsErrorTable.h:320
RuleExecInfo::doi
dataObjInfo_t * doi
Definition: irods_re_structs.hpp:28
irods_resource_backport.hpp
irods::resource_redirect
error resource_redirect(const std::string &, rsComm_t *, dataObjInp_t *, std::string &, rodsServerHost_t *&, int &, dataObjInfo_t **_data_obj_info=0)
Definition: irods_resource_redirect.cpp:786
SpecColl
Definition: objInfo.h:76
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
fileRenameInp_t
Definition: fileRename.h:7
rcGlobalExtern.h
DataObjInfo::filePath
char filePath[(1024+64)]
Definition: objInfo.h:137
getPathStMode
int getPathStMode(const char *p)
Definition: rcMisc.cpp:4354
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
rsBulkDataObjReg.hpp
irods_resource_redirect.hpp
createBunDirForBulkPut
int createBunDirForBulkPut(rsComm_t *rsComm, dataObjInp_t *dataObjInp, const char *, specColl_t *specColl, char *phyBunDir)
Definition: rsBulkDataObjPut.cpp:308
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
COL_D_DATA_CHECKSUM
#define COL_D_DATA_CHECKSUM
Definition: rodsGenQuery.h:177
DataObjInfo::dataId
rodsLong_t dataId
Definition: objInfo.h:143
GenQueryOut::sqlResult
sqlResult_t sqlResult[50]
Definition: rodsGenQuery.h:72
_rsBulkDataObjPut
int _rsBulkDataObjPut(rsComm_t *rsComm, bulkOprInp_t *bulkOprInp, bytesBuf_t *bulkOprInpBBuf)
Definition: rsBulkDataObjPut.cpp:232
resolveLinkedPath
int resolveLinkedPath(rsComm_t *rsComm, char *objPath, specCollCache_t **specCollCache, keyValPair_t *condInput)
Definition: specColl.cpp:711
irods::get_resc_properties_as_kvp
error get_resc_properties_as_kvp(const std::string &, keyValPair_t *)
Definition: irods_resource_backport.cpp:500
initReiWithDataObjInp
int initReiWithDataObjInp(ruleExecInfo_t *rei, rsComm_t *rsComm, dataObjInp_t *dataObjIn)
Definition: irods_re_structs.cpp:164
freeRodsObjStat
int freeRodsObjStat(rodsObjStat_t *rodsObjStat)
Definition: rcMisc.cpp:3537
RenamedPhyFiles::newFilePath
char newFilePath[50][(1024+64)]
Definition: bulkDataObjPut.h:27
COL_DATA_NAME
#define COL_DATA_NAME
Definition: rodsGenQuery.h:165
verifyChksumLocFile
int verifyChksumLocFile(char *fileName, const char *myChksum, char *chksumStr)
Definition: checksum.cpp:178
RuleExecInfo::condInputData
keyValPair_t * condInputData
Definition: irods_re_structs.hpp:34
irods::error::code
long long code() const
Definition: irods_error.cpp:194
RESC_HIER_STR_KW
#define RESC_HIER_STR_KW
Definition: rodsKeyWdDef.h:225
DATA_INCLUDED_KW
#define DATA_INCLUDED_KW
Definition: rodsKeyWdDef.h:36
clearGenQueryOut
void clearGenQueryOut(void *)
Definition: rcMisc.cpp:1150
COL_D_RESC_NAME
#define COL_D_RESC_NAME
Definition: rodsGenQuery.h:171
getSqlResultByInx
sqlResult_t * getSqlResultByInx(genQueryOut_t *genQueryOut, int attriInx)
Definition: rcMisc.cpp:1387
GenQueryOut::continueInx
int continueInx
Definition: rodsGenQuery.h:70
freeAllDataObjInfo
int freeAllDataObjInfo(dataObjInfo_t *dataObjInfoHead)
Definition: rcMisc.cpp:561
bulkProcAndRegSubfile
int bulkProcAndRegSubfile(rsComm_t *rsComm, const char *, const std::string &rescHier, char *subObjPath, char *subfilePath, rodsLong_t dataSize, int dataMode, int flags, genQueryOut_t *bulkDataObjRegInp, renamedPhyFiles_t *renamedPhyFiles, genQueryOut_t *attriArray)
Definition: rsBulkDataObjPut.cpp:507
UNIX_FILE_RENAME_ERR
@ UNIX_FILE_RENAME_ERR
Definition: rodsErrorTable.h:318
postProcRenamedPhyFiles
int postProcRenamedPhyFiles(renamedPhyFiles_t *renamedPhyFiles, int regStatus)
Definition: rsBulkDataObjPut.cpp:779
REGISTER_OPR
#define REGISTER_OPR
Definition: bulkDataObjReg.h:11
UNIX_FILE_OPENDIR_ERR
@ UNIX_FILE_OPENDIR_ERR
Definition: rodsErrorTable.h:312
REMOTE_CREATE
#define REMOTE_CREATE
Definition: getRemoteZoneResc.h:4
DataObjInp
Definition: dataObjInpOut.h:65
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
fillBulkDataObjRegInp
int fillBulkDataObjRegInp(const char *rescName, const char *rescHier, char *objPath, char *filePath, char *dataType, rodsLong_t dataSize, int dataMode, int modFlag, int replNum, char *chksum, genQueryOut_t *bulkDataObjRegInp)
Definition: rsBulkDataObjPut.cpp:646
irods.pypyodbc.buffer
buffer
Definition: pypyodbc.py:46
GenQueryOut
Definition: rodsGenQuery.h:67
DataObjInfo::replNum
int replNum
Definition: objInfo.h:140
SYS_REQUESTED_BUF_TOO_LARGE
@ SYS_REQUESTED_BUF_TOO_LARGE
Definition: rodsErrorTable.h:178
addRenamedPhyFile
int addRenamedPhyFile(char *subObjPath, char *oldFileName, char *newFileName, renamedPhyFiles_t *renamedPhyFiles)
Definition: rsBulkDataObjPut.cpp:755
RenamedPhyFiles::origFilePath
char origFilePath[50][(1024+64)]
Definition: bulkDataObjPut.h:26
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
SYS_BULK_REG_COUNT_EXCEEDED
@ SYS_BULK_REG_COUNT_EXCEEDED
Definition: rodsErrorTable.h:177
collection.hpp
GenQueryOut::rowCnt
int rowCnt
Definition: rodsGenQuery.h:68
physPath.hpp
irods::log
void log(const error &)
Definition: irods_log.cpp:13
fileRenameInp_t::rescHier
char rescHier[(1024+64)]
Definition: fileRename.h:11
initBulkDataObjRegInp
int initBulkDataObjRegInp(genQueryOut_t *bulkDataObjRegInp)
Definition: rcMisc.cpp:3612
rsBulkDataObjPut.hpp
bulkOprInp_t::objPath
char objPath[(1024+64)]
Definition: bulkDataObjPut.h:18
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
BytesBuf
Definition: rodsDef.h:197
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
bulkRegUnbunSubfiles
int bulkRegUnbunSubfiles(rsComm_t *rsComm, const char *, const std::string &rescHier, char *collection, char *phyBunDir, int flags, genQueryOut_t *attriArray)
Definition: rsBulkDataObjPut.cpp:389
chkCollForExtAndReg
int chkCollForExtAndReg(rsComm_t *rsComm, char *collection, rodsObjStat_t **rodsObjStatOut)
Definition: rsStructFileExtAndReg.cpp:262
RenamedPhyFiles
Definition: bulkDataObjPut.h:23
mkFileDirR
int mkFileDirR(rsComm_t *rsComm, size_t startDirLen, const std::string &destDir, const std::string &hier, int mode)
Definition: fileOpr.cpp:147
SYS_PATH_IS_NOT_A_FILE
@ SYS_PATH_IS_NOT_A_FILE
Definition: rodsErrorTable.h:119
DataObjInfo::chksum
char chksum[64]
Definition: objInfo.h:135
SpecColl::collection
char collection[(1024+64)]
Definition: objInfo.h:79
OFFSET_INX
#define OFFSET_INX
Definition: bulkDataObjReg.h:10
SqlResult::value
char * value
Definition: rodsGenQuery.h:64
postProcBulkPut
int postProcBulkPut(rsComm_t *rsComm, genQueryOut_t *bulkDataObjRegInp, genQueryOut_t *bulkDataObjRegOut)
Definition: rsBulkDataObjPut.cpp:849
getRescForCreate
int getRescForCreate(rsComm_t *rsComm, dataObjInp_t *dataObjInp, std::string &_resc_name)
Definition: rsDataObjCreate.cpp:604
rsBulkDataObjPut
int rsBulkDataObjPut(rsComm_t *rsComm, bulkOprInp_t *bulkOprInp, bytesBuf_t *bulkOprInpBBuf)
Definition: rsBulkDataObjPut.cpp:91
VERIFY_CHKSUM_FLAG
#define VERIFY_CHKSUM_FLAG
Definition: msParam.h:113
getAttriInAttriArray
int getAttriInAttriArray(const char *objPath, genQueryOut_t *attriArray, int *outDataMode, char **outChksum)
Definition: rcMisc.cpp:3810
irods::resource_manager::hier_to_leaf_id
error hier_to_leaf_id(const std::string &, rodsLong_t &)
Definition: irods_resource_manager.cpp:1082
rodsServerHost
Definition: rodsConnect.h:62
DataObjInfo::rescName
char rescName[64]
Definition: objInfo.h:131
apiHeaderAll.h
fileRenameInp_t::oldFileName
char oldFileName[(1024+64)]
Definition: fileRename.h:9
SqlResult
Definition: rodsGenQuery.h:61
RenamedPhyFiles::objPath
char objPath[50][(1024+64)]
Definition: bulkDataObjPut.h:25
rsMkCollR
int rsMkCollR(rsComm_t *rsComm, const char *startColl, const char *destColl)
Definition: collection.cpp:428
RuleExecInfo
Definition: irods_re_structs.hpp:18
getAndConnRemoteZone
int getAndConnRemoteZone(rsComm_t *rsComm, dataObjInp_t *dataObjInp, rodsServerHost_t **rodsServerHost, char *remotZoneOpr)
Definition: rodsConnect.cpp:784
applyRule
int applyRule(char *inAction, msParamArray_t *inMsParamArray, ruleExecInfo_t *rei, int reiSaveFlag)
Definition: irods_re_structs.cpp:65
generate_iadmin_commands_for_41_to_42_upgrade.host
host
Definition: generate_iadmin_commands_for_41_to_42_upgrade.py:23
resource.hpp
ORPHAN_DIR
#define ORPHAN_DIR
Definition: physPath.hpp:21
SqlResult::len
int len
Definition: rodsGenQuery.h:63
rodsObjStat
Definition: objStat.h:8
initDataObjInpFromBulkOpr
int initDataObjInpFromBulkOpr(dataObjInp_t *dataObjInp, bulkOprInp_t *bulkOprInp)
Definition: rsBulkDataObjPut.cpp:376
irods::experimental::filesystem::client::rename
auto rename(rcComm_t &_comm, const path &_from, const path &_to) -> void
Definition: filesystem.cpp:805
cleanupBulkRegFiles
int cleanupBulkRegFiles(rsComm_t *rsComm, genQueryOut_t *bulkDataObjRegInp)
Definition: rsBulkDataObjPut.cpp:814
DataObjInfo::objPath
char objPath[(1024+64)]
Definition: objInfo.h:130
rodsObjStat::specColl
specColl_t * specColl
Definition: objStat.h:18
size
long long size
Definition: filesystem.cpp:102
irods_random.hpp
UNIX_FILE_STAT_ERR
@ UNIX_FILE_STAT_ERR
Definition: rodsErrorTable.h:306
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
COL_D_DATA_PATH
#define COL_D_DATA_PATH
Definition: rodsGenQuery.h:172
dataObjOpr.hpp
rsApiHandler.hpp
DataObjInp::condInput
keyValPair_t condInput
Definition: dataObjInpOut.h:74
freeGenQueryOut
int freeGenQueryOut(genQueryOut_t **genQueryOut)
Definition: rcMisc.cpp:1133
SYS_COPY_ALREADY_IN_RESC
@ SYS_COPY_ALREADY_IN_RESC
Definition: rodsErrorTable.h:113
NAME_LEN
#define NAME_LEN
Definition: rodsDef.h:55
clearKeyVal
int clearKeyVal(keyValPair_t *condInput)
Definition: rcMisc.cpp:1047
mkDirForFilePath
int mkDirForFilePath(rsComm_t *rsComm, size_t startDirLen, const std::string &filePath, const std::string &hier, int mode)
Definition: fileOpr.cpp:120
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
bulkOprInp_t::attriArray
genQueryOut_t attriArray
Definition: bulkDataObjPut.h:19
getMountedSubPhyPath
int getMountedSubPhyPath(char *logMountPoint, char *phyMountPoint, char *logSubPath, char *phySubPathOut)
Definition: rcMisc.cpp:3078
POLICY_OFF
#define POLICY_OFF
Definition: rodsDef.h:143
DataObjInfo
Definition: objInfo.h:129
COL_DATA_SIZE
#define COL_DATA_SIZE
Definition: rodsGenQuery.h:169
DataObjInfo::dataSize
rodsLong_t dataSize
Definition: objInfo.h:134
irods::CREATE_OPERATION
const std::string CREATE_OPERATION("CREATE")
rsBulkDataObjReg
int rsBulkDataObjReg(rsComm_t *rsComm, genQueryOut_t *bulkDataObjRegInp, genQueryOut_t **bulkDataObjRegOut)
Definition: rsBulkDataObjReg.cpp:20
DataObjInfo::dataMode
char dataMode[32]
Definition: objInfo.h:148
rsDataObjPut.hpp
MODIFY_OPR
#define MODIFY_OPR
Definition: bulkDataObjReg.h:12
USER_CHKSUM_MISMATCH
@ USER_CHKSUM_MISMATCH
Definition: rodsErrorTable.h:245
SpecCollCache
Definition: objInfo.h:102
rodsLong_t
long long rodsLong_t
Definition: rodsType.h:32
unbunBulkBuf
int unbunBulkBuf(rsComm_t *rsComm, dataObjInp_t *dataObjInp, bulkOprInp_t *bulkOprInp, bytesBuf_t *bulkBBuf)
Definition: rsBulkDataObjPut.cpp:149
rsStructFileExtAndReg.hpp
objMetaOpr.hpp
COL_D_DATA_ID
#define COL_D_DATA_ID
Definition: rodsGenQuery.h:163
chkOrphanFile
int chkOrphanFile(rsComm_t *rsComm, char *filePath, const char *rescName, dataObjInfo_t *dataObjInfo)
Definition: dataObjOpr.cpp:1099
USER__NULL_INPUT_ERR
@ USER__NULL_INPUT_ERR
Definition: rodsErrorTable.h:247
COL_DATA_MODE
#define COL_DATA_MODE
Definition: rodsGenQuery.h:183