Filesys-Virtual-Async-Dispatcher
view release on metacpan or search on metacpan
lib/Filesys/Virtual/Async/Dispatcher.pm view on Meta::CPAN
sub lstat {
my( $self, $fh_or_path, $callback ) = @_;
# FIXME we don't support array mode because it would require insane amounts of munging the paths
if ( ref $fh_or_path and ref( $fh_or_path ) eq 'ARRAY' ) {
if ( DEBUG ) {
warn 'Passing an ARRAY to lstat() is not supported by the Dispatcher!';
}
$callback->( undef );
return;
}
# is it a fh or path?
if ( ref $fh_or_path ) {
# get the proper mount
my $mapping = $self->_resolve_fh( $fh_or_path );
if ( defined $mapping ) {
if ( exists $self->{'fhmap'}->{ $mapping } ) {
my( $mount, undef ) = $self->_findmount( $self->{'fhmap'}->{ $mapping } );
$mount->lstat( $fh_or_path, $callback );
} else {
die "internal inconsistency - unknown fh: $fh_or_path";
}
} else {
die "internal inconsistency - unknown fh: $fh_or_path";
}
} else {
my( $mount, $where ) = $self->_findmount( $fh_or_path );
$mount->lstat( $where, $callback );
}
return;
}
sub utime {
my( $self, $fh_or_path, $atime, $mtime, $callback ) = @_;
# is it a fh or path?
if ( ref $fh_or_path ) {
# get the proper mount
my $mapping = $self->_resolve_fh( $fh_or_path );
if ( defined $mapping ) {
if ( exists $self->{'fhmap'}->{ $mapping } ) {
my( $mount, undef ) = $self->_findmount( $self->{'fhmap'}->{ $mapping } );
$mount->utime( $fh_or_path, $atime, $mtime, $callback );
} else {
die "internal inconsistency - unknown fh: $fh_or_path";
}
} else {
die "internal inconsistency - unknown fh: $fh_or_path";
}
} else {
my( $mount, $where ) = $self->_findmount( $fh_or_path );
$mount->utime( $where, $atime, $mtime, $callback );
}
return;
}
sub chown {
my( $self, $fh_or_path, $uid, $gid, $callback ) = @_;
# is it a fh or path?
if ( ref $fh_or_path ) {
# get the proper mount
my $mapping = $self->_resolve_fh( $fh_or_path );
if ( defined $mapping ) {
if ( exists $self->{'fhmap'}->{ $mapping } ) {
my( $mount, undef ) = $self->_findmount( $self->{'fhmap'}->{ $mapping } );
$mount->chown( $fh_or_path, $uid, $gid, $callback );
} else {
die "internal inconsistency - unknown fh: $fh_or_path";
}
} else {
die "internal inconsistency - unknown fh: $fh_or_path";
}
} else {
my( $mount, $where ) = $self->_findmount( $fh_or_path );
$mount->chown( $where, $uid, $gid, $callback );
}
return;
}
sub truncate {
my( $self, $fh_or_path, $offset, $callback ) = @_;
# is it a fh or path?
if ( ref $fh_or_path ) {
# get the proper mount
my $mapping = $self->_resolve_fh( $fh_or_path );
if ( defined $mapping ) {
if ( exists $self->{'fhmap'}->{ $mapping } ) {
my( $mount, undef ) = $self->_findmount( $self->{'fhmap'}->{ $mapping } );
$mount->truncate( $fh_or_path, $offset, $callback );
} else {
die "internal inconsistency - unknown fh: $fh_or_path";
}
} else {
die "internal inconsistency - unknown fh: $fh_or_path";
}
} else {
my( $mount, $where ) = $self->_findmount( $fh_or_path );
$mount->truncate( $where, $offset, $callback );
}
return;
}
sub chmod {
my( $self, $fh_or_path, $mode, $callback ) = @_;
# is it a fh or path?
if ( ref $fh_or_path ) {
# get the proper mount
my $mapping = $self->_resolve_fh( $fh_or_path );
if ( defined $mapping ) {
if ( exists $self->{'fhmap'}->{ $mapping } ) {
my( $mount, undef ) = $self->_findmount( $self->{'fhmap'}->{ $mapping } );
$mount->chmod( $fh_or_path, $mode, $callback );
} else {
die "internal inconsistency - unknown fh: $fh_or_path";
}
} else {
die "internal inconsistency - unknown fh: $fh_or_path";
}
} else {
my( $mount, $where ) = $self->_findmount( $fh_or_path );
$mount->chmod( $where, $mode, $callback );
}
return;
}
sub unlink {
my( $self, $path, $callback ) = @_;
my( $mount, $where ) = $self->_findmount( $path );
$mount->unlink( $where, $callback );
( run in 3.682 seconds using v1.01-cache-2.11-cpan-71847e10f99 )