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)  

rsEndTransaction.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See endTransaction.h for a description of this API call.*/
5 
6 #include "endTransaction.h"
8 #include "miscServerFunct.hpp"
10 #include "rsEndTransaction.hpp"
11 
12 int
13 rsEndTransaction( rsComm_t *rsComm, endTransactionInp_t *endTransactionInp ) {
15  int status;
16 
17  rodsLog( LOG_DEBUG, "endTransaction" );
18 
19  status = getAndConnRcatHost( rsComm, MASTER_RCAT, ( const char* )NULL, &rodsServerHost );
20  if ( status < 0 ) {
21  return status;
22  }
23 
25  std::string svc_role;
26  irods::error ret = get_catalog_service_role(svc_role);
27  if(!ret.ok()) {
28  irods::log(PASS(ret));
29  return ret.code();
30  }
31  if( irods::CFG_SERVICE_ROLE_PROVIDER == svc_role ) {
32  status = _rsEndTransaction( rsComm, endTransactionInp );
33  } else if( irods::CFG_SERVICE_ROLE_CONSUMER == svc_role ) {
35  } else {
36  rodsLog(
37  LOG_ERROR,
38  "role not supported [%s]",
39  svc_role.c_str() );
41  }
42 
43  }
44  else {
46  endTransactionInp );
47  }
48 
49  if ( status < 0 ) {
51  "rsEndTransaction: rcEndTransaction failed" );
52  }
53  return status;
54 }
55 
56 int
57 _rsEndTransaction( rsComm_t *rsComm, endTransactionInp_t *endTransactionInp ) {
58  int status;
59 
61  "_rsEndTransaction arg0=%s",
62  endTransactionInp->arg0 );
63 
64  if ( strcmp( endTransactionInp->arg0, "commit" ) == 0 ) {
65  status = chlCommit( rsComm );
66  return status;
67  }
68 
69  if ( strcmp( endTransactionInp->arg0, "rollback" ) == 0 ) {
70  status = chlRollback( rsComm );
71  return status;
72  }
73 
74  return CAT_INVALID_ARGUMENT;
75 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
irods::CFG_SERVICE_ROLE_CONSUMER
const std::string CFG_SERVICE_ROLE_CONSUMER("consumer")
irods_configuration_keywords.hpp
rodsServerHost::localFlag
int localFlag
Definition: rodsConnect.h:68
SYS_SERVICE_ROLE_NOT_SUPPORTED
@ SYS_SERVICE_ROLE_NOT_SUPPORTED
Definition: rodsErrorTable.h:217
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
chlCommit
int chlCommit(rsComm_t *rsComm)
Definition: icatHighLevelRoutines.cpp:1090
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
_rsEndTransaction
int _rsEndTransaction(rsComm_t *rsComm, endTransactionInp_t *endTransactionInp)
Definition: rsEndTransaction.cpp:57
rsEndTransaction.hpp
irods::error::code
long long code() const
Definition: irods_error.cpp:194
LOG_DEBUG
#define LOG_DEBUG
Definition: rodsLog.h:23
irods::CFG_SERVICE_ROLE_PROVIDER
const std::string CFG_SERVICE_ROLE_PROVIDER("provider")
endTransactionInp_t
Definition: endTransaction.h:6
chlRollback
int chlRollback(rsComm_t *rsComm)
Definition: icatHighLevelRoutines.cpp:1039
endTransaction.h
SYS_NO_RCAT_SERVER_ERR
@ SYS_NO_RCAT_SERVER_ERR
Definition: rodsErrorTable.h:110
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
irods::log
void log(const error &)
Definition: irods_log.cpp:13
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::error
Definition: irods_error.hpp:23
rsEndTransaction
int rsEndTransaction(rsComm_t *rsComm, endTransactionInp_t *endTransactionInp)
Definition: rsEndTransaction.cpp:13
miscServerFunct.hpp
getAndConnRcatHost
int getAndConnRcatHost(rsComm_t *rsComm, int rcatType, const char *rcatZoneHint, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:26
MASTER_RCAT
#define MASTER_RCAT
Definition: rodsDef.h:85
get_catalog_service_role
irods::error get_catalog_service_role(std::string &_role)
Definition: miscServerFunct.cpp:3153
rodsServerHost
Definition: rodsConnect.h:62
icatHighLevelRoutines.hpp
CAT_INVALID_ARGUMENT
@ CAT_INVALID_ARGUMENT
Definition: rodsErrorTable.h:431
rcEndTransaction
int rcEndTransaction(rcComm_t *conn, endTransactionInp_t *endTransactionInp)
Definition: rcEndTransaction.cpp:31
endTransactionInp_t::arg0
char * arg0
Definition: endTransaction.h:7
irods::error::ok
bool ok()
Definition: irods_error.cpp:258