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)  

rsSubStructFileTruncate.cpp
Go to the documentation of this file.
1 
4 #include "miscServerFunct.hpp"
5 #include "dataObjOpr.hpp"
7 
9 
10 
11 int
14  int remoteFlag;
15  int status;
16 
17  remoteFlag = resolveHost( &subFile->addr, &rodsServerHost );
18 
19  if ( remoteFlag == LOCAL_HOST ) {
20  status = _rsSubStructFileTruncate( rsComm, subFile );
21  }
22  else if ( remoteFlag == REMOTE_HOST ) {
24  }
25  else {
26  if ( remoteFlag < 0 ) {
27  return remoteFlag;
28  }
29  else {
31  "rsSubStructFileTruncate: resolveHost returned unrecognized value %d",
32  remoteFlag );
34  }
35  }
36 
37  return status;
38 }
39 
40 int
43  int status;
44 
45  if ( rodsServerHost == NULL ) {
47  "remoteSubStructFileTruncate: Invalid rodsServerHost" );
49  }
50 
51  if ( ( status = svrToSvrConnect( rsComm, rodsServerHost ) ) < 0 ) {
52  return status;
53  }
54 
56 
57  if ( status < 0 ) {
59  "remoteSubStructFileTruncate: rcSubStructFileTruncate failed for %s, status = %d",
60  subFile->subFilePath, status );
61  }
62 
63  return status;
64 }
65 
67  subFile_t * _sub_file ) {
68  // =-=-=-=-=-=-=-
69  // create first class structured object
71  new irods::structured_object( *_sub_file ) );
72  struct_obj->comm( _comm );
73  struct_obj->resc_hier( _sub_file->specColl->rescHier );
74 
75  // =-=-=-=-=-=-=-
76  // call abstrcated interface to truncate
77  irods::error trunc_err = fileTruncate( _comm, struct_obj );
78  if ( !trunc_err.ok() ) {
79  std::stringstream msg;
80  msg << "failed on call to fileTruncate for [";
81  msg << struct_obj->physical_path();
82  msg << "]";
83  irods::log( PASSMSG( msg.str(), trunc_err ) );
84  return trunc_err.code();
85 
86  }
87  else {
88  return trunc_err.code();
89 
90  }
91 
92 }
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
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
Subfile
Definition: objInfo.h:316
SYS_UNRECOGNIZED_REMOTE_FLAG
@ SYS_UNRECOGNIZED_REMOTE_FLAG
Definition: rodsErrorTable.h:88
Subfile::subFilePath
char subFilePath[(1024+64)]
Definition: objInfo.h:318
REMOTE_HOST
#define REMOTE_HOST
Definition: rodsConnect.h:45
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
Subfile::specColl
specColl_t * specColl
Definition: objInfo.h:322
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
rsSubStructFileTruncate
int rsSubStructFileTruncate(rsComm_t *rsComm, subFile_t *subFile)
Definition: rsSubStructFileTruncate.cpp:12
irods::error::code
long long code() const
Definition: irods_error.cpp:194
remoteSubStructFileTruncate
int remoteSubStructFileTruncate(rsComm_t *rsComm, subFile_t *subFile, rodsServerHost_t *rodsServerHost)
Definition: rsSubStructFileTruncate.cpp:41
rsSubStructFileTruncate.hpp
irods::structured_object
Definition: irods_structured_object.hpp:15
SYS_INVALID_SERVER_HOST
@ SYS_INVALID_SERVER_HOST
Definition: rodsErrorTable.h:89
Subfile::addr
rodsHostAddr_t addr
Definition: objInfo.h:317
svrToSvrConnect
int svrToSvrConnect(rsComm_t *rsComm, rodsServerHost_t *rodsServerHost)
Definition: miscServerFunct.cpp:106
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
SpecColl::rescHier
char rescHier[(1024+64)]
Definition: objInfo.h:84
_rsSubStructFileTruncate
int _rsSubStructFileTruncate(rsComm_t *_comm, subFile_t *_sub_file)
Definition: rsSubStructFileTruncate.cpp:66
irods::log
void log(const error &)
Definition: irods_log.cpp:13
irods::structured_object_ptr
boost::shared_ptr< structured_object > structured_object_ptr
Definition: irods_structured_object.hpp:107
fileTruncate
irods::error fileTruncate(rsComm_t *, irods::first_class_object_ptr)
Definition: fileDriver.cpp:514
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
rcSubStructFileTruncate
int rcSubStructFileTruncate(rcComm_t *conn, subFile_t *subStructFileTruncateInp)
Definition: rcSubStructFileTruncate.cpp:23
rodsServerHost
Definition: rodsConnect.h:62
subStructFileTruncate.h
irods_structured_object.hpp
dataObjOpr.hpp
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375