[Bps-public-commit] Prophet - A disconnected, replicated p2p database branch, master, updated. 86f879f2a2fbb0b221759fa49dc21391dc71e53b
jesse
jesse at bestpractical.com
Thu Feb 19 23:29:04 EST 2009
The branch, master has been updated
via 86f879f2a2fbb0b221759fa49dc21391dc71e53b (commit)
from 5c327a82876571512f12688f2e0074d06f765a5c (commit)
Summary of changes:
Makefile.PL | 1 -
lib/Prophet/Replica/prophet.pm | 24 +++++++++++-------------
2 files changed, 11 insertions(+), 14 deletions(-)
- Log -----------------------------------------------------------------
commit 86f879f2a2fbb0b221759fa49dc21391dc71e53b
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Thu Feb 19 23:27:58 2009 -0500
Remove dependency on File::Find::Rule
diff --git a/Makefile.PL b/Makefile.PL
index e4d0bd7..72f0917 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -14,7 +14,6 @@ requires('URI');
requires('HTTP::Date');
requires( 'JSON' => '2.00' );
requires('Module::Pluggable');
-requires('File::Find::Rule');
requires('Proc::InvokeEditor');
requires( 'Scalar::Defer' => '0.18' );
requires( 'Any::Moose' => '0.04' );
diff --git a/lib/Prophet/Replica/prophet.pm b/lib/Prophet/Replica/prophet.pm
index db58637..8adbbde 100644
--- a/lib/Prophet/Replica/prophet.pm
+++ b/lib/Prophet/Replica/prophet.pm
@@ -7,7 +7,7 @@ use File::Spec ();
use File::Path;
use Cwd ();
use Digest::SHA1 qw(sha1_hex);
-use File::Find::Rule;
+use File::Find;
use Data::UUID;
use Prophet::Util;
use JSON;
@@ -162,7 +162,7 @@ TODO: define the format for changesets and records
Files inside the C<records> directory are index files which list off all published versions of a record and the key necessary to retrieve the record from the I<content-addressed store>.
-Inside the C<records> directory, you'll find directories named for each
+Inside the C<records> directory, you'll warn "Got types ".join(',', at types);find directories named for each
C<type> in your database. Inside each C<type> directory, you'll find a two-level directory tree of single hexadecimal digits. You'll find the record with the type <Foo> and the UUID C<29A3CA16-03C5-11DD-9AE0-E25CFCEE7EC4> stored in
records/Foo/2/9/29A3CA16-03C5-11DD-9AE0-E25CFCEE7EC4
@@ -1029,13 +1029,11 @@ sub list_records {
return [] unless $self->type_exists( type => $args{type} );
#return just the filenames, which, File::Find::Rule doesn't seem capable of
- my @record_uuids
- = map { my @path = split( qr'/', $_ ); pop @path }
- File::Find::Rule->file->maxdepth(3)->in(
+ my @record_uuids;
+ find sub { return unless -f $_; push @record_uuids, $_ },
File::Spec->catdir(
- $self->fs_root => $self->_record_type_dir( $args{'type'} )
- )
- );
+ $self->fs_root => $self->_record_type_dir( $args{'type'} ));
+
return [
map {
my $record = $args{record_class}->new( { app_handle => $self->app_handle, handle => $self, type => $args{type} } );
@@ -1053,11 +1051,11 @@ sub list_records {
sub list_types {
my $self = shift;
-
- return [ map { my @path = split( qr'/', $_ ); pop @path }
- File::Find::Rule->mindepth(1)->maxdepth(1)
- ->in( File::Spec->catdir( $self->fs_root => $self->record_dir ) ) ];
-
+ opendir( my $dh, File::Spec->catdir( $self->fs_root => $self->record_dir ) )
+ || die "can't open type directory $!";
+ my @types = grep {$_ !~ /^\./ } readdir($dh);
+ closedir $dh;
+ return \@types;
}
sub type_exists {
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list