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)  

rsGetHostForPut.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See getHostForPut.h for a description of this API call.*/
5 
6 #include "getHostForPut.h"
7 #include "rodsLog.h"
8 #include "rsGlobalExtern.hpp"
9 #include "rcGlobalExtern.h"
10 #include "getRemoteZoneResc.h"
11 #include "dataObjCreate.h"
12 #include "objMetaOpr.hpp"
13 #include "resource.hpp"
14 #include "collection.hpp"
15 #include "specColl.hpp"
16 #include "miscServerFunct.hpp"
17 #include "rsGetHostForPut.hpp"
18 
19 // =-=-=-=-=-=-=-
22 
23 
25  rsComm_t* rsComm,
26  dataObjInp_t* dataObjInp,
27  char ** outHost ) {
29  const int remoteFlag = getAndConnRemoteZone(rsComm, dataObjInp, &rodsServerHost, REMOTE_OPEN);
30  if (remoteFlag < 0) {
31  return remoteFlag;
32  }
33  else if (REMOTE_HOST == remoteFlag) {
34  const int status = rcGetHostForPut(rodsServerHost->conn, dataObjInp, outHost);
35  if (status < 0) {
36  return status;
37  }
38  }
39  else {
40  // =-=-=-=-=-=-=-
41  // working on the "home zone", determine if we need to redirect to a different
42  // server in this zone for this operation. if there is a RESC_HIER_STR_KW then
43  // we know that the redirection decision has already been made
44  std::string hier;
45  if ( getValByKey( &dataObjInp->condInput, RESC_HIER_STR_KW ) == NULL ) {
47  dataObjInp, hier );
48  if ( !ret.ok() ) {
49  std::stringstream msg;
50  msg << __FUNCTION__;
51  msg << " :: failed in irods::resolve_resource_hierarchy for [";
52  msg << dataObjInp->objPath << "]";
53  irods::log( PASSMSG( msg.str(), ret ) );
54  return ret.code();
55  }
56  // =-=-=-=-=-=-=-
57  // we resolved the redirect and have a host, set the hier str for subsequent
58  // api calls, etc.
59  addKeyVal( &dataObjInp->condInput, RESC_HIER_STR_KW, hier.c_str() );
60 
61  } // if keyword
62 
63  // =-=-=-=-=-=-=-
64  // extract the host location from the resource hierarchy
65  std::string location;
66  irods::error ret = irods::get_loc_for_hier_string( hier, location );
67  if ( !ret.ok() ) {
68  irods::log( PASSMSG( "rsGetHostForPut - failed in get_loc_for_hier_string", ret ) );
69  return -1;
70  }
71 
72  // =-=-=-=-=-=-=-
73  // set the out variable
74  *outHost = strdup( location.c_str() );
75  }
76 
77  return 0;
78 
79 }
getValByKey
char * getValByKey(const keyValPair_t *condInput, const char *keyWord)
Definition: rcMisc.cpp:675
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
getRemoteZoneResc.h
specColl.hpp
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
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
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
REMOTE_OPEN
#define REMOTE_OPEN
Definition: getRemoteZoneResc.h:5
irods_resource_backport.hpp
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
rcGlobalExtern.h
dataObjCreate.h
irods_resource_redirect.hpp
rsGlobalExtern.hpp
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
rsGetHostForPut
int rsGetHostForPut(rsComm_t *rsComm, dataObjInp_t *dataObjInp, char **outHost)
Definition: rsGetHostForPut.cpp:24
DataObjInp
Definition: dataObjInpOut.h:65
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
collection.hpp
rodsLog.h
irods::log
void log(const error &)
Definition: irods_log.cpp:13
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
rcGetHostForPut
int rcGetHostForPut(rcComm_t *conn, dataObjInp_t *dataObjInp, char **outHost)
Definition: rcGetHostForPut.cpp:44
rodsServerHost
Definition: rodsConnect.h:62
getHostForPut.h
getAndConnRemoteZone
int getAndConnRemoteZone(rsComm_t *rsComm, dataObjInp_t *dataObjInp, rodsServerHost_t **rodsServerHost, char *remotZoneOpr)
Definition: rodsConnect.cpp:784
rsGetHostForPut.hpp
resource.hpp
DataObjInp::condInput
keyValPair_t condInput
Definition: dataObjInpOut.h:74
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
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
irods::CREATE_OPERATION
const std::string CREATE_OPERATION("CREATE")
objMetaOpr.hpp