line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::Storage::DBI::Replicated::Balancer::First; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
3653
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
with 'DBIx::Class::Storage::DBI::Replicated::Balancer'; |
5
|
|
|
|
|
|
|
use namespace::clean -except => 'meta'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
DBIx::Class::Storage::DBI::Replicated::Balancer::First - Just get the First Balancer |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
This class is used internally by L. You |
14
|
|
|
|
|
|
|
shouldn't need to create instances of this class. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Given a pool (L) of replicated |
19
|
|
|
|
|
|
|
database's (L), defines a |
20
|
|
|
|
|
|
|
method by which query load can be spread out across each replicant in the pool. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This Balancer just gets whichever is the first replicant in the pool. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This class defines the following attributes. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 METHODS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This class defines the following methods. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 next_storage |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Just get the first storage. Probably only good when you have one replicant. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub next_storage { |
39
|
|
|
|
|
|
|
return (shift->pool->active_replicants)[0]; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 FURTHER QUESTIONS? |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Check the list of L. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This module is free software L |
49
|
|
|
|
|
|
|
by the L. You can |
50
|
|
|
|
|
|
|
redistribute it and/or modify it under the same terms as the |
51
|
|
|
|
|
|
|
L. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |