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)  

rsPhyBundleColl.cpp
Go to the documentation of this file.
1 
3 /* rsPhyBundleColl.c. See phyBundleColl.h for a description of
4  * this API call.*/
5 
6 #include "phyBundleColl.h"
7 #include "objMetaOpr.hpp"
8 #include "resource.hpp"
9 #include "collection.hpp"
10 #include "specColl.hpp"
11 #include "physPath.hpp"
12 #include "dataObjOpr.hpp"
13 #include "miscServerFunct.hpp"
14 #include "openCollection.h"
15 #include "readCollection.h"
16 #include "closeCollection.h"
17 #include "dataObjRepl.h"
18 #include "dataObjUnlink.h"
19 #include "dataObjCreate.h"
20 #include "dataObjClose.h"
21 #include "syncMountedColl.h"
22 #include "regReplica.h"
23 #include "unbunAndRegPhyBunfile.h"
24 #include "fileChksum.h"
25 #include "modDataObjMeta.h"
26 #include "irods_stacktrace.hpp"
27 #include "rsPhyBundleColl.hpp"
28 #include "rsOpenCollection.hpp"
29 #include "rsCloseCollection.hpp"
30 #include "rsDataObjClose.hpp"
31 #include "rsDataObjUnlink.hpp"
32 #include "rsReadCollection.hpp"
34 #include "rsRegReplica.hpp"
35 #include "rsModDataObjMeta.hpp"
36 #include "rsStructFileSync.hpp"
37 #include "rsDataObjRepl.hpp"
38 #include "rsDataObjCreate.hpp"
39 #include "rsFileChksum.hpp"
40 
41 // =-=-=-=-=-=-=-
44 #include "irods_stacktrace.hpp"
45 #include "irods_random.hpp"
46 
47 static rodsLong_t OneGig = ( 1024 * 1024 * 1024 );
48 
49 int
51  structFileExtAndRegInp_t* phyBundleCollInp ) {
52  int status = -1;
53  specCollCache_t* specCollCache = 0;
54  char* destRescName = 0;
55 
56  resolveLinkedPath( rsComm, phyBundleCollInp->objPath, &specCollCache,
57  &phyBundleCollInp->condInput );
58 
59  resolveLinkedPath( rsComm, phyBundleCollInp->collection,
60  &specCollCache, NULL );
61 
62  if ( ( destRescName = getValByKey( &phyBundleCollInp->condInput,
63  DEST_RESC_NAME_KW ) ) == NULL ) {
65  }
66 
67  if ( isLocalZone( phyBundleCollInp->collection ) == 0 ) {
68  /* can only do local zone */
69  return SYS_INVALID_ZONE_NAME;
70  }
71 
72  // =-=-=-=-=-=-=-
73  // working on the "home zone", determine if we need to redirect to a different
74  // server in this zone for this operation. if there is a RESC_HIER_STR_KW then
75  // we know that the redirection decision has already been made
76  dataObjInp_t data_inp;
77  bzero( &data_inp, sizeof( data_inp ) );
78  rstrcpy( data_inp.objPath, phyBundleCollInp->objPath, MAX_NAME_LEN );
79  bzero( &data_inp.condInput, sizeof( data_inp.condInput ) );
80  addKeyVal( &data_inp.condInput, DEST_RESC_NAME_KW, destRescName );
81 
82  std::string hier;
83  char* hier_kw = getValByKey( &phyBundleCollInp->condInput, RESC_HIER_STR_KW );
84  if ( hier_kw == NULL ) {
86  &data_inp, hier );
87  if ( !ret.ok() ) {
88  std::stringstream msg;
89  msg << "failed in irods::resolve_resource_hierarchy for [";
90  msg << data_inp.objPath << "]";
91  irods::log( PASSMSG( msg.str(), ret ) );
92  return ret.code();
93  }
94 
95  // =-=-=-=-=-=-=-
96  // we resolved the redirect and have a host, set the hier str for subsequent
97  // api calls, etc.
98  addKeyVal( &phyBundleCollInp->condInput, RESC_HIER_STR_KW, hier.c_str() );
99 
100  }
101  else {
102  hier = hier_kw;
103 
104  }
105 
106  // =-=-=-=-=-=-=-
107  // extract the host location from the resource hierarchy
108  std::string location;
109  irods::error ret = irods::get_loc_for_hier_string( hier, location );
110  if ( !ret.ok() ) {
111  irods::log( PASSMSG( "rsPhyBundleColl - failed in get_loc_for_hier_string", ret ) );
112  return -1;
113  }
114 
115 
116 
117  rodsHostAddr_t rescAddr;
118  bzero( &rescAddr, sizeof( rescAddr ) );
119 
120  rstrcpy( rescAddr.hostAddr, location.c_str(), NAME_LEN );
122  int remoteFlag = resolveHost( &rescAddr, &rodsServerHost );
123 
124 
125 
126  if ( remoteFlag == LOCAL_HOST ) {
127  status = _rsPhyBundleColl( rsComm, phyBundleCollInp, destRescName );
128  }
129  else if ( remoteFlag == REMOTE_HOST ) {
130  status = remotePhyBundleColl( rsComm, phyBundleCollInp, rodsServerHost );
131  }
132  else if ( remoteFlag < 0 ) {
133  status = remoteFlag;
134  }
135 
136 
137  return status;
138 }
139 
140 int
142  structFileExtAndRegInp_t* phyBundleCollInp,
143  const char *_resc_name ) {
144 
145  collInp_t collInp;
146  bzero( &collInp, sizeof( collInp ) );
147  rstrcpy( collInp.collName, phyBundleCollInp->collection, MAX_NAME_LEN );
149 
150  char* srcRescName = getValByKey( &phyBundleCollInp->condInput, RESC_NAME_KW );
151  if ( srcRescName != NULL ) {
153  addKeyVal( &collInp.condInput, RESC_NAME_KW, srcRescName );
154  }
155 
156  int handleInx = rsOpenCollection( rsComm, &collInp );
157 
158  if ( handleInx < 0 ) {
160  "_rsPhyBundleColl: rsOpenCollection of %s error. status = %d",
161  collInp.collName, handleInx );
162  return handleInx;
163  }
164 
165  if ( CollHandle[handleInx].rodsObjStat->specColl != NULL ) {
167  "_rsPhyBundleColl: unable to bundle special collection %s",
168  collInp.collName );
169  rsCloseCollection( rsComm, &handleInx );
170  return 0;
171  }
172 
173  /* create the bundle file */
174  char* dataType = getValByKey( &phyBundleCollInp->condInput, DATA_TYPE_KW ); // JMC - backport 4658
175  char* rescHier = getValByKey( &phyBundleCollInp->condInput, RESC_HIER_STR_KW );
176  dataObjInp_t dataObjInp;
177  int l1descInx = createPhyBundleDataObj( rsComm, phyBundleCollInp->collection,
178  _resc_name, rescHier, &dataObjInp, dataType ); // JMC - backport 4658
179 
180  if ( l1descInx < 0 ) {
181  return l1descInx;
182  }
183 
184  // =-=-=-=-=-=-=-
185  // JMC - backport 4528
186  int chksumFlag = -1;
187  if ( getValByKey( &phyBundleCollInp->condInput, VERIFY_CHKSUM_KW ) != NULL ) {
188  L1desc[l1descInx].chksumFlag = VERIFY_CHKSUM;
189  chksumFlag = 1;
190  }
191  else {
192  chksumFlag = 0;
193  }
194  // =-=-=-=-=-=-=-
195  // JMC - backport 4771
196  int maxSubFileCnt = -1; // JMC - backport 4528, 4771
197  if ( getValByKey( &phyBundleCollInp->condInput, MAX_SUB_FILE_KW ) != NULL ) {
198  maxSubFileCnt = atoi( getValByKey( &phyBundleCollInp->condInput, MAX_SUB_FILE_KW ) );
199  }
200  else {
201  maxSubFileCnt = MAX_SUB_FILE_CNT;
202  }
203 
204  rodsLong_t maxBunSize;
205  if ( getValByKey( &phyBundleCollInp->condInput, MAX_BUNDLE_SIZE_KW ) != NULL ) {
206  maxBunSize = atoi( getValByKey( &phyBundleCollInp->condInput, MAX_BUNDLE_SIZE_KW ) ) * OneGig;
207  }
208  else {
209  maxBunSize = MAX_BUNDLE_SIZE * OneGig;
210  }
211 
212  // =-=-=-=-=-=-=-
213  char phyBunDir[MAX_NAME_LEN];
214  createPhyBundleDir( rsComm, L1desc[l1descInx].dataObjInfo->filePath,
215  phyBunDir, L1desc[l1descInx].dataObjInfo->rescHier );
216 
217  curSubFileCond_t curSubFileCond;
218  bunReplCacheHeader_t bunReplCacheHeader;
219  bzero( &bunReplCacheHeader, sizeof( bunReplCacheHeader ) );
220  bzero( &curSubFileCond, sizeof( curSubFileCond ) );
221 
222  int status = -1;
223  int savedStatus = 0;
224  collEnt_t* collEnt = NULL;
225  while ( ( status = rsReadCollection( rsComm, &handleInx, &collEnt ) ) >= 0 ) {
226  if ( collEnt->objType == DATA_OBJ_T ) {
227  if ( curSubFileCond.collName[0] == '\0' ) {
228  /* a new dataObj. */
229  rstrcpy( curSubFileCond.collName, collEnt->collName,
230  MAX_NAME_LEN );
231  rstrcpy( curSubFileCond.dataName, collEnt->dataName,
232  MAX_NAME_LEN );
233  curSubFileCond.dataId = strtoll( collEnt->dataId, 0, 0 );
234  }
235  else if ( strcmp( curSubFileCond.collName, collEnt->collName ) != 0
236  || strcmp( curSubFileCond.dataName, collEnt->dataName ) != 0 ) {
237  /* a new file, need to handle the old one */
238  if ( bunReplCacheHeader.numSubFiles >= maxSubFileCnt || // JMC - backport 4771
239  bunReplCacheHeader.totSubFileSize + collEnt->dataSize > maxBunSize ) {
240  /* bundle is full */
241  status = bundleAndRegSubFiles( rsComm, l1descInx,
242  phyBunDir, phyBundleCollInp->collection,
243  &bunReplCacheHeader, chksumFlag ); // JMC - backport 4528
244  if ( status < 0 ) {
246  "_rsPhyBundleColl:bunAndRegSubFiles err for %s,stst=%d",
247  phyBundleCollInp->collection, status );
248  savedStatus = status;
249  }
250  else {
251  /* create a new bundle file */
252  l1descInx = createPhyBundleDataObj( rsComm,
253  phyBundleCollInp->collection, _resc_name,
254  rescHier, &dataObjInp, dataType ); // JMC - backport 4658
255 
256  if ( l1descInx < 0 ) {
258  "_rsPhyBundleColl:createPhyBundleDataObj err for %s,stat=%d",
259  phyBundleCollInp->collection, l1descInx );
260  freeCollEnt( collEnt );
261  return l1descInx;
262  }
263 
264  createPhyBundleDir( rsComm,
265  L1desc[l1descInx].dataObjInfo->filePath, phyBunDir, L1desc[l1descInx].dataObjInfo->rescHier );
266  /* need to reset subPhyPath since phyBunDir has
267  * changed */
268  /* At this point subPhyPath[0] == 0 if it has gone
269  * through replAndAddSubFileToDir below. != 0 if it has
270  * not and already a good cache copy */
271  if ( curSubFileCond.subPhyPath[0] != '\0' )
272  setSubPhyPath( phyBunDir, curSubFileCond.dataId,
273  curSubFileCond.subPhyPath );
274 
275  }
276  } /* end of new bundle file */
277  status = replAndAddSubFileToDir( rsComm, &curSubFileCond, _resc_name, phyBunDir, &bunReplCacheHeader );
278  if ( status < 0 ) {
279  savedStatus = status;
281  "_rsPhyBundleColl:replAndAddSubFileToDir err for %s,sta=%d",
282  curSubFileCond.subPhyPath, status );
283  }
284  curSubFileCond.bundled = 0;
285  curSubFileCond.subPhyPath[0] =
286  curSubFileCond.cachePhyPath[0] = '\0';
287  rstrcpy( curSubFileCond.collName, collEnt->collName,
288  MAX_NAME_LEN );
289  rstrcpy( curSubFileCond.dataName, collEnt->dataName,
290  MAX_NAME_LEN );
291  curSubFileCond.dataId = strtoll( collEnt->dataId, 0, 0 );
292  } /* end of name compare */
293 
294  if ( curSubFileCond.bundled > 0 ) {
295  /* already bundled. skip */
296  }
297  else if ( isDataObjBundled( collEnt ) ) {
298  /* already bundled, skip */
299  curSubFileCond.bundled = 1;
300  curSubFileCond.subPhyPath[0] = '\0';
301  curSubFileCond.cachePhyPath[0] = '\0';
302  /* XXXX there was a bug that if dataSize == 0, replStatus is 0.
303  * This bug has been fixed since 3.1 */
304  }
305  else if ( ( collEnt->replStatus > 0 || curSubFileCond.subPhyPath[0] == '\0' ) && // JMC - backport 4755
306  strcmp( collEnt->resource, _resc_name ) == 0 ) {
307  /* have a good copy in cache resource */
308  setSubPhyPath( phyBunDir, curSubFileCond.dataId, curSubFileCond.subPhyPath );
309  rstrcpy( curSubFileCond.cachePhyPath, collEnt->phyPath, MAX_NAME_LEN );
310  curSubFileCond.cacheReplNum = collEnt->replNum;
311  curSubFileCond.subFileSize = collEnt->dataSize;
312  }
313 
314  } // if data obj
315 
316  free( collEnt ); /* just free collEnt but not content */
317 
318  } // while
319  /* handle any remaining */
320 
321  status = replAndAddSubFileToDir( rsComm, &curSubFileCond,
322  _resc_name, phyBunDir, &bunReplCacheHeader );
323  if ( status < 0 ) {
324  savedStatus = status;
326  "_rsPhyBundleColl:replAndAddSubFileToDir err for %s,stat=%d",
327  curSubFileCond.subPhyPath, status );
328  }
329 
330  status = bundleAndRegSubFiles( rsComm, l1descInx, phyBunDir,
331  phyBundleCollInp->collection, &bunReplCacheHeader, chksumFlag ); // JMC - backport 4528
332  if ( status < 0 ) {
334  "_rsPhyBundleColl:bunAndRegSubFiles err for %s,stat=%d",
335  phyBundleCollInp->collection, status );
336  }
337 
338  clearKeyVal( &collInp.condInput );
339  rsCloseCollection( rsComm, &handleInx );
340 
341  if ( status >= 0 && savedStatus < 0 ) {
342  return savedStatus;
343  }
344  else {
345  return status;
346  }
347 }
348 
349 int
351  const char *myRescName, char *phyBunDir, bunReplCacheHeader_t *bunReplCacheHeader ) {
352  int status;
353  dataObjInfo_t dataObjInfo;
354 
355  if ( curSubFileCond->bundled == 1 ) {
356  return 0;
357  }
358 
359  bzero( &dataObjInfo, sizeof( dataObjInfo ) );
360  /* next dataObj. See if we need to replicate */
361  if ( curSubFileCond->subPhyPath[0] == '\0' ) {
362  /* don't have a good cache copy yet. make one */
363  status = replDataObjForBundle( rsComm, curSubFileCond->collName,
364  curSubFileCond->dataName, myRescName,
365  0, 0, 1, &dataObjInfo );
366  if ( status >= 0 ) {
367  setSubPhyPath( phyBunDir, curSubFileCond->dataId,
368  curSubFileCond->subPhyPath );
369  rstrcpy( curSubFileCond->cachePhyPath, dataObjInfo.filePath,
370  MAX_NAME_LEN );
371  curSubFileCond->cacheReplNum = dataObjInfo.replNum;
372  curSubFileCond->subFileSize = dataObjInfo.dataSize;
373  }
374  }
375  status = addSubFileToDir( curSubFileCond, bunReplCacheHeader );
376  if ( status < 0 ) {
378  "_rsPhyBundleColl:addSubFileToDir error for %s,stst=%d",
379  curSubFileCond->subPhyPath, status );
380  }
381  return status;
382 }
383 
384 int
385 bundleAndRegSubFiles( rsComm_t *rsComm, int l1descInx, char *phyBunDir,
386  char *collection, bunReplCacheHeader_t *bunReplCacheHeader, int chksumFlag ) { // JMC - backport 4528
387  int status;
388  openedDataObjInp_t dataObjCloseInp;
389  bunReplCache_t *tmpBunReplCache, *nextBunReplCache;
390  regReplica_t regReplicaInp;
391  dataObjInp_t dataObjUnlinkInp;
392  keyValPair_t regParam; // JMC - backport 4528
393  modDataObjMeta_t modDataObjMetaInp; // JMC - backport 4528
394 
395  int savedStatus = 0;
396 
397  bzero( &dataObjCloseInp, sizeof( dataObjCloseInp ) );
398  dataObjCloseInp.l1descInx = l1descInx;
399  if ( bunReplCacheHeader->numSubFiles == 0 ) {
400  bzero( &dataObjUnlinkInp, sizeof( dataObjUnlinkInp ) );
401  rstrcpy( dataObjUnlinkInp.objPath,
402  L1desc[l1descInx].dataObjInfo->objPath, MAX_NAME_LEN );
403  dataObjUnlinkS( rsComm, &dataObjUnlinkInp,
404  L1desc[l1descInx].dataObjInfo );
405  L1desc[l1descInx].bytesWritten = 0;
406  rsDataObjClose( rsComm, &dataObjCloseInp );
407  bzero( bunReplCacheHeader, sizeof( bunReplCacheHeader_t ) );
408  return 0;
409  }
410 
411  status = phyBundle( rsComm, L1desc[l1descInx].dataObjInfo, phyBunDir,
412  collection, CREATE_TAR_OPR ); // JMC - backport 4643
413  if ( status < 0 ) {
415  "bundleAndRegSubFiles: rsStructFileSync of %s error. stat = %d",
416  L1desc[l1descInx].dataObjInfo->objPath, status );
417  rmLinkedFilesInUnixDir( phyBunDir );
418  rmdir( phyBunDir );
419  rsDataObjClose( rsComm, &dataObjCloseInp );
420  tmpBunReplCache = bunReplCacheHeader->bunReplCacheHead;
421  while ( tmpBunReplCache != NULL ) {
422  nextBunReplCache = tmpBunReplCache->next;
423  free( tmpBunReplCache );
424  tmpBunReplCache = nextBunReplCache; // JMC - backport 4579
425  }
426  bzero( bunReplCacheHeader, sizeof( bunReplCacheHeader_t ) );
427  return status;
428  }
429  else {
430  /* mark it was written so the size would be adjusted */
431  L1desc[l1descInx].bytesWritten = 1;
432  }
433 
434  /* now register a replica for each subfile */
435  tmpBunReplCache = bunReplCacheHeader->bunReplCacheHead;
436 
437  if ( tmpBunReplCache == NULL ) {
438  rmdir( phyBunDir );
439  bzero( &dataObjUnlinkInp, sizeof( dataObjUnlinkInp ) );
440  rstrcpy( dataObjUnlinkInp.objPath,
441  L1desc[l1descInx].dataObjInfo->objPath, MAX_NAME_LEN );
442  dataObjUnlinkS( rsComm, &dataObjUnlinkInp,
443  L1desc[l1descInx].dataObjInfo );
444  L1desc[l1descInx].bytesWritten = 0;
445  rsDataObjClose( rsComm, &dataObjCloseInp );
446  bzero( bunReplCacheHeader, sizeof( bunReplCacheHeader_t ) );
447  return 0;
448  }
449 
450  bzero( &regReplicaInp, sizeof( regReplicaInp ) );
451  regReplicaInp.srcDataObjInfo = ( dataObjInfo_t* )malloc( sizeof( dataObjInfo_t ) );
452  regReplicaInp.destDataObjInfo = ( dataObjInfo_t* )malloc( sizeof( dataObjInfo_t ) );
453  bzero( regReplicaInp.srcDataObjInfo, sizeof( dataObjInfo_t ) );
454  bzero( regReplicaInp.destDataObjInfo, sizeof( dataObjInfo_t ) );
455  addKeyVal( &regReplicaInp.condInput, ADMIN_KW, "" );
457  // XXXX - JMC :: filePath was copied into objPath??? #1111 by hcjiv
458  rstrcpy( regReplicaInp.destDataObjInfo->objPath,
459  L1desc[l1descInx].dataObjInfo->objPath, MAX_NAME_LEN );
460  rstrcpy( regReplicaInp.destDataObjInfo->filePath,
461  L1desc[l1descInx].dataObjInfo->filePath, MAX_NAME_LEN );
462  rstrcpy( regReplicaInp.destDataObjInfo->rescHier,
463  L1desc[l1descInx].dataObjInfo->rescHier, MAX_NAME_LEN );
464 
465  regReplicaInp.destDataObjInfo->rescId = L1desc[l1descInx].dataObjInfo->rescId;
466 
467  // =-=-=-=-=-=-=-
468  // JMC - backport 4528
469  if ( chksumFlag != 0 ) {
470  bzero( &modDataObjMetaInp, sizeof( modDataObjMetaInp ) );
471  bzero( &regParam, sizeof( regParam ) );
472  modDataObjMetaInp.dataObjInfo = regReplicaInp.destDataObjInfo;
473  modDataObjMetaInp.regParam = &regParam;
474  }
475  // =-=-=-=-=-=-=-
476 
477  /* close here because dataObjInfo is still being used */
478 
479  rsDataObjClose( rsComm, &dataObjCloseInp );
480  while ( tmpBunReplCache != NULL ) {
481  char subPhyPath[MAX_NAME_LEN];
482 
483  nextBunReplCache = tmpBunReplCache->next;
484  /* rm the hard link here */
485  snprintf( subPhyPath, MAX_NAME_LEN, "%s/%lld", phyBunDir,
486  tmpBunReplCache->dataId );
487  // =-=-=-=-=-=-=-
488  // JMC - backport 4528
489  if ( chksumFlag != 0 ) {
490  status = fileChksum( rsComm, regReplicaInp.destDataObjInfo->filePath,
491  subPhyPath, regReplicaInp.destDataObjInfo->rescHier, 0, tmpBunReplCache->chksumStr );
492  if ( status < 0 ) {
493  savedStatus = status;
494  rodsLogError( LOG_ERROR, status, "bundleAndRegSubFiles: fileChksum error for %s", tmpBunReplCache->objPath );
495  }
496  }
497  // =-=-=-=-=-=-=-
498  unlink( subPhyPath );
499  /* register the replica */
500  rstrcpy( regReplicaInp.srcDataObjInfo->objPath,
501  tmpBunReplCache->objPath, MAX_NAME_LEN );
502  regReplicaInp.srcDataObjInfo->dataId =
503  regReplicaInp.destDataObjInfo->dataId =
504  tmpBunReplCache->dataId;
505  regReplicaInp.srcDataObjInfo->replNum = tmpBunReplCache->srcReplNum;
506 
507  status = rsRegReplica( rsComm, &regReplicaInp );
508  if ( status < 0 ) {
509  savedStatus = status;
511  "bundleAndRegSubFiles: rsRegReplica error for %s. stat = %d",
512  tmpBunReplCache->objPath, status );
513  }
514  // =-=-=-=-=-=-=-
515  // JMC - backport 4528
516  if ( chksumFlag != 0 ) {
517  addKeyVal( &regParam, CHKSUM_KW, tmpBunReplCache->chksumStr );
518  // avoid triggering file operations
519  addKeyVal( &regParam, IN_PDMO_KW, "" );
520  status = rsModDataObjMeta( rsComm, &modDataObjMetaInp );
521  clearKeyVal( &regParam );
522  if ( status < 0 ) {
523  savedStatus = status;
524  rodsLogError( LOG_ERROR, status, "bundleAndRegSubFiles: rsModDataObjMeta error for %s.", tmpBunReplCache->objPath );
525  }
526  }
527  // =-=-=-=-=-=-=-
528  free( tmpBunReplCache );
529  tmpBunReplCache = nextBunReplCache;
530  }
531  clearKeyVal( &regReplicaInp.condInput );
532  free( regReplicaInp.srcDataObjInfo );
533  free( regReplicaInp.destDataObjInfo );
534  bzero( bunReplCacheHeader, sizeof( bunReplCacheHeader_t ) );
535  rmdir( phyBunDir );
536 
537  if ( status >= 0 && savedStatus < 0 ) {
538  return savedStatus;
539  }
540  else {
541  return status;
542  }
543 }
544 
545 /* phyBundle
546  * Valid oprType are CREATE_TAR_OPR and ADD_TO_TAR_OPR
547  */
548 int
549 phyBundle( rsComm_t *rsComm, dataObjInfo_t *dataObjInfo, char *phyBunDir,
550  char *collection, int oprType ) { // JMC - backport 4643
551  structFileOprInp_t structFileOprInp;
552  int status = 0;
553  char *dataType; // JMC - backport 4633
554 
555  dataType = dataObjInfo->dataType;
556 
557  bzero( &structFileOprInp, sizeof( structFileOprInp ) );
558  addKeyVal( &structFileOprInp.condInput, RESC_HIER_STR_KW, dataObjInfo->rescHier );
559 
560  structFileOprInp.specColl = ( specColl_t* )malloc( sizeof( specColl_t ) );
561  memset( structFileOprInp.specColl, 0, sizeof( specColl_t ) );
562  structFileOprInp.specColl->type = TAR_STRUCT_FILE_T;
563 
564  /* collection and objPath are only important for reg CollInfo2 */
565  rstrcpy( structFileOprInp.specColl->collection, collection, MAX_NAME_LEN );
566  rstrcpy( structFileOprInp.specColl->objPath, dataObjInfo->objPath, MAX_NAME_LEN );
567  structFileOprInp.specColl->collClass = STRUCT_FILE_COLL;
568  rstrcpy( structFileOprInp.specColl->resource, dataObjInfo->rescName, NAME_LEN );
569  rstrcpy( structFileOprInp.specColl->phyPath, dataObjInfo->filePath, MAX_NAME_LEN );
570  rstrcpy( structFileOprInp.specColl->rescHier, dataObjInfo->rescHier, MAX_NAME_LEN );
571  addKeyVal( &structFileOprInp.condInput, RESC_HIER_STR_KW, dataObjInfo->rescHier );
572 
573  rstrcpy( structFileOprInp.specColl->cacheDir, phyBunDir, MAX_NAME_LEN );
574  structFileOprInp.specColl->cacheDirty = 1;
575  /* don't reg CollInfo2 */
576  structFileOprInp.oprType = NO_REG_COLL_INFO | oprType; // JMC - backport 4657
577  if ( dataType != NULL && // JMC - backport 4633
578  ( strstr( dataType, GZIP_TAR_DT_STR ) != NULL || // JMC - backport 4658
579  strstr( dataType, BZIP2_TAR_DT_STR ) != NULL ||
580  strstr( dataType, ZIP_DT_STR ) != NULL ) ) {
581  addKeyVal( &structFileOprInp.condInput, DATA_TYPE_KW, dataType );
582  }
583 
584  status = rsStructFileSync( rsComm, &structFileOprInp );
585 
586  free( structFileOprInp.specColl );
587 
588  if ( status < 0 ) {
590  "phyBundle: rsStructFileSync of %s error. stat = %d",
591  dataObjInfo->objPath, status );
592  }
593 
594  return status;
595 }
596 
597 int
599  bunReplCacheHeader_t *bunReplCacheHeader ) {
600  int status;
601  bunReplCache_t *bunReplCache;
602 
603  /* add a link */
604  status = link( curSubFileCond->cachePhyPath, curSubFileCond->subPhyPath );
605  if ( status < 0 ) {
607  "addSubFileToDir: link error %s to %s. errno = %d",
608  curSubFileCond->cachePhyPath, curSubFileCond->subPhyPath, errno );
609  return UNIX_FILE_LINK_ERR - errno;
610  }
611  bunReplCache = ( bunReplCache_t* )malloc( sizeof( bunReplCache_t ) );
612  bzero( bunReplCache, sizeof( bunReplCache_t ) );
613  bunReplCache->dataId = curSubFileCond->dataId;
614  snprintf( bunReplCache->objPath, MAX_NAME_LEN, "%s/%s",
615  curSubFileCond->collName, curSubFileCond->dataName );
616  bunReplCache->srcReplNum = curSubFileCond->cacheReplNum;
617  bunReplCache->next = bunReplCacheHeader->bunReplCacheHead;
618  bunReplCacheHeader->bunReplCacheHead = bunReplCache;
619  bunReplCacheHeader->numSubFiles++;
620  bunReplCacheHeader->totSubFileSize += curSubFileCond->subFileSize;
621 
622  return 0;
623 }
624 
625 int
626 setSubPhyPath( char *phyBunDir, rodsLong_t dataId, char *subPhyPath ) {
627  snprintf( subPhyPath, MAX_NAME_LEN, "%s/%lld", phyBunDir, dataId );
628  return 0;
629 }
630 
631 int
633  if ( strcmp( collEnt->resource, BUNDLE_RESC ) == 0 ) {
634  if ( collEnt->replStatus > 0 ) {
635  return 1;
636  }
637  else {
638  /* XXXXXX need to remove this outdated copy */
639  return 0;
640  }
641  }
642  else {
643  return 0;
644  }
645 }
646 
647 int
648 replDataObjForBundle( rsComm_t *rsComm, char *collName, char *dataName,
649  const char *rescName, char* rescHier, char* dstRescHier,
650  int adminFlag, dataObjInfo_t *outCacheObjInfo ) {
651  transferStat_t transStat;
652  dataObjInp_t dataObjInp;
653  int status;
654 
655  if ( outCacheObjInfo != NULL ) {
656  memset( outCacheObjInfo, 0, sizeof( dataObjInfo_t ) );
657  }
658 
659  memset( &dataObjInp, 0, sizeof( dataObjInp_t ) );
660  memset( &transStat, 0, sizeof( transStat ) );
661 
662  snprintf( dataObjInp.objPath, MAX_NAME_LEN, "%s/%s", collName, dataName );
663  addKeyVal( &dataObjInp.condInput, BACKUP_RESC_NAME_KW, rescName );
664  if ( rescHier ) {
665  addKeyVal( &dataObjInp.condInput, RESC_HIER_STR_KW, rescHier );
666  }
667  if ( dstRescHier ) {
668  addKeyVal( &dataObjInp.condInput, DEST_RESC_HIER_STR_KW, dstRescHier );
669  }
670  if ( adminFlag > 0 ) {
671  addKeyVal( &dataObjInp.condInput, ADMIN_KW, "" );
672  }
673 
674  status = _rsDataObjRepl( rsComm, &dataObjInp, &transStat,
675  outCacheObjInfo );
676  clearKeyVal( &dataObjInp.condInput );
677  return status;
678 }
679 
680 int
681 createPhyBundleDir( rsComm_t *rsComm, char *bunFilePath,
682  char *outPhyBundleDir, char* hier ) {
683  /* the dir where we put the files to bundle is in phyPath.dir */
684  snprintf( outPhyBundleDir, MAX_NAME_LEN, "%s.dir", bunFilePath );
685  int status = mkFileDirR( rsComm, 0, outPhyBundleDir, hier, getDefDirMode() );
686  if ( status < 0 ) {
687  rodsLog( LOG_ERROR, "mkFileDirR failed in createPhyBundleDir with status %d", status );
688  }
689  return status;
690 }
691 
692 int
693 createPhyBundleDataObj( rsComm_t *rsComm, char *collection,
694  const std::string& _resc_name, const char* rescHier, dataObjInp_t *dataObjInp, // should be able to only use rescHier
695  char* dataType ) { // JMC - backport 4658
696  int l1descInx;
697  int status;
698 
699  /* XXXXXX We do bundle only with UNIX_FILE_TYPE for now */
700  if ( _resc_name.empty() ) {
702  }
703 
704  rodsLong_t resc_id = 0;
705  irods::error ret = resc_mgr.hier_to_leaf_id(_resc_name,resc_id);
706  if( !ret.ok()) {
707  irods::log(PASS(ret));
708  return ret.code();
709  }
710 
711  std::string type;
712  irods::error err = irods::get_resource_property< std::string >(
713  resc_id,
715  type );
716  if ( !err.ok() ) {
717  irods::log( PASS( err ) );
718  }
719 
720  do {
721  int loopCnt = 0;
722  bzero( dataObjInp, sizeof( dataObjInp_t ) );
723  while ( 1 ) {
724  status = rsMkBundlePath( rsComm, collection, dataObjInp->objPath,
725  irods::getRandom<unsigned int>() );
726  if ( status < 0 ) {
728  "createPhyBundleFile: getPhyBundlePath err for %s.stat = %d",
729  collection, status );
730  return status;
731  }
732  /* check if BundlePath already existed */
733  if ( isData( rsComm, dataObjInp->objPath, NULL ) >= 0 ) {
734  if ( loopCnt >= 100 ) {
735  break;
736  }
737  else {
738  loopCnt++;
739  continue;
740  }
741  }
742  else {
743  break;
744  }
745  }
746 
747  if ( dataType != NULL && strstr( dataType, BUNDLE_STR ) != NULL ) { // JMC - backport 4658
748  addKeyVal( &dataObjInp->condInput, DATA_TYPE_KW, dataType );
749  }
750  else {
751  /* assume it is TAR_BUNDLE_DT_STR */
753  }
754 
755  if ( rescHier != NULL ) {
756  addKeyVal( &dataObjInp->condInput, RESC_HIER_STR_KW, rescHier );
757  }
758 
759  if ( dataType != NULL && strstr( dataType, ZIP_DT_STR ) != NULL ) { // JMC - backport 4664
760  /* zipFile type. must end with .zip */
761  int len = strlen( dataObjInp->objPath );
762  if ( strcmp( &dataObjInp->objPath[len - 4], ".zip" ) != 0 ) {
763  strcat( dataObjInp->objPath, ".zip" );
764  }
765  }
766 
767  l1descInx = _rsDataObjCreateWithResc( rsComm, dataObjInp, _resc_name );
768 
769  clearKeyVal( &dataObjInp->condInput );
770  }
771  while ( l1descInx == OVERWRITE_WITHOUT_FORCE_FLAG );
772 
773  if ( l1descInx >= 0 ) {
774  l3Close( rsComm, l1descInx );
775  L1desc[l1descInx].l3descInx = 0;
776  if ( dataType != NULL && strstr( dataType, ZIP_DT_STR ) != NULL ) { // JMC - backport 4664
777  l3Unlink( rsComm, L1desc[l1descInx].dataObjInfo );
778  }
779  }
780 
781  return l1descInx;
782 }
783 
784 /* rsMkBundlePath - set the BundlePath to
785  * /zone/bundle/home/.../collection.myRanNum. Make all the necessary
786  * parent collections. The output is put in bundlePath.
787  */
788 
789 int
790 rsMkBundlePath( rsComm_t *rsComm, char *collection, char *bundlePath,
791  int myRanNum ) {
792  int status;
793  char *tmpStr;
794  char startBundlePath[MAX_NAME_LEN];
795  char destBundleColl[MAX_NAME_LEN], myFile[MAX_NAME_LEN];
796  char *bundlePathPtr;
797 
798  bundlePathPtr = bundlePath;
799  *bundlePathPtr = '/';
800  bundlePathPtr++;
801  tmpStr = collection + 1;
802  /* copy the zone */
803  while ( *tmpStr != '\0' ) {
804  *bundlePathPtr = *tmpStr;
805  bundlePathPtr ++;
806  if ( *tmpStr == '/' ) {
807  tmpStr ++;
808  break;
809  }
810  tmpStr ++;
811  }
812 
813  if ( *tmpStr == '\0' ) {
815  "rsMkBundlePath: input path %s too short", collection );
816  return USER_INPUT_PATH_ERR;
817  }
818 
819  /* cannot bundle trash and bundle */
820  if ( strncmp( tmpStr, "trash/", 6 ) == 0 ||
821  strncmp( tmpStr, "bundle/", 7 ) == 0 ) {
823  "rsMkBundlePath: cannot bundle trash or bundle path %s", collection );
824  return USER_INPUT_PATH_ERR;
825  }
826 
827 
828  /* don't want to go back beyond /myZone/bundle/home */
829  *bundlePathPtr = '\0';
830  rstrcpy( startBundlePath, bundlePath, MAX_NAME_LEN );
831 
832  snprintf( bundlePathPtr, MAX_NAME_LEN, "bundle/%s.%u", tmpStr, ( unsigned int )myRanNum );
833 
834  if ( ( status = splitPathByKey( bundlePath, destBundleColl, MAX_NAME_LEN, myFile, MAX_NAME_LEN, '/' ) )
835  < 0 ) {
837  "rsMkBundlePath: splitPathByKey error for %s ", bundlePath );
838  return USER_INPUT_PATH_ERR;
839  }
840 
841  status = rsMkCollR( rsComm, startBundlePath, destBundleColl );
842 
843  if ( status < 0 ) {
845  "rsMkBundlePath: rsMkCollR error for startPath %s, destPath %s ",
846  startBundlePath, destBundleColl );
847  }
848 
849  return status;
850 }
851 
852 int
855  int status;
856 
857  if ( rodsServerHost == NULL ) {
859  "remotePhyBundleColl: Invalid rodsServerHost" );
861  }
862 
863  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
864  return status;
865  }
866 
867  status = rcPhyBundleColl( rodsServerHost->conn, phyBundleCollInp );
868  return status;
869 }
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
OpenedDataObjInp
Definition: dataObjInpOut.h:104
OneGig
static rodsLong_t OneGig
Definition: rsPhyBundleColl.cpp:47
L1desc
l1desc_t L1desc[1026]
Definition: irods_server_globals.cpp:29
RESC_NAME_KW
#define RESC_NAME_KW
Definition: rodsKeyWdDef.h:19
NULL
#define NULL
Definition: rodsDef.h:70
MAX_SUB_FILE_KW
#define MAX_SUB_FILE_KW
Definition: rodsKeyWdDef.h:123
rsComm_t
Definition: rcConnect.h:145
fileChksum.h
BunReplCache
Definition: phyBundleColl.h:19
getDefDirMode
int getDefDirMode()
Definition: physPath.cpp:1070
rsReadCollection
int rsReadCollection(rsComm_t *rsComm, int *handleInxInp, collEnt_t **collEnt)
Definition: rsReadCollection.cpp:15
transferStat_t
Definition: objInfo.h:291
addKeyVal
int addKeyVal(keyValPair_t *condInput, const char *keyWord, const char *value)
Definition: rcMisc.cpp:789
rsOpenCollection
int rsOpenCollection(rsComm_t *rsComm, collInp_t *openCollInp)
Definition: rsOpenCollection.cpp:16
NO_REG_COLL_INFO
#define NO_REG_COLL_INFO
Definition: syncMountedColl.h:10
SYS_INTERNAL_NULL_INPUT_ERR
@ SYS_INTERNAL_NULL_INPUT_ERR
Definition: rodsErrorTable.h:92
CollEnt::resource
char * resource
Definition: miscUtil.h:125
specColl.hpp
modDataObjMeta.h
CollInp
Definition: dataObjInpOut.h:157
CurSubFileCond::subPhyPath
char subPhyPath[(1024+64)]
Definition: phyBundleColl.h:37
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
rsDataObjCreate.hpp
unbunAndRegPhyBunfile.h
SpecColl::resource
char resource[64]
Definition: objInfo.h:83
CollEnt::replNum
int replNum
Definition: miscUtil.h:115
bundleAndRegSubFiles
int bundleAndRegSubFiles(rsComm_t *rsComm, int l1descInx, char *phyBunDir, char *collection, bunReplCacheHeader_t *bunReplCacheHeader, int chksumFlag)
Definition: rsPhyBundleColl.cpp:385
irods_stacktrace.hpp
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
CurSubFileCond::cacheReplNum
int cacheReplNum
Definition: phyBundleColl.h:39
resc_mgr
irods::resource_manager resc_mgr
Definition: irods_resource_manager.cpp:31
irods::resolve_resource_hierarchy
error resolve_resource_hierarchy(const std::string &, rsComm_t *, dataObjInp_t *, std::string &, dataObjInfo_t **_data_obj_info=0)
Definition: irods_resource_redirect.cpp:505
CurSubFileCond
Definition: phyBundleColl.h:33
isLocalZone
int isLocalZone(char *zoneHint)
Definition: rodsConnect.cpp:869
OpenedDataObjInp::l1descInx
int l1descInx
Definition: dataObjInpOut.h:105
fileChksum
int fileChksum(rsComm_t *rsComm, char *objPath, char *fileName, char *rescHier, char *orig_chksum, char *chksumStr)
Definition: rsFileChksum.cpp:113
setSubPhyPath
int setSubPhyPath(char *phyBunDir, rodsLong_t dataId, char *subPhyPath)
Definition: rsPhyBundleColl.cpp:626
CollEnt::collName
char * collName
Definition: miscUtil.h:119
StructFileExtAndRegInp
Definition: structFileExtAndReg.h:7
CollHandle
std::vector< collHandle_t > CollHandle
Definition: irods_server_globals.cpp:31
CHKSUM_KW
#define CHKSUM_KW
Definition: rodsKeyWdDef.h:25
BZIP2_TAR_DT_STR
#define BZIP2_TAR_DT_STR
Definition: objInfo.h:30
SpecColl::cacheDirty
int cacheDirty
Definition: objInfo.h:92
DataObjInfo::dataType
char dataType[64]
Definition: objInfo.h:133
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
SpecColl::phyPath
char phyPath[(1024+64)]
Definition: objInfo.h:85
replAndAddSubFileToDir
int replAndAddSubFileToDir(rsComm_t *rsComm, curSubFileCond_t *curSubFileCond, const char *myRescName, char *phyBunDir, bunReplCacheHeader_t *bunReplCacheHeader)
Definition: rsPhyBundleColl.cpp:350
isData
int isData(rsComm_t *rsComm, char *objName, rodsLong_t *dataId)
Definition: objMetaOpr.cpp:47
rsPhyBundleColl.hpp
BUNDLE_RESC
#define BUNDLE_RESC
Definition: phyBundleColl.h:11
SpecColl::cacheDir
char cacheDir[(1024+64)]
Definition: objInfo.h:89
DataObjInfo::rescId
rodsLong_t rescId
Definition: objInfo.h:164
CollEnt::dataSize
rodsLong_t dataSize
Definition: miscUtil.h:118
rsOpenCollection.hpp
SpecColl::type
structFileType_t type
Definition: objInfo.h:78
createPhyBundleDataObj
int createPhyBundleDataObj(rsComm_t *rsComm, char *collection, const std::string &_resc_name, const char *rescHier, dataObjInp_t *dataObjInp, char *dataType)
Definition: rsPhyBundleColl.cpp:693
l1desc::dataObjInfo
dataObjInfo_t * dataObjInfo
Definition: objDesc.hpp:42
DataObjInfo::rescHier
char rescHier[(1024+64)]
Definition: objInfo.h:132
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
CurSubFileCond::collName
char collName[(1024+64)]
Definition: phyBundleColl.h:34
UNIX_FILE_LINK_ERR
@ UNIX_FILE_LINK_ERR
Definition: rodsErrorTable.h:320
StructFileExtAndRegInp::objPath
char objPath[(1024+64)]
Definition: structFileExtAndReg.h:8
BunReplCache::objPath
char objPath[(1024+64)]
Definition: phyBundleColl.h:21
NO_TRIM_REPL_FG
#define NO_TRIM_REPL_FG
Definition: miscUtil.h:94
irods_resource_backport.hpp
SpecColl
Definition: objInfo.h:76
rsUnbunAndRegPhyBunfile.hpp
l1desc::l3descInx
int l3descInx
Definition: objDesc.hpp:35
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
BunReplCacheHeader
Definition: phyBundleColl.h:27
l1desc::chksumFlag
int chksumFlag
Definition: objDesc.hpp:49
STRUCT_FILE_COLL
@ STRUCT_FILE_COLL
Definition: objInfo.h:47
DataObjInfo::filePath
char filePath[(1024+64)]
Definition: objInfo.h:137
remotePhyBundleColl
int remotePhyBundleColl(rsComm_t *rsComm, structFileExtAndRegInp_t *phyBundleCollInp, rodsServerHost_t *rodsServerHost)
Definition: rsPhyBundleColl.cpp:853
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
dataObjCreate.h
CollInp::flags
int flags
Definition: dataObjInpOut.h:159
rmLinkedFilesInUnixDir
int rmLinkedFilesInUnixDir(char *phyBunDir)
Definition: rsUnbunAndRegPhyBunfile.cpp:416
MAX_BUNDLE_SIZE_KW
#define MAX_BUNDLE_SIZE_KW
Definition: rodsKeyWdDef.h:119
irods_resource_redirect.hpp
_rsDataObjRepl
int _rsDataObjRepl(rsComm_t *rsComm, dataObjInp_t *dataObjInp, transferStat_t *transStat, dataObjInfo_t *outDataObjInfo)
Definition: rsDataObjRepl.cpp:229
DataObjInfo::dataId
rodsLong_t dataId
Definition: objInfo.h:143
rsReadCollection.hpp
readCollection.h
CollEnt::dataId
char * dataId
Definition: miscUtil.h:121
CollEnt::replStatus
int replStatus
Definition: miscUtil.h:116
DATA_TYPE_KW
#define DATA_TYPE_KW
Definition: rodsKeyWdDef.h:23
StructFileExtAndRegInp::collection
char collection[(1024+64)]
Definition: structFileExtAndReg.h:9
BunReplCacheHeader::numSubFiles
int numSubFiles
Definition: phyBundleColl.h:28
regReplica_t::condInput
keyValPair_t condInput
Definition: regReplica.h:10
resolveLinkedPath
int resolveLinkedPath(rsComm_t *rsComm, char *objPath, specCollCache_t **specCollCache, keyValPair_t *condInput)
Definition: specColl.cpp:711
loopCnt
int loopCnt
Definition: irodsXmsgServer.cpp:18
rsCloseCollection
int rsCloseCollection(rsComm_t *rsComm, int *handleInxInp)
Definition: rsCloseCollection.cpp:14
closeCollection.h
regReplica_t::destDataObjInfo
dataObjInfo_t * destDataObjInfo
Definition: regReplica.h:9
BACKUP_RESC_NAME_KW
#define BACKUP_RESC_NAME_KW
Definition: rodsKeyWdDef.h:22
DEST_RESC_NAME_KW
#define DEST_RESC_NAME_KW
Definition: rodsKeyWdDef.h:20
CREATE_TAR_OPR
#define CREATE_TAR_OPR
Definition: syncMountedColl.h:12
rsPhyBundleColl
int rsPhyBundleColl(rsComm_t *rsComm, structFileExtAndRegInp_t *phyBundleCollInp)
Definition: rsPhyBundleColl.cpp:50
irods::error::code
long long code() const
Definition: irods_error.cpp:194
SYS_INVALID_ZONE_NAME
@ SYS_INVALID_ZONE_NAME
Definition: rodsErrorTable.h:94
RESC_HIER_STR_KW
#define RESC_HIER_STR_KW
Definition: rodsKeyWdDef.h:225
isDataObjBundled
int isDataObjBundled(collEnt_t *collEnt)
Definition: rsPhyBundleColl.cpp:632
replDataObjForBundle
int replDataObjForBundle(rsComm_t *rsComm, char *collName, char *dataName, const char *rescName, char *rescHier, char *dstRescHier, int adminFlag, dataObjInfo_t *outCacheObjInfo)
Definition: rsPhyBundleColl.cpp:648
syncMountedColl.h
freeCollEnt
int freeCollEnt(collEnt_t *collEnt)
Definition: miscUtil.cpp:1759
CollEnt::phyPath
char * phyPath
Definition: miscUtil.h:127
BunReplCache::chksumStr
char chksumStr[64]
Definition: phyBundleColl.h:22
irods::RESOURCE_TYPE
const std::string RESOURCE_TYPE("resource_property_type")
createPhyBundleDir
int createPhyBundleDir(rsComm_t *rsComm, char *bunFilePath, char *outPhyBundleDir, char *hier)
Definition: rsPhyBundleColl.cpp:681
CurSubFileCond::dataName
char dataName[(1024+64)]
Definition: phyBundleColl.h:35
rsRegReplica
int rsRegReplica(rsComm_t *rsComm, regReplica_t *regReplicaInp)
Definition: rsRegReplica.cpp:187
l3Close
int l3Close(rsComm_t *rsComm, int l1descInx)
Definition: rsDataObjClose.cpp:723
BunReplCacheHeader::totSubFileSize
rodsLong_t totSubFileSize
Definition: phyBundleColl.h:29
StructFileOprInp::oprType
int oprType
Definition: structFileSync.h:10
CollEnt
Definition: miscUtil.h:113
rsDataObjClose
int rsDataObjClose(rsComm_t *rsComm, openedDataObjInp_t *dataObjCloseInp)
Definition: rsDataObjClose.cpp:56
rsStructFileSync.hpp
DataObjInp
Definition: dataObjInpOut.h:65
rsDataObjClose.hpp
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
BunReplCache::srcReplNum
int srcReplNum
Definition: phyBundleColl.h:23
ZIP_DT_STR
#define ZIP_DT_STR
Definition: objInfo.h:31
rsFileChksum.hpp
SYS_INVALID_SERVER_HOST
@ SYS_INVALID_SERVER_HOST
Definition: rodsErrorTable.h:89
addSubFileToDir
int addSubFileToDir(curSubFileCond_t *curSubFileCond, bunReplCacheHeader_t *bunReplCacheHeader)
Definition: rsPhyBundleColl.cpp:598
BunReplCacheHeader::bunReplCacheHead
bunReplCache_t * bunReplCacheHead
Definition: phyBundleColl.h:30
CollInp::condInput
keyValPair_t condInput
Definition: dataObjInpOut.h:161
ADMIN_KW
#define ADMIN_KW
Definition: rodsKeyWdDef.h:62
INCLUDE_CONDINPUT_IN_QUERY
#define INCLUDE_CONDINPUT_IN_QUERY
Definition: miscUtil.h:95
DataObjInfo::replNum
int replNum
Definition: objInfo.h:140
svrToSvrConnect
int svrToSvrConnect(rsComm_t *rsComm, rodsServerHost_t *rodsServerHost)
Definition: miscServerFunct.cpp:106
BunReplCache::dataId
rodsLong_t dataId
Definition: phyBundleColl.h:20
USER_NO_RESC_INPUT_ERR
@ USER_NO_RESC_INPUT_ERR
Definition: rodsErrorTable.h:252
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
SpecColl::rescHier
char rescHier[(1024+64)]
Definition: objInfo.h:84
CurSubFileCond::cachePhyPath
char cachePhyPath[(1024+64)]
Definition: phyBundleColl.h:38
collection.hpp
StructFileExtAndRegInp::condInput
keyValPair_t condInput
Definition: structFileExtAndReg.h:12
splitPathByKey
int splitPathByKey(const char *srcPath, char *dir, size_t maxDirLen, char *file, size_t maxFileLen, char key)
Definition: stringOpr.cpp:222
physPath.hpp
irods::log
void log(const error &)
Definition: irods_log.cpp:13
DEST_RESC_HIER_STR_KW
#define DEST_RESC_HIER_STR_KW
Definition: rodsKeyWdDef.h:226
modDataObjMeta_t::regParam
keyValPair_t * regParam
Definition: modDataObjMeta.h:9
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
RECUR_QUERY_FG
#define RECUR_QUERY_FG
Definition: miscUtil.h:92
dataObjClose.h
regReplica.h
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
DATA_OBJ_T
@ DATA_OBJ_T
Definition: rodsType.h:38
MAX_SUB_FILE_CNT
#define MAX_SUB_FILE_CNT
Definition: phyBundleColl.h:17
regReplica_t::srcDataObjInfo
dataObjInfo_t * srcDataObjInfo
Definition: regReplica.h:8
modDataObjMeta_t::dataObjInfo
dataObjInfo_t * dataObjInfo
Definition: modDataObjMeta.h:8
CurSubFileCond::subFileSize
rodsLong_t subFileSize
Definition: phyBundleColl.h:40
dataObjRepl.h
CollEnt::dataName
char * dataName
Definition: miscUtil.h:120
mkFileDirR
int mkFileDirR(rsComm_t *rsComm, size_t startDirLen, const std::string &destDir, const std::string &hier, int mode)
Definition: fileOpr.cpp:147
CurSubFileCond::bundled
int bundled
Definition: phyBundleColl.h:41
SpecColl::collection
char collection[(1024+64)]
Definition: objInfo.h:79
IN_PDMO_KW
#define IN_PDMO_KW
Definition: rodsKeyWdDef.h:227
TAR_STRUCT_FILE_T
@ TAR_STRUCT_FILE_T
Definition: objInfo.h:55
StructFileOprInp
Definition: structFileSync.h:8
irods::resource_manager::hier_to_leaf_id
error hier_to_leaf_id(const std::string &, rodsLong_t &)
Definition: irods_resource_manager.cpp:1082
TAR_BUNDLE_DT_STR
#define TAR_BUNDLE_DT_STR
Definition: objInfo.h:34
rodsServerHost
Definition: rodsConnect.h:62
DataObjInfo::rescName
char rescName[64]
Definition: objInfo.h:131
_rsPhyBundleColl
int _rsPhyBundleColl(rsComm_t *rsComm, structFileExtAndRegInp_t *phyBundleCollInp, const char *_resc_name)
Definition: rsPhyBundleColl.cpp:141
rodsHostAddr_t::hostAddr
char hostAddr[256]
Definition: rodsDef.h:297
l1desc::bytesWritten
rodsLong_t bytesWritten
Definition: objDesc.hpp:45
OVERWRITE_WITHOUT_FORCE_FLAG
@ OVERWRITE_WITHOUT_FORCE_FLAG
Definition: rodsErrorTable.h:243
VERY_LONG_METADATA_FG
#define VERY_LONG_METADATA_FG
Definition: miscUtil.h:91
VERIFY_CHKSUM_KW
#define VERIFY_CHKSUM_KW
Definition: rodsKeyWdDef.h:16
rsMkCollR
int rsMkCollR(rsComm_t *rsComm, const char *startColl, const char *destColl)
Definition: collection.cpp:428
openCollection.h
CurSubFileCond::dataId
rodsLong_t dataId
Definition: phyBundleColl.h:36
rsModDataObjMeta
int rsModDataObjMeta(rsComm_t *rsComm, modDataObjMeta_t *modDataObjMetaInp)
Definition: rsModDataObjMeta.cpp:23
rodsLogError
void rodsLogError(int level, int errCode, char *formatStr,...)
Definition: rodsLog.cpp:422
rsModDataObjMeta.hpp
resource.hpp
phyBundle
int phyBundle(rsComm_t *rsComm, dataObjInfo_t *dataObjInfo, char *phyBunDir, char *collection, int oprType)
Definition: rsPhyBundleColl.cpp:549
rsRegReplica.hpp
CollEnt::objType
objType_t objType
Definition: miscUtil.h:114
CollInp::collName
char collName[(1024+64)]
Definition: dataObjInpOut.h:158
BunReplCache::next
struct BunReplCache * next
Definition: phyBundleColl.h:24
GZIP_TAR_DT_STR
#define GZIP_TAR_DT_STR
Definition: objInfo.h:29
StructFileOprInp::condInput
keyValPair_t condInput
Definition: structFileSync.h:13
rsMkBundlePath
int rsMkBundlePath(rsComm_t *rsComm, char *collection, char *bundlePath, int myRanNum)
Definition: rsPhyBundleColl.cpp:790
rodsObjStat
Definition: objStat.h:8
phyBundleColl.h
DataObjInfo::objPath
char objPath[(1024+64)]
Definition: objInfo.h:130
rsStructFileSync
int rsStructFileSync(rsComm_t *rsComm, structFileOprInp_t *structFileOprInp)
Definition: rsStructFileSync.cpp:14
rodsObjStat::specColl
specColl_t * specColl
Definition: objStat.h:18
irods_random.hpp
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
dataObjOpr.hpp
_rsDataObjCreateWithResc
int _rsDataObjCreateWithResc(rsComm_t *rsComm, dataObjInp_t *dataObjInp, const std::string &_resc_name)
Definition: rsDataObjCreate.cpp:377
DataObjInp::condInput
keyValPair_t condInput
Definition: dataObjInpOut.h:74
modDataObjMeta_t
Definition: modDataObjMeta.h:7
irods::get_loc_for_hier_string
error get_loc_for_hier_string(const std::string &_hier, std::string &_loc)
Definition: irods_resource_backport.cpp:633
regReplica_t
Definition: regReplica.h:7
NAME_LEN
#define NAME_LEN
Definition: rodsDef.h:55
KeyValPair
Definition: objInfo.h:120
clearKeyVal
int clearKeyVal(keyValPair_t *condInput)
Definition: rcMisc.cpp:1047
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
SpecColl::objPath
char objPath[(1024+64)]
Definition: objInfo.h:80
type
int type
Definition: filesystem.cpp:103
DataObjInfo
Definition: objInfo.h:129
USER_INPUT_PATH_ERR
@ USER_INPUT_PATH_ERR
Definition: rodsErrorTable.h:248
DataObjInfo::dataSize
rodsLong_t dataSize
Definition: objInfo.h:134
irods::CREATE_OPERATION
const std::string CREATE_OPERATION("CREATE")
rsCloseCollection.hpp
rsDataObjRepl.hpp
SpecCollCache
Definition: objInfo.h:102
rodsLong_t
long long rodsLong_t
Definition: rodsType.h:32
MAX_BUNDLE_SIZE
#define MAX_BUNDLE_SIZE
Definition: phyBundleColl.h:16
VERIFY_CHKSUM
#define VERIFY_CHKSUM
Definition: objDesc.hpp:30
objMetaOpr.hpp
SpecColl::collClass
specCollClass_t collClass
Definition: objInfo.h:77
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375
rcPhyBundleColl
int rcPhyBundleColl(rcComm_t *conn, structFileExtAndRegInp_t *phyBundleCollInp)
Definition: rcPhyBundleColl.cpp:33
rodsHostAddr_t
Definition: rodsDef.h:296
StructFileOprInp::specColl
specColl_t * specColl
Definition: structFileSync.h:12
BUNDLE_STR
#define BUNDLE_STR
Definition: phyBundleColl.h:13