Scott Baker | eee8dd8 | 2019-09-24 12:52:34 -0700 | [diff] [blame^] | 1 | package cluster |
| 2 | |
| 3 | // Strategy for partition to consumer assignement |
| 4 | type Strategy string |
| 5 | |
| 6 | const ( |
| 7 | // StrategyRange is the default and assigns partition ranges to consumers. |
| 8 | // Example with six partitions and two consumers: |
| 9 | // C1: [0, 1, 2] |
| 10 | // C2: [3, 4, 5] |
| 11 | StrategyRange Strategy = "range" |
| 12 | |
| 13 | // StrategyRoundRobin assigns partitions by alternating over consumers. |
| 14 | // Example with six partitions and two consumers: |
| 15 | // C1: [0, 2, 4] |
| 16 | // C2: [1, 3, 5] |
| 17 | StrategyRoundRobin Strategy = "roundrobin" |
| 18 | ) |
| 19 | |
| 20 | // Error instances are wrappers for internal errors with a context and |
| 21 | // may be returned through the consumer's Errors() channel |
| 22 | type Error struct { |
| 23 | Ctx string |
| 24 | error |
| 25 | } |