High Level Object API
From SRB
srbObjOpen
/*
* srbObjOpen - Open a SRB object * * Input - srbConn* conn - From clConnect (). * char *objID - The SRB object ID to open. The objID is must have * been registered with MMCAT. One or more conditions * can be appended to the objID. Each condition must be * preceded by the character '&'. Currently, only one condition * is supported. i.e., COPY=n (where n = replica number beginning * with 0). e.g. foo©=1 specifies opening replica number * 1 of data object "foo". * int oflag - Unix type open flag. O_CREAT is not supported. * char *collectionName - The name of the collection this objID * belongs. * * Output - Returns the object descriptor. * Returns a negative value upon failure. */
extern int srbObjOpen(srbConn* conn, char *objID, int oflag, char *collectionName);
srbObjOpenWithTicket
/*
* srbObjOpenWithTicket - Open a SRB object using a ticket. * * Input - srbConn* conn - From clConnect (). * char *objID - The SRB object ID to open. The objID is must have * been registered registered with MMCAT. objID may be NULL. * In this case, SRB will open the object associated with the * ticket. One or more conditions can be appended to the objID. * Each condition must be preceded by the character '&'. * Currently, only one condition is supported. i.e., COPY=n * (where n = replica number beginning with 0). * e.g. foo©=1 specifies opening replica number * 1 of data object "foo". * int oflag - Unix type open flag. O_CREAT is not supported. * char *collectionName - The name of the collection this objID * belongs. * char *ticket - The ticket for the object. * * * Output - Returns the object descriptor. * Returns a negative value upon failure. */
extern int srbObjOpenWithTicket (srbConn* conn, char *objID, int oflag, char *collectionName, char *ticket);
srbObjCreate
/*
* srbObjCreate - Create a SRB object
*
* Input - srbConn* conn - From clConnect ().
* int catType - catalog type. e,g., MDAS_CATALOG.
* char *objID - The SRB object ID to create. The objID is a
* user defined name to be registered with MDAS. This
* ID will be used for subsequent reference of the data
* object.
* One or more conditions can be appended to the objID.
* Each condition must be preceded by the character '&'.
* Currently, two conditions are supported:
* 1) COPIES=MMM where MMM may be:
* a) an integer n which means n replica should be created.
* The "resourceName" input is the logical resource in which
* this object is to be stored. This logical resource must
* consist of at least n physical resources. e.g. foo&COPIES=2
* specifies the creation of two replica of data object "foo".
* b) the keyword RR which means a single copy should be
* created in one of the physical resources belonging to
* the input logical resource ("resourceName") chosen in a
* Round-Robin fashion. e.g. foo&COPIES=RR.
* c) the keyword RANDOM produces similar effect as the
* RR keyword. The only difference is the selection algorithm
* is random rather than Round-Robin. e.g. foo&COPIES=RANDOM.
* 2) CONTAINER=containerName. This keyword specifies the
* object is to be placed in the given container. The
* container must have already been created using the
* srbContainerCreate() call.
* char *dataTypeName - Data type. e.g. "generic"
* char *resourceName - The storage resource name. This may be a
* the name of a single resource or a resource group
* (or logical resource) consisting of two or more physical
* resources.
* e.g. "mda18-unix-sdsc"
* char *collectionName - The collection name.
* char *pathName - The file/DB path of the data.
* srb_long_t dataSize - File size. Used by HPSS to determine COS.
* -1 => don't know and the default COS will be used.
*
*
* Output - Returns the object descriptor.
* Returns a negative value upon failure.
*/
extern int srbObjCreate(srbConn* conn, int catType, char *objID, char *dataTypeName, char *resourceName, char *collectionName, char *pathName, srb_long_t dataSize);
srbObjClose
/*
* srbObjClose - Close an opened object * * Input - srbConn* conn - From clConnect (). * int desc - The object descriptor (from the srbObjOpen call). * * * Output - Returns 0 upon success. * Returns a negative value upon failure. */
extern int srbObjClose (srbConn* conn, int desc);
srbObjUnlink
/*
* srbObjUnlink - Unlink an SRB object * * Input - srbConn* conn - From clConnect (). * char *objID - The SRB object ID to unlink. The objID is obtained * through registration with MDAS. * char *collectionName - The name of the collection this objID * belongs. * * Output - Returns 0 upon success. * Returns a negative value upon failure. * */
extern int srbObjUnlink (srbConn* conn, char *objID, char *collectionName);
srbObjRead
/*
* srbObjRead - Read len bytes of the SRB object into buf * * Input - srbConn* conn - From clConnect (). * int desc - The object descriptor (from the srbObjOpen call) to read. * char *buf - The input buffer. * int len - The number of bytes to read. * * Output - Returns the length of bytes read. * Returns a negative value upon failure. * the CALLER must have allocated enough space to hold the result returned */
extern int srbObjRead(srbConn *conn, int desc, char *buf, int len);
srbObjSeek
/*
* srbObjSeek - Change the current read or write location on an SRB object. * Input - srbConn* conn - From clConnect (). * int desc - The object descriptor (from the srbObjOpen call) to seek. * int offset - The position of the next operation * int whence - Same definition as in Unix. * SEEK_SET - pointer is set to the value of the Offset parameter. * SEEK_CUR - pointer is set to its current location plus the * value of the Offset parameter. * SEEK_END - pointer is set to the size of the file plus the * value of the Offset parameter. * * Output - Returns the resulting offset, as measured in bytes from the * beginning of the file. * Returns a negative value upon failure. */
extern srb_long_t srbObjSeek(srbConn *conn, int desc, srb_long_t offset, int whence);
srbObjSync
/*
* srbObjSync - Sync an opened object (call fsync for UNIX FS) * * Input - srbConn* conn - From srbConnect (). * int desc - The object descriptor (from the srbObjOpen call). * * * Output - Returns 0 upon success. * Returns a negative value upon failure. */
extern int srbObjSync (srbConn* conn, int desc);
srbObjStat
/*
* srbObjStat - Stat a srb Path - The result is placed in statbuf which * is of type (strust stat) of the local fs. * * Input - srbConn* conn - From srbConnect (). * int catType - The catalog type. * char *path - the SRB path. * stat *statbuf - The place to put the stat result. * * Output - stat result in statbuf. * Returns 0 upon success. * Returns a negative value upon failure. */
extern int srbObjStat(srbConn* conn, int catType, char *path, struct stat *statbuf);
srbObjStat64
/*
* srbObjStat64 - Stat a srb Path - The result is placed in statbuf which * is of type (strust stat) of the local fs. * * Input - srbConn* conn - From srbConnect (). * int catType - The catalog type. * char *path - the SRB path. * stat *statbuf - The place to put the stat result. * * Output - stat result in statbuf. * Returns 0 upon success. * Returns a negative value upon failure. */
extern int srbObjStat64 (srbConn* conn, int catType, char *path, struct stat64 *statbuf);
srbObjGetdents
/*
* srbObjGetdents - The SRB equivalent of the getdents call. * * Input - srbConn* conn - From srbConnect (). * int catType - The catalog type. * int fd - the opened fd. * dirent_t *buf - The place to put the dirents result. * size_t nbyte - The max number of bytes to output. * * Output - dirents result in buf. * Returns 0 upon success. * Returns a negative value upon failure. */
extern int srbObjGetdents (srbConn* conn, int catType, int fd, dirent_t *buf, size_t nbyte);
srbObjGetdents64
/*
* srbObjGetdents64 - The SRB equivalent of the getdents64 call. * * Input - srbConn* conn - From srbConnect (). * int catType - The catalog type. * int fd - the opened fd. * dirent_t *buf - The place to put the dirents result. * size_t nbyte - The max number of bytes to output. * * Output - dirents result in buf. * Returns 0 upon success. * Returns a negative value upon failure. */
extern int srbObjGetdents64 (srbConn* conn, int catType, int fd, dirent64_t *buf, size_t nbyte);
srbCollSeek
/*
* srbCollSeek - Seek into a collection. A collection must have been * opened using srbObjOpen. * Input - srbConn* conn - From srbConnect (). * int desc - The object descriptor (from the srbObjOpen call) to seek. * int offset - The position of the next operation * int whence - Same definition as in Unix. * SEEK_SET - pointer is set to the value of the Offset parameter. * SEEK_CUR - pointer is set to its current location plus the * value of the Offset parameter. * SEEK_END - pointer is set to the size of the file plus the * value of the Offset parameter. * int is64Flag - valid vaiue: IS_64_BIT or IS_32_BIT. * * Output - Returns 0 upon success. * Returns a negative value upon failure. */
extern int
srbCollSeek(srbConn *conn, int desc, int offset, int whence, int is64Flag);
srbObjLockRange
/*
* srbObjLockRange - perform locking operations on all or a portion of a file; * block and wait if the lock cannot be acquired. * The arguments are following the MDSPlus convention. * * Input - srbConn* conn - From srbConnect (). * int desc - The object descriptor (from the srbObjOpen call). * int64 offset - offset for the lock range. * int size - size of the lock range. * int mode - 0 F_UNLCK unlock * 1 F_RDLCK set a read lock * 2 F_WRLCK set a write lock * * Output - Returns 0 upon success. * Returns a negative value upon failure. */
extern int srbObjLockRange(srbConn* conn, int fd, srb_long_t offset,
int size, int mode);
srbObjProxyOpr
/*
* srbObjProxyOpr - Proxy Operation request. * * Input - srbConn* conn - From clConnect (). * ProxyOprId operation -The type of proxy operation. Valid operations: * OPR_COPY - Copy from the object descriptor given in sourceInp * to the object descriptor given in destInp. * If successful, the number of bypes copied is returned. -ive * values means failure. * * int inputInt1 - intput integer 1. * int inputInt2 - intput integer 2. * int inputInt3 - intput integer 3. * int inputInt4 - intput integer 4. * char *inputStr1 - Input String 1. * char *inputStr2 - Input String 2. * char *inputStr3 - Input String 3. * char *inputStr4 - Input String 4. * char *inputStr5 - Input String 5. * byteStream *inputBStrm1 - Input Byte stream 1. * byteStream *inputBStrm2 - Input Byte stream 2. * * * Output - Returns 0 or positive value upon success. * Returns a negative value upon failure. * outBuf - any byte stream output. */
extern int srbObjProxyOpr (srbConn *conn, ProxyOprId operation, int inputInt1, int inputInt2, int inputInt3, int inputInt4, char *inputStr1, char *inputStr2, char *inputStr3, char *inputStr4, char *inputStr5, byteStream *inputBStrm1, byteStream *inputBStrm2, char *outBuf);
srbGenProxyFunct
/*
* srbGenProxyFunct - New general Proxy Operation request. * * Input - srbConn* conn - From srbConnect (). * int functType -The type of proxy operation. * int intInput1 - an integer input. * int intInput2 - an integer input. * char *strInput1 - a string input. * char *strInput2 - a string input. * void *inputStruct - Pointer to input struct. * void *outputStruct - Pointer to output struct. * int maxOutSz - the max size of packed output * * * Output - Returns 0 or positive value upon success. * Returns a negative value upon failure. * outBuf - any byte stream output. */
int srbGenProxyFunct (srbConn *conn, int functType, int intInput1, int intInput2, char *strInput1, char *strInput2, void *inputStruct, FormatDef inputFormat, void **outputStruct, FormatDef outputFormat, FormatDefConst *localDef, int maxOutSz);
int
_srbGenProxyFunct (srbConn *conn, int functType, int intInput1, int intInput2,
char *strInput1, char *strInput2, struct varlena *packedInput,
struct varlena *packedOutput, int maxOutSz);
srbObjReplicate
/*
* srbObjReplicate - Make a copy of an SRB object * * Input - srbConn* conn - From clConnect (). * int catType - catalog type. e,g., MDAS_CATALOG. * char *objID - The SRB object ID to replicate. * char *collectionName - The name of the collection this objID * belongs. * char *newResourceName - The storage resource name of the new copy. * e.g. "mda18-unix-sdsc" * char *newPathName - The file/DB path of the new copy. * * Output - Returns 0 upon success. * Returns a negative value upon failure. * */
extern int srbObjReplicate (srbConn* conn, int catType, char *objID, char *collectionName, char *newResourceName, char *newPathName);
srbObjMove
/*
* srbObjMove - Move a copy of an SRB object to a new location * * Input - srbConn* conn - From clConnect (). * int catType - catalog type. e,g., MDAS_CATALOG. * char *objID - The SRB object ID to unlink. The objID is obtained * through registration with MDAS. * char *collectionName - The name of the collection this objID * belongs. * char *srcResource - The source resource to move - not used * char *newResourceName - The storage resource name of the new copy. * e.g. "mda18-unix-sdsc" * char *newPathName - The file/DB path of the new copy. * char *container - the container to move into * * Output - Returns 0 upon success. * Returns a negative value upon failure. * */
extern int srbObjMove (srbConn* conn, int catType, char *objID, char *collectionName, char *srcResource, char *newResourceName, char *newPathName, char *container);
srbObjWrite
/*
* srbObjWrite - Write len bytes of buf into the Object fd * * Input - srbConn* conn - From clConnect (). * int desc - The Object descriptor to write (from svrObjOpen or * svrObjCreate). * char *buf - The output buffer. * int len - The length to write. * * Output - Returns the number of bytes written.. * Returns a negative value upon failure. * */
extern int srbObjWrite(srbConn *conn, int desc, char *buf, int len);
srbCreateCollect
/*
* srbCreateCollect - Create a SRB collection * * Input - srbConn* conn - From clConnect (). * int catType - catalog type. e,g., MDAS_CATALOG. * char *parentCollect- The parent collection in which to create * the new collection. * char *newCollect - The name of the collection to create. * * Output - Returns 0 - success. * Returns negative - failure. */
extern int srbCreateCollect (srbConn* conn, int catType, char *parentCollect, char *newCollect);
/*
* srbListCollect - List a SRB collection * * Input - srbConn* conn - From clConnect (). * int catType - catalog type. e,g., MDAS_CATALOG. * char *collectionName- The collection to list. * char *flag - "C" - non-recursive. "R" - recursive * mdasC_sql_result_struct *listResult - The address points to the * result. A pointer to a user supplied mdasC_sql_result_struct. * * Output - Returns 0 - success. * Returns negative - failure. */
extern int srbListCollect (srbConn* conn, int catType, char *collectionName, char *flag, mdasC_sql_result_struct *listResult, int rowsWanted);
srbModifyCollect
/*
* srbModifyCollect - Modify a SRB collection * * Input - srbConn* conn - From clConnect (). * int catType - catalog type. e,g., MDAS_CATALOG. * char *collectionName - The name of the collection this objID * belongs. * char *dataValue1 - Input value 1. * char *dataValue2 - Input value 2. * char *dataValue3 - Input value 3. * int retractionType - The type of retraction. See srbC_mdas_externs.h * for the retractionType definition. * * * Output - Returns 0 - success. * Returns negative - failure. */
extern int srbModifyCollect (srbConn* conn, int catType, char *collectionName, char *dataValue1, char *dataValue2, char *dataValue3, int retractionType);
srbIssueTicket
/*
* srbIssueTicket - Issue a ticket. * * Input - srbConn* conn - From clConnect (). * char *objID - The object ID * char *collectionName - The collection name * char *collectionFlag - The collect flag if vCollectionName * is non NULL. "R" - the ticket is for all dataset and * sub-collection recursively. "D" - the ticket is for the * datasets directly beneath the colloection. * char *beginTime - The beginning time when the ticket * becomes effective. A NULL means no time limit. * char *endTime - The ending time of the ticket. * int accessCnt - The number of time the ticket can be used to * access the dataset. * char *ticketUser - The user/userGroup that will use the * ticket. Multiply users can be specified with the following * format: * user1@domain1&user2@domain2 .... * If it is NULL, => all users. * * char **ticket - The address to put the output ticket. * * Output - Returns 0 - success. * Returns negative - failure. */
extern int srbIssueTicket (srbConn* conn, char *objID, char *collectionName, char *collectionFlag, char *beginTime, char *endTime, int accessCnt, char *ticketUser, char **ticket);
srbRemoveTicket
/* srbRemoveTicket - Cancel a ticket.
* * * Input : char *ticket - The ticket to remove. * * Output : Returns 0 - success, negative - failure */
extern int srbRemoveTicket (srbConn* conn, char *ticket);
srbRemoveTicketWithZone
/* srbRemoveTicketWithZone - Cancel a ticket.
* * * Input : char *ticket - The ticket to remove. * Output : Returns 0 - success, negative - failure */
extern int srbRemoveTicketWithZone (srbConn* conn, char *mcatZone, char *ticket);
srbContainerCreate
/*
* srbContainerCreate - Create a container * * Input - srbConn* conn - From clConnect (). * int catType - catalog type. e,g., MDAS_CATALOG. * char *containName - The name of the container to be created. * char *containerType - Data type of the container. e.g. "generic" * char *resourceName - The storage resource name. This should be is a * logical resource (resource group) consisting of two physical * resources, a TEMPORARY_RES_CL and a PERMANENT_RES_CL class. * srb_long_t containerSize - The size of the container to be created. * * * Output - Returns 0 ==> success. * Returns a negative value upon failure. */
extern int srbContainerCreate (srbConn *conn, int catType, char *containerName, char *containerType, char *resourceName, srb_long_t containerSize);
srbGetContainerInfo
/* * srbGetContainerInfo - Get Info on a SRB container. * * Input : srbConn* conn, * int catType - The catalog type - 0 = MDAS_CATALOG * char *containerName - The name of the container. * mdasC_sql_result_struct *myresult - A pointer to a user supplied * mdasC_sql_result_struct. * int rowsWanted - number of rows of result wanted. * Output: * A mdasC_sql_result_struct *myresult * * Return value : * 0 - success; myresult->continuation_index >= 0, ==> more results from * the query. Use srbGetMoreRows() to retrieve more rows. * a negative value - failure */
extern int srbGetContainerInfo (srbConn *conn, int catType, char *containerName,
mdasC_sql_result_struct *myresult, int rowsWanted);
srbRmContainer
/*
* srbRmContainer - remove a container * * Input - srbConn* conn - From clConnect (). * int catType - catalog type - 0 - MCAT * char *containerName - The name of the container. * int deleteFlag - D_DELETE_ONE - delete the container by the * owner. D_SU_DELETE_TRASH_ONE - remove the container from * the trash bin by admin user. * * Output - Returns 0 if successful. * Returns a negative value upon failure. */
extern int srbRmContainer(srbConn *conn, int catType, char *containerName, int deleteFlag);
srbSyncContainer
/*
* srbSyncContainer - Sync a container - Sync the permanant replica with the * temporary replica. * * Input - srbConn* conn - From clConnect (). * int catType - catalog type - 0 - MCAT * char *containerName - The name of the container. * int syncFlag - valid values are: * PURGE_FLAG - purge the cache copies after sync is done. * PRIMARY_FLAG - Synchronize to the primary archival resource * only. The default is to synchronize all archival resources. * * Output - Returns 0 if successful. * Returns a negative value upon failure. */
extern int srbSyncContainer (srbConn *conn, int catType, char *containerName, int syncFlag);
/*
* srbSyncData - Sync a data object - Synchronize all copies (replica) of * an SRB object with the most recently modified version * latest replica. * * Input - srbConn* conn - From srbConnect (). * int catType - catalog type - 0 - MCAT * char *objID - The SRB object ID to Sync. * char *collectionName - The name of the collection this objID * belongs. * char *resource - The resource for the object to sync to. * A NULL or empty string means synchronize existing copies. * * Output - Returns 0 if successful. * Returns a negative value upon failure. */
srbSyncData
extern int srbSyncData (srbConn *conn, int catType, char *objID, char *collectionName, char *resource);
/*
* srbReplContainer - Replicate a container. * * Input - srbConn* co * Output - Returns 0 if successful. * int catType - catalog type - 0 - MCAT * char *containerName - The name of the container. * char *newResourceName - The resource for the replica. * * Output - Returns 0 if successful. * Returns a negative value upon failure. */
extern int
srbSyncData (srbConn *conn, int catType, char *objID, char *collectionName,
char *resource);
srbContainerOpen
/*
* srbContainerOpen - Open a container for ingestion. * * Input - srbConn* conn - From srbConnect (). * int catType - catalog type - 0 - MCAT * char *containerName - The name of the container. * int openFlag - O_RDWR, O_WRONLY or O_RDONLY. * * Output - Returns 0 if successful. * Returns a negative value upon failure. */
extern int srbContainerOpen (srbConn *conn, int catType, char *containerName, int openFlag);
srbContainerClose
/*
* srbContainerClose - Close an opened a container. * * Input - srbConn* conn - From srbConnect (). * int catType - catalog type - 0 - MCAT * int confFd - The fd returned from srbContainerOpen (). * * Output - Returns 0 if successful. * Returns a negative value upon failure. */
extern int srbContainerClose (srbConn *conn, int confFd);
srbObjCopy
/*
* srbObjCopy - Copy a dataset. This is a client call as oppose to *_srbDataCopy which is only used by the server. * * * Input - srbConn* conn - From srbConnect (). * int catType - catalog type - 0 - MCAT * int confFd - The fd returned from srbContainerOpen (). * * Output - Returns 0 if successful. * Returns a negative value /* * srbObjCopy - Copy a dataset. This is a client call as oppose to *_srbDataCopy which is only used by the server. * * Input - srbConn* conn - From srbConnect (). * char *srcObjID - The source object. * char *srcCollection - The source collection. * char *destObjID - The destination object. * char *destCollection - The destination collection. * char *destResource - The resource to put the destination object. * * Output - Returns the number of bytes copied. * Returns a negative value upon failure. */
extern srb_long_t srbObjCopy(srbConn* conn, char *srcObjID, char *srcCollection, char *destObjID, char *destCollection, char *destResource);
srbObjPut
/*
* srbObjPut - Copy a dataset from local space to SRB space. This is * only used by the SRB client vs _srbDataPut which is used only by the * SRB server. * * Input - srbConn* conn - From srbConnect (). * char *destObjID - The destination objID. * char *destCollection - The destination collwction. * char *destResLoc - The destination resource. * char *dataType - The data type. * char *destPath - The destination path name. * char *locFilePath - The local fullPath name. * srb_long_t size - The size of the file. negative means don't know. * int forceFlag - over write flag * * * Output - Returns the number of bytes copied. * Returns a negative value upon failure. */
extern srb_long_t srbObjPut(srbConn* conn, char *destObjID, char *destCollection, char *destResLoc, char *dataType, char *destPath, char *locFilePath, srb_long_t size, int forceFlag);
srbBulkRegister
/*
* srbBulkRegister - Register inContainer object in bulk. * * Input - srbConn* conn - From srbConnect (). * int catType - catalog type - 0 - MCAT * char *containerName/Resource - For normal objects, this input * specifies the Resource and for inContainer objects, it is the * name of the container. * mdasC_sql_result_struct *myresult - The mdasC_sql_result_struct * that contains the objects to be registered. * myresult->sqlresult[0].values should contain dataNameList * myresult->sqlresult[1].values should contain collectionNameList * myresult->sqlresult[2].values should contain dataSizeList (in ascii) * (I will perform atol) * If all inContainer objects: * myresult->sqlresult[3].values should contain offSetList (in ascii) * * If all normal objects: * myresult->sqlresult[3].values should contain dataType * myresult->sqlresult[4].values should contain physical pathName * myresult->row_count should contain the number of datsets to * be registered. * * int noCheckFlag - 1 - check file permission before register * * * Output - Returns 0 if successful. * Returns a negative value upon failure. */
extern int srbBulkRegister (srbConn *conn, int catType, char *containerName, mdasC_sql_result_struct *myresult, int noCheckFlag);
srbObjGet
/*
* srbObjGet - Copy a dataset from SRB space to local space. This is * only used by the SRB client vs _srbDataGet which is used only by the * SRB server. * * Input - srbConn* conn - From srbConnect (). * char *srcObjID - The source objID. * char *srcCollection - The source collwction. * char *locFilePath - The local fullPath name. * * Output - Returns the number of bytes copied. * Returns a negative value upon failure. */
extern srb_long_t srbObjGet (srbConn* conn, char *srcObjID, char *srcCollection, char *locFilePath);
srbObjGetC
/*
* srbObjGetC - The client initiated version of srbObjGet. Copy a dataset * from SRB space to local space. This is only used by the SRB client * vs _srbDataGet which is used only by the SRB server. * * Input - srbConn* conn - From srbConnect (). * char *srcObjID - The source objID. * char *srcCollection - The source collwction. * char *locFilePath - The local fullPath name. * int flag - not used currently * int numThreads - number of threads * * Output - Returns the number of bytes copied. * Returns a negative value upon failure. */
extern srb_long_t srbObjGetC (srbConn* conn, char *srcObjID, char *srcCollection, char *locFilePath, int flag, int numThreads);
srbExecFunction
/*
* srbExecFunction - Proxy Operation that exec a function. * * Input - srbConn* conn - From srbConnect (). * char *function - The function to run. * char *functionArgv - The function argument string * char *proxyAddr - The host address where this proxy operation * should be performed. NULL => the server for the * current connect. * int portalFlag - The portal flag (see definition in srb.h). * Valid flags are - PORTAL_OFF, PORTAL_ON, * PORTAL_STD_IN_OUT. * * * * Output - Returns 0 or positive value upon success. * Returns a negative value upon failure. * outBuf - any byte stream output. */
extern int srbExecFunction (srbConn *conn, char *function, char *functionArgv, char *proxyAddr, int portalFlag);
srbBulkLoad
/*
* srbBulkLoad - Bulk load a set of data. All the actual data should * already be contained in bloadFullPath, but in concatenated form * just as in the case of a container. * * Input - srbConn* conn - From srbConnect (). * int catType - catalog type - 0 - MCAT * char *bloadFullPath - The name of the container. * mdasC_sql_result_struct *myresult - The mdasC_sql_result_struct * that contains the objects to be registered. * myresult->sqlresult[0].values should contain dataNameList * myresult->sqlresult[1].values should contain collectionNameList * myresult->sqlresult[2].values should contain dataSizeList (in ascii) * (I will perform atol) * myresult->sqlresult[3].values should contain offSetList (in ascii) * myresult->row_count should contain the number of datsets to * be registered. * myresult->continuation_index 0 - no chksum; K_FLAG - verify and register * chksum. * * Output - Returns 0 if successful. * Returns a negative value upon failure. */
extern int srbBulkLoad (srbConn *conn, int catType, char *bloadFullPath, mdasC_sql_result_struct *myresult);
srbBulkUnload
/*
* srbBulkUnload - Bulk unload of non-container files in a collection * recursively. * * Input - srbConn* conn - From srbConnect (). * int flag - flag value for future use. * char *collection - The collection to unload * mdasC_sql_result_struct *myresult - A list of files to be * unloaded. * * Output - In addition to myresult, returns 0 or positive value * representing the socket fd from which the data will come. * */
extern int srbBulkUnload (srbConn *conn, int catType, int flag, char *collection, mdasC_sql_result_struct **myresult);
srbObjChksum
/*
* srbObjChksum - Checksum a SRB data file. By default, if the chksum * already already exists, do nothing and return the cjksum value. * If the chksum does not exist, compute and reigister it. * * Input - srbConn* conn - From srbConnect (). * char *objID - The data name. * char *collectionName - The collection name. * int chksumFlag - valid flags are : * l_FLAG - list the registered chksum value. * c_FLAG - compute chksum, but don't register * f_FLAG - force compute and register of chksum even if one * already exist. * char *inpChksum - No used. * * Output - 0 - success, CHKSUM_REG - a new chksum has been registered, * Returns a negative value upon failure. * the CALLER must have allocated enough space in char * chksum to hold * the result returned */
extern int srbObjChksum (srbConn *conn, char *objID, char *collectionName, int chksumFlag, char *inpChksum, char *chksum);
srbGetMcatZone
/*
* srbGetMcatZone - Get the Mcat Zone of this user. * * Input - srbConn* conn - From srbConnect (). * char *userName - The input userName. * char *domainName - The input domainName. * char *mcatName - The output mcatname. It should be preallocated * with length MAX_TOKEN * * Output - Returns 0 if success. * Returns a negative value upon failure. * the CALLER must have allocated enough space to hold the result returned */
extern int srbGetMcatZone(srbConn *conn, char *userName, char *domainName, char *mcatName);
srbObjPutC
/*
* srbObjPutC - The client initiated version of srbObjPut. Copy a dataset * from local space to SRB space. This is only used by the SRB client vs * _srbDataPut which is used only by the SRB server. * * Input - srbConn* conn - From srbConnect (). * char *destObjID - The destination objID. * char *destCollection - The destination collwction. * char *destResLoc - The destination resource. * char *dataType - The data type. * char *destPath - The destination path name. * char *locFilePath - The local fullPath name. * srb_long_t size - The size of the file. negative means don't know. * int forceFlag - over write flag * int numThreads - number of threads * * Output - Returns the number of bytes copied. * Returns a negative value upon failure. */
srb_long_t srbObjPutC (srbConn* conn, char *destObjID, char *destCollection, char *destResLoc, char *dataType, char *destPath, char *locFilePath, srb_long_t size, int forceFlag, int numThreads);
srbGetFsFreeSpace
/*
* srbGetFsFreeSpace - get the FS free space in bytes of the FS where the * input path is a file or directory. * * Input - srbConn* conn - From srbConnect (). * int storSysType - Storage system type. * 0 = Unix, 1 = UniTree, 2 = HPSS, 3 = FTP, 4 = HTTP. * char *hostAddr - The Host address of the SRB. * char *path - A file or directory path in the FS * int flag - not used * * Output - Returns the free space in bytes upon success. * Returns a negative value upon failure. */
srb_long_t srbGetFsFreeSpace (srbConn *conn, int storSysType, char *hostAddr, char *path, int flag);
srbObjFStage
/*
* srbObjFStage - Stage a SRB object. Only applicable to samfs resource. * * Input - srbConn* conn - From srbConnect (). * int catType - catalog type. e,g., MDAS_CATALOG. * char *objID - The SRB object ID to stage. The objID is obtained * through registration with MDAS. * char *collectionName - The collection of the objID. * char *resource - stage the copy in this resource. * int flag - not used currently. * * Output - Returns 0 upon success, a negative value upon failure. */
int srbObjFStage(srbConn* conn, int catType, char *objID, char *collectionName, char *resource, int flag);
srbBackupData
/*
* srbBackupData - Backup a data object - Make a replica to the backup * resource. Skip it if a good copy already exist. * * Input - srbConn* conn - From srbConnect (). * int catType - catalog type - 0 - MCAT * char *objID - The SRB object ID to Sync. * char *collectionName - The name of the collection this objID * belongs. * char *backupResource - The backup resource * int flag - not used. * * Output - Returns 0 if successful. * Returns a negative value upon failure. */
int srbBackupData (srbConn *conn, int catType, char *objID, char *collectionName, char *backupResource, int flag);
srbGetSvrVersion
/*
* srbGetSvrVersion - Get the Server version * * Input - srbConn* conn - From srbConnect (). * char **outbuf - Pointer to point of output buffer. * * Output - Returns the status. * Returns a negative value upon failure. */
int srbGetSvrVersion(srbConn *conn, char *outbuf);
srbExecCommand
/*
* srbExecCommand - Proxy Operation that exec a command. * * Input - srbConn* conn - From srbConnect (). * char *command - The command to run. * char *commandArgv - The command argument string * char *proxyAddr - The host address where this proxy operation * should be performed. NULL => the server for the * current connect. * char *filename - The file Path name to open. Must be an * absolute path. * int portalFlag - The portal flag (see definition in srb.h). * Valid flags are - PORTAL_OFF, PORTAL_ON, * PORTAL_STD_IN_OUT. * * * * Output - Returns 0 or positive value upon success. * Returns a negative value upon failure. * outBuf - any byte stream output. */
int srbExecCommand (srbConn *conn, char *command, char *commandArgv, char *proxyAddr, char *filename, int portalFlag);
srbBulkUnloadC
/*
* srbBulkUnloadC - The client initiated socket conection version of * Bulk unload of non-container files in a collection * recursively. * * Input - srbConn* conn - From srbConnect (). * int flag - flag value for future use. * char *collection - The collection to unload * mdasC_sql_result_struct *myresult - A list of files to be * unloaded. * * Output - In addition to myresult, returns 0 or positive value * representing the socket fd from which the data will come. * */
int srbBulkUnloadC (srbConn *conn, int catType, int flag, char *collection, mdasC_sql_result_struct **myresult);
srbBulkCopy
/*
* srbBulkCopy - Bulk copy recursively from a collection to another. * * Input - srbConn* conn - From clConnect (). * int catType - catalog type. e,g., MDAS_CATALOG. * char *collectionName - The collection * int flag - not used * char *destResource - The target resource to move to. * char *destCollection - The destination collection * Output - Returns 0 - success. * Returns negative - failure. */
int srbBulkCopy (srbConn* conn, int catType, char *collectionName, int flag, char *destResource, char *destCollection);
srbExecCommandC
/*
* srbExecCommandC - Proxy Operation that exec a command - client * initiated. * * Input - srbConn* conn - From srbConnect (). * char *command - The command to run. * char *commandArgv - The command argument string * char *proxyAddr - The host address where this proxy operation * should be performed. NULL => the server for the * current connect. * char *filename - The file Path name to open. Must be an * absolute path. * int portalFlag - The portal flag (see definition in srb.h). * Valid flags are - PORTAL_OFF, PORTAL_ON, * PORTAL_STD_IN_OUT. * * * * Output - Returns 0 or positive value upon success. * Returns a negative value upon failure. * outBuf - any byte stream output. */
int srbExecCommandC (srbConn *conn, char *command, char *commandArgv, char *proxyAddr, char *filename, int portalFlag);
srb_perror
/*--------------------------------------------------------------------------
void srb_perror(fd, error_id, error_mnenomic, flags)
SYNOPSIS
#include <srbErrno.h>
void srb_perror(fd, error_id, error_mnenomic, flags);
DESCRIPTION
srb_error() emits an SRB error message corresponding to the SRB
error referred to by <error_id> or <error_mnenomic> (if non-null) .
if both <error_id> and <error_mnenomic> are passed, <error_mnenomic>
will take precedence.
The message is emitted to the file
descriptor referred to by <fd>. If <fd> is invalid, the
error will be emitted to the stderr (fd 2).
Optional behavior of srb_perror is controlled by the <flags>
parameter. <flags> is constructed by ORing the following values:
SRB_LONG_MSG Emit the SRB error long message.
SRB_RCMD_ACTION Emit the SRB recommended action.
The format of the message emitted to <fd> is as follows:
srb error mnenomic: srb short message
[ srb long message ]
[ srb recommended action ]
INPUT PARAMETERS
fd Refers to a file description to which the message should
be emitted. If fd is invalid, the message will be emitted
to stderr.
error_id Refers to a valid SRB error id from the SRB error message
table contained within srb_error.h. If the error id
is invalid, the error SRB_NO_ERROR will be emitted.
flags Contains the OR'ed value of the flags described above.
*/
void srb_perror(int fd, int error_id, char *error_mnenomic, int flags);
srbConnect
/*
* srbConnect() - Establishes a connectin to a srbServer through the srbMaster * at the specified host and port. This is a new version of clConnect(). * clConnect() still exists for backward compatibility purpose. * * Input : char *srbHost - The host address of srbMaster. * If the input value in NULL, it will use the env variable * "srbHost" if it is defined. If not, it use the hostname of the * client machine. * char *srbPort - The port # of srbMaster. If the input value in NULL, * it will use the env variable "srbPort" if it is defined. * If not, it defaults to the default port 5558). * char *srbAuth - The auth string. It is used to define the password * for MDAS or SEA authentication. For SEA authentication, this is * the password used by the SEA library to decrypt the encrypted * private key stored in the file ~/.SEAuuuuu@ddddd (where uuuuu * is the user ID and ddddd is the user domain name). This input is * not needed if an unencrypted private key is available in the * /tmp directory (generated using the 'seaauth auto' command). * To provide additional flexibility, a client may also use the * env variable "srbAuth" to specify the password. If the MDAS * authentication scheme, a client may also supply the password in * the ~.srb/.MdasAuth file. If a client uses more than one method * to specify the password, the vaule given in this function * call will take precedent, the env variable "srbAuth" comes next * and the ~.srb/.MdasAuth file is last. * char *userName - The user ID in the SRB env. * char *domainName - The user domain. * char *authScheme - The authentication scheme to use. Valid values * are: "PASSWD_AUTH", "SEA_AUTH", "SEA_ENCRYPT", "GSI_AUTH" and * "GSI_SECURE_COMM" given in clAuthExtern.h. * char *serverDn - the distinguish name of the server user. Valid * only for the "GSI_AUTH" and "GSI_SECURE_COMM". * * Output - returns a srbConn* which is needed for all subsequent calls. * if the status field of the connection returned is CONNECTION_BAD, * then some fields may be null'ed out instead of having valid values */
srbConn* srbConnect(char *srbHost, char* srbPort, char* srbAuth, char *userName, char *domainName, char *authScheme, char *serverDn);
clConnect
/*
* clConnect() - Establishes a connectin to a srbServer through the srbMaster * at the specified host and port. This call is being replaced by srbConnect. * * Input : char *srbHost - The host address of srbMaster. * If the input value in NULL, it will use the env variable * "srbHost" if it is defined. If not, it use the hostname of the * client machine. * char *srbPort - The port # of srbMaster. If the input value in NULL, * it will use the env variable "srbPort" if it is defined. * If not, it defaults to the default port 5558). * char *srbAuth - The auth string. It is used to define the password * for MDAS or SEA authentication. For SEA authentication, this is * the password used by the SEA library to decrypt the encrypted * private key stored in the file ~/.SEAuuuuu@ddddd (where uuuuu * is the user ID and ddddd is the user domain name). This input is * not needed if an unencrypted private key is available in the * /tmp directory (generated using the 'seaauth auto' command). * To provide additional flexibility, a client may also use the * env variable "srbAuth" to specify the password. If the MDAS * authentication scheme, a client may also supply the password in * the ~.srb/.MdasAuth file. If a client uses more than one method * to specify the password, the vaule given in this function * call will take precedent, the env variable "srbAuth" comes next * and the ~.srb/.MdasAuth file is last. * * Output - returns a srbConn* which is needed for all subsequent calls. * if the status field of the connection returned is CONNECTION_BAD, * then some fields may be null'ed out instead of having valid values */
srbConn* clConnect(char *srbHost, char* srbPort, char* srbAuth);
tiUserConnect
/*
* tiUserConnect() - Establishes a connection to a srbServer through the * srbMaster at the specified host and port by a TICKET USER. Normal * authentication will be bypassed for a TICKET USER. * * Input : char *srbHost - The host address of srbMaster. * If the input value in NULL, it will use the env variable * "srbHost" if it is defined. If not, it use the hostname of the * client machine. * char *srbPort - The port # of srbMaster. If the input value in NULL, * it will use the env variable "srbPort" if it is defined. * If not, it defaults to the default port 5558). * * Output - returns a srbConn* which is needed for all subsequent calls. * if the status field of the connection returned is CONNECTION_BAD, * then some fields may be null'ed out instead of having valid values */
srbConn* tiUserConnect(char *srbHost, char* srbPort);
clFinish
/* clFinish - close a connection to the SRB server
* also frees the srbConn data structure so it shouldn't be re-used * after this */
void clFinish(srbConn *conn);
clErrorMessage
/* clErrorMessage - Returns the ErrorMessage of a connection. This is the
* error message returned by the SRB server from the current client call. * * Input - srbConn* conn (from clConnect()) * Output - The pointer to ErrorMessage */
char* clErrorMessage(srbConn* conn);


