/[Sack]/trunk/bin/sack.pl
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/bin/sack.pl

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

revision 33 by dpavlin, Wed Sep 23 20:28:21 2009 UTC revision 35 by dpavlin, Wed Sep 23 21:55:08 2009 UTC
# Line 57  sub BEGIN { Line 57  sub BEGIN {
57    
58  use lib "$prefix/srv/Sack/lib/";  use lib "$prefix/srv/Sack/lib/";
59  use Sack::Digest;  use Sack::Digest;
60    Sack::Digest->clean;
61  Sack::Digest->open( $port );  Sack::Digest->open( $port );
62  sub digest { Sack::Digest->digest($_[0]) }  sub digest { Sack::Digest->to_int($_[0]) }
63    
64  use lib "$prefix/srv/webpac2/lib/";  use lib "$prefix/srv/webpac2/lib/";
65  use WebPAC::Input::ISI;  use WebPAC::Input::ISI;
# Line 240  sub run_views { Line 241  sub run_views {
241    
242                          store $out => $path;                          store $out => $path;
243                          report "[$port] SAVE $path $offset-$limit", -s $path, "bytes";                          report "[$port] SAVE $path $offset-$limit", -s $path, "bytes";
244    
245                            if ( -s $path < 4096 ) {
246                                    print '$out = ',dump( $out ),$/;
247                            }
248                  }                  }
249    
250          }          }
251    
252  }  }
253    
254    
255    sub info_tabs {
256            "$port\t$offset\t$limit\t$num_records\t$path\t"
257            . join(',', map {
258                    my $b = $_;
259                    $b =~ s{^.+/([^/]+)$}{$1};
260                    "$b " . -s $_
261            } glob '/dev/shm/sack.*' );
262    }
263    
264    
265  if ( $port ) {  if ( $port ) {
266          my $sock = IO::Socket::INET->new(          my $sock = IO::Socket::INET->new(
267                  Listen    => SOMAXCONN,                  Listen    => SOMAXCONN,
# Line 275  if ( $port ) { Line 291  if ( $port ) {
291                          run_code $header[1] => $content;                          run_code $header[1] => $content;
292                          send_sock $client => freeze $out;                          send_sock $client => freeze $out;
293                  } elsif ( $header[0] eq 'info' ) {                  } elsif ( $header[0] eq 'info' ) {
294                          my $info = "$port\t$offset\t$limit\t$num_records\t$path";                          my $info = info_tabs;
                         $info .= "\t" . eval $header[1] if $header[1];  
295                          warn "[$port] info $info\n";                          warn "[$port] info $info\n";
296                          send_sock $client => $info;                          send_sock $client => $info;
297                  } elsif ( $header[0] eq 'exit' ) {                  } elsif ( $header[0] eq 'exit' ) {
# Line 293  sub info { Line 308  sub info {
308          send_nodes 'info' => $2;          send_nodes 'info' => $2;
309    
310          my @info = (          my @info = (
311                  "port\toffset\tlimit\t#recs\tpath",                  "port\toffset\tlimit\t#recs\tpath\tfiles",
312                  "----\t------\t-----\t-----\t----",                  "----\t------\t-----\t-----\t----\t-----",
313                  "$port\t$offset\t$limit\t$num_records\t$path",                  info_tabs,
314          );          );
315    
316          push @info, get_node $_ foreach @nodes;          push @info, get_node $_ foreach @nodes;

Legend:
Removed from v.33  
changed lines
  Added in v.35

  ViewVC Help
Powered by ViewVC 1.1.26