Muck
view release on metacpan or search on metacpan
lib/Muck/FS/VFS.pm
lib/Muck/FS/S3.pm
lib/Muck/FS/S3/AWSAuthConnection.pm
lib/Muck/FS/S3/GetResponse.pm
lib/Muck/FS/S3/ListAllMyBucketsResponse.pm
lib/Muck/FS/S3/ListBucketResponse.pm
lib/Muck/FS/S3/QueryStringAuthGenerator.pm
lib/Muck/FS/S3/Response.pm
lib/Muck/FS/S3/S3Object.pm
t/FS-chmod.t
t/FS-chown.t
t/FS-getattr.t
t/FS-getdir.t
t/FS-link.t
t/FS-mkdir.t
t/FS-mknod.t
t/FS-open.t
t/FS-read.t
t/FS-readlink.t
t/FS-rename.t
t/FS-rmdir.t
lib/Muck/FS.pm view on Meta::CPAN
## File Handle Cache Setup
$self->{Rfh_cache} = {};
$self->{Wfh_cache} = {};
$fuse_self = $self;
Fuse::main(
mountpoint => $arg->{'mount'},
mountopts => 'allow_other',
threaded => '0',
chown => \&Muck::FS::VFS::x_chown,
chmod => \&Muck::FS::VFS::x_chmod,
getattr => \&Muck::FS::VFS::x_getattr,
getdir => \&Muck::FS::VFS::x_getdir,
link => \&Muck::FS::VFS::x_link,
mknod => \&Muck::FS::VFS::x_mknod,
mkdir => \&Muck::FS::VFS::x_mkdir,
open => \&Muck::FS::VFS::x_open,
read => \&Muck::FS::VFS::x_read,
readlink => \&Muck::FS::VFS::x_readlink,
release => \&Muck::FS::VFS::x_release,
lib/Muck/FS/VFS.pm view on Meta::CPAN
use POE::Component::IKC::ClientLite;
#use threads;
#use threads::shared;
use strict;
use constant BLOCK => 4096;
# these are up front in an array so the Muck::FS can pre-prepare these
# and cache the resulting statement handles for re-use
our @statements = (
{ name => 'chown_uid',
sql => 'UPDATE inodes SET uid=? WHERE inode=?' },
{ name => 'chown_gid',
sql => 'UPDATE inodes SET gid=? WHERE inode=?' },
{ name => 'chown_uid_gid',
sql => 'UPDATE inodes SET uid=?, gid=? WHERE inode=?' },
{ name => 'chmod',
sql => 'UPDATE inodes SET mode=? WHERE inode=?' },
{ name => 'getattr',
sql => 'SELECT inode, mode, uid, gid, atime, mtime, ctime, ' .
'size, dirty, cachetime ' .
'FROM inodes WHERE inode=? AND deleted = 0' },
{ name => 'inuse',
sql => 'UPDATE inodes SET inuse = inuse + ? WHERE inode = ?' },
{ name => 'last_id',
lib/Muck/FS/VFS.pm view on Meta::CPAN
my $memcache = $Muck::FS::fuse_self->{memcached};
$memcache->delete($from); # purge from cache to allow regen of nlinks
# TODO - should really look for any other paths that use this same inode
# and delete their caches too so that nlinks will get fixed in cache
return 0;
}
#----------------------------------------------------------------------------
sub x_chown {
#----------------------------------------------------------------------------
# update db only - no cachefile/s3 changes needed
debug("CALLBACK: x_chown(@_)");
my ( $file, $uid, $gid ) = @_;
my ( $inode ) = path2inode( $file );
if ( $uid and $gid ) {
db_execute('chown_uid_gid', $uid, $gid, $inode);
} elsif ( $uid ) {
db_execute('chown_uid', $uid, $inode);
} elsif ( $gid ) {
db_execute('chown_gid', $gid, $inode);
}
return 0;
}
#----------------------------------------------------------------------------
sub x_chmod {
#----------------------------------------------------------------------------
# update db only - no cachefile/s3 changes needed
debug("CALLBACK: x_chmod(@_)");
my ( $file, $mode ) = @_;
t/FS-chown.t view on Meta::CPAN
use English;
plan tests => 4;
my (@stat);
chdir($_point);
system("echo frog >file");
SKIP: {
skip('Need root to give away ownership', 4) unless ($UID == 0);
ok(chown(0,0,"file"),"set 0,0");
@stat = stat("file");
ok($stat[4] == 0 && $stat[5] == 0,"0,0");
ok(chown(1,1,"file"),"set 1,1");
@stat = stat("file");
ok($stat[4] == 1 && $stat[5] == 1,"1,1");
}
unlink("file");
( run in 0.950 second using v1.01-cache-2.11-cpan-71847e10f99 )