forked from TykTechnologies/tyk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added load balancing and service discovery support
- Loading branch information
1 parent
e5b7b14
commit 7e0cf7a
Showing
4 changed files
with
223 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package main | ||
|
||
type RoundRobin struct { | ||
pos int | ||
max int | ||
cur int | ||
} | ||
|
||
func (r *RoundRobin) SetMax(rp interface{}) { | ||
r.max = len(*rp.(*[]string)) | ||
} | ||
|
||
func (r *RoundRobin) GetPos() int { | ||
r.cur = r.pos | ||
r.pos += 1 | ||
if r.pos == (r.max) { | ||
r.pos = 0 | ||
} | ||
log.Warning("Returning index: ", r.cur) | ||
return r.cur | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters