/[Sack]/trunk/lib/Sack/Lorry.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Sack/Lorry.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 127 by dpavlin, Wed Oct 7 16:21:33 2009 UTC revision 137 by dpavlin, Wed Oct 7 18:30:22 2009 UTC
# Line 14  use Time::HiRes qw(time sleep); Line 14  use Time::HiRes qw(time sleep);
14    
15  use lib 'lib';  use lib 'lib';
16  use base qw(Sack::Pid);  use base qw(Sack::Pid);
17    use Sack;
18    
19  our $pids;  our $pids;
20    
# Line 270  sub view { Line 271  sub view {
271          return $out;          return $out;
272  }  }
273    
274    sub command {
275            my ( $self, $cmd ) = @_;
276    
277            duration "repl $cmd";
278    
279            my $repl = 1;
280    
281            if ( $cmd =~ m{^v} ) {
282                    $out = $self->view( $self->{view} );
283                    duration 'view';
284            } elsif ( $cmd =~ m{^d} ) {
285                    warn dump $out;
286                    duration 'dump';
287            } elsif ( $cmd =~ m{^x} ) {
288                    $repl = 0;
289            } elsif ( $cmd =~ m{^r} ) {
290                    $self->restart_nodes;
291            } elsif ( $cmd =~ m{^i} ) {
292                    $self->send_to_all({ info => 1 });
293                    my $info = $self->get_from_all;
294                    foreach my $port ( $self->connected ) {
295                            warn "INFO view $self->{view} ", -s $self->{view}, " bytes\n";
296                            warn "[$port] $self->{port_on_host}->{$port} ", dump( $info->{$port} ), "\n";
297                    }
298            } elsif ( $cmd =~ m{^u} ) {
299                    my $updated;
300                    foreach my $host ( $self->connected ) {
301                            next if $updated->{$host}++;
302                            warn "update $host\n";
303                            system "find /srv/Sack/ | cpio --create | ssh -F etc/lib.ssh $host cpio --extract --make-directories --unconditional";
304                    }
305            } elsif ( $cmd =~ m{^sh\s+(.+)} ) {
306                    $self->send_to_all({ sh => $1 });
307                    my $sh = $self->get_from_all;
308                    foreach my $port ( $self->connected ) {
309                            warn "[$port]# $1\n$sh->{$port}->{sh}";
310                    }
311            } else {
312                    warn "UNKNOWN $cmd\n" if $cmd;
313            }
314    
315    }
316    
317    
318  sub DESTROY {  sub DESTROY {
319          warn "pids ",dump( $pids );          warn "pids ",dump( $pids );

Legend:
Removed from v.127  
changed lines
  Added in v.137

  ViewVC Help
Powered by ViewVC 1.1.26