Explain that the arbitrary ordering is arbitrary

This commit is contained in:
Mark Haines 2017-02-09 14:39:12 +00:00
parent 00ca811537
commit 01632989ac

View file

@ -23,6 +23,7 @@ type StateKeyTuple struct {
} }
// LessThan returns true if this state key is less than the other state key. // LessThan returns true if this state key is less than the other state key.
// The ordering is arbitrary and is used to implement binary search and to efficiently deduplicate entries.
func (a StateKeyTuple) LessThan(b StateKeyTuple) bool { func (a StateKeyTuple) LessThan(b StateKeyTuple) bool {
if a.EventTypeNID != b.EventTypeNID { if a.EventTypeNID != b.EventTypeNID {
return a.EventTypeNID < b.EventTypeNID return a.EventTypeNID < b.EventTypeNID
@ -38,6 +39,7 @@ type StateEntry struct {
} }
// LessThan returns true if this state entry is less than the other state entry. // LessThan returns true if this state entry is less than the other state entry.
// The ordering is arbitrary and is used to implement binary search and to efficiently deduplicate entries.
func (a StateEntry) LessThan(b StateEntry) bool { func (a StateEntry) LessThan(b StateEntry) bool {
if a.StateKeyTuple != b.StateKeyTuple { if a.StateKeyTuple != b.StateKeyTuple {
return a.StateKeyTuple.LessThan(b.StateKeyTuple) return a.StateKeyTuple.LessThan(b.StateKeyTuple)