in reply to Data Structure Design
Anyway, I'd be inclined to do something like this:
This is obviously very abstract. If you want to do all the workers in parallel you could. I also don't know if "workers" and "queen" correctly describes the relationship between these servers; you could probably think of better terms.my @clusters = ( { Name => 'cluster1', Workers => [ qw(h1 h2 h3 h4 h5 h6) ], Queen => 'h7' }, { ... } ); foreach my $cluster (@clusters) { foreach my $worker (@{$cluster->{Workers}}) { handle_worker($worker, ...); } handle_queen($cluster->{Queen}, ...); }
But this kind of arrangement gives you a lot of flexibility. For example, if another kind of server gets added to the mix later, it's trivial to add processing for it.
|
|---|