e8fa630f2a1900e3a77c14ab80118d162a8a55de
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Replicated / Balancer / First.pm
1 package DBIx::Class::Storage::DBI::Replicated::Balancer::First;
2
3 use Moose;
4 with 'DBIx::Class::Storage::DBI::Replicated::Balancer';
5
6 =head1 NAME
7
8 DBIx::Class::Storage::DBI::Replicated::Balancer::First - Just get the First Balancer
9
10 =head1 SYNOPSIS
11
12 This class is used internally by L<DBIx::Class::Storage::DBI::Replicated>.  You
13 shouldn't need to create instances of this class.
14     
15 =head1 DESCRIPTION
16
17 Given a pool (L<DBIx::Class::Storage::DBI::Replicated::Pool>) of replicated
18 database's (L<DBIx::Class::Storage::DBI::Replicated::Replicant>), defines a
19 method by which query load can be spread out across each replicant in the pool.
20
21 This Balancer just get's whatever is the first replicant in the pool
22
23 =head1 ATTRIBUTES
24
25 This class defines the following attributes.
26
27 =head1 METHODS
28
29 This class defines the following methods.
30
31 =head2 next_storage
32
33 Just get the first storage.  Probably only good when you have one replicant.
34
35 =cut
36
37 sub next_storage {
38   return  (shift->pool->active_replicants)[0];
39 }
40
41 =head1 AUTHOR
42
43 John Napiorkowski <john.napiorkowski@takkle.com>
44
45 =head1 LICENSE
46
47 You may distribute this code under the same terms as Perl itself.
48
49 =cut
50
51 __PACKAGE__->meta->make_immutable;
52
53 1;