AC-Yenta
view release on metacpan or search on metacpan
lib/AC/Yenta/Kibitz/Store/Client.pm view on Meta::CPAN
$proto->{data} = $data;
$proto->{content} = $content;
eval {
my $yp = AC::Yenta::Protocol->new();
$proto->{data} = $yp->decode_reply($proto) if $data;
};
if(my $e = $@){
problem("cannot decode reply: $e");
}
# process
$me->{_store_ok} = 1;
if( $proto->{is_error} || $@ ){
my $e = $@ || 'remote error';
$me->run_callback('error', {
error => $e,
});
}else{
$me->run_callback('load', $proto);
}
lib/AC/Yenta/Kibitz/Store/Server.pm view on Meta::CPAN
my $req;
eval {
$req = ACPYentaGetSet->decode( $gpb );
};
if(my $e = $@){
problem("cannot decode request: $e");
$io->shut();
return;
}
# process requests
my @res;
my $rescont;
for my $r (@{ $req->{data} }){
debug("get request: $r->{map}, $r->{key}, $r->{version}");
my($data, $ver, $file, $meta) = store_get( $r->{map}, $r->{key}, $r->{version} );
my $res = {
map => $r->{map},
key => $r->{key},
};
lib/AC/Yenta/Kibitz/Store/Server.pm view on Meta::CPAN
data_encrypted => $proto->{data_encrypted},
}, { check => \@res } );
debug("sending check reply");
$io->timeout_rel($TIMEOUT);
$io->{writebuf_timeout} = $TIMEOUT;
$io->write_and_shut( $response );
}
# get + process merkle data
sub _get_check {
my $map = shift;
my $shard = shift;
my $ver = shift;
my $lev = shift;
my $res = store_get_merkle($map, $shard, $ver, $lev);
return unless $res;
for my $r (@$res) {
$r->{map} = $map;
lib/AC/Yenta/Monitor.pm view on Meta::CPAN
# -*- perl -*-
# Copyright (c) 2009 AdCopy
# Author: Jeff Weisberg
# Created: 2009-May-12 11:03 (EDT)
# Function: monitor related processes
#
# $Id$
# we periodically check the heartbeats of various processes (dancrs, scriblers, ...)
# and kibitz their info around the network
package AC::Yenta::Monitor;
use AC::Yenta::Debug 'monitor';
use AC::Yenta::Config;
use AC::Yenta::Monitor::Client;
use AC::Misc;
use AC::Yenta::MySelf;
use Sys::Hostname;
lib/AC/Yenta/Monitor.pm view on Meta::CPAN
_hb_ip_info( $up, $MON{$id} );
$MON{$id} = $up;
}
sub _hb_ip_info {
my $up = shift;
my $old = shift;
my $ip;
$ip = $old->{ip} if ($old->{process_id} == $up->{process_id}) && ($old->{server_id} eq $up->{server_id});
unless( $ip ){
my $port = $up->{port};
unless( $port ){
# use monitored port (id is from config)
(undef, $port) = split /:/, $up->{id};
}
if( $up->{ip} ){
$ip = [ { ipv4 => $up->{ip}, port => $port, natdom => undef } ];
lib/AC/Yenta/Store/BDBI.pm view on Meta::CPAN
while( !$end || ($k lt $e) ){
debug("range $k");
last unless $k =~ m|$map/$sub/|;
$k =~ s|$map/$sub/||;
push @k, { k => $k, v => $v };
my $r = $cursor->c_get($k, $v, DB_NEXT);
last if $r; # error
# cursor locks the db
# close+recreate so other processes can proceed
unless( $max -- ){
$cursor->c_close();
$me->_finish();
sleep 0;
$me->_start();
$cursor = $me->{db}->db_cursor();
$cursor->c_get($k, $v, DB_SET);
$max = $MAX;
}
}
lib/AC/protobuf/heartbeat.pl view on Meta::CPAN
'hostname', 9, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_STRING(),
'server_id', 10, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_INT32(),
'process_id', 11, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_OPTIONAL(),
Google::ProtocolBuffers::Constants::TYPE_INT32(),
'capacity_metric', 12, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
proto/heartbeat.proto view on Meta::CPAN
required int32 status_code = 1;
optional string status_message = 2;
optional fixed32 ipv4 = 3;
optional int32 port = 4;
optional fixed64 timestamp = 5;
required string subsystem = 6;
optional string environment = 7;
optional int32 sort_metric = 8;
optional string hostname = 9;
required string server_id = 10;
required int32 process_id = 11;
optional int32 capacity_metric = 12;
}
( run in 0.327 second using v1.01-cache-2.11-cpan-8d75d55dd25 )