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)  

rsOpenCollection.cpp
Go to the documentation of this file.
1 
4 /* rsOpenCollection.c - server handling routine for rcOpenCollection
5  */
6 
7 #include "rsOpenCollection.hpp"
8 #include "rcMisc.h"
9 #include "openCollection.h"
10 #include "closeCollection.h"
11 #include "rsGlobalExtern.hpp"
12 #include "rcGlobalExtern.h"
13 #include "rsObjStat.hpp"
14 #include "rsCloseCollection.hpp"
15 
16 int rsOpenCollection(rsComm_t* rsComm, collInp_t* openCollInp)
17 {
18  int handleInx = allocCollHandle();
19 
20  if (handleInx < 0) {
21  return handleInx;
22  }
23 
24  collHandle_t *collHandle = &CollHandle[handleInx];
25  int status = rsInitQueryHandle(&collHandle->queryHandle, rsComm);
26 
27  if (status < 0) {
28  return status;
29  }
30 
32  rstrcpy(collHandle->dataObjInp.objPath, openCollInp->collName, MAX_NAME_LEN);
33 
34  if ((openCollInp->flags & INCLUDE_CONDINPUT_IN_QUERY) != 0) {
35  replKeyVal( &openCollInp->condInput, &collHandle->dataObjInp.condInput );
36  }
37 
38  rodsObjStat_t *rodsObjStatOut = NULL;
39  status = rsObjStat( rsComm, &collHandle->dataObjInp, &rodsObjStatOut );
40  if ( status < 0 ) {
41  freeRodsObjStat( rodsObjStatOut );
42  rsCloseCollection( rsComm, &handleInx );
43  return status;
44  }
45 
46  if ( rodsObjStatOut->objType != COLL_OBJ_T ) {
47  freeRodsObjStat( rodsObjStatOut );
48  rsCloseCollection( rsComm, &handleInx );
50  }
51 
52  replSpecColl( rodsObjStatOut->specColl, &collHandle->dataObjInp.specColl );
53  if ( rodsObjStatOut->specColl != NULL &&
54  rodsObjStatOut->specColl->collClass == LINKED_COLL ) {
55  /* save the linked path */
56  rstrcpy( collHandle->linkedObjPath, rodsObjStatOut->specColl->objPath, MAX_NAME_LEN );
57  };
58 
59  collHandle->rodsObjStat = rodsObjStatOut;
60 
61  collHandle->state = COLL_OPENED;
62  collHandle->flags = openCollInp->flags;
63  /* the collection exist. now query the data in it */
64  return handleInx;
65 }
DataObjInp::objPath
char objPath[(1024+64)]
Definition: dataObjInpOut.h:66
allocCollHandle
int allocCollHandle()
Definition: objDesc.cpp:585
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
CollInp
Definition: dataObjInpOut.h:157
DataObjInp::specColl
specColl_t * specColl
Definition: dataObjInpOut.h:73
rsInitQueryHandle
int rsInitQueryHandle(queryHandle_t *queryHandle, rsComm_t *rsComm)
Definition: objDesc.cpp:623
collHandle_t
Definition: miscUtil.h:97
CollHandle
std::vector< collHandle_t > CollHandle
Definition: irods_server_globals.cpp:31
rcMisc.h
rsOpenCollection.hpp
collHandle_t::state
collState_t state
Definition: miscUtil.h:98
collHandle_t::linkedObjPath
char linkedObjPath[(1024+64)]
Definition: miscUtil.h:108
rcGlobalExtern.h
CollInp::flags
int flags
Definition: dataObjInpOut.h:159
rsCloseCollection
int rsCloseCollection(rsComm_t *rsComm, int *handleInxInp)
Definition: rsCloseCollection.cpp:14
freeRodsObjStat
int freeRodsObjStat(rodsObjStat_t *rodsObjStat)
Definition: rcMisc.cpp:3537
COLL_OBJ_T
@ COLL_OBJ_T
Definition: rodsType.h:39
rsOpenCollection
int rsOpenCollection(rsComm_t *rsComm, collInp_t *openCollInp)
Definition: rsOpenCollection.cpp:16
closeCollection.h
collHandle_t::queryHandle
queryHandle_t queryHandle
Definition: miscUtil.h:103
rsGlobalExtern.hpp
LINKED_COLL
@ LINKED_COLL
Definition: objInfo.h:49
remove_trailing_path_separators
void remove_trailing_path_separators(char *path)
Definition: rodsPath.cpp:536
rsObjStat
int rsObjStat(rsComm_t *rsComm, dataObjInp_t *dataObjInp, rodsObjStat_t **rodsObjStatOut)
Definition: rsObjStat.cpp:23
collHandle_t::dataObjInp
dataObjInp_t dataObjInp
Definition: miscUtil.h:105
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
rodsObjStat::objType
objType_t objType
Definition: objStat.h:10
collHandle_t::rodsObjStat
rodsObjStat_t * rodsObjStat
Definition: miscUtil.h:102
CollInp::condInput
keyValPair_t condInput
Definition: dataObjInpOut.h:161
COLL_OPENED
@ COLL_OPENED
Definition: miscUtil.h:70
INCLUDE_CONDINPUT_IN_QUERY
#define INCLUDE_CONDINPUT_IN_QUERY
Definition: miscUtil.h:95
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
collHandle_t::flags
int flags
Definition: miscUtil.h:100
rsObjStat.hpp
openCollection.h
CAT_NAME_EXISTS_AS_DATAOBJ
@ CAT_NAME_EXISTS_AS_DATAOBJ
Definition: rodsErrorTable.h:449
replSpecColl
int replSpecColl(specColl_t *inSpecColl, specColl_t **outSpecColl)
Definition: rcMisc.cpp:778
CollInp::collName
char collName[(1024+64)]
Definition: dataObjInpOut.h:158
rodsObjStat
Definition: objStat.h:8
rodsObjStat::specColl
specColl_t * specColl
Definition: objStat.h:18
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
DataObjInp::condInput
keyValPair_t condInput
Definition: dataObjInpOut.h:74
SpecColl::objPath
char objPath[(1024+64)]
Definition: objInfo.h:80
rsCloseCollection.hpp
replKeyVal
int replKeyVal(const keyValPair_t *srcCondInput, keyValPair_t *destCondInput)
Definition: rcMisc.cpp:739
SpecColl::collClass
specCollClass_t collClass
Definition: objInfo.h:77