view release on metacpan or search on metacpan
lib/AC/Yenta/IO/TCP/Client.pm view on Meta::CPAN
# -*- perl -*-
# Copyright (c) 2009 AdCopy
# Author: Jeff Weisberg
# Created: 2009-Aug-10 12:38 (EDT)
# Function: choose best IP addr to use in NAT/cloud env
#
# $Id$
package AC::Yenta::IO::TCP::Client;
our @ISA = 'AC::DC::IO::TCP::Client';
use AC::Yenta::MySelf;
use AC::Misc;
use strict;
lib/AC/Yenta/Status.pm view on Meta::CPAN
next unless @peer;
debug("saving peer status file");
unless( open(FILE, ">$file.tmp") ){
problem("cannot open save file '$file.tmp': $!");
return;
}
for my $pd (@peer){
# only save best addr in save file
my($ip, $port) = AC::Yenta::IO::TCP::Client->use_addr_port( $pd->{ip} );
my $data = {
id => $pd->{server_id},
addr => $ip,
port => int($port),
status => int($pd->{status}),
subsystem => $pd->{subsystem},
environment => $pd->{environment},
sort_metric => int($pd->{sort_metric}),
lib/AC/Yenta/Store/AE.pm view on Meta::CPAN
return 1;
}
################################################################
# find most stale map
sub _pick_map {
my $me = shift;
my $maps = conf_value('map');
my(@best, $bestv);
for my $m (keys %$maps){
my $lt = AC::Yenta::Store::store_get_internal($m, 'ae_last_start');
if( !@best || $lt < $bestv ){
@best = $m;
$bestv = $lt;
}elsif( $lt == $bestv ){
push @best, $m;
}
}
return unless @best;
my $map = $best[ rand(@best) ];
$me->{map} = $map;
# is this a data or file map?
# adjust accordingly
my $cf = conf_map( $map );
$me->{has_files} = 1 if $cf->{basedir};
$me->{maxget} = $me->{has_files} ? $MAXFILES : $MAXGET;
$me->{expire} = $cf->{expire};
return 1;
lib/AC/protobuf/auth.pl view on Meta::CPAN
Google::ProtocolBuffers->create_message(
'ACPAuth',
[
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_STRING(),
'algorithm', 1, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
unless (ACPEncrypt->can('_pb_fields_list')) {
Google::ProtocolBuffers->create_message(
'ACPEncrypt',
[
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_STRING(),
lib/AC/protobuf/auth.pl view on Meta::CPAN
Google::ProtocolBuffers::Constants::TYPE_INT32(),
'length', 5, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_BYTES(),
'ciphertext', 50, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
}
1;
lib/AC/protobuf/heartbeat.pl view on Meta::CPAN
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, }
);
}
}
1;
lib/AC/protobuf/std_ipport.pl view on Meta::CPAN
Google::ProtocolBuffers::Constants::TYPE_INT32(),
'port', 2, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_OPTIONAL(),
Google::ProtocolBuffers::Constants::TYPE_STRING(),
'natdom', 3, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
}
1;
lib/AC/protobuf/std_reply.pl view on Meta::CPAN
Google::ProtocolBuffers::Constants::TYPE_INT32(),
'status_code', 1, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_OPTIONAL(),
Google::ProtocolBuffers::Constants::TYPE_STRING(),
'status_message', 2, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
}
1;
lib/AC/protobuf/yenta_check.pl view on Meta::CPAN
Google::ProtocolBuffers::Constants::TYPE_STRING(),
'hash', 5, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_OPTIONAL(),
Google::ProtocolBuffers::Constants::TYPE_INT64(),
'shard', 6, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
unless (ACPYentaCheckReply->can('_pb_fields_list')) {
Google::ProtocolBuffers->create_message(
'ACPYentaCheckReply',
[
[
Google::ProtocolBuffers::Constants::LABEL_REPEATED(),
'ACPYentaCheckValue',
'check', 1, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
unless (ACPYentaCheckRequest->can('_pb_fields_list')) {
Google::ProtocolBuffers->create_message(
'ACPYentaCheckRequest',
[
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_STRING(),
lib/AC/protobuf/yenta_check.pl view on Meta::CPAN
Google::ProtocolBuffers::Constants::TYPE_INT64(),
'version', 3, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_OPTIONAL(),
Google::ProtocolBuffers::Constants::TYPE_INT64(),
'shard', 4, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
}
1;
lib/AC/protobuf/yenta_getset.pl view on Meta::CPAN
Google::ProtocolBuffers::Constants::TYPE_BYTES(),
'file', 6, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_OPTIONAL(),
Google::ProtocolBuffers::Constants::TYPE_INT64(),
'shard', 7, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
unless (ACPYentaDistRequest->can('_pb_fields_list')) {
Google::ProtocolBuffers->create_message(
'ACPYentaDistRequest',
[
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_INT32(),
lib/AC/protobuf/yenta_getset.pl view on Meta::CPAN
Google::ProtocolBuffers::Constants::TYPE_STRING(),
'sender', 3, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
'ACPYentaMapDatum',
'datum', 4, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
unless (ACPYentaGetSet->can('_pb_fields_list')) {
Google::ProtocolBuffers->create_message(
'ACPYentaGetSet',
[
[
Google::ProtocolBuffers::Constants::LABEL_REPEATED(),
'ACPYentaMapDatum',
'data', 1, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
unless (ACPYentaDistReply->can('_pb_fields_list')) {
Google::ProtocolBuffers->create_message(
'ACPYentaDistReply',
[
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_INT32(),
lib/AC/protobuf/yenta_getset.pl view on Meta::CPAN
Google::ProtocolBuffers::Constants::TYPE_STRING(),
'status_message', 2, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_BOOL(),
'haveit', 3, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
}
1;
lib/AC/protobuf/yenta_status.pl view on Meta::CPAN
Google::ProtocolBuffers->create_message(
'ACPYentaStatusReply',
[
[
Google::ProtocolBuffers::Constants::LABEL_REPEATED(),
'ACPYentaStatus',
'status', 1, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
unless (ACPYentaStatus->can('_pb_fields_list')) {
Google::ProtocolBuffers->create_message(
'ACPYentaStatus',
[
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_STRING(),
lib/AC/protobuf/yenta_status.pl view on Meta::CPAN
Google::ProtocolBuffers::Constants::TYPE_STRING(),
'path', 15, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_OPTIONAL(),
Google::ProtocolBuffers::Constants::TYPE_INT32(),
'capacity_metric', 16, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
unless (ACPYentaStatusRequest->can('_pb_fields_list')) {
Google::ProtocolBuffers->create_message(
'ACPYentaStatusRequest',
[
[
Google::ProtocolBuffers::Constants::LABEL_OPTIONAL(),
'ACPYentaStatus',
'myself', 1, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
unless (ACPIPPort->can('_pb_fields_list')) {
Google::ProtocolBuffers->create_message(
'ACPIPPort',
[
[
Google::ProtocolBuffers::Constants::LABEL_REQUIRED(),
Google::ProtocolBuffers::Constants::TYPE_FIXED32(),
lib/AC/protobuf/yenta_status.pl view on Meta::CPAN
Google::ProtocolBuffers::Constants::TYPE_INT32(),
'port', 2, undef
],
[
Google::ProtocolBuffers::Constants::LABEL_OPTIONAL(),
Google::ProtocolBuffers::Constants::TYPE_STRING(),
'natdom', 3, undef
],
],
{ 'create_accessors' => 1, 'follow_best_practice' => 1, }
);
}
}
1;