IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 4, 2007, 3:41:29 PM (19 years ago)
Author:
jhoblitt
Message:

add File::ExtAttr support

Location:
trunk/Nebulous-Server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/Build.PL

    r13257 r13269  
    9292        'Net::Server::Daemonize'=> '0.05',
    9393        'Sys::Statistics::Linux::DiskUsage' => '0.02',
    94 
     94        'File::ExtAttr'         => '1.03',
    9595    },
    9696    build_requires      => {
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r13251 r13269  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.38 2007-05-04 23:36:46 jhoblitt Exp $
     3# $Id: Server.pm,v 1.39 2007-05-05 01:41:29 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    208208    my $filename = $key;
    209209    # mange '/'s into ':'
    210     $key =~ s|/|:|g;
    211     my $uri = URI::file->new("$vol_path/$key.$ins_id");
     210    $filename =~ s|/|:|g;
     211    my $uri = URI::file->new("$vol_path/$filename.$ins_id");
    212212    $log->debug("generated uri $uri");
    213213
    214214    # TODO add some stuff here to retry if unsucessful
    215215    eval {
    216         _create_empty_file($uri->file);
     216        _create_empty_file($uri->file, $key);
    217217    };
    218218    if ($@) {
     
    361361    }
    362362
    363     my $uri = URI::file->new("$vol_path/$key.$ins_id");
     363    my $filename = $key;
     364    # mange '/'s into ':'
     365    $filename =~ s|/|:|g;
     366    my $uri = URI::file->new("$vol_path/$filename.$ins_id");
    364367    $log->debug("generated uri $uri");
    365368
    366369    # TODO add some stuff here to retry if unsucessful
    367370    eval {
    368         _create_empty_file($uri->file);
     371        _create_empty_file($uri->file, $key);
    369372    };
    370373    if ($@) {
  • trunk/Nebulous-Server/t/03_server_create_object.t

    r13206 r13269  
    33# Copryight (C) 2004-2005  Joshua Hoblitt
    44#
    5 # $Id: 03_server_create_object.t,v 1.17 2007-05-04 00:43:44 jhoblitt Exp $
     5# $Id: 03_server_create_object.t,v 1.18 2007-05-05 01:41:29 jhoblitt Exp $
    66
    77use strict;
    88use warnings FATAL => qw( all );
    99
    10 use Test::More tests => 22;
     10use Test::More tests => 28;
    1111
    1212use lib qw( ./t ./lib );
     
    1717use Test::URI;
    1818use URI::Split qw( uri_split );
     19use File::ExtAttr qw( getfattr );
    1920
    2021my $neb = Nebulous::Server->new(
     
    3334    ok(-e $path, "file exists");
    3435    uri_scheme_ok($uri, 'file');
     36
     37    is(getfattr($path, 'nebulous_key'), 'foo', 'nebulous_key xattr');
    3538}
    3639
     
    4447    ok(-e $path, "file exists");
    4548    uri_scheme_ok($uri, 'file');
     49
     50    is(getfattr($path, 'nebulous_key'), '/foo', 'nebulous_key xattr');
    4651}
    4752
     
    5560    ok(-e $path, "file exists");
    5661    uri_scheme_ok($uri, 'file');
     62
     63    is(getfattr($path, 'nebulous_key'), '/foo/', 'nebulous_key xattr');
    5764}
    5865
     
    6673    ok(-e $path, "file exists");
    6774    uri_scheme_ok($uri, 'file');
     75
     76    is(getfattr($path, 'nebulous_key'), 'foo/', 'nebulous_key xattr');
    6877}
    6978
     
    7786    ok(-e $path, "file exists");
    7887    uri_scheme_ok($uri, 'file');
     88
     89    is(getfattr($path, 'nebulous_key'), 'foo/bar', 'nebulous_key xattr');
    7990}
    8091
     
    8899    ok(-e $path, "file exists");
    89100    uri_scheme_ok($uri, 'file');
     101
     102    is(getfattr($path, 'nebulous_key'), '/foo/bar', 'nebulous_key xattr');
    90103}
    91104
Note: See TracChangeset for help on using the changeset viewer.