~guilhem-fr/mogilefs/perl-MogileFS-Client

« back to all changes in this revision

Viewing changes to lib/MogileFS/Admin.pm

  • Committer: dormando
  • Date: 2010-09-19 06:22:14 UTC
  • Revision ID: git-v1:c8d4026c4be344be9227774301dec7afa2c629c3
remove deprecated stats stuff from client

git-svn-id: http://code.sixapart.com/svn/mogilefs/trunk@1487 f67b2e87-0811-0410-a7e0-dd94e48410d6

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
    return 1;
102
102
}
103
103
 
104
 
# get a hashref of statistics on how the MogileFS server is doing.  there are several
105
 
# sections of statistics, in this form:
106
 
# {
107
 
#     replication => { "domain-name" => { "class-name" => { devcount => filecount }, ... }, ... },
108
 
# }
109
 
sub get_stats {
110
 
    my MogileFS::Admin $self = shift;
111
 
    my $ret = {};
112
 
 
113
 
    # do the request, default to request all stats if they didn't specify any
114
 
    push @_, 'all' unless @_;
115
 
    my $res = $self->{backend}->do_request("stats", { map { $_ => 1 } @_ })
116
 
        or return undef;
117
 
 
118
 
    # get replication statistics
119
 
    foreach my $i (1..$res->{"replicationcount"}) {
120
 
        $ret->{replication}->{$res->{"replication${i}domain"}}->{$res->{"replication${i}class"}}->{$res->{"replication${i}devcount"}} = $res->{"replication${i}files"};
121
 
    }
122
 
 
123
 
    # get file statistics
124
 
    foreach my $i (1..$res->{"filescount"}) {
125
 
        $ret->{files}->{$res->{"files${i}domain"}}->{$res->{"files${i}class"}} = $res->{"files${i}files"};
126
 
    }
127
 
 
128
 
    # get device statistics
129
 
    foreach my $i (1..$res->{"devicescount"}) {
130
 
        $ret->{devices}->{$res->{"devices${i}id"}} = {
131
 
            host => $res->{"devices${i}host"},
132
 
            status => $res->{"devices${i}status"},
133
 
            files => $res->{"devices${i}files"},
134
 
        };
135
 
    }
136
 
 
137
 
    # get fid statistics if they're provided
138
 
    if ($res->{fidmax}) {
139
 
        $ret->{fids} = {
140
 
            max => $res->{fidmax},
141
 
        };
142
 
    }
143
 
 
144
 
    # return the created response
145
 
    return $ret;
146
 
}
147
 
 
148
104
# get a hashref of the domains we know about in the format of
149
105
#   { domain_name => { class_name => mindevcount, class_name => mindevcount, ... }, ... }
150
106
sub get_domains {