IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 14, 2008, 12:52:37 PM (18 years ago)
Author:
eugene
Message:

moving distributed verion code to a branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/neb_distrib_20081210/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r20175 r20989  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: SQL.pm,v 1.75 2008-10-15 20:45:51 jhoblitt Exp $
     3# $Id: SQL.pm,v 1.75.6.1 2008-12-14 22:52:37 eugene Exp $
    44
    55package Nebulous::Server::SQL;
     
    88use warnings FATAL => qw( all );
    99
    10 our $VERSION = '0.02';
     10our $VERSION = '0.03';
    1111
    1212use base qw( Class::Accessor::Fast );
     
    4747        (so_id, vol_id, uri)
    4848        VALUES (?, ?, 'error')
     49    },
     50    get_all_instances   => qq{
     51        SELECT * FROM INSTANCE
     52        WHERE so_id = ?
    4953    },
    5054    get_object          => qq{
     
    324328        HAVING available_instances < instances OR instances < copies
    325329    },
    326     find_objects_with_extra_instances => qq{
    327         SELECT
    328             storage_object.so_id,
    329             ext_id,
     330    find_objects_with_extra_instances_by_xattr => qq{
     331        SELECT
     332            so.so_id,
     333            so.ext_id,
    330334            count(ins_id) as instances,
    331             volume.name as volume_name,
    332             volume.host as volume_host,
    333             count(mymountedvol.vol_id) as available_instances,
    334             count(mymountedvol.vol_id) > 0 as recoverable,
    335             storage_object_xattr.value as copies
    336         FROM storage_object
    337         JOIN instance
    338             USING(so_id)
    339         JOIN volume
    340             USING(vol_id)
    341         LEFT JOIN storage_object_xattr
    342             ON storage_object.so_id = storage_object_xattr.so_id
    343         JOIN mymountedvol
     335            mv.name as volume_name,
     336            mv.host as volume_host,
     337            count(mv.vol_id) as available_instances,
     338            xattr.value as copies
     339        FROM storage_object AS so
     340        JOIN storage_object_xattr as xattr
     341            ON so.so_id = xattr.so_id
     342            AND xattr.name = 'user.copies'
     343        JOIN instance AS i
     344            ON so.so_id = i.so_id
     345        JOIN mountedvol AS mv
    344346            USING(vol_id)
    345347        WHERE
    346             mymountedvol.available = 1
    347             AND storage_object_xattr.name = 'user.copies'
     348            mv.available = 1
    348349        GROUP BY so_id
    349350        HAVING available_instances > copies
     351        limit 5;
    350352    },
    351353    get_mounted_volumes => qq{
Note: See TracChangeset for help on using the changeset viewer.