IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17077


Ignore:
Timestamp:
Mar 20, 2008, 3:25:21 PM (18 years ago)
Author:
jhoblitt
Message:

add Nebulous::Server::mounts()

Location:
trunk/Nebulous-Server
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/Changes

    r17073 r17077  
    22
    330.07
     4    - add Nebulous::Server::mounts()
    45    - server/client split into Nebulous::Server and Nebulous::Client packages
    56    - add support for storing instances in multi-tier 'hashed' directories
  • trunk/Nebulous-Server/MANIFEST

    r17074 r17077  
    4848t/13_server_rename_object.t
    4949t/14_server_xattr.t
     50t/15_mounts.t
    5051t/75_parse_neb_key.t
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r17074 r17077  
    1 # Copyright (c) 2004  Joshua Hoblitt
     1# Copyright (c) 2004-2008  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.56 2008-03-20 23:29:56 jhoblitt Exp $
     3# $Id: Server.pm,v 1.57 2008-03-21 01:24:36 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    11051105
    11061106
     1107sub mounts
     1108{
     1109    my $self = shift;
     1110
     1111    validate_pos(@_);
     1112
     1113    my $log = $self->log;
     1114    my $sql = $self->sql;
     1115    my $db  =$self->db;
     1116
     1117    $log->debug("entered - @_");
     1118
     1119    my $stats;
     1120    my $query;
     1121    eval {
     1122        # ask the db to generate the table of mounted Nebulous volume
     1123        $db->do("call getmountedvol()");
     1124
     1125        $query = $db->prepare_cached( $sql->get_mounted_volumes );
     1126        $query->execute();
     1127
     1128        # suck that table into an AoA
     1129        $stats = $query->fetchall_arrayref;
     1130
     1131        $query->finish;
     1132    };
     1133    $log->logdie("database error: $@") if $@;
     1134
     1135    $log->logdie("no mounted volumes found") unless (scalar @$stats);
     1136
     1137    $log->debug("leaving");
     1138
     1139    return $stats;
     1140}
     1141
     1142
    11071143sub _get_storage_volume
    11081144{
  • trunk/Nebulous-Server/lib/Nebulous/Server.pod

    r16261 r17077  
    2727    Nebulous::Server->delete_instance( $uri );
    2828    Nebulous::Server->stat_object( $key );
     29    Nebulous::Server->mounts();
    2930
    3031=head1 DESCRIPTION
     
    9798    number of instances
    9899
     100=item * mounts( $key );
     101
     102Accepts no parameters and returns an AoA of:
     103
     104    [
     105        [
     106            mountpoint,
     107            total,
     108            used,
     109            vol_id,
     110            name,
     111            path,
     112            allocate,
     113            available,
     114            xattr,
     115        ],
     116        [ ... ],
     117        ...
     118    ]
     119
    99120=back
    100121
     
    117138=head1 COPYRIGHT
    118139
    119 Copyright (C) 2004-2005  Joshua Hoblitt.  All rights reserved.
     140Copyright (C) 2004-2008  Joshua Hoblitt.  All rights reserved.
    120141
    121142This program is free software; you can redistribute it and/or modify it under
  • trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r17072 r17077  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: SQL.pm,v 1.49 2008-03-20 21:10:57 jhoblitt Exp $
     3# $Id: SQL.pm,v 1.50 2008-03-21 01:24:36 jhoblitt Exp $
    44
    55package Nebulous::Server::SQL;
     
    265265        GROUP BY so_id
    266266        HAVING need_recovery = 1
     267    },
     268    get_mounted_volumes => qq{
     269        SELECT * FROM mountedvol ORDER BY vol_id
    267270    },
    268271);
Note: See TracChangeset for help on using the changeset viewer.