/[Sack]/trunk/lib/Sack/Server.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/Server.pm

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

revision 196 by dpavlin, Sun Nov 8 16:17:59 2009 UTC revision 203 by dpavlin, Sun Nov 8 22:56:46 2009 UTC
# Line 13  use Storable qw(); Line 13  use Storable qw();
13  use File::Slurp;  use File::Slurp;
14  use Cwd qw(abs_path);  use Cwd qw(abs_path);
15    
16    use lib '/srv/Sack/lib';
17    use Sack::Merge;
18    
19  my @cloud;  my @cloud;
20  my $cloud_path = $ENV{CLOUD} || die "start with: CLOUD=etc/cloud perl -I/srv/Sack/lib $0\n";  my $cloud_path = $ENV{CLOUD} || die "start with: CLOUD=etc/cloud perl -I/srv/Sack/lib $0\n";
21  @cloud = read_file $cloud_path;  @cloud = read_file $cloud_path;
# Line 104  while (1) { Line 107  while (1) {
107                                          } elsif ( $repl =~ m{load\s*(\S+)?} ) {                                          } elsif ( $repl =~ m{load\s*(\S+)?} ) {
108                                                  my $name = $1 || 'shard';                                                  my $name = $1 || 'shard';
109                                                  @shard_paths = glob "/tmp/sack/$name/*";                                                  @shard_paths = glob "/tmp/sack/$name/*";
110                                                  warn "loading shards ", dump( @shard_paths );                                                  warn "loading shard $name from ", dump( @shard_paths );
111                                                  to_all { load => $name };                                                  to_all { load => $name };
112                                          } elsif ( $repl =~ m{view\s*(\S+)?} ) {                                          } elsif ( $repl =~ m{view\s*(\S+)?} ) {
113                                                  my $path = $1 || '/srv/Sack/views/00.demo.pl';                                                  my $path = $1 || '/srv/Sack/views/00.demo.pl';
114                                                  my $code = read_file $path;                                                  my $code = read_file $path;
115                                                    Sack::Merge->clean;
116                                                  to_all { view => $code, path => $path };                                                  to_all { view => $code, path => $path };
117                                                  $response->{view}->{$path}->{running};                                                  $response->{view}->{$path}->{running};
118                                          } elsif ( $repl =~ m{debug\s*(.+)?} ) {                                          } elsif ( $repl =~ m{debug\s*(.+)?} ) {
119                                                  to_all { debug => $1 };                                                  to_all { debug => $1 };
120                                            } elsif ( $repl =~ m{out} ) {
121                                                    my $out = Sack::Merge->out;    
122                                                    warn "out ",dump( $out );
123                                                    $response->{out} = $out;
124                                            } elsif ( $repl =~ m{clean} ) {
125                                                    delete $info->{shard};
126                                                    to_all { clean => 1 };
127                                          } else {                                          } else {
128                                                  $response->{error}->{unknown} = $data;                                                  $response->{error}->{unknown} = $data;
129                                          }                                          }
# Line 130  while (1) { Line 141  while (1) {
141                                          } else {                                          } else {
142                                                  warn "no more shards for [", $data->{port}, "]\n";                                                  warn "no more shards for [", $data->{port}, "]\n";
143                                          }                                          }
144                                    } elsif ( defined $data->{out} ) {
145                                            Sack::Merge->add( $data->{out} );
146                                  } else {                                  } else {
147                                          warn "UNKNOWN ",dump($data);                                          warn "UNKNOWN ",dump($data);
148                                  }                                  }

Legend:
Removed from v.196  
changed lines
  Added in v.203

  ViewVC Help
Powered by ViewVC 1.1.26