From 01632989ac3c5044fa20bac7be9cd033b7a303fc Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Thu, 9 Feb 2017 14:39:12 +0000 Subject: [PATCH] Explain that the arbitrary ordering is arbitrary --- src/github.com/matrix-org/dendrite/roomserver/types/types.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/github.com/matrix-org/dendrite/roomserver/types/types.go b/src/github.com/matrix-org/dendrite/roomserver/types/types.go index 910ba303f..0c43baf89 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/types/types.go +++ b/src/github.com/matrix-org/dendrite/roomserver/types/types.go @@ -23,6 +23,7 @@ type StateKeyTuple struct { } // 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 { if 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. +// The ordering is arbitrary and is used to implement binary search and to efficiently deduplicate entries. func (a StateEntry) LessThan(b StateEntry) bool { if a.StateKeyTuple != b.StateKeyTuple { return a.StateKeyTuple.LessThan(b.StateKeyTuple)