Update class order in the loadbalancer API, add DEFAULT_ALGORITHM variable to __all__.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/81d5fd63 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/81d5fd63 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/81d5fd63 Branch: refs/heads/trunk Commit: 81d5fd6336f13a1eabdc90509d771a8586798495 Parents: e1fc7e9 Author: Tomaz Muraus <[email protected]> Authored: Sun Nov 17 20:33:40 2013 +0100 Committer: Tomaz Muraus <[email protected]> Committed: Sun Nov 17 20:33:40 2013 +0100 ---------------------------------------------------------------------- libcloud/loadbalancer/base.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/81d5fd63/libcloud/loadbalancer/base.py ---------------------------------------------------------------------- diff --git a/libcloud/loadbalancer/base.py b/libcloud/loadbalancer/base.py index c017f3b..1508121 100644 --- a/libcloud/loadbalancer/base.py +++ b/libcloud/loadbalancer/base.py @@ -19,8 +19,9 @@ from libcloud.common.types import LibcloudError __all__ = [ 'Member', 'LoadBalancer', + 'Algorithm', 'Driver', - 'Algorithm' + 'DEFAULT_ALGORITHM' ] @@ -57,20 +58,6 @@ class Member(object): self.ip, self.port)) -class Algorithm(object): - """ - Represents a load balancing algorithm. - """ - - RANDOM = 0 - ROUND_ROBIN = 1 - LEAST_CONNECTIONS = 2 - WEIGHTED_ROUND_ROBIN = 3 - WEIGHTED_LEAST_CONNECTIONS = 4 - -DEFAULT_ALGORITHM = Algorithm.ROUND_ROBIN - - class LoadBalancer(object): """ Provide a common interface for handling Load Balancers. @@ -130,6 +117,20 @@ class LoadBalancer(object): self.name, self.state)) +class Algorithm(object): + """ + Represents a load balancing algorithm. + """ + + RANDOM = 0 + ROUND_ROBIN = 1 + LEAST_CONNECTIONS = 2 + WEIGHTED_ROUND_ROBIN = 3 + WEIGHTED_LEAST_CONNECTIONS = 4 + +DEFAULT_ALGORITHM = Algorithm.ROUND_ROBIN + + class Driver(BaseDriver): """ A base Driver class to derive from
