(i, j int)
| 35 | } |
| 36 | |
| 37 | func (b BugsByEditTime) Less(i, j int) bool { |
| 38 | if b[i].EditLamportTime() < b[j].EditLamportTime() { |
| 39 | return true |
| 40 | } |
| 41 | |
| 42 | if b[i].EditLamportTime() > b[j].EditLamportTime() { |
| 43 | return false |
| 44 | } |
| 45 | |
| 46 | // When the logical clocks are identical, that means we had a concurrent |
| 47 | // edition. In this case we rely on the timestamp. While the timestamp might |
| 48 | // be incorrect due to a badly set clock, the drift in sorting is bounded |
| 49 | // by the first sorting using the logical clock. That means that if users |
| 50 | // synchronize their bugs regularly, the timestamp will rarely be used, and |
| 51 | // should still provide a kinda accurate sorting when needed. |
| 52 | return b[i].LastOp().Time().Before(b[j].LastOp().Time()) |
| 53 | } |
| 54 | |
| 55 | func (b BugsByEditTime) Swap(i, j int) { |
| 56 | b[i], b[j] = b[j], b[i] |
nothing calls this directly
no test coverage detected