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)  

libload_balanced.cpp
Go to the documentation of this file.
1 // =-=-=-=-=-=-=-
2 // irods includes
3 #include "msParam.h"
4 #include "genQuery.h"
5 #include "generalAdmin.h"
6 #include "miscServerFunct.hpp"
7 #include "rsGenQuery.hpp"
8 
9 // =-=-=-=-=-=-=-
11 #include "irods_file_object.hpp"
17 #include "irods_stacktrace.hpp"
19 
20 // =-=-=-=-=-=-=-
21 // stl includes
22 #include <iostream>
23 #include <sstream>
24 #include <vector>
25 #include <string>
26 
27 // =-=-=-=-=-=-=-
28 // boost includes
29 #include <boost/lexical_cast.hpp>
30 #include <boost/function.hpp>
31 #include <boost/any.hpp>
32 
33 #define MAX_ELAPSE_TIME 1800
34 
37 const std::string DEFER_POLICY_KEY( "defer_policy" );
38 
41 const std::string DEFER_POLICY_LOCALHOST( "localhost_defer_policy" );
42 
45 template< typename DEST_TYPE >
47  irods::plugin_context& _ctx ) {
48  irods::error result = SUCCESS();
49 
50  // =-=-=-=-=-=-=-
51  // ask the context if it is valid
52  irods::error ret = _ctx.valid< DEST_TYPE >();
53  result = ASSERT_PASS( ret, "Resource context invalid." );
54 
55  return result;
56 
57 } // load_balanced_check_params
58 
63  const std::string& _name,
64  const std::string& _hier,
66  irods::resource_ptr& _resc ) {
67  irods::error result = SUCCESS();
68 
69  irods::resource_child_map* cmap_ref;
70  _props.get< irods::resource_child_map* >(
72  cmap_ref );
73 
74  // =-=-=-=-=-=-=-
75  // create a parser and parse the string
77  irods::error err = parse.set_string( _hier );
78  if ( ( result = ASSERT_PASS( err, "Failed in set_string" ) ).ok() ) {
79 
80  // =-=-=-=-=-=-=-
81  // get the next resource in the series
82  std::string next;
83  err = parse.next( _name, next );
84 
85  if ( ( result = ASSERT_PASS( err, "Failed in next." ) ).ok() ) {
86 
87  // =-=-=-=-=-=-=-
88  // get the next resource from the child map
89  if ( ( result = ASSERT_ERROR( cmap_ref->has_entry( next ), CHILD_NOT_FOUND, "Child map missing entry: \"%s\"",
90  next.c_str() ) ).ok() ) {
91  // =-=-=-=-=-=-=-
92  // assign resource
93  _resc = (*cmap_ref)[ next ].second;
94  }
95  }
96  }
97 
98  return result;
99 
100 } // get_next_child_in_hier
101 
102 // =-=-=-=-=-=-=-
105 template< typename DEST_TYPE >
107  irods::plugin_context& _ctx,
108  irods::resource_ptr& _resc ) {
109  irods::error result = SUCCESS();
110 
111  // =-=-=-=-=-=-=-
112  // check incoming parameters
113  irods::error err = load_balanced_check_params< DEST_TYPE >( _ctx );
114  if ( ( result = ASSERT_PASS( err, "Bad resource context." ) ).ok() ) {
115 
116  // =-=-=-=-=-=-=-
117  // get the object's name
118  std::string name;
119  err = _ctx.prop_map().get< std::string >( irods::RESOURCE_NAME, name );
120  if ( ( result = ASSERT_PASS( err, "Failed to get property." ) ).ok() ) {
121 
122  // =-=-=-=-=-=-=-
123  // get the object's hier string
124  boost::shared_ptr< DEST_TYPE > dst_obj = boost::dynamic_pointer_cast< DEST_TYPE >( _ctx.fco() );
125  std::string hier = dst_obj->resc_hier( );
126 
127  // =-=-=-=-=-=-=-
128  // get the next child pointer given our name and the hier string
129  err = get_next_child_in_hier( name, hier, _ctx.prop_map(), _resc );
130  result = ASSERT_PASS( err, "Get next child failed." );
131  }
132  }
133 
134  return result;
135 
136 } // load_balanced_get_resc_for_call
137 
138 // =-=-=-=-=-=-=-
143  srand( time( NULL ) );
144  return SUCCESS();
145 
146 } // load_balanced_start_operation
147 
151  irods::plugin_context& _ctx ) {
152  irods::error result = SUCCESS();
153 
154  // =-=-=-=-=-=-=-
155  // get the child resc to call
156  irods::resource_ptr resc;
157  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
158  if ( ( result = ASSERT_PASS( err, "Invalid resource context." ) ).ok() ) {
159 
160  // =-=-=-=-=-=-=-
161  // call create on the child
162  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_CREATE, _ctx.fco() );
163  result = ASSERT_PASS( err, "Failed calling create on child resource." );
164  }
165 
166  return result;
167 } // load_balanced_file_create
168 
169 // =-=-=-=-=-=-=-
170 // interface for POSIX Open
172  irods::plugin_context& _ctx ) {
173  irods::error result = SUCCESS();
174 
175  // =-=-=-=-=-=-=-
176  // get the child resc to call
177  irods::resource_ptr resc;
178  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
179  if ( ( result = ASSERT_PASS( err, "Failed in file open." ) ).ok() ) {
180 
181  // =-=-=-=-=-=-=-
182  // call open operation on the child
183  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_OPEN, _ctx.fco() );
184  result = ASSERT_PASS( err, "Failed calling open on the child." );
185  }
186 
187  return result;
188 } // load_balanced_file_open
189 
193  irods::plugin_context& _ctx,
194  void* _buf,
195  int _len ) {
196  irods::error result = SUCCESS();
197 
198  // =-=-=-=-=-=-=-
199  // get the child resc to call
200  irods::resource_ptr resc;
201  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
202  if ( ( result = ASSERT_PASS( err, "Failed finding resource." ) ).ok() ) {
203 
204  // =-=-=-=-=-=-=-
205  // call read on the child
206  err = resc->call< void*, int >( _ctx.comm(), irods::RESOURCE_OP_READ, _ctx.fco(), _buf, _len );
207  result = ASSERT_PASS( err, "Failed calling operation on child resource." );
208  }
209 
210  return result;
211 
212 } // load_balanced_file_read
213 
217  irods::plugin_context& _ctx,
218  void* _buf,
219  int _len ) {
220  irods::error result = SUCCESS();
221 
222  // =-=-=-=-=-=-=-
223  // get the child resc to call
224  irods::resource_ptr resc;
225  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
226  if ( ( result = ASSERT_PASS( err, "Failed choosing child resource." ) ).ok() ) {
227 
228  // =-=-=-=-=-=-=-
229  // call write on the child
230  err = resc->call< void*, int >( _ctx.comm(), irods::RESOURCE_OP_WRITE, _ctx.fco(), _buf, _len );
231  result = ASSERT_PASS( err, "Failed calling operation on child resource." );
232  }
233 
234  return result;
235 } // load_balanced_file_write
236 
240  irods::plugin_context& _ctx ) {
241  irods::error result = SUCCESS();
242 
243  // =-=-=-=-=-=-=-
244  // get the child resc to call
245  irods::resource_ptr resc;
246  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
247  if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced resource." ) ).ok() ) {
248 
249  // =-=-=-=-=-=-=-
250  // call close on the child
251  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_CLOSE, _ctx.fco() );
252  result = ASSERT_PASS( err, "Failed calling operation in child." );
253  }
254 
255  return result;
256 } // load_balanced_file_close
257 
261  irods::plugin_context& _ctx ) {
262  irods::error result = SUCCESS();
263 
264  // =-=-=-=-=-=-=-
265  // get the child resc to call
266  irods::resource_ptr resc;
267  irods::error err = load_balanced_get_resc_for_call< irods::data_object >( _ctx, resc );
268  if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced resource." ) ).ok() ) {
269 
270  // =-=-=-=-=-=-=-
271  // call unlink on the child
272  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_UNLINK, _ctx.fco() );
273  result = ASSERT_PASS( err, "Failed during call to child operation." );
274  }
275 
276  return result;
277 } // load_balanced_file_unlink
278 
282  irods::plugin_context& _ctx,
283  struct stat* _statbuf ) {
284  irods::error result = SUCCESS();
285 
286  // =-=-=-=-=-=-=-
287  // get the child resc to call
288  irods::resource_ptr resc;
289  irods::error err = load_balanced_get_resc_for_call< irods::data_object >( _ctx, resc );
290  if ( ( result = ASSERT_PASS( err, "Failed selecting load_balanced child resource." ) ).ok() ) {
291 
292  // =-=-=-=-=-=-=-
293  // call stat on the child
294  err = resc->call< struct stat* >( _ctx.comm(), irods::RESOURCE_OP_STAT, _ctx.fco(), _statbuf );
295  result = ASSERT_PASS( err, "Failed in call to child operation." );
296  }
297 
298  return result;
299 } // load_balanced_file_stat
300 
304  irods::plugin_context& _ctx,
305  long long _offset,
306  int _whence ) {
307  irods::error result = SUCCESS();
308 
309  // =-=-=-=-=-=-=-
310  // get the child resc to call
311  irods::resource_ptr resc;
312  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
313  if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced child." ) ).ok() ) {
314 
315  // =-=-=-=-=-=-=-
316  // call lseek on the child
317  err = resc->call< long long, int >( _ctx.comm(), irods::RESOURCE_OP_LSEEK, _ctx.fco(), _offset, _whence );
318  result = ASSERT_PASS( err, "Failed calling child operation." );
319  }
320 
321  return result;
322 } // load_balanced_file_lseek
323 
327  irods::plugin_context& _ctx ) {
328  irods::error result = SUCCESS();
329 
330  // =-=-=-=-=-=-=-
331  // get the child resc to call
332  irods::resource_ptr resc;
333  irods::error err = load_balanced_get_resc_for_call< irods::collection_object >( _ctx, resc );
334  if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced child resource." ) ).ok() ) {
335 
336  // =-=-=-=-=-=-=-
337  // call mkdir on the child
338  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_MKDIR, _ctx.fco() );
339  result = ASSERT_PASS( err, "Failed calling child operation." );
340  }
341 
342  return result;
343 } // load_balanced_file_mkdir
344 
348  irods::plugin_context& _ctx ) {
349  irods::error result = SUCCESS();
350 
351  // =-=-=-=-=-=-=-
352  // get the child resc to call
353  irods::resource_ptr resc;
354  irods::error err = load_balanced_get_resc_for_call< irods::collection_object >( _ctx, resc );
355  if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced resource." ) ).ok() ) {
356 
357  // =-=-=-=-=-=-=-
358  // call rmdir on the child
359  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_RMDIR, _ctx.fco() );
360  result = ASSERT_PASS( err, "Failed calling child operation." );
361  }
362 
363  return result;
364 } // load_balanced_file_rmdir
365 
369  irods::plugin_context& _ctx ) {
370  irods::error result = SUCCESS();
371 
372  // =-=-=-=-=-=-=-
373  // get the child resc to call
374  irods::resource_ptr resc;
375  irods::error err = load_balanced_get_resc_for_call< irods::collection_object >( _ctx, resc );
376  if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced resource." ) ).ok() ) {
377 
378  // =-=-=-=-=-=-=-
379  // call opendir on the child
380  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_OPENDIR, _ctx.fco() );
381  result = ASSERT_PASS( err, "Failed calling child operation." );
382  }
383 
384  return result;
385 } // load_balanced_file_opendir
386 
387 // =-=-=-=-=-=-=-
390  irods::plugin_context& _ctx ) {
391  irods::error result = SUCCESS();
392 
393  // =-=-=-=-=-=-=-
394  // get the child resc to call
395  irods::resource_ptr resc;
396  irods::error err = load_balanced_get_resc_for_call< irods::collection_object >( _ctx, resc );
397  if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced resource." ) ).ok() ) {
398 
399  // =-=-=-=-=-=-=-
400  // call closedir on the child
401  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_CLOSEDIR, _ctx.fco() );
402  result = ASSERT_PASS( err, "Failed calling child operation." );
403  }
404 
405  return result;
406 } // load_balanced_file_closedir
407 
411  irods::plugin_context& _ctx,
412  struct rodsDirent** _dirent_ptr ) {
413  irods::error result = SUCCESS();
414 
415  // =-=-=-=-=-=-=-
416  // get the child resc to call
417  irods::resource_ptr resc;
418  irods::error err = load_balanced_get_resc_for_call< irods::collection_object >( _ctx, resc );
419  if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced resource." ) ).ok() ) {
420 
421  // =-=-=-=-=-=-=-
422  // call readdir on the child
423  err = resc->call< struct rodsDirent** >( _ctx.comm(), irods::RESOURCE_OP_READDIR, _ctx.fco(), _dirent_ptr );
424  result = ASSERT_PASS( err, "Failed calling child operation." );
425  }
426 
427  return result;
428 } // load_balanced_file_readdir
429 
433  irods::plugin_context& _ctx,
434  const char* _new_file_name ) {
435  irods::error result = SUCCESS();
436 
437  // =-=-=-=-=-=-=-
438  // get the child resc to call
439  irods::resource_ptr resc;
440  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
441  if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced resource." ) ).ok() ) {
442 
443  // =-=-=-=-=-=-=-
444  // call rename on the child
445  err = resc->call< const char* >( _ctx.comm(), irods::RESOURCE_OP_RENAME, _ctx.fco(), _new_file_name );
446  result = ASSERT_PASS( err, "Failed calling child operation." );
447  }
448 
449  return result;
450 } // load_balanced_file_rename
451 
455  irods::plugin_context& _ctx ) {
456  irods::error result = SUCCESS();
457 
458  // =-=-=-=-=-=-=-
459  // get the child resc to call
460  irods::resource_ptr resc;
461  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
462  if ( ( result = ASSERT_PASS( err, "Failed selecting load_balanced resource." ) ).ok() ) {
463 
464  // =-=-=-=-=-=-=-
465  // call freespace on the child
466  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_TRUNCATE, _ctx.fco() );
467  result = ASSERT_PASS( err, "Failed calling child operation." );
468  }
469 
470  return result;
471 } // load_balanced_file_truncate
472 
476  irods::plugin_context& _ctx ) {
477  irods::error result = SUCCESS();
478 
479  // =-=-=-=-=-=-=-
480  // get the child resc to call
481  irods::resource_ptr resc;
482  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
483  if ( ( result = ASSERT_PASS( err, "Failed selecting load_balanced resource." ) ).ok() ) {
484 
485  // =-=-=-=-=-=-=-
486  // call freespace on the child
487  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_FREESPACE, _ctx.fco() );
488  result = ASSERT_PASS( err, "Failed calling child operation." );
489  }
490 
491  return result;
492 } // load_balanced_file_getfs_freespace
493 
498  irods::plugin_context& _ctx,
499  const char* _cache_file_name ) {
500  irods::error result = SUCCESS();
501 
502  // =-=-=-=-=-=-=-
503  // get the child resc to call
504  irods::resource_ptr resc;
505  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
506  if ( ( result = ASSERT_PASS( err, "Failed to select load_balanced resource." ) ).ok() ) {
507  // =-=-=-=-=-=-=-
508  // call stage on the child
509  err = resc->call< const char* >( _ctx.comm(), irods::RESOURCE_OP_STAGETOCACHE, _ctx.fco(), _cache_file_name );
510  result = ASSERT_PASS( err, "Failed calling child operation." );
511  }
512 
513  return result;
514 } // load_balanced_file_stage_to_cache
515 
521  irods::plugin_context& _ctx,
522  const char* _cache_file_name ) {
523  irods::error result = SUCCESS();
524 
525  // =-=-=-=-=-=-=-
526  // get the child resc to call
527  irods::resource_ptr resc;
528  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
529  if ( ( result = ASSERT_PASS( err, "Failed selecting load_balanced resource." ) ).ok() ) {
530 
531  // =-=-=-=-=-=-=-
532  // call synctoarch on the child
533  err = resc->call< const char* >( _ctx.comm(), irods::RESOURCE_OP_SYNCTOARCH, _ctx.fco(), _cache_file_name );
534  result = ASSERT_PASS( err, "Failed calling child operation." );
535  }
536 
537  return result;
538 } // load_balanced_file_sync_to_arch
539 
543  irods::plugin_context& _ctx ) {
544  irods::error result = SUCCESS();
545 
546  // =-=-=-=-=-=-=-
547  // get the child resc to call
548  irods::resource_ptr resc;
549  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
550  if ( ( result = ASSERT_PASS( err, "Failed selecting load_balanced resource." ) ).ok() ) {
551 
552  // =-=-=-=-=-=-=-
553  // call rename on the child
554  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_REGISTERED, _ctx.fco() );
555  result = ASSERT_PASS( err, "Failed calling child operation." );
556  }
557 
558  return result;
559 } // load_balanced_file_registered
560 
564  irods::plugin_context& _ctx ) {
565  irods::error result = SUCCESS();
566 
567  // =-=-=-=-=-=-=-
568  // get the child resc to call
569  irods::resource_ptr resc;
570  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
571  if ( ( result = ASSERT_PASS( err, "Failed selecting load_balanced resource." ) ).ok() ) {
572 
573  // =-=-=-=-=-=-=-
574  // call rename on the child
575  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_UNREGISTERED, _ctx.fco() );
576  result = ASSERT_PASS( err, "Failed calling child operation." );
577  }
578 
579  return result;
580 } // load_balanced_file_unregistered
581 
585  irods::plugin_context& _ctx ) {
586  irods::error result = SUCCESS();
587 
588  // =-=-=-=-=-=-=-
589  // get the child resc to call
590  irods::resource_ptr resc;
591  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
592  if ( ( result = ASSERT_PASS( err, "Failed selecting load_balanced resource." ) ).ok() ) {
593 
594  // =-=-=-=-=-=-=-
595  // call rename on the child
596  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_MODIFIED, _ctx.fco() );
597  result = ASSERT_PASS( err, "Failed calling child operation." );
598  }
599 
600  return result;
601 } // load_balanced_file_modified
602 
606  irods::plugin_context& _ctx,
607  const std::string* _opr ) {
608  irods::error result = SUCCESS();
609 
610  // =-=-=-=-=-=-=-
611  // get the child resc to call
612  irods::resource_ptr resc;
613  irods::error err = load_balanced_get_resc_for_call< irods::file_object >( _ctx, resc );
614  if ( ( result = ASSERT_PASS( err, "Failed selecting load_balanced resource." ) ).ok() ) {
615 
616  // =-=-=-=-=-=-=-
617  // call rename on the child
618  err = resc->call( _ctx.comm(), irods::RESOURCE_OP_NOTIFY, _ctx.fco(), _opr );
619  result = ASSERT_PASS( err, "Failed calling child operation." );
620  }
621 
622  return result;
623 
624 } // load_balanced_file_notify
625 
629  irods::plugin_context& _ctx,
630  std::vector< std::string >& _resc_names,
631  std::vector< int >& _resc_loads,
632  std::vector< int >& _resc_times ) {
633  // =-=-=-=-=-=-=-
634  //
635  int i = 0, j = 0, nresc = 0, status = 0;
636  char* tResult = 0;
637  genQueryInp_t genQueryInp;
638  genQueryOut_t* genQueryOut = NULL;
639 
640  // =-=-=-=-=-=-=-
641  // query the database in order to retrieve the information on the
642  // resources' load
643  memset( &genQueryInp, 0, sizeof( genQueryInp ) );
644  addInxIval( &genQueryInp.selectInp, COL_SLD_RESC_NAME, 1 );
645  addInxIval( &genQueryInp.selectInp, COL_SLD_LOAD_FACTOR, 1 );
647 
648  // =-=-=-=-=-=-=-
649  // a tmp fix to increase no. of resource to 256
650  genQueryInp.maxRows = MAX_SQL_ROWS * 10;
651  status = rsGenQuery( _ctx.comm(), &genQueryInp, &genQueryOut );
652  if ( status == 0 ) {
653  nresc = genQueryOut->rowCnt;
654  // =-=-=-=-=-=-=-
655  // vectors should be sized to number of resources
656  // these vectors will be indexed directly, not built
657  _resc_names.resize( nresc );
658  _resc_loads.resize( nresc );
659  _resc_times.resize( nresc );
660 
661  for ( i = 0; i < genQueryOut->attriCnt; i++ ) {
662  for ( j = 0; j < nresc; j++ ) {
663  tResult = genQueryOut->sqlResult[i].value;
664  tResult += j * genQueryOut->sqlResult[i].len;
665  switch ( i ) {
666  case 0:
667  _resc_names[j] = tResult;
668 
669  case 1:
670  _resc_loads[j] = atoi( tResult );
671  break;
672  case 2:
673  _resc_times[j] = atoi( tResult );
674  break;
675  }
676  }
677  }
678  }
679  else {
680  clearGenQueryInp( &genQueryInp );
681  freeGenQueryOut( &genQueryOut );
682  return ERROR( status, "genquery failed" );
683  }
684 
685  clearGenQueryInp( &genQueryInp );
686  freeGenQueryOut( &genQueryOut );
687 
688  return SUCCESS();
689 
690 } // get_load_lists
691 
692 
693 
697  irods::plugin_context& _ctx,
698  const std::string* _opr,
699  const std::string* _curr_host,
700  irods::hierarchy_parser* _out_parser,
701  float* _out_vote ) {
702  // =-=-=-=-=-=-=-
703  // capture the name, time and load lists from the DB
704  std::vector< std::string > names;
705  std::vector< int > loads;
706  std::vector< int > times;
708  _ctx,
709  names,
710  loads,
711  times );
712  if ( !ret.ok() ) {
713  return PASS( ret );
714  }
715 
716  // =-=-=-=-=-=-=-
717  // retrieve local time in order to check if the load information is up
718  // to date, ie less than MAX_ELAPSE_TIME seconds old
719  int min_load = 100;
720  time_t time_now = 0;
721  time( &time_now );
722 
723  // =-=-=-=-=-=-=-
724  // iterate over children and find them in the lists
725  //
726  //
727  irods::resource_child_map* cmap_ref;
730  cmap_ref );
731 
732  bool resc_found = false;
733 
734  irods::resource_ptr selected_resource;
735  irods::resource_child_map::iterator itr = cmap_ref->begin();
736  for ( ; itr != cmap_ref->end(); ++itr ) {
737  // =-=-=-=-=-=-=-
738  // cache resc ptr for ease of use
739  irods::resource_ptr resc = itr->second.second;
740 
741  // =-=-=-=-=-=-=-
742  // get the resource name for comparison
743  std::string resc_name;
744  ret = resc->get_property< std::string >( irods::RESOURCE_NAME, resc_name );
745  if ( !ret.ok() ) {
746  return PASS( ret );
747  }
748 
749  // =-=-=-=-=-=-=-
750  // scan the list for a match
751  for ( size_t i = 0; i < names.size(); ++i ) {
752  if ( resc_name == names[ i ] ) {
753  if ( loads[ i ] >= 0 &&
754  min_load > loads[ i ] &&
755  ( time_now - times[ i ] ) < MAX_ELAPSE_TIME ) {
756  resc_found = true;
757  min_load = loads[i];
758  selected_resource = resc;
759  }
760 
761  } // if match
762 
763  } // for i
764 
765  } // for itr
766 
767  // =-=-=-=-=-=-=-
768  // if we did not find a resource, this is definitely an error
769  if ( !resc_found ) {
770  return ERROR(
772  "failed to find child resc in load list" );
773  }
774 
775  // =-=-=-=-=-=-=-
776  // forward the redirect call to the child for assertion of the whole operation,
777  // there may be more than a leaf beneath us
778  float vote = 0.0;
779  irods::hierarchy_parser parser = ( *_out_parser );
780  irods::error err = selected_resource->call <
781  const std::string*,
782  const std::string*,
784  float* > (
785  _ctx.comm(),
787  _ctx.fco(),
788  _opr,
789  _curr_host,
790  &parser,
791  &vote );
792  std::string hier;
793  parser.str( hier );
794  rodsLog(
795  LOG_DEBUG10,
796  "load_balanced node - hier : [%s], vote %f",
797  hier.c_str(),
798  vote );
799  if ( !err.ok() ) {
800  irods::log( PASS( err ) );
801  }
802 
803  // =-=-=-=-=-=-=-
804  // set the out variables
805  ( *_out_parser ) = parser;
806  ( *_out_vote ) = vote;
807 
808  return SUCCESS();
809 
810 } // load_balanced_redirect_for_create_operation
811 
815  irods::plugin_context& _ctx,
816  const std::string* _opr,
817  const std::string* _curr_host,
818  irods::hierarchy_parser* _out_parser,
819  float* _out_vote ) {
820 
821  *_out_vote = 0.0;
822 
823  // =-=-=-=-=-=-=-
824  // data struct to hold parser and vote from the search
825  std::map< float, irods::hierarchy_parser > result_map;
826 
827  irods::resource_child_map* cmap_ref;
830  cmap_ref );
831 
832  if(cmap_ref->empty()) {
833  return SUCCESS();
834  }
835 
836  // =-=-=-=-=-=-=-
837  // iterate over all the children and pick the highest vote
838  irods::resource_child_map::iterator itr = cmap_ref->begin();
839  for ( ; itr != cmap_ref->end(); ++itr ) {
840  // =-=-=-=-=-=-=-
841  // cache resc ptr for ease of use
842  irods::resource_ptr resc = itr->second.second;
843 
844  // =-=-=-=-=-=-=-
845  // temp results from open redirect call - init parser with incoming
846  // hier parser
847  float vote = 0.0;
848  irods::hierarchy_parser parser = ( *_out_parser );
849 
850  // =-=-=-=-=-=-=-
851  // forward the redirect call to the child for assertion of the whole operation,
852  // there may be more than a leaf beneath us
853  irods::error err = resc->call <
854  const std::string*,
855  const std::string*,
857  float* > (
858  _ctx.comm(),
860  _ctx.fco(),
861  _opr,
862  _curr_host,
863  &parser,
864  &vote );
865  std::string hier;
866  parser.str( hier );
867  rodsLog( LOG_DEBUG10, "load_balanced node - hier : [%s], vote %f", hier.c_str(), vote );
868  if ( !err.ok() ) {
869  irods::log( PASS( err ) );
870  }
871  else {
872  result_map[ vote ] = parser;
873  }
874 
875  } // for
876 
877  if( result_map.empty() ) {
878  return SUCCESS();
879  }
880 
881  // =-=-=-=-=-=-=-
882  // now that we have collected all of the results the map
883  // will have put the largest one at the end of the map
884  // so grab that one and return the result if it is non zero
885  float high_vote = result_map.rbegin()->first;
886  if(0.0 == high_vote) {
887  return SUCCESS();
888  }
889  else if ( high_vote > 0.0 ) {
890  ( *_out_parser ) = result_map.rbegin()->second;
891  ( *_out_vote ) = high_vote;
892  return SUCCESS();
893 
894  }
895  else {
896  return ERROR( -1, "no valid data object found to open" );
897  }
898 
899 } // load_balanced_redirect_for_open_operation
900 
901 
906  irods::plugin_context& _ctx,
907  const std::string* _opr,
908  const std::string* _curr_host,
909  irods::hierarchy_parser* _out_parser,
910  float* _out_vote ) {
911  irods::error result = SUCCESS();
912 
913  // =-=-=-=-=-=-=-
914  // check incoming parameters
915  irods::error err = load_balanced_check_params< irods::file_object >( _ctx );
916  if ( ( result = ASSERT_PASS( err, "Invalid resource context." ) ).ok() ) {
917  if ( ( result = ASSERT_ERROR( _opr && _curr_host && _out_parser && _out_vote, SYS_INVALID_INPUT_PARAM,
918  "Invalid parameters." ) ).ok() ) {
919  // =-=-=-=-=-=-=-
920  // get the object's hier string
921  irods::file_object_ptr file_obj = boost::dynamic_pointer_cast< irods::file_object >( _ctx.fco() );
922  std::string hier = file_obj->resc_hier( );
923 
924  // =-=-=-=-=-=-=-
925  // get the object's hier string
926  std::string name;
927  err = _ctx.prop_map().get< std::string >( irods::RESOURCE_NAME, name );
928  if ( ( result = ASSERT_PASS( err, "Failed to get property: \"%s\".", irods::RESOURCE_NAME.c_str() ) ).ok() ) {
929 
930  // =-=-=-=-=-=-=-
931  // add ourselves into the hierarch before calling child resources
932  _out_parser->add_child( name );
933 
934  // =-=-=-=-=-=-=-
935  // test the operation to determine which choices to make
936  if ( irods::OPEN_OPERATION == ( *_opr ) ||
937  irods::WRITE_OPERATION == ( *_opr ) ||
938  irods::UNLINK_OPERATION == ( *_opr )) {
939  std::string err_msg = "failed in resolve hierarchy for [" + ( *_opr ) + "]";
940  err = load_balanced_redirect_for_open_operation( _ctx, _opr, _curr_host, _out_parser, _out_vote );
941  result = ASSERT_PASS( err, err_msg );
942 
943  }
944  else if ( irods::CREATE_OPERATION == ( *_opr ) ) {
945 
946  // =-=-=-=-=-=-=-
947  // get the next_child resource for create
948  irods::resource_ptr resc;
949  std::string err_msg = "failed in resolve hierarchy for [" + ( *_opr ) + "]";
950  err = load_balanced_redirect_for_create_operation( _ctx, _opr, _curr_host, _out_parser, _out_vote );
951  result = ASSERT_PASS( err, err_msg );
952  }
953  else {
954 
955  // =-=-=-=-=-=-=-
956  // must have been passed a bad operation
957  result = ASSERT_ERROR( false, INVALID_OPERATION, "Operation not supported: \"%s\".",
958  _opr->c_str() );
959  }
960  }
961  }
962  }
963 
964  return result;
965 } // load_balanced_file_resolve_hierarchy
966 
967 // =-=-=-=-=-=-=-
968 // load_balanced_file_rebalance - code which would rebalance the subtree
970  irods::plugin_context& _ctx ) {
971 
972  irods::resource_child_map* cmap_ref;
975  cmap_ref );
976 
977  // =-=-=-=-=-=-=-
978  // forward request for rebalance to children
979  irods::error result = SUCCESS();
980  irods::resource_child_map::iterator itr = cmap_ref->begin();
981  for ( ; itr != cmap_ref->end(); ++itr ) {
982  irods::error ret = itr->second.second->call( _ctx.comm(), irods::RESOURCE_OP_REBALANCE, _ctx.fco() );
983  if ( !( result = ASSERT_PASS( ret, "Failed calling child operation." ) ).ok() ) {
984  irods::log( PASS( result ) );
985  }
986  }
987 
988  if ( !result.ok() ) {
989  return PASS( result );
990  }
991 
992  return SUCCESS();
993 
994 } // load_balanced_file_rebalance
995 
996 // =-=-=-=-=-=-=-
997 // 3. create derived class to handle unix file system resources
998 // necessary to do custom parsing of the context string to place
999 // any useful values into the property map for reference in later
1000 // operations. semicolon is the preferred delimiter
1002  public:
1004  const std::string& _inst_name,
1005  const std::string& _context ) :
1006  irods::resource( _inst_name, _context ) {
1007  // =-=-=-=-=-=-=-
1008  // extract the defer policy from the context string
1009  irods::kvp_map_t kvp;
1011  _context,
1012  kvp );
1013  if(!ret.ok()) {
1014  rodsLog(
1015  LOG_ERROR,
1016  "libload_balanced: invalid context [%s]",
1017  _context.c_str() );
1018  return;
1019  }
1020 
1021  if ( kvp.end() != kvp.find( DEFER_POLICY_KEY ) ) {
1022  properties_.set< std::string >(
1024  kvp[ DEFER_POLICY_KEY ] );
1025  }
1026  else {
1027  properties_.set< std::string >(
1030  rodsLog(
1031  LOG_DEBUG,
1032  "load_balanced_resource :: using localhost policy, none specificed" );
1033  }
1034 
1035  }
1036 
1037  // =-=-=-=-=-=-
1038  // override from plugin_base
1040  _flg = false;
1041  return ERROR( -1, "nop" );
1042  }
1043 
1044  // =-=-=-=-=-=-
1045  // override from plugin_base
1047  return ERROR( -1, "nop" );
1048  }
1049 
1050 }; // class
1051 
1052 // =-=-=-=-=-=-=-
1053 // 4. create the plugin factory function which will return a dynamically
1054 // instantiated object of the previously defined derived resource. use
1055 // the add_operation member to associate a 'call name' to the interfaces
1056 // defined above. for resource plugins these call names are standardized
1057 // as used by the irods facing interface defined in
1058 // server/drivers/src/fileDriver.c
1059 extern "C"
1060 irods::resource* plugin_factory( const std::string& _inst_name,
1061  const std::string& _context ) {
1062  // =-=-=-=-=-=-=-
1063  // 4a. create unixfilesystem_resource
1064  load_balanced_resource* resc = new load_balanced_resource( _inst_name, _context );
1065 
1066  // =-=-=-=-=-=-=-
1067  // 4b. map function names to operations. this map will be used to load
1068  // the symbols from the shared object in the delay_load stage of
1069  // plugin loading.
1070  using namespace irods;
1071  using namespace std;
1072  resc->add_operation(
1074  function<error(plugin_context&)>(
1076 
1077  resc->add_operation(
1079  function<error(plugin_context&)>(
1081 
1082  resc->add_operation<void*,int>(
1084  std::function<
1085  error(irods::plugin_context&,void*,int)>(
1087 
1088  resc->add_operation<void*,int>(
1090  function<error(plugin_context&,void*,int)>(
1092 
1093  resc->add_operation(
1095  function<error(plugin_context&)>(
1097 
1098  resc->add_operation(
1100  function<error(plugin_context&)>(
1102 
1103  resc->add_operation<struct stat*>(
1105  function<error(plugin_context&, struct stat*)>(
1107 
1108  resc->add_operation(
1110  function<error(plugin_context&)>(
1112 
1113  resc->add_operation(
1115  function<error(plugin_context&)>(
1117 
1118  resc->add_operation<struct rodsDirent**>(
1120  function<error(plugin_context&,struct rodsDirent**)>(
1122 
1123  resc->add_operation<const char*>(
1125  function<error(plugin_context&, const char*)>(
1127 
1128  resc->add_operation(
1130  function<error(plugin_context&)>(
1132 
1133  resc->add_operation<long long, int>(
1135  function<error(plugin_context&, long long, int)>(
1137 
1138  resc->add_operation(
1140  function<error(plugin_context&)>(
1142 
1143  resc->add_operation(
1145  function<error(plugin_context&)>(
1147 
1148  resc->add_operation<const char*>(
1150  function<error(plugin_context&, const char*)>(
1152 
1153  resc->add_operation<const char*>(
1155  function<error(plugin_context&, const char*)>(
1157 
1158  resc->add_operation(
1160  function<error(plugin_context&)>(
1162 
1163  resc->add_operation(
1165  function<error(plugin_context&)>(
1167 
1168  resc->add_operation(
1170  function<error(plugin_context&)>(
1172 
1173  resc->add_operation<const std::string*>(
1175  function<error(plugin_context&, const std::string*)>(
1177 
1178  resc->add_operation(
1180  function<error(plugin_context&)>(
1182 
1183  resc->add_operation<const std::string*, const std::string*, irods::hierarchy_parser*, float*>(
1185  function<error(plugin_context&,const std::string*, const std::string*, irods::hierarchy_parser*, float*)>(
1187 
1188  resc->add_operation(
1190  function<error(plugin_context&)>(
1192 
1193 
1194  // =-=-=-=-=-=-=-
1195  // set some properties necessary for backporting to iRODS legacy code
1196  resc->set_property< int >( irods::RESOURCE_CHECK_PATH_PERM, 2 );//DO_CHK_PATH_PERM );
1197  resc->set_property< int >( irods::RESOURCE_CREATE_PATH, 1 );//CREATE_PATH );
1198 
1199  // =-=-=-=-=-=-=-
1200  // 4c. return the pointer through the generic interface of an
1201  // irods::resource pointer
1202  return dynamic_cast<irods::resource*>( resc );
1203 
1204 } // plugin_factory
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
MAX_SQL_ROWS
#define MAX_SQL_ROWS
Definition: rodsGenQuery.h:16
NULL
#define NULL
Definition: rodsDef.h:70
irods_physical_object.hpp
COL_SLD_LOAD_FACTOR
#define COL_SLD_LOAD_FACTOR
Definition: rodsGenQuery.h:382
irods::lookup_table< boost::any >
irods::RESOURCE_NAME
const std::string RESOURCE_NAME("resource_property_name")
irods::RESOURCE_OP_STAT
const std::string RESOURCE_OP_STAT("resource_stat")
msParam.h
irods::plugin_context::valid
virtual error valid()
Definition: irods_plugin_context.hpp:77
irods.six.next
next
Definition: six.py:518
irods::resource
Definition: irods_resource_plugin.hpp:25
load_balanced_start_operation
irods::error load_balanced_start_operation(irods::plugin_property_map &, irods::resource_child_map &)
Definition: libload_balanced.cpp:140
irods::RESOURCE_CHECK_PATH_PERM
const std::string RESOURCE_CHECK_PATH_PERM("resource_property_check_path_perm")
irods::RESOURCE_OP_MODIFIED
const std::string RESOURCE_OP_MODIFIED("resource_modified")
load_balanced_resource
Definition: libload_balanced.cpp:1001
irods_file_object.hpp
irods::RESOURCE_OP_CLOSEDIR
const std::string RESOURCE_OP_CLOSEDIR("resource_closedir")
irods_stacktrace.hpp
irods::pdmo_type
std::function< irods::error(rcComm_t *) > pdmo_type
Definition: irods_plugin_base.hpp:29
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
load_balanced_file_readdir
irods::error load_balanced_file_readdir(irods::plugin_context &_ctx, struct rodsDirent **_dirent_ptr)
Definition: libload_balanced.cpp:410
irods_collection_object.hpp
irods::resource_ptr
boost::shared_ptr< resource > resource_ptr
Definition: irods_resource_types.hpp:11
irods::RESOURCE_OP_RESOLVE_RESC_HIER
const std::string RESOURCE_OP_RESOLVE_RESC_HIER("resource_resolve_hierarchy")
GenQueryInp
Definition: rodsGenQuery.h:24
generalAdmin.h
SELECT_MAX
#define SELECT_MAX
Definition: rodsGenQuery.h:103
irods::RESOURCE_OP_READDIR
const std::string RESOURCE_OP_READDIR("resource_readdir")
load_balanced_file_sync_to_arch
irods::error load_balanced_file_sync_to_arch(irods::plugin_context &_ctx, const char *_cache_file_name)
Definition: libload_balanced.cpp:520
irods::hierarchy_parser
Definition: irods_hierarchy_parser.hpp:14
irods::lookup_table::begin
iterator begin()
Definition: irods_lookup_table.hpp:53
irods::RESOURCE_OP_READ
const std::string RESOURCE_OP_READ("resource_read")
COL_SLD_RESC_NAME
#define COL_SLD_RESC_NAME
Definition: rodsGenQuery.h:381
irods::RESOURCE_OP_FREESPACE
const std::string RESOURCE_OP_FREESPACE("resource_freespace")
irods::lookup_table< std::pair< std::string, resource_ptr > >::iterator
irods_hash_map::iterator iterator
Definition: irods_lookup_table.hpp:31
irods::RESOURCE_OP_LSEEK
const std::string RESOURCE_OP_LSEEK("resource_lseek")
load_balanced_file_lseek
irods::error load_balanced_file_lseek(irods::plugin_context &_ctx, long long _offset, int _whence)
Definition: libload_balanced.cpp:303
DEFER_POLICY_KEY
const std::string DEFER_POLICY_KEY("defer_policy")
deploy_schemas_locally.parser
parser
Definition: deploy_schemas_locally.py:59
irods::plugin_context
Definition: irods_plugin_context.hpp:18
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_redirect.hpp
irods::resource::resource
resource(const std::string &_inst, const std::string &_ctx)
Definition: irods_resource_plugin.hpp:29
irods::plugin_base::set_property
error set_property(const std::string &_key, const T &_val)
Definition: irods_plugin_base.hpp:304
SYS_INVALID_INPUT_PARAM
@ SYS_INVALID_INPUT_PARAM
Definition: rodsErrorTable.h:195
GenQueryInp::selectInp
inxIvalPair_t selectInp
Definition: rodsGenQuery.h:53
GenQueryInp::maxRows
int maxRows
Definition: rodsGenQuery.h:25
GenQueryOut::sqlResult
sqlResult_t sqlResult[50]
Definition: rodsGenQuery.h:72
load_balanced_file_notify
irods::error load_balanced_file_notify(irods::plugin_context &_ctx, const std::string *_opr)
Definition: libload_balanced.cpp:605
ASSERT_ERROR
#define ASSERT_ERROR(expr_, code_, format_,...)
Definition: irods_error.hpp:123
irods_resource_plugin.hpp
SUCCESS
#define SUCCESS()
Definition: irods_error.hpp:121
INVALID_OPERATION
@ INVALID_OPERATION
Definition: rodsErrorTable.h:760
irods::plugin_context::comm
virtual rsComm_t * comm()
Definition: irods_plugin_context.hpp:95
irods::RESOURCE_OP_TRUNCATE
const std::string RESOURCE_OP_TRUNCATE("resource_truncate")
irods_string_tokenize.hpp
load_balanced_file_modified
irods::error load_balanced_file_modified(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:584
load_balanced_resource::post_disconnect_maintenance_operation
irods::error post_disconnect_maintenance_operation(irods::pdmo_type &)
Definition: libload_balanced.cpp:1046
irods::RESOURCE_OP_RENAME
const std::string RESOURCE_OP_RENAME("resource_rename")
load_balanced_file_stat
irods::error load_balanced_file_stat(irods::plugin_context &_ctx, struct stat *_statbuf)
Definition: libload_balanced.cpp:281
irods::OPEN_OPERATION
const std::string OPEN_OPERATION("OPEN")
irods.pypyodbc.long
long
Definition: pypyodbc.py:43
irods::plugin_context::prop_map
virtual irods::plugin_property_map & prop_map()
Definition: irods_plugin_context.hpp:99
irods::lookup_table::empty
bool empty() const
Definition: irods_lookup_table.hpp:50
LOG_DEBUG
#define LOG_DEBUG
Definition: rodsLog.h:23
irods::plugin_base::properties_
plugin_property_map properties_
Definition: irods_plugin_base.hpp:332
load_balanced_redirect_for_create_operation
irods::error load_balanced_redirect_for_create_operation(irods::plugin_context &_ctx, const std::string *_opr, const std::string *_curr_host, irods::hierarchy_parser *_out_parser, float *_out_vote)
Definition: libload_balanced.cpp:696
COL_SLD_CREATE_TIME
#define COL_SLD_CREATE_TIME
Definition: rodsGenQuery.h:383
irods::hierarchy_parser::add_child
error add_child(const std::string &_resc)
Definition: irods_hierarchy_parser.cpp:88
irods::RESOURCE_OP_CREATE
const std::string RESOURCE_OP_CREATE("resource_create")
irods
Definition: apiHandler.hpp:35
load_balanced_file_close
irods::error load_balanced_file_close(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:239
load_balanced_file_write
irods::error load_balanced_file_write(irods::plugin_context &_ctx, void *_buf, int _len)
Definition: libload_balanced.cpp:216
load_balanced_redirect_for_open_operation
irods::error load_balanced_redirect_for_open_operation(irods::plugin_context &_ctx, const std::string *_opr, const std::string *_curr_host, irods::hierarchy_parser *_out_parser, float *_out_vote)
Definition: libload_balanced.cpp:814
get_next_child_in_hier
irods::error get_next_child_in_hier(const std::string &_name, const std::string &_hier, irods::plugin_property_map &_props, irods::resource_ptr &_resc)
Definition: libload_balanced.cpp:62
DEFER_POLICY_LOCALHOST
const std::string DEFER_POLICY_LOCALHOST("localhost_defer_policy")
irods::RESOURCE_OP_NOTIFY
const std::string RESOURCE_OP_NOTIFY("resource_notify")
load_balanced_file_registered
irods::error load_balanced_file_registered(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:542
genQuery.h
irods::RESOURCE_CREATE_PATH
const std::string RESOURCE_CREATE_PATH("resource_property_create_path")
irods::RESOURCE_OP_WRITE
const std::string RESOURCE_OP_WRITE("resource_write")
load_balanced_file_opendir
irods::error load_balanced_file_opendir(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:368
get_load_lists
irods::error get_load_lists(irods::plugin_context &_ctx, std::vector< std::string > &_resc_names, std::vector< int > &_resc_loads, std::vector< int > &_resc_times)
Definition: libload_balanced.cpp:628
addInxIval
int addInxIval(inxIvalPair_t *inxIvalPair, int inx, int value)
Definition: rcMisc.cpp:883
ASSERT_PASS
#define ASSERT_PASS(prev_error_, format_,...)
Definition: irods_error.hpp:124
load_balanced_file_resolve_hierarchy
irods::error load_balanced_file_resolve_hierarchy(irods::plugin_context &_ctx, const std::string *_opr, const std::string *_curr_host, irods::hierarchy_parser *_out_parser, float *_out_vote)
Definition: libload_balanced.cpp:905
GenQueryOut
Definition: rodsGenQuery.h:67
irods::lookup_table::has_entry
bool has_entry(KeyType _k) const
Definition: irods_lookup_table.hpp:41
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
GenQueryOut::attriCnt
int attriCnt
Definition: rodsGenQuery.h:69
irods::RESOURCE_OP_CLOSE
const std::string RESOURCE_OP_CLOSE("resource_close")
load_balanced_check_params
irods::error load_balanced_check_params(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:46
GenQueryOut::rowCnt
int rowCnt
Definition: rodsGenQuery.h:68
irods::log
void log(const error &)
Definition: irods_log.cpp:13
irods::RESC_CHILD_MAP_PROP
const std::string RESC_CHILD_MAP_PROP("resource_child_map_property")
rodsDirent
Definition: rodsType.h:70
irods::RESOURCE_OP_UNLINK
const std::string RESOURCE_OP_UNLINK("resource_unlink")
irods::RESOURCE_OP_RMDIR
const std::string RESOURCE_OP_RMDIR("resource_rmdir")
load_balanced_file_read
irods::error load_balanced_file_read(irods::plugin_context &_ctx, void *_buf, int _len)
Definition: libload_balanced.cpp:192
load_balanced_file_unlink
irods::error load_balanced_file_unlink(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:260
irods::lookup_table::end
iterator end()
Definition: irods_lookup_table.hpp:56
ERROR
#define ERROR(code_, message_)
Definition: irods_error.hpp:117
irods::RESOURCE_OP_UNREGISTERED
const std::string RESOURCE_OP_UNREGISTERED("resource_unregistered")
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
load_balanced_file_stage_to_cache
irods::error load_balanced_file_stage_to_cache(irods::plugin_context &_ctx, const char *_cache_file_name)
Definition: libload_balanced.cpp:497
load_balanced_file_rmdir
irods::error load_balanced_file_rmdir(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:347
SqlResult::value
char * value
Definition: rodsGenQuery.h:64
irods::RESOURCE_OP_REGISTERED
const std::string RESOURCE_OP_REGISTERED("resource_registered")
irods_hierarchy_parser.hpp
irods::parse_kvp_string
error parse_kvp_string(const std::string &_str, kvp_map_t &_kvp, const std::string &_association=KVP_DEF_ASSOCIATION, const std::string &_delimeter=KVP_DEF_DELIMITER)
Definition: irods_kvp_string_parser.cpp:69
load_balanced_file_open
irods::error load_balanced_file_open(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:171
load_balanced_file_rebalance
irods::error load_balanced_file_rebalance(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:969
load_balanced_file_closedir
irods::error load_balanced_file_closedir(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:389
irods::RESOURCE_OP_MKDIR
const std::string RESOURCE_OP_MKDIR("resource_mkdir")
load_balanced_resource::need_post_disconnect_maintenance_operation
irods::error need_post_disconnect_maintenance_operation(bool &_flg)
Definition: libload_balanced.cpp:1039
irods::RESOURCE_OP_OPENDIR
const std::string RESOURCE_OP_OPENDIR("resource_opendir")
irods::RESOURCE_OP_STAGETOCACHE
const std::string RESOURCE_OP_STAGETOCACHE("resource_stagetocache")
error
int error
Definition: filesystem.cpp:101
irods::file_object_ptr
boost::shared_ptr< file_object > file_object_ptr
Definition: irods_file_object.hpp:145
MAX_ELAPSE_TIME
#define MAX_ELAPSE_TIME
Definition: libload_balanced.cpp:33
irods::WRITE_OPERATION
const std::string WRITE_OPERATION("WRITE")
irods::plugin_base::add_operation
error add_operation(const std::string &_op, std::function< error(plugin_context &)> _f)
Definition: irods_plugin_base.hpp:122
irods::plugin_context::fco
virtual first_class_object_ptr fco()
Definition: irods_plugin_context.hpp:102
irods::RESOURCE_OP_SYNCTOARCH
const std::string RESOURCE_OP_SYNCTOARCH("resource_synctoarch")
irods_kvp_string_parser.hpp
load_balanced_file_rename
irods::error load_balanced_file_rename(irods::plugin_context &_ctx, const char *_new_file_name)
Definition: libload_balanced.cpp:432
CHILD_NOT_FOUND
@ CHILD_NOT_FOUND
Definition: rodsErrorTable.h:753
SqlResult::len
int len
Definition: rodsGenQuery.h:63
load_balanced_resource::load_balanced_resource
load_balanced_resource(const std::string &_inst_name, const std::string &_context)
Definition: libload_balanced.cpp:1003
LOG_DEBUG10
#define LOG_DEBUG10
Definition: rodsLog.h:19
load_balanced_get_resc_for_call
irods::error load_balanced_get_resc_for_call(irods::plugin_context &_ctx, irods::resource_ptr &_resc)
Definition: libload_balanced.cpp:106
rsGenQuery.hpp
load_balanced_file_mkdir
irods::error load_balanced_file_mkdir(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:326
irods::RESOURCE_OP_REBALANCE
const std::string RESOURCE_OP_REBALANCE("resource_rebalance")
load_balanced_file_create
irods::error load_balanced_file_create(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:150
irods::lookup_table::set
error set(const std::string &_key, const ValueType &_val)
Definition: irods_lookup_table.hpp:83
freeGenQueryOut
int freeGenQueryOut(genQueryOut_t **genQueryOut)
Definition: rcMisc.cpp:1133
irods::kvp_map_t
std::map< std::string, std::string > kvp_map_t
Definition: irods_kvp_string_parser.hpp:30
load_balanced_file_unregistered
irods::error load_balanced_file_unregistered(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:563
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
irods::RESOURCE_OP_OPEN
const std::string RESOURCE_OP_OPEN("resource_open")
clearGenQueryInp
void clearGenQueryInp(void *voidInp)
Definition: rcMisc.cpp:1118
irods::CREATE_OPERATION
const std::string CREATE_OPERATION("CREATE")
rsGenQuery
int rsGenQuery(rsComm_t *rsComm, genQueryInp_t *genQueryInp, genQueryOut_t **genQueryOut)
Definition: rsGenQuery.cpp:604
irods::UNLINK_OPERATION
const std::string UNLINK_OPERATION("UNLINK")
plugin_factory
irods::resource * plugin_factory(const std::string &_inst_name, const std::string &_context)
Definition: libload_balanced.cpp:1060
load_balanced_file_getfs_freespace
irods::error load_balanced_file_getfs_freespace(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:475
load_balanced_file_truncate
irods::error load_balanced_file_truncate(irods::plugin_context &_ctx)
Definition: libload_balanced.cpp:454