NAME

DBIO::Replicated::Balancer::Random - Randomly choose an active replicant

VERSION

version 0.900004

METHODS

new

Same as "new" in DBIO::Replicated::Balancer, plus master_read_weight (default 0), which is also available as a read/write accessor.

next_storage

Returns nothing if there are no active replicants. Otherwise draws a random number in [0, replicants + master_read_weight): values below the replicant count pick that replicant, the rest pick the master. With the default weight 0 the master is never picked while a replicant is active; a weight of 1 gives the master the same share as one replicant.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.