[Bps-public-commit] Prophet branch, master, updated. bf8b0d1b7bf521d8dafe9d66cce7fa2db375cdd7
jesse
jesse at bestpractical.com
Fri Aug 28 15:49:53 EDT 2009
The branch, master has been updated
via bf8b0d1b7bf521d8dafe9d66cce7fa2db375cdd7 (commit)
via 06d8533ade25d29cfa176df770b47429c8e3233e (commit)
from 928af40288cfaeb67cfb53813238ea4df8915ca1 (commit)
Summary of changes:
lib/Prophet/CLI/Command/Clone.pm | 46 +++++++++++++++++++++++++++++++++++++-
lib/Prophet/Server/Dispatcher.pm | 5 ++-
2 files changed, 48 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 06d8533ade25d29cfa176df770b47429c8e3233e
Author: Pedro Melo <melo at simplicidade.org>
Date: Fri Aug 28 18:03:48 2009 +0100
Added --local to prophet clone: list local Bonjour sources
For each source we print the clone URL and the UUID.
There is no friendly name annouced via Bonjour for now, so thats the
best we can do.
Signed-off-by: Pedro Melo <melo at simplicidade.org>
diff --git a/lib/Prophet/CLI/Command/Clone.pm b/lib/Prophet/CLI/Command/Clone.pm
index fd40af6..4780bff 100644
--- a/lib/Prophet/CLI/Command/Clone.pm
+++ b/lib/Prophet/CLI/Command/Clone.pm
@@ -7,7 +7,7 @@ sub usage_msg {
my $cmd = $self->cli->get_script_name;
return <<"END_USAGE";
-usage: ${cmd}clone --from <url>
+usage: ${cmd}clone --from <url> | --local
END_USAGE
}
@@ -16,6 +16,11 @@ sub run {
$self->print_usage if $self->has_arg('h');
+ if ($self->has_arg('local')) {
+ $self->list_bonjour_sources;
+ return;
+ }
+
$self->validate_args();
$self->set_arg( 'to' => $self->app_handle->handle->url() );
@@ -97,6 +102,45 @@ sub validate_args {
sub merge_resolver { 'Prophet::Resolver::AlwaysTarget'}
+=head2 list_bonjour_sources
+
+Probes the local network for bonjour replicas if the local arg is specified.
+
+Prints a list of all sources found.
+
+=cut
+sub list_bonjour_sources {
+ my $self = shift;
+ my @bonjour_sources;
+
+ Prophet::App->try_to_require('Net::Bonjour');
+ if ( Prophet::App->already_required('Net::Bonjour') ) {
+ print "Probing for local sources with Bonjour\n\n";
+ my $res = Net::Bonjour->new('prophet');
+ $res->discover;
+ my $count = 0;
+ for my $entry ( $res->entries ) {
+ require URI;
+ my $uri = URI->new();
+ $uri->scheme( 'http' );
+ $uri->host($entry->hostname);
+ $uri->port( $entry->port );
+ $uri->path('replica/');
+ print ' * '.$uri->canonical.' - '.$entry->name."\n";
+ $count++;
+ }
+
+ if ($count) {
+ print "\nFound $count source".($count==1? '' : 's')."\n";
+ }
+ else {
+ print "No local sources found.\n";
+ }
+ }
+
+ return;
+}
+
__PACKAGE__->meta->make_immutable;
no Any::Moose;
commit bf8b0d1b7bf521d8dafe9d66cce7fa2db375cdd7
Author: Pedro Melo <melo at simplicidade.org>
Date: Fri Aug 28 17:26:27 2009 +0100
Fix: the uuid_generator is in the replica, not the server
Signed-off-by: Pedro Melo <melo at simplicidade.org>
diff --git a/lib/Prophet/Server/Dispatcher.pm b/lib/Prophet/Server/Dispatcher.pm
index 2711e60..1a0d840 100644
--- a/lib/Prophet/Server/Dispatcher.pm
+++ b/lib/Prophet/Server/Dispatcher.pm
@@ -52,7 +52,8 @@ under { method => 'GET' } => sub {
on 'changesets.idx' => sub {
my $self = shift;
my $index = '';
- $_->metadata->{replica_handle}->traverse_changesets(
+ my $repl = $_->metadata->{replica_handle};
+ $repl->traverse_changesets(
after=> 0,
load_changesets => 0,
callback => sub {
@@ -60,7 +61,7 @@ under { method => 'GET' } => sub {
my $data = $args{changeset_metadata};
my $changeset_index_line = pack( 'Na16NH40',
$data->[0],
- $self->server->uuid_generator->from_string( $data->[1]),
+ $repl->uuid_generator->from_string( $data->[1]),
$data->[2],
$data->[3]);
$index .= $changeset_index_line;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list