line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Algorithm::ConsistentHash::Ketama::Bucket; |
2
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
259
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub new { |
5
|
9
|
|
|
9
|
1
|
482
|
my ($class, %args) = @_; |
6
|
9
|
|
|
|
|
45
|
my $self = bless {%args}, $class; |
7
|
9
|
|
|
|
|
63
|
return $self; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
9
|
|
|
9
|
1
|
5431
|
sub label { $_[0]->{label} } |
11
|
9
|
|
|
9
|
1
|
5754
|
sub weight { $_[0]->{weight} } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
1; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
__END__ |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Algorithm::ConsistentHash::Ketama::Bucket - A Bucket Object |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my @buckets = $ketama->buckets; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $bucket = shift @buckets; |
26
|
|
|
|
|
|
|
$bucket->label; |
27
|
|
|
|
|
|
|
$bucket->weight; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This class simply represents a bucket in Algorithm::ConsistentnHash::Ketama. |
32
|
|
|
|
|
|
|
There are no interface to add a bucket using this object. This class is just |
33
|
|
|
|
|
|
|
a utility to represent this data. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 new |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Creates a new bucket object |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 label |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Returns the string label for this bucket |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 weight |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Returns the weight of this bucket |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |