int rsDataObjGet (rsComm_t *rsComm, dataObjInp_t *dataObjInp, portalOprOut_t **portalOprOut, bytesBuf_t *dataObjOutBBuf) { int status; int remoteFlag; rodsServerHost_t *rodsServerHost; specCollCache_t *specCollCache = NULL; resolveLinkedPath (rsComm, dataObjInp->objPath, &specCollCache, &dataObjInp->condInput); remoteFlag = getAndConnRemoteZone (rsComm, dataObjInp, &rodsServerHost, REMOTE_OPEN); if (remoteFlag < 0) { return (remoteFlag); } else if (remoteFlag == LOCAL_HOST) { status = _rsDataObjGet (rsComm, dataObjInp, portalOprOut, dataObjOutBBuf, BRANCH_MSG); } else { int l1descInx; status = _rcDataObjGet (rodsServerHost->conn, dataObjInp, portalOprOut, dataObjOutBBuf); if (status < 0) { return (status); } if (status == 0 || (dataObjOutBBuf != NULL && dataObjOutBBuf->len > 0)) { /* data included in buf */ return status; } else { /* have to allocate a local l1descInx to keep track of things * since the file is in remote zone. It sets remoteL1descInx, * oprType = REMOTE_ZONE_OPR and remoteZoneHost so that * rsComplete knows what to do */ l1descInx = allocAndSetL1descForZoneOpr ( (*portalOprOut)->l1descInx, dataObjInp, rodsServerHost, NULL); if (l1descInx < 0) return l1descInx; (*portalOprOut)->l1descInx = l1descInx; return status; } } return (status); }
int rsDataObjGet( rsComm_t *rsComm, dataObjInp_t *dataObjInp, portalOprOut_t **portalOprOut, bytesBuf_t *dataObjOutBBuf ) { int status; int remoteFlag; rodsServerHost_t *rodsServerHost; specCollCache_t *specCollCache = NULL; resolveLinkedPath( rsComm, dataObjInp->objPath, &specCollCache, &dataObjInp->condInput ); remoteFlag = getAndConnRemoteZone( rsComm, dataObjInp, &rodsServerHost, REMOTE_OPEN ); if ( remoteFlag < 0 ) { return remoteFlag; } else if ( remoteFlag == LOCAL_HOST ) { // =-=-=-=-=-=-=- // working on the "home zone", determine if we need to redirect to a different // server in this zone for this operation. if there is a RESC_HIER_STR_KW then // we know that the redirection decision has already been made if ( getValByKey( &dataObjInp->condInput, RESC_HIER_STR_KW ) == NULL ) { std::string hier; irods::error ret = irods::resolve_resource_hierarchy( irods::OPEN_OPERATION, rsComm, dataObjInp, hier ); if ( !ret.ok() ) { std::stringstream msg; msg << "rsDataObjGet :: failed in irods::resolve_resource_redirect for ["; msg << dataObjInp->objPath << "]"; irods::log( PASSMSG( msg.str(), ret ) ); return ret.code(); } // =-=-=-=-=-=-=- // we resolved the redirect and have a host, set the hier str for subsequent // api calls, etc. addKeyVal( &dataObjInp->condInput, RESC_HIER_STR_KW, hier.c_str() ); } // if keyword status = _rsDataObjGet( rsComm, dataObjInp, portalOprOut, dataObjOutBBuf, BRANCH_MSG ); } else { int l1descInx; status = _rcDataObjGet( rodsServerHost->conn, dataObjInp, portalOprOut, dataObjOutBBuf ); if ( status < 0 ) { return status; } if ( status == 0 || ( dataObjOutBBuf != NULL && dataObjOutBBuf->len > 0 ) ) { /* data included in buf */ return status; } else { /* have to allocate a local l1descInx to keep track of things * since the file is in remote zone. It sets remoteL1descInx, * oprType = REMOTE_ZONE_OPR and remoteZoneHost so that * rsComplete knows what to do */ l1descInx = allocAndSetL1descForZoneOpr( ( *portalOprOut )->l1descInx, dataObjInp, rodsServerHost, NULL ); if ( l1descInx < 0 ) { return l1descInx; } ( *portalOprOut )->l1descInx = l1descInx; return status; } } return status; }