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)  

irods_resource_manager.cpp
Go to the documentation of this file.
1 // =-=-=-=-=-=-=-
2 #include "rcMisc.h"
4 #include "irods_log.hpp"
6 #include "irods_stacktrace.hpp"
8 #include "irods_load_plugin.hpp"
9 #include "irods_lexical_cast.hpp"
10 #include "rsGenQuery.hpp"
11 
12 // =-=-=-=-=-=-=-
13 // irods includes
14 #include "getRescQuota.h"
17 #include "rsGlobalExtern.hpp"
18 #include "generalAdmin.h"
19 #include "phyBundleColl.h"
20 #include "miscServerFunct.hpp"
21 #include "genQuery.h"
22 
23 // =-=-=-=-=-=-=-
24 // stl includes
25 #include <iostream>
26 #include <vector>
27 #include <iterator>
28 
29 // =-=-=-=-=-=-=-
30 // global singleton
32 
33 namespace irods {
34 // =-=-=-=-=-=-=-
35 // public - Constructor
37  } // ctor
38 
39 // =-=-=-=-=-=-=-
40 // public - Copy Constructor
42  } // cctor
43 
44 // =-=-=-=-=-=-=-
45 // public - Destructor
47  } // cctor
48 
49 // =-=-=-=-=-=-=-
50 // public - retrieve a resource given its key
52  std::string _key,
53  resource_ptr& _value ) {
54 
55  if ( _key.empty() ) {
56  return ERROR( SYS_INVALID_INPUT_PARAM, "empty key" );
57  }
58 
59  if ( resource_name_map_.has_entry( _key ) ) {
60  _value = resource_name_map_[ _key ];
61  return SUCCESS();
62 
63  }
64  else {
65  std::stringstream msg;
66  msg << "no resource found for name ["
67  << _key << "]";
68  return ERROR( SYS_RESC_DOES_NOT_EXIST, msg.str() );
69 
70  }
71 
72  } // resolve
73 
74 // =-=-=-=-=-=-=-
75 // public - retrieve a resource given its key
77  rodsLong_t _resc_id,
78  resource_ptr& _value ) {
79  if ( resource_id_map_.has_entry( _resc_id ) ) {
80  _value = resource_id_map_[ _resc_id ];
81  return SUCCESS();
82 
83  }
84  else {
85  std::stringstream msg;
86  msg << "no resource found for name ["
87  << _resc_id << "]";
88  return ERROR( SYS_RESC_DOES_NOT_EXIST, msg.str() );
89 
90  }
91 
92  } // resolve
93 
95  resource_ptr& _plugin,
96  const std::string _plugin_name,
97  const std::string _inst_name,
98  const std::string _context ) {
99  resource* resc = 0;
100  error ret = load_plugin< resource >(
101  resc,
102  _plugin_name,
104  _inst_name,
105  _context );
106  if ( ret.ok() && resc ) {
107  _plugin.reset( resc );
108  }
109  else {
110  if ( ret.code() == PLUGIN_ERROR_MISSING_SHARED_OBJECT ) {
111  rodsLog(
112  LOG_DEBUG,
113  "loading impostor resource for [%s] of type [%s] with context [%s] and load_plugin message [%s]",
114  _inst_name.c_str(),
115  _plugin_name.c_str(),
116  _context.c_str(),
117  ret.result().c_str());
118  _plugin.reset(
119  new impostor_resource(
120  "impostor_resource", "" ) );
121  } else {
122  return PASS( ret );
123  }
124  }
125 
126  return SUCCESS();
127 
128  } // load_resource_plugin
129 
130 // =-=-=-=-=-=-=-
131 // public - retrieve a resource given a vault path
133  std::string _physical_path,
134  rodsServerHost_t* _svr_host,
135  std::string& _out_path ) {
136  // =-=-=-=-=-=-=-
137  // simple flag to state a resource matching the prop and value is found
138  bool found = false;
139 
140  // =-=-=-=-=-=-=-
141  // quick check on the resource table
142  if ( resource_name_map_.empty() ) {
143  return ERROR( SYS_INVALID_INPUT_PARAM, "empty resource table" );
144  }
145 
146  // =-=-=-=-=-=-=-
147  // quick check on the path that it has something in it
148  if ( _physical_path.empty() ) {
149  return ERROR( SYS_INVALID_INPUT_PARAM, "empty property" );
150  }
151 
152  // =-=-=-=-=-=-=-
153  // iterate through the map and search for our path
155  for ( ; !found && itr != resource_name_map_.end(); ++itr ) {
156  // =-=-=-=-=-=-=-
157  // get the host pointer from the resource
158  rodsServerHost_t* svr_host = 0;
159  error ret = itr->second->get_property< rodsServerHost_t* >( RESOURCE_HOST, svr_host );
160  if ( !ret.ok() ) {
161  PASS( ret );
162  }
163 
164  // =-=-=-=-=-=-=-
165  // if this host matches the incoming host pointer then were good
166  // otherwise continue searching
167  if ( svr_host != _svr_host ) {
168  continue;
169  }
170 
171  // =-=-=-=-=-=-=-
172  // query resource for the property value
173  std::string path;
174  ret = itr->second->get_property<std::string>( RESOURCE_PATH, path );
175 
176  // =-=-=-=-=-=-=-
177  // if we get a good parameter and do not match non-storage nodes with an empty physical path
178  if ( ret.ok() ) {
179  // =-=-=-=-=-=-=-
180  // compare incoming value and stored value
181  // one may be a subset of the other so compare both ways
182  if ( !path.empty() && ( _physical_path.find( path ) != std::string::npos ) ) {
183  found = true;
184  _out_path = path;
185  }
186 
187  }
188  else {
189  std::stringstream msg;
190  msg << "resource_manager::resolve_from_physical_path - ";
191  msg << "failed to get vault parameter from resource";
192  msg << ret.code();
193  irods::log( PASSMSG( msg.str(), ret ) );
194 
195  }
196 
197  } // for itr
198 
199  // =-=-=-=-=-=-=-
200  // did we find a resource and is the ptr valid?
201  if ( true == found ) {
202  return SUCCESS();
203  }
204  else {
205  std::stringstream msg;
206  msg << "failed to find resource for path [";
207  msg << _physical_path;
208  msg << "]";
209  return ERROR( SYS_INVALID_INPUT_PARAM, msg.str() );
210  }
211 
212  } // validate_vault_path
213 
214 // =-=-=-=-=-=-=-
215 // public - connect to the catalog and query for all the
216 // attached resources and instantiate them
218  // =-=-=-=-=-=-=-
219  // clear existing resource map and initialize
221 
222  // =-=-=-=-=-=-=-
223  // set up data structures for a gen query
224  genQueryInp_t genQueryInp;
225  genQueryOut_t* genQueryOut = NULL;
226 
227  error proc_ret;
228 
229  memset( &genQueryInp, 0, sizeof( genQueryInp ) );
230 
231  addInxIval( &genQueryInp.selectInp, COL_R_RESC_ID, 1 );
232  addInxIval( &genQueryInp.selectInp, COL_R_RESC_NAME, 1 );
233  addInxIval( &genQueryInp.selectInp, COL_R_ZONE_NAME, 1 );
234  addInxIval( &genQueryInp.selectInp, COL_R_TYPE_NAME, 1 );
235  addInxIval( &genQueryInp.selectInp, COL_R_CLASS_NAME, 1 );
236  addInxIval( &genQueryInp.selectInp, COL_R_LOC, 1 );
237  addInxIval( &genQueryInp.selectInp, COL_R_VAULT_PATH, 1 );
238  addInxIval( &genQueryInp.selectInp, COL_R_FREE_SPACE, 1 );
239  addInxIval( &genQueryInp.selectInp, COL_R_RESC_INFO, 1 );
240  addInxIval( &genQueryInp.selectInp, COL_R_RESC_COMMENT, 1 );
241  addInxIval( &genQueryInp.selectInp, COL_R_CREATE_TIME, 1 );
242  addInxIval( &genQueryInp.selectInp, COL_R_MODIFY_TIME, 1 );
243  addInxIval( &genQueryInp.selectInp, COL_R_RESC_STATUS, 1 );
244  addInxIval( &genQueryInp.selectInp, COL_R_RESC_CHILDREN, 1 );
245  addInxIval( &genQueryInp.selectInp, COL_R_RESC_CONTEXT, 1 );
246  addInxIval( &genQueryInp.selectInp, COL_R_RESC_PARENT, 1 );
247  addInxIval( &genQueryInp.selectInp, COL_R_RESC_PARENT_CONTEXT, 1 );
248 
249  genQueryInp.maxRows = MAX_SQL_ROWS;
250 
251  // =-=-=-=-=-=-=-
252  // init continueInx to pass for first loop
253  int continueInx = 1;
254 
255  // =-=-=-=-=-=-=-
256  // loop until continuation is not requested
257  while ( continueInx > 0 ) {
258  // =-=-=-=-=-=-=-
259  // perform the general query
260  int status = rsGenQuery( _comm, &genQueryInp, &genQueryOut );
261 
262  // =-=-=-=-=-=-=-
263  // perform the general query
264  if ( status < 0 ) {
265  freeGenQueryOut( &genQueryOut );
266  clearGenQueryInp( &genQueryInp );
267  if ( status != CAT_NO_ROWS_FOUND ) {
268  // actually an error
269  rodsLog( LOG_NOTICE, "initResc: rsGenQuery error, status = %d",
270  status );
271  return ERROR( status, "genQuery failed." );
272  }
273 
274  break; // CAT_NO_ROWS_FOUND expected at the end of a query
275 
276  } // if
277 
278  // =-=-=-=-=-=-=-
279  // given a series of rows, each being a resource, create a resource and add it to the table
280  proc_ret = process_init_results( genQueryOut );
281 
282  // =-=-=-=-=-=-=-
283  // if error is not valid, clear query and bail
284  if ( !proc_ret.ok() ) {
285  irods::error log_err = PASSMSG( "init_from_catalog - process_init_results failed", proc_ret );
286  irods::log( log_err );
287  freeGenQueryOut( &genQueryOut );
288  break;
289  }
290  else {
291  if ( genQueryOut != NULL ) {
292  continueInx = genQueryInp.continueInx = genQueryOut->continueInx;
293  freeGenQueryOut( &genQueryOut );
294  }
295  else {
296  continueInx = 0;
297  }
298 
299  } // else
300 
301  } // while
302 
303  freeGenQueryOut( &genQueryOut );
304  clearGenQueryInp( &genQueryInp );
305 
306  // =-=-=-=-=-=-=-
307  // pass along the error if we are in an error state
308  if ( !proc_ret.ok() ) {
309  return PASSMSG( "process_init_results failed.", proc_ret );
310  }
311 
312  // =-=-=-=-=-=-=-
313  // Update child resource maps
314  proc_ret = init_child_map();
315  if ( !proc_ret.ok() ) {
316  return PASSMSG( "init_child_map failed.", proc_ret );
317  }
318 
319  // =-=-=-=-=-=-=-
320  // gather the post disconnect maintenance operations
321  error op_ret = gather_operations();
322  if ( !op_ret.ok() ) {
323  return PASSMSG( "gather_operations failed.", op_ret );
324  }
325 
326  // =-=-=-=-=-=-=-
327  // call start for plugins
328  error start_err = start_resource_plugins();
329  if ( !start_err.ok() ) {
330  return PASSMSG( "start_resource_plugins failed.", start_err );
331  }
332 
333  // =-=-=-=-=-=-=-
334  // win!
335  return SUCCESS();
336 
337  } // init_from_catalog
338 
339 // =-=-=-=-=-=-=-
342  // =-=-=-=-=-=-=-
343  // iterate over all resources in the table
345  for ( itr = resource_name_map_.begin();
346  itr != resource_name_map_.end();
347  ++itr ) {
348  itr->second->stop_operation();
349 
350  } // for itr
351 
352  return SUCCESS();
353 
354  } // shut_down_resources
355 
356 // =-=-=-=-=-=-=-
359  std::vector< std::string >& _list ) {
360  // =-=-=-=-=-=-=-
361  // iterate over all resources in the table
363  for ( itr = resource_name_map_.begin();
364  itr != resource_name_map_.end();
365  ++itr ) {
366  resource_ptr resc = itr->second;
367  resource_ptr parent_ptr;
368  error ret = itr->second->get_parent( parent_ptr );
369  if ( !ret.ok() ) {
370  std::string resc_name;
371  ret = resc->get_property< std::string >( RESOURCE_NAME, resc_name );
372  if ( !ret.ok() ) {
373  return PASS( ret );
374  }
375 
376  _list.push_back( resc_name );
377 
378  }
379 
380  } // for itr
381 
382  return SUCCESS();
383 
384  } // get_root_resources
385 
387  resource_ptr _resc,
388  std::string& _name ) {
389 
390  std::string my_name;
391  error ret = _resc->get_property<std::string>(
393  my_name);
394  if(!ret.ok()) {
395  return PASS(ret);
396  }
397 
398  std::string parent_id_str;
399  ret = _resc->get_property<std::string>(
401  parent_id_str);
402  if(!ret.ok()) {
403  return PASS(ret);
404  }
405 
406  if(parent_id_str.empty()) {
407  std::stringstream msg;
408  return ERROR(
410  "empty parent string");
411  }
412 
413  rodsLong_t parent_id;
414  ret = lexical_cast<rodsLong_t>(
415  parent_id_str,
416  parent_id);
417  if(!ret.ok()) {
418  return PASS(ret);
419  }
420 
421  resource_ptr parent_resc;
422  ret = resolve(
423  parent_id,
424  parent_resc);
425  if(!ret.ok()) {
426  return PASS(ret);
427  }
428 
429  return parent_resc->get_property<std::string>(
431  _name );
432  } // get_parent_name
433 
435  const std::string& _resc_name,
436  std::string& _hierarchy ) {
437 
438  _hierarchy = _resc_name;
439  std::string parent_name = _resc_name;
440 
441  resource_ptr resc;
442  while( !parent_name.empty() ) {
443  error ret = resolve(
444  parent_name,
445  resc);
446  if(!ret.ok()) {
447  return PASS(ret);
448  }
449 
450  ret = get_parent_name(
451  resc,
452  parent_name );
453  if(!ret.ok()) {
454  if(HIERARCHY_ERROR == ret.code()) {
455  break;
456  }
457 
458  return PASS(ret);
459  }
460 
461  if(!parent_name.empty()) {
462  _hierarchy = parent_name +
464  _hierarchy;
465  }
466  } // while
467 
468  return SUCCESS();
469 
470  } // get_hier_to_root_for_resc
471 
473  const std::string& _resc_name,
474  leaf_bundle_t& _bundle ) {
475  resource_ptr resc;
476  error ret = resolve(
477  _resc_name,
478  resc);
479  if(!ret.ok()) {
480  return PASS(ret);
481  }
482 
483  if(resc->num_children() > 0 ) {
484  // still more children to traverse
485  std::vector<std::string> children;
486  resc->children(children);
487 
488  for( size_t idx = 0;
489  idx < children.size();
490  ++idx ) {
491 
493  children[idx],
494  _bundle );
495  if(!ret.ok() ) {
496  return PASS(ret);
497  }
498 
499  } // for idx
500  }
501  else {
502  // we have found a leaf
503  rodsLong_t resc_id;
504  ret = resc->get_property<rodsLong_t>(
505  RESOURCE_ID,
506  resc_id);
507  if(!ret.ok()) {
508  return PASS(ret);
509  }
510 
511  _bundle.push_back( resc_id );
512  }
513 
514  return SUCCESS();
515 
516  } // gather_leaf_bundle_for_child
517 
518  // throws irods::exception
519  std::vector<resource_manager::leaf_bundle_t> resource_manager::gather_leaf_bundles_for_resc(const std::string& _resource_name) {
520  resource_ptr resc;
521  error err = resolve(_resource_name, resc);
522  if (!err.ok()) {
523  THROW(err.code(), err.result());
524  }
525 
526  std::vector<std::string> children;
527  resc->children(children);
528  std::vector<leaf_bundle_t> ret;
529  ret.resize(children.size());
530  for (size_t i=0; i<children.size(); ++i) {
531  err = gather_leaf_bundle_for_child(children[i], ret[i]);
532  if (!err.ok()) {
533  THROW(err.code(), err.result());
534  }
535  std::sort(std::begin(ret[i]), std::end(ret[i]));
536  }
537  return ret;
538  }
539 
540 // =-=-=-=-=-=-=-
541 // public - take results from genQuery, extract values and create resources
543  // =-=-=-=-=-=-=-
544  // extract results from query
545  if ( !_result ) {
546  return ERROR( SYS_INVALID_INPUT_PARAM, "_result parameter is null" );
547  }
548 
549  // =-=-=-=-=-=-=-
550  // values to extract from query
551  sqlResult_t *rescId = 0, *rescName = 0, *zoneName = 0, *rescType = 0, *rescClass = 0;
552  sqlResult_t *rescLoc = 0, *rescVaultPath = 0, *freeSpace = 0, *rescInfo = 0;
553  sqlResult_t *rescComments = 0, *rescCreate = 0, *rescModify = 0, *rescStatus = 0;
554  sqlResult_t *rescChildren = 0, *rescContext = 0, *rescParent = 0, *rescParentContext = 0;
555 
556  // =-=-=-=-=-=-=-
557  // extract results from query
558  if ( ( rescId = getSqlResultByInx( _result, COL_R_RESC_ID ) ) == NULL ) {
559  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_RESC_ID failed" );
560  }
561 
562  if ( ( rescName = getSqlResultByInx( _result, COL_R_RESC_NAME ) ) == NULL ) {
563  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_RESC_NAME failed" );
564  }
565 
566  if ( ( zoneName = getSqlResultByInx( _result, COL_R_ZONE_NAME ) ) == NULL ) {
567  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_ZONE_NAME failed" );
568  }
569 
570  if ( ( rescType = getSqlResultByInx( _result, COL_R_TYPE_NAME ) ) == NULL ) {
571  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_TYPE_NAME failed" );
572  }
573 
574  if ( ( rescClass = getSqlResultByInx( _result, COL_R_CLASS_NAME ) ) == NULL ) {
575  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_CLASS_NAME failed" );
576  }
577 
578  if ( ( rescLoc = getSqlResultByInx( _result, COL_R_LOC ) ) == NULL ) {
579  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_LOC failed" );
580  }
581 
582  if ( ( rescVaultPath = getSqlResultByInx( _result, COL_R_VAULT_PATH ) ) == NULL ) {
583  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_VAULT_PATH failed" );
584  }
585 
586  if ( ( freeSpace = getSqlResultByInx( _result, COL_R_FREE_SPACE ) ) == NULL ) {
587  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_FREE_SPACE failed" );
588  }
589 
590  if ( ( rescInfo = getSqlResultByInx( _result, COL_R_RESC_INFO ) ) == NULL ) {
591  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_RESC_INFO failed" );
592  }
593 
594  if ( ( rescComments = getSqlResultByInx( _result, COL_R_RESC_COMMENT ) ) == NULL ) {
595  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_RESC_COMMENT failed" );
596  }
597 
598  if ( ( rescCreate = getSqlResultByInx( _result, COL_R_CREATE_TIME ) ) == NULL ) {
599  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_CREATE_TIME failed" );
600  }
601 
602  if ( ( rescModify = getSqlResultByInx( _result, COL_R_MODIFY_TIME ) ) == NULL ) {
603  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_MODIFY_TIME failed" );
604  }
605 
606  if ( ( rescStatus = getSqlResultByInx( _result, COL_R_RESC_STATUS ) ) == NULL ) {
607  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_RESC_STATUS failed" );
608  }
609 
610  if ( ( rescChildren = getSqlResultByInx( _result, COL_R_RESC_CHILDREN ) ) == NULL ) {
611  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_RESC_CHILDREN failed" );
612  }
613 
614  if ( ( rescContext = getSqlResultByInx( _result, COL_R_RESC_CONTEXT ) ) == NULL ) {
615  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_RESC_CONTEXT failed" );
616  }
617 
618  if ( ( rescParent = getSqlResultByInx( _result, COL_R_RESC_PARENT ) ) == NULL ) {
619  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_RESC_PARENT failed" );
620  }
621 
622  if ( ( rescParentContext = getSqlResultByInx( _result, COL_R_RESC_PARENT_CONTEXT ) ) == NULL ) {
623  return ERROR( UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_R_RESC_PARENT_CONTEXT failed" );
624  }
625 
626  // =-=-=-=-=-=-=-
627  // iterate through the rows, initialize a resource for each entry
628  for ( int i = 0; i < _result->rowCnt; ++i ) {
629  // =-=-=-=-=-=-=-
630  // extract row values
631  std::string tmpRescId = &rescId->value[ rescId->len * i ];
632  std::string tmpRescLoc = &rescLoc->value[ rescLoc->len * i ];
633  std::string tmpRescName = &rescName->value[ rescName->len * i ];
634  std::string tmpZoneName = &zoneName->value[ zoneName->len * i ];
635  std::string tmpRescType = &rescType->value[ rescType->len * i ];
636  std::string tmpRescInfo = &rescInfo->value[ rescInfo->len * i ];
637  std::string tmpFreeSpace = &freeSpace->value[ freeSpace->len * i ];
638  std::string tmpRescClass = &rescClass->value[ rescClass->len * i ];
639  std::string tmpRescCreate = &rescCreate->value[ rescCreate->len * i ];
640  std::string tmpRescModify = &rescModify->value[ rescModify->len * i ];
641  std::string tmpRescStatus = &rescStatus->value[ rescStatus->len * i ];
642  std::string tmpRescComments = &rescComments->value[ rescComments->len * i ];
643  std::string tmpRescVaultPath = &rescVaultPath->value[ rescVaultPath->len * i ];
644  std::string tmpRescChildren = &rescChildren->value[ rescChildren->len * i ];
645  std::string tmpRescContext = &rescContext->value[ rescContext->len * i ];
646  std::string tmpRescParent = &rescParent->value[ rescParent->len * i ];
647  std::string tmpRescParentCtx = &rescParentContext->value[ rescParent->len * i ];
648 
649  // =-=-=-=-=-=-=-
650  // create the resource and add properties for column values
651  resource_ptr resc;
652  error ret = load_resource_plugin( resc, tmpRescType, tmpRescName, tmpRescContext );
653  if ( !ret.ok() ) {
654  irods::log(PASS(ret));
655  continue;
656  }
657 
658  // =-=-=-=-=-=-=-
659  // resolve the host name into a rods server host structure
660  if ( tmpRescLoc != irods::EMPTY_RESC_HOST ) {
661  rodsHostAddr_t addr;
662  rstrcpy( addr.hostAddr, const_cast<char*>( tmpRescLoc.c_str() ), LONG_NAME_LEN );
663  rstrcpy( addr.zoneName, const_cast<char*>( tmpZoneName.c_str() ), NAME_LEN );
664 
665  rodsServerHost_t* tmpRodsServerHost = 0;
666  if ( resolveHost( &addr, &tmpRodsServerHost ) < 0 ) {
667  rodsLog( LOG_NOTICE, "procAndQueRescResult: resolveHost error for %s",
668  addr.hostAddr );
669  }
670 
671  resc->set_property< rodsServerHost_t* >( RESOURCE_HOST, tmpRodsServerHost );
672 
673  }
674  else {
675  resc->set_property< rodsServerHost_t* >( RESOURCE_HOST, 0 );
676  }
677 
678  rodsLong_t resource_id = strtoll( tmpRescId.c_str(), 0, 0 );
679  resc->set_property<rodsLong_t>( RESOURCE_ID, resource_id );
680  resc->set_property<long>( RESOURCE_QUOTA, RESC_QUOTA_UNINIT );
681 
682  resc->set_property<std::string>( RESOURCE_FREESPACE, tmpFreeSpace );
683  resc->set_property<std::string>( RESOURCE_ZONE, tmpZoneName );
684  resc->set_property<std::string>( RESOURCE_NAME, tmpRescName );
685  resc->set_property<std::string>( RESOURCE_LOCATION, tmpRescLoc );
686  resc->set_property<std::string>( RESOURCE_TYPE, tmpRescType );
687  resc->set_property<std::string>( RESOURCE_CLASS, tmpRescClass );
688  resc->set_property<std::string>( RESOURCE_PATH, tmpRescVaultPath );
689  resc->set_property<std::string>( RESOURCE_INFO, tmpRescInfo );
690  resc->set_property<std::string>( RESOURCE_COMMENTS, tmpRescComments );
691  resc->set_property<std::string>( RESOURCE_CREATE_TS, tmpRescCreate );
692  resc->set_property<std::string>( RESOURCE_MODIFY_TS, tmpRescModify );
693  resc->set_property<std::string>( RESOURCE_CHILDREN, tmpRescChildren );
694  resc->set_property<std::string>( RESOURCE_CONTEXT, tmpRescContext );
695  resc->set_property<std::string>( RESOURCE_PARENT, tmpRescParent );
696  resc->set_property<std::string>( RESOURCE_PARENT_CONTEXT, tmpRescParentCtx );
697 
698  if ( tmpRescStatus == std::string( RESC_DOWN ) ) {
699  resc->set_property<int>( RESOURCE_STATUS, INT_RESC_STATUS_DOWN );
700  }
701  else {
702  resc->set_property<int>( RESOURCE_STATUS, INT_RESC_STATUS_UP );
703  }
704 
705  // =-=-=-=-=-=-=-
706  // add new resource to the map
707  resource_name_map_[ tmpRescName ] = resc;
708  resource_id_map_[ resource_id ] = resc;
709 
710  } // for i
711 
712  return SUCCESS();
713 
714  } // process_init_results
715 
716 // =-=-=-=-=-=-=-
717 // public - given a type, load up a resource plugin
719  std::string _key,
720  std::string _inst,
721  std::string _ctx,
722  resource_ptr& _resc ) {
723  // =-=-=-=-=-=-=-
724  // create the resource and add properties for column values
725  error ret = load_resource_plugin( _resc, _type, _inst, _ctx );
726  if ( !ret.ok() ) {
727  return PASSMSG( "Failed to load Resource Plugin", ret );
728  }
729 
730  resource_name_map_[ _key ] = _resc;
731 
732  return SUCCESS();
733 
734  } // init_from_type
735 
736 // =-=-=-=-=-=-=-
737 // private - walk the resource map and wire children up to parents
739  for( auto itr : resource_name_map_ ) {
740  const std::string& child_name = itr.first;
741  resource_ptr child_resc = itr.second;
742 
743  std::string parent_id_str;
744  error ret = child_resc->get_property<std::string>(
746  parent_id_str );
747  if(!ret.ok() || parent_id_str.empty()) {
748  continue;
749  }
750 
751  rodsLong_t parent_id = 0;
752  ret = lexical_cast<rodsLong_t>(
753  parent_id_str,
754  parent_id );
755  if(!ret.ok()) {
756  irods::log(PASS(ret));
757  continue;
758  }
759 
760  if(!resource_id_map_.has_entry(parent_id)) {
761  rodsLog(
762  LOG_ERROR,
763  "invalid parent resource id %ld",
764  parent_id );
765  continue;
766  }
767 
768  resource_ptr parent_resc = resource_id_map_[parent_id];
769 
770  std::string parent_child_context;
771  ret = child_resc->get_property<std::string>(
773  parent_child_context );
774  if(!ret.ok()) {
775  }
776 
777  parent_resc->add_child(
778  child_name,
779  parent_child_context,
780  child_resc);
781 
782  child_resc->set_parent(parent_resc);
783 
784  rodsLog(
785  LOG_DEBUG,
786  "%s - add [%s][%s] to [%ld]",
787  __FUNCTION__,
788  child_name.c_str(),
789  parent_child_context.c_str(),
790  parent_id);
791 
792  } // for itr
793 
794  return SUCCESS();
795 
796  } // init_child_map
797 
798 // =-=-=-=-=-=-=-
799 // public - print the list of local resources out to stderr
802  for ( itr = resource_name_map_.begin(); itr != resource_name_map_.end(); ++itr ) {
803  std::string loc, path, name;
804  error path_err = itr->second->get_property< std::string >( RESOURCE_PATH, path );
805  error loc_err = itr->second->get_property< std::string >( RESOURCE_LOCATION, loc );
806  if ( path_err.ok() && loc_err.ok() && "localhost" == loc ) {
807  rodsLog( LOG_NOTICE, " RescName: %s, VaultPath: %s\n",
808  itr->first.c_str(), path.c_str() );
809  }
810 
811  } // for itr
812 
813  } // print_local_resources
814 
815 // =-=-=-=-=-=-=-
816 // private - gather the post disconnect maintenance operations
817 // from the resource plugins
819  // =-=-=-=-=-=-=-
820  // vector of already processed resources
821  std::vector< std::string > proc_vec;
822 
823  // =-=-=-=-=-=-=-
824  // iterate over all of the resources
826  for ( resc_itr = resource_name_map_.begin(); resc_itr != resource_name_map_.end(); ++resc_itr ) {
827  resource_ptr& resc = resc_itr->second;
828 
829  // =-=-=-=-=-=-=-
830  // skip if already processed
831  std::string name;
832  error get_err = resc->get_property< std::string >( RESOURCE_NAME, name );
833 
834  if ( get_err.ok() ) {
835  std::vector< std::string >::iterator itr;
836  itr = std::find< std::vector< std::string >::iterator, std::string >( proc_vec.begin(), proc_vec.end(), name );
837  if ( proc_vec.end() != itr ) {
838  continue;
839  }
840  }
841  else {
842  std::stringstream msg;
843  msg << "resource_manager::gather_operations - failed to get property ";
844  msg << "[name] for resource";
845  return PASSMSG( msg.str(), get_err );
846  }
847 
848  // =-=-=-=-=-=-=-
849  // vector which will hold this 'top level resource' ops
850  std::vector< pdmo_type > resc_ops;
851 
852  // =-=-=-=-=-=-=-
853  // cache the parent operator
854  pdmo_type pdmo_op;
855  error pdmo_err = resc->post_disconnect_maintenance_operation( pdmo_op );
856  if ( pdmo_err.ok() ) {
857  resc_ops.push_back( pdmo_op );
858  }
859 
860  // =-=-=-=-=-=-=-
861  // mark this resource done
862  proc_vec.push_back( name );
863 
864  // =-=-=-=-=-=-=-
865  // dive if children are present
866  std::string child_str;
867  error child_err = resc->get_property< std::string >( RESOURCE_CHILDREN, child_str );
868  if ( child_err.ok() && !child_str.empty() ) {
869  gather_operations_recursive( child_str, proc_vec, resc_ops );
870  }
871 
872  // =-=-=-=-=-=-=-
873  // if we got ops, add vector of ops to mgr's vector
874  if ( !resc_ops.empty() ) {
875  maintenance_operations_.push_back( resc_ops );
876  }
877 
878  } // for itr
879 
880  return SUCCESS();
881 
882  } // gather_operations
883 
884 // =-=-=-=-=-=-=-
886 // maintenance operations from the resources, in breadth first order
888  std::vector< std::string >& _proc_vec,
889  std::vector< pdmo_type >& _resc_ops ) {
890  // =-=-=-=-=-=-=-
891  // create a child parser to traverse the list
893  parser.set_string( _children );
894  children_parser::children_map_t children_list;
895  error ret = parser.list( children_list );
896  if ( !ret.ok() ) {
897  return PASSMSG( "gather_operations_recursive failed.", ret );
898  }
899 
900  // =-=-=-=-=-=-=-
901  // iterate over all of the children, cache the operators
902  children_parser::children_map_t::const_iterator itr;
903  for ( itr = children_list.begin(); itr != children_list.end(); ++itr ) {
904  std::string child = itr->first;
905 
906  // =-=-=-=-=-=-=-
907  // lookup the child resource pointer
908  resource_ptr resc;
909  error get_err = resource_name_map_.get( child, resc );
910  if ( get_err.ok() ) {
911  // =-=-=-=-=-=-=-
912  // cache operation if there is one
913  pdmo_type pdmo_op;
914  error pdmo_ret = resc->post_disconnect_maintenance_operation( pdmo_op );
915  if ( pdmo_ret.ok() ) {
916  _resc_ops.push_back( pdmo_op );
917  }
918 
919  // =-=-=-=-=-=-=-
920  // mark this child as done
921  _proc_vec.push_back( child );
922 
923  }
924  else {
925  std::stringstream msg;
926  msg << "failed to get resource for key [";
927  msg << child;
928  msg << "]";
929  return ERROR( SYS_INVALID_INPUT_PARAM, msg.str() );
930  }
931 
932  } // for itr
933 
934  // =-=-=-=-=-=-=-
935  // iterate over all of the children again, recurse if they have more children
936  for ( itr = children_list.begin(); itr != children_list.end(); ++itr ) {
937  std::string child = itr->first;
938 
939  // =-=-=-=-=-=-=-
940  // lookup the child resource pointer
941  resource_ptr resc;
942  error get_err = resource_name_map_.get( child, resc );
943  if ( get_err.ok() ) {
944  std::string child_str;
945  error child_err = resc->get_property< std::string >( RESOURCE_CHILDREN, child_str );
946  if ( child_err.ok() && !child_str.empty() ) {
947  error gather_err = gather_operations_recursive( child_str, _proc_vec, _resc_ops );
948  }
949 
950  }
951  else {
952  std::stringstream msg;
953  msg << "failed to get resource for key [";
954  msg << child;
955  msg << "]";
956  return ERROR( SYS_INVALID_INPUT_PARAM, msg.str() );
957  }
958 
959  } // for itr
960 
961  return SUCCESS();
962 
963  } // gather_operations_recursive
964 
965 // =-=-=-=-=-=-=-
966 // public - call the start op on the resource plugins
968  // =-=-=-=-=-=-=-
969  // iterate through resource plugins
971  for ( itr = resource_name_map_.begin();
972  itr != resource_name_map_.end();
973  ++itr ) {
974  // =-=-=-=-=-=-=-
975  // if any resources need a pdmo, return true;
976  error ret = itr->second->start_operation( );
977  if ( !ret.ok() ) {
978  irods::log( ret );
979  }
980 
981  } // for itr
982 
983  return SUCCESS();
984 
985  } // start_resource_operations
986 
987 
988 // =-=-=-=-=-=-=-
989 // public - exec the pdmos ( post disconnect maintenance operations ) in order
991  bool need_pdmo = false;
992 
993  // =-=-=-=-=-=-=-
994  // iterate through resource plugins
996  for ( itr = resource_name_map_.begin();
997  itr != resource_name_map_.end();
998  ++itr ) {
999  // =-=-=-=-=-=-=-
1000  // if any resources need a pdmo, return true;
1001  bool flg = false;
1002  itr->second->need_post_disconnect_maintenance_operation( flg );
1003  if ( flg ) {
1004  need_pdmo = true;
1005  break;
1006  }
1007 
1008  } // for itr
1009 
1010  return need_pdmo;
1011 
1012  } // need_maintenance_operations
1013 
1014 // =-=-=-=-=-=-=-
1015 // public - exec the pdmos ( post disconnect maintenance operations ) in order
1017  int result = 0;
1018 
1019  // =-=-=-=-=-=-=-
1020  // iterate through op vectors
1021  std::vector< std::vector< pdmo_type > >::iterator vec_itr;
1022  for ( vec_itr = maintenance_operations_.begin();
1023  vec_itr != maintenance_operations_.end();
1024  ++vec_itr ) {
1025  // =-=-=-=-=-=-=-
1026  // iterate through ops
1027  std::vector< pdmo_type >::iterator op_itr;
1028  for ( op_itr = vec_itr->begin();
1029  op_itr != vec_itr->end();
1030  ++op_itr ) {
1031  // =-=-=-=-=-=-=-
1032  // call the op
1033  try {
1034  error ret = ( ( *op_itr ) )( _comm );
1035  if ( !ret.ok() ) {
1036  log( PASSMSG( "resource_manager::call_maintenance_operations - op failed", ret ) );
1037  result = ret.code();
1038  }
1039  }
1040  catch ( const boost::bad_function_call& ) {
1041  rodsLog( LOG_ERROR, "maintenance operation threw boost::bad_function_call" );
1042  result = SYS_INTERNAL_ERR;
1043  }
1044 
1045  } // for op_itr
1046 
1047  } // for vec_itr
1048 
1049  return result;
1050  } // call_maintenance_operations
1051 
1052  /*
1053  * construct a vector of all resource hierarchies in the system
1054  * throws irods::exception
1055  */
1056  std::vector<std::string> resource_manager::get_all_resc_hierarchies( void ) {
1057  std::vector<std::string> hier_list;
1058  for ( const auto& entry : resource_name_map_ ) {
1059  const resource_ptr resc = entry.second;
1060  if ( resc->num_children() > 0 ) {
1061  continue;
1062  }
1063 
1064  rodsLong_t leaf_id = 0;
1065  error err = resc->get_property<rodsLong_t>(
1066  RESOURCE_ID,
1067  leaf_id );
1068  if ( !err.ok() ) {
1069  THROW( err.code(), err.result() );
1070  }
1071 
1072  std::string curr_hier;
1073  err = leaf_id_to_hier( leaf_id, curr_hier );
1074  if ( !err.ok() ) {
1075  THROW( err.code(), err.result() );
1076  }
1077  hier_list.push_back( curr_hier );
1078  }
1079  return hier_list;
1080  } // get_all_resc_hierarchies
1081 
1083  const std::string& _hier,
1084  rodsLong_t& _id ) {
1085  if(_hier.empty()) {
1086  return ERROR(
1088  "empty hierarchy string" );
1089  }
1090 
1092  p.set_string( _hier );
1093 
1094  std::string leaf;
1095  p.last_resc( leaf );
1096 
1097  if( !resource_name_map_.has_entry(leaf) ) {
1098  return ERROR(
1100  leaf );
1101  }
1102 
1103  resource_ptr resc = resource_name_map_[leaf];
1104 
1105  rodsLong_t id = 0;
1106  error ret = resc->get_property<rodsLong_t>(
1107  RESOURCE_ID,
1108  id );
1109  if( !ret.ok() ) {
1110  return PASS(ret);
1111  }
1112 
1113  _id = id;
1114 
1115  return SUCCESS();
1116 
1117  } // hier_to_leaf_id
1118 
1120  const rodsLong_t& _id,
1121  std::string& _hier ) {
1122  if( !resource_id_map_.has_entry(_id) ) {
1123  std::stringstream msg;
1124  msg << "invalid resource id: " << _id;
1125  return ERROR(
1127  msg.str() );
1128  }
1129 
1130  resource_ptr resc = resource_id_map_[ _id ];
1131 
1132  std::string hier;
1133  error ret = resc->get_property<std::string>(
1134  RESOURCE_NAME,
1135  hier );
1136  if( !ret.ok() ) {
1137  return PASS(ret);
1138  }
1139 
1140  resc->get_parent(resc);
1141  while( resc.get() ) {
1142  std::string name;
1143  error ret = resc->get_property<std::string>(
1144  RESOURCE_NAME,
1145  name );
1146  if( !ret.ok() ) {
1147  return PASS(ret);
1148  }
1149 
1150  hier.insert( 0, ";" );
1151  hier.insert( 0, name);
1152 
1153  resc->get_parent(resc);
1154  }
1155 
1156  _hier = hier;
1157 
1158  return SUCCESS();
1159 
1160  } // leaf_id_to_hier
1161 
1163  const rodsLong_t& _id,
1164  std::string& _name ) {
1165  // parent name might be 'empty'
1166  if(!_id) {
1167  return SUCCESS();
1168  }
1169 
1170  if( !resource_id_map_.has_entry(_id) ) {
1171  std::stringstream msg;
1172  msg << "invalid resource id: " << _id;
1173  return ERROR(
1175  msg.str() );
1176  }
1177 
1178  resource_ptr resc = resource_id_map_[ _id ];
1179 
1180  std::string hier;
1181  error ret = resc->get_property<std::string>(
1182  RESOURCE_NAME,
1183  _name );
1184  if( !ret.ok() ) {
1185  return PASS(ret);
1186  }
1187 
1188  return SUCCESS();
1189 
1190  } // resc_id_to_name
1191 
1193  const std::string& _id_str,
1194  std::string& _name ) {
1195  // parent name might be 'empty'
1196  if("0" == _id_str || _id_str.empty()) {
1197  return SUCCESS();
1198  }
1199 
1200  rodsLong_t resc_id = 0;
1201  error ret = lexical_cast<rodsLong_t>(
1202  _id_str,
1203  resc_id );
1204  if(!ret.ok()) {
1205  return PASS(ret);
1206  }
1207 
1208  if( !resource_id_map_.has_entry(resc_id) ) {
1209  std::stringstream msg;
1210  msg << "invalid resource id: " << _id_str;
1211  return ERROR(
1213  msg.str() );
1214  }
1215  resource_ptr resc = resource_id_map_[ resc_id ];
1216 
1217  std::string hier;
1218  ret = resc->get_property<std::string>(
1219  RESOURCE_NAME,
1220  _name );
1221  if( !ret.ok() ) {
1222  return PASS(ret);
1223  }
1224 
1225  return SUCCESS();
1226 
1227  } // resc_id_to_name
1228 
1230  const std::string& _resc_name,
1231  bool& _ret ) {
1232  if( !resource_name_map_.has_entry(_resc_name) ) {
1233  return ERROR(
1235  _resc_name );
1236  }
1237 
1238  resource_ptr resc = resource_name_map_[_resc_name];
1239 
1240  _ret = resc->num_children() > 0;
1241 
1242  return SUCCESS();
1243  } // is_coordinating_resource
1244 
1245 }; // namespace irods
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
COL_R_CREATE_TIME
#define COL_R_CREATE_TIME
Definition: rodsGenQuery.h:153
MAX_SQL_ROWS
#define MAX_SQL_ROWS
Definition: rodsGenQuery.h:16
irods::resource_manager::get_hier_to_root_for_resc
error get_hier_to_root_for_resc(const std::string &, std::string &)
Definition: irods_resource_manager.cpp:434
rcComm_t
Definition: rcConnect.h:95
NULL
#define NULL
Definition: rodsDef.h:70
irods::RESOURCE_CLASS
const std::string RESOURCE_CLASS("resource_property_class")
COL_R_RESC_CHILDREN
#define COL_R_RESC_CHILDREN
Definition: rodsGenQuery.h:157
irods::RESOURCE_LOCATION
const std::string RESOURCE_LOCATION("resource_property_location")
COL_R_RESC_NAME
#define COL_R_RESC_NAME
Definition: rodsGenQuery.h:144
rsComm_t
Definition: rcConnect.h:145
irods_children_parser.hpp
irods::RESOURCE_COMMENTS
const std::string RESOURCE_COMMENTS("resource_property_comments")
irods::resource_manager::is_coordinating_resource
error is_coordinating_resource(const std::string &, bool &)
Definition: irods_resource_manager.cpp:1229
GenQueryInp::continueInx
int continueInx
Definition: rodsGenQuery.h:28
irods::resource_manager::init_from_type
error init_from_type(std::string, std::string, std::string, std::string, resource_ptr &)
Definition: irods_resource_manager.cpp:718
COL_R_RESC_STATUS
#define COL_R_RESC_STATUS
Definition: rodsGenQuery.h:155
irods::lookup_table
Definition: irods_lookup_table.hpp:24
irods::RESOURCE_NAME
const std::string RESOURCE_NAME("resource_property_name")
THROW
#define THROW(_code, _msg)
Definition: irods_exception.hpp:68
resc_mgr
irods::resource_manager resc_mgr
Definition: irods_resource_manager.cpp:31
COL_R_RESC_CONTEXT
#define COL_R_RESC_CONTEXT
Definition: rodsGenQuery.h:158
COL_R_LOC
#define COL_R_LOC
Definition: rodsGenQuery.h:148
UNMATCHED_KEY_OR_INDEX
@ UNMATCHED_KEY_OR_INDEX
Definition: rodsErrorTable.h:244
irods::resource
Definition: irods_resource_plugin.hpp:25
COL_R_RESC_INFO
#define COL_R_RESC_INFO
Definition: rodsGenQuery.h:151
irods_stacktrace.hpp
irods::pdmo_type
std::function< irods::error(rcComm_t *) > pdmo_type
Definition: irods_plugin_base.hpp:29
irods::resource_manager::init_from_catalog
error init_from_catalog(rsComm_t *)
Definition: irods_resource_manager.cpp:217
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
irods::resource_manager::print_local_resources
void print_local_resources()
Definition: irods_resource_manager.cpp:800
irods::EMPTY_RESC_HOST
const std::string EMPTY_RESC_HOST("EMPTY_RESC_HOST")
irods::resource_ptr
boost::shared_ptr< resource > resource_ptr
Definition: irods_resource_types.hpp:11
irods::resource_manager::iterator
lookup_table< resource_ptr >::iterator iterator
Definition: irods_resource_manager.hpp:190
irods::resource_manager::load_resource_plugin
error load_resource_plugin(resource_ptr &, const std::string, const std::string, const std::string)
Definition: irods_resource_manager.cpp:94
GenQueryInp
Definition: rodsGenQuery.h:24
generalAdmin.h
irods::resource_manager::call_maintenance_operations
int call_maintenance_operations(rcComm_t *)
Definition: irods_resource_manager.cpp:1016
irods::resource_manager::resource_id_map_
lookup_table< resource_ptr, long, std::hash< long > > resource_id_map_
Definition: irods_resource_manager.hpp:239
irods::hierarchy_parser
Definition: irods_hierarchy_parser.hpp:14
rcMisc.h
irods::RESOURCE_CONTEXT
const std::string RESOURCE_CONTEXT("resource_property_context")
pid_age.p
p
Definition: pid_age.py:13
irods::RESOURCE_CHILDREN
const std::string RESOURCE_CHILDREN("resource_property_children")
LONG_NAME_LEN
#define LONG_NAME_LEN
Definition: rodsDef.h:57
irods::lookup_table::begin
iterator begin()
Definition: irods_lookup_table.hpp:53
irods::RESOURCE_PATH
const std::string RESOURCE_PATH("resource_property_path")
PASSMSG
#define PASSMSG(message_, prev_error_)
Definition: irods_error.hpp:119
irods::resource_manager::resource_manager
resource_manager()
Definition: irods_resource_manager.cpp:36
deploy_schemas_locally.parser
parser
Definition: deploy_schemas_locally.py:59
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
generate_iadmin_commands_for_41_to_42_upgrade.name
name
Definition: generate_iadmin_commands_for_41_to_42_upgrade.py:23
irods::lookup_table::get
error get(const std::string &_key, ValueType &_val)
Definition: irods_lookup_table.hpp:71
irods::RESOURCE_STATUS
const std::string RESOURCE_STATUS("resource_property_status")
irods::impostor_resource
Definition: irods_resource_plugin_impostor.hpp:8
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
id
long long id
Definition: filesystem.cpp:105
GenQueryInp::selectInp
inxIvalPair_t selectInp
Definition: rodsGenQuery.h:53
GenQueryInp::maxRows
int maxRows
Definition: rodsGenQuery.h:25
irods::resource_manager::gather_operations
error gather_operations(void)
Definition: irods_resource_manager.cpp:818
irods::resource_manager::maintenance_operations_
std::vector< std::vector< pdmo_type > > maintenance_operations_
Definition: irods_resource_manager.hpp:240
SYS_INTERNAL_ERR
@ SYS_INTERNAL_ERR
Definition: rodsErrorTable.h:211
irods::experimental::filesystem::client::end
auto end(const collection_iterator &) noexcept -> const collection_iterator
Definition: collection_iterator.hpp:88
irods::resource_manager::~resource_manager
virtual ~resource_manager()
Definition: irods_resource_manager.cpp:46
INT_RESC_STATUS_UP
#define INT_RESC_STATUS_UP
Definition: rodsDef.h:281
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
irods_string_tokenize.hpp
rsGlobalExtern.hpp
irods::experimental::filesystem::client::begin
auto begin(collection_iterator _iter) noexcept -> collection_iterator
Definition: collection_iterator.hpp:83
irods::error::code
long long code() const
Definition: irods_error.cpp:194
COL_R_RESC_ID
#define COL_R_RESC_ID
Definition: rodsGenQuery.h:143
irods::resource_manager::get_parent_name
error get_parent_name(resource_ptr, std::string &)
Definition: irods_resource_manager.cpp:386
irods::children_parser::children_map_t
std::map< std::string, std::string > children_map_t
Definition: irods_children_parser.hpp:17
getSqlResultByInx
sqlResult_t * getSqlResultByInx(genQueryOut_t *genQueryOut, int attriInx)
Definition: rcMisc.cpp:1387
irods::lookup_table::empty
bool empty() const
Definition: irods_lookup_table.hpp:50
RESC_QUOTA_UNINIT
#define RESC_QUOTA_UNINIT
Definition: getRescQuota.h:9
LOG_DEBUG
#define LOG_DEBUG
Definition: rodsLog.h:23
GenQueryOut::continueInx
int continueInx
Definition: rodsGenQuery.h:70
irods::resource_manager::gather_leaf_bundle_for_child
error gather_leaf_bundle_for_child(const std::string &, leaf_bundle_t &)
Definition: irods_resource_manager.cpp:472
irods
Definition: apiHandler.hpp:35
irods::resource_manager::gather_leaf_bundles_for_resc
std::vector< leaf_bundle_t > gather_leaf_bundles_for_resc(const std::string &_resource_name)
Definition: irods_resource_manager.cpp:519
irods::RESOURCE_TYPE
const std::string RESOURCE_TYPE("resource_property_type")
irods_load_plugin.hpp
irods::resource_manager::shut_down_resources
error shut_down_resources()
Definition: irods_resource_manager.cpp:341
genQuery.h
SYS_RESC_DOES_NOT_EXIST
@ SYS_RESC_DOES_NOT_EXIST
Definition: rodsErrorTable.h:145
irods::resource_manager::need_maintenance_operations
bool need_maintenance_operations()
Definition: irods_resource_manager.cpp:990
irods::resource_manager::validate_vault_path
error validate_vault_path(std::string, rodsServerHost_t *, std::string &)
Definition: irods_resource_manager.cpp:132
irods::resource_manager::get_all_resc_hierarchies
std::vector< std::string > get_all_resc_hierarchies(void)
Definition: irods_resource_manager.cpp:1056
getRescQuota.h
irods::children_parser
Definition: irods_children_parser.hpp:15
irods::resource_manager::resolve
error resolve(std::string, resource_ptr &)
Definition: irods_resource_manager.cpp:51
irods::resource_manager::leaf_bundle_t
std::vector< rodsLong_t > leaf_bundle_t
Definition: irods_resource_manager.hpp:84
addInxIval
int addInxIval(inxIvalPair_t *inxIvalPair, int inx, int value)
Definition: rcMisc.cpp:883
GenQueryOut
Definition: rodsGenQuery.h:67
irods::resource_manager::start_resource_plugins
error start_resource_plugins(void)
Definition: irods_resource_manager.cpp:967
irods::RESOURCE_ZONE
const std::string RESOURCE_ZONE("resource_property_zone")
irods::lookup_table::has_entry
bool has_entry(KeyType _k) const
Definition: irods_lookup_table.hpp:41
COL_R_TYPE_NAME
#define COL_R_TYPE_NAME
Definition: rodsGenQuery.h:146
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
irods::RESOURCE_FREESPACE
const std::string RESOURCE_FREESPACE("resource_property_freespace")
GenQueryOut::rowCnt
int rowCnt
Definition: rodsGenQuery.h:68
irods::log
void log(const error &)
Definition: irods_log.cpp:13
irods::RESOURCE_CREATE_TS
const std::string RESOURCE_CREATE_TS("resource_property_create_ts")
irods::hierarchy_parser::delimiter
static const std::string & delimiter(void)
Definition: irods_hierarchy_parser.cpp:210
irods::resource_manager::init_child_map
error init_child_map(void)
Definition: irods_resource_manager.cpp:738
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::RESOURCE_QUOTA
const std::string RESOURCE_QUOTA("resource_property_quota")
irods::lookup_table::end
iterator end()
Definition: irods_lookup_table.hpp:56
ERROR
#define ERROR(code_, message_)
Definition: irods_error.hpp:117
COL_R_RESC_PARENT_CONTEXT
#define COL_R_RESC_PARENT_CONTEXT
Definition: rodsGenQuery.h:160
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
INT_RESC_STATUS_DOWN
#define INT_RESC_STATUS_DOWN
Definition: rodsDef.h:282
HIERARCHY_ERROR
@ HIERARCHY_ERROR
Definition: rodsErrorTable.h:752
irods_lexical_cast.hpp
irods::resource_manager::leaf_id_to_hier
error leaf_id_to_hier(const rodsLong_t &, std::string &)
Definition: irods_resource_manager.cpp:1119
irods::resource_manager::gather_operations_recursive
error gather_operations_recursive(const std::string &, std::vector< std::string > &, std::vector< pdmo_type > &)
private - lower level recursive call to gather the post disconnect
Definition: irods_resource_manager.cpp:887
SqlResult::value
char * value
Definition: rodsGenQuery.h:64
irods_hierarchy_parser.hpp
COL_R_ZONE_NAME
#define COL_R_ZONE_NAME
Definition: rodsGenQuery.h:145
irods::resource_manager::hier_to_leaf_id
error hier_to_leaf_id(const std::string &, rodsLong_t &)
Definition: irods_resource_manager.cpp:1082
PLUGIN_ERROR_MISSING_SHARED_OBJECT
@ PLUGIN_ERROR_MISSING_SHARED_OBJECT
Definition: rodsErrorTable.h:776
irods::RESOURCE_MODIFY_TS
const std::string RESOURCE_MODIFY_TS("resource_property_modify_ts")
irods::resource_manager::resource_name_map_
lookup_table< resource_ptr > resource_name_map_
Definition: irods_resource_manager.hpp:238
irods::resource_manager::process_init_results
error process_init_results(genQueryOut_t *)
Definition: irods_resource_manager.cpp:542
rodsServerHost
Definition: rodsConnect.h:62
COL_R_RESC_COMMENT
#define COL_R_RESC_COMMENT
Definition: rodsGenQuery.h:152
entry
Definition: ruleAdmin.cpp:22
rodsHostAddr_t::hostAddr
char hostAddr[256]
Definition: rodsDef.h:297
CAT_NO_ROWS_FOUND
@ CAT_NO_ROWS_FOUND
Definition: rodsErrorTable.h:423
SqlResult
Definition: rodsGenQuery.h:61
irods_resource_manager.hpp
irods::resource_manager::get_root_resources
error get_root_resources(std::vector< std::string > &)
Definition: irods_resource_manager.cpp:358
irods::resource_manager
Definition: irods_resource_manager.hpp:30
SqlResult::len
int len
Definition: rodsGenQuery.h:63
COL_R_FREE_SPACE
#define COL_R_FREE_SPACE
Definition: rodsGenQuery.h:150
COL_R_RESC_PARENT
#define COL_R_RESC_PARENT
Definition: rodsGenQuery.h:159
irods::lookup_table::clear
void clear()
Definition: irods_lookup_table.hpp:47
phyBundleColl.h
irods::RESOURCE_PARENT
const std::string RESOURCE_PARENT("resource_property_parent")
rsGenQuery.hpp
COL_R_CLASS_NAME
#define COL_R_CLASS_NAME
Definition: rodsGenQuery.h:147
irods::RESOURCE_INFO
const std::string RESOURCE_INFO("resource_property_info")
COL_R_MODIFY_TIME
#define COL_R_MODIFY_TIME
Definition: rodsGenQuery.h:154
rstrcpy
char * rstrcpy(char *dest, const char *src, int maxLen)
Definition: stringOpr.cpp:51
irods::PLUGIN_TYPE_RESOURCE
const std::string PLUGIN_TYPE_RESOURCE("resources")
RESC_DOWN
#define RESC_DOWN
Definition: rodsDef.h:276
irods_resource_plugin_impostor.hpp
freeGenQueryOut
int freeGenQueryOut(genQueryOut_t **genQueryOut)
Definition: rcMisc.cpp:1133
NAME_LEN
#define NAME_LEN
Definition: rodsDef.h:55
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
irods::RESOURCE_HOST
const std::string RESOURCE_HOST("resource_property_host")
clearGenQueryInp
void clearGenQueryInp(void *voidInp)
Definition: rcMisc.cpp:1118
rsGenQuery
int rsGenQuery(rsComm_t *rsComm, genQueryInp_t *genQueryInp, genQueryOut_t **genQueryOut)
Definition: rsGenQuery.cpp:604
irods::RESOURCE_PARENT_CONTEXT
const std::string RESOURCE_PARENT_CONTEXT("resource_property_parent_context")
irods::error::result
std::string result() const
Definition: irods_error.cpp:201
irods::resource_manager::resc_id_to_name
error resc_id_to_name(const rodsLong_t &, std::string &)
Definition: irods_resource_manager.cpp:1162
rodsHostAddr_t::zoneName
char zoneName[64]
Definition: rodsDef.h:298
irods_log.hpp
rodsLong_t
long long rodsLong_t
Definition: rodsType.h:32
resolveHost
int resolveHost(rodsHostAddr_t *addr, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:375
irods::RESOURCE_ID
const std::string RESOURCE_ID("resource_property_id")
COL_R_VAULT_PATH
#define COL_R_VAULT_PATH
Definition: rodsGenQuery.h:149
rodsHostAddr_t
Definition: rodsDef.h:296