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)  

rsSyncMountedColl.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See syncMountedColl.h for a description of this API call.*/
5 
6 #include "syncMountedColl.h"
7 #include "rodsLog.h"
8 #include "icatDefines.h"
9 #include "objMetaOpr.hpp"
10 #include "collection.hpp"
11 #include "resource.hpp"
12 #include "rsGlobalExtern.hpp"
13 #include "rcGlobalExtern.h"
14 #include "rsSyncMountedColl.hpp"
15 #include "miscServerFunct.hpp"
16 #include "apiHeaderAll.h"
17 #include "rsStructFileSync.hpp"
18 
19 // =-=-=-=-=-=-=-
21 
22 int
23 rsSyncMountedColl( rsComm_t *rsComm, dataObjInp_t *syncMountedCollInp ) {
24  rodsLog( LOG_NOTICE, "rsSyncMountedColl - start" );
25 
26  int status;
27  rodsObjStat_t *rodsObjStatOut = NULL;
28  dataObjInp_t myDataObjInp;
29  int remoteFlag;
31 
32  status = collStat( rsComm, syncMountedCollInp, &rodsObjStatOut );
33  if ( status < 0 || NULL == rodsObjStatOut ) {
34  freeRodsObjStat( rodsObjStatOut );
35  return status; // JMC cppcheck - nullptr
36  }
37 
38  if ( rodsObjStatOut->specColl == NULL ) {
39  freeRodsObjStat( rodsObjStatOut );
41  "rsSyncMountedColl: %s not a mounted collection",
42  syncMountedCollInp->objPath );
44  }
45 
46  bzero( &myDataObjInp, sizeof( myDataObjInp ) );
47  rstrcpy( myDataObjInp.objPath, rodsObjStatOut->specColl->objPath,
48  MAX_NAME_LEN );
49  remoteFlag = getAndConnRemoteZone( rsComm, &myDataObjInp, &rodsServerHost,
50  REMOTE_OPEN );
51 
52  if ( remoteFlag < 0 ) {
53  freeRodsObjStat( rodsObjStatOut );
54  return remoteFlag;
55  }
56  else if ( remoteFlag == REMOTE_HOST ) {
58  syncMountedCollInp );
59  }
60  else {
61  status = _rsSyncMountedColl( rsComm, rodsObjStatOut->specColl,
62  syncMountedCollInp->oprType );
63  }
64 
65  freeRodsObjStat( rodsObjStatOut );
66 
67  rodsLog( LOG_NOTICE, "rsSyncMountedColl - done" );
68 
69  return status;
70 }
71 
72 int
73 _rsSyncMountedColl( rsComm_t *rsComm, specColl_t *specColl, int oprType ) {
74  int status;
75 
76  if ( getStructFileType( specColl ) >= 0 ) { /* a struct file */
77  structFileOprInp_t structFileOprInp;
78 
79  if ( strlen( specColl->resource ) == 0 ) {
80  /* nothing to sync */
81  return 0;
82  }
83 
84  memset( &structFileOprInp, 0, sizeof( structFileOprInp ) );
85 
86  // =-=-=-=-=-=-=-
87  // extract the host location from the resource hierarchy
88  std::string location;
89  irods::error ret = irods::get_loc_for_hier_string( specColl->rescHier, location );
90  if ( !ret.ok() ) {
91  irods::log( PASSMSG( "rsSyncMountedColl - failed in get_loc_for_hier_string", ret ) );
92  return -1;
93  }
94 
95 
96  addKeyVal( &structFileOprInp.condInput, RESC_HIER_STR_KW, specColl->rescHier );
97  rstrcpy( structFileOprInp.addr.hostAddr, location.c_str(), NAME_LEN );
98  structFileOprInp.oprType = oprType;
99  structFileOprInp.specColl = specColl;
100  status = rsStructFileSync( rsComm, &structFileOprInp );
101 
102 
103  }
104  else { /* not a struct file */
106  }
107 
108  return status;
109 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
DataObjInp::objPath
char objPath[(1024+64)]
Definition: dataObjInpOut.h:66
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
addKeyVal
int addKeyVal(keyValPair_t *condInput, const char *keyWord, const char *value)
Definition: rcMisc.cpp:789
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
rsSyncMountedColl
int rsSyncMountedColl(rsComm_t *rsComm, dataObjInp_t *syncMountedCollInp)
Definition: rsSyncMountedColl.cpp:23
SpecColl::resource
char resource[64]
Definition: objInfo.h:83
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
REMOTE_OPEN
#define REMOTE_OPEN
Definition: getRemoteZoneResc.h:5
getStructFileType
int getStructFileType(specColl_t *specColl)
Definition: objMetaOpr.cpp:386
collStat
int collStat(rsComm_t *rsComm, dataObjInp_t *dataObjInp, rodsObjStat_t **rodsObjStatOut)
Definition: collection.cpp:271
irods_resource_backport.hpp
SpecColl
Definition: objInfo.h:76
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
rcGlobalExtern.h
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
rsSyncMountedColl.hpp
freeRodsObjStat
int freeRodsObjStat(rodsObjStat_t *rodsObjStat)
Definition: rcMisc.cpp:3537
rsGlobalExtern.hpp
rcSyncMountedColl
int rcSyncMountedColl(rcComm_t *conn, dataObjInp_t *syncMountedCollInp)
Definition: rcSyncMountedColl.cpp:40
RESC_HIER_STR_KW
#define RESC_HIER_STR_KW
Definition: rodsKeyWdDef.h:225
syncMountedColl.h
StructFileOprInp::oprType
int oprType
Definition: structFileSync.h:10
SYS_COLL_NOT_MOUNTED_ERR
@ SYS_COLL_NOT_MOUNTED_ERR
Definition: rodsErrorTable.h:141
rsStructFileSync.hpp
DataObjInp
Definition: dataObjInpOut.h:65
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
SpecColl::rescHier
char rescHier[(1024+64)]
Definition: objInfo.h:84
collection.hpp
rodsLog.h
irods::log
void log(const error &)
Definition: irods_log.cpp:13
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
icatDefines.h
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
_rsSyncMountedColl
int _rsSyncMountedColl(rsComm_t *rsComm, specColl_t *specColl, int oprType)
Definition: rsSyncMountedColl.cpp:73
StructFileOprInp
Definition: structFileSync.h:8
rodsServerHost
Definition: rodsConnect.h:62
apiHeaderAll.h
DataObjInp::oprType
int oprType
Definition: dataObjInpOut.h:72
rodsHostAddr_t::hostAddr
char hostAddr[256]
Definition: rodsDef.h:297
getAndConnRemoteZone
int getAndConnRemoteZone(rsComm_t *rsComm, dataObjInp_t *dataObjInp, rodsServerHost_t **rodsServerHost, char *remotZoneOpr)
Definition: rodsConnect.cpp:784
resource.hpp
StructFileOprInp::condInput
keyValPair_t condInput
Definition: structFileSync.h:13
rodsObjStat
Definition: objStat.h:8
rsStructFileSync
int rsStructFileSync(rsComm_t *rsComm, structFileOprInp_t *structFileOprInp)
Definition: rsStructFileSync.cpp:14
rodsObjStat::specColl
specColl_t * specColl
Definition: objStat.h:18
StructFileOprInp::addr
rodsHostAddr_t addr
Definition: structFileSync.h:9
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
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
NAME_LEN
#define NAME_LEN
Definition: rodsDef.h:55
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
SpecColl::objPath
char objPath[(1024+64)]
Definition: objInfo.h:80
objMetaOpr.hpp
StructFileOprInp::specColl
specColl_t * specColl
Definition: structFileSync.h:12