summaryrefslogtreecommitdiffstats
path: root/persistence
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-11-06 22:17:15 +0100
committerTor Egge <Tor.Egge@online.no>2023-11-06 22:17:15 +0100
commit64369b4a2e36c4d9b354fe3ae7fdbb35e17023f3 (patch)
tree643a2c9689637b981d55e643fbff9123588ed408 /persistence
parent5c4c6f9fe13163b055d1ad5ea05c5c9468fbe179 (diff)
Compare all elements of DocTypeGidAndTimestamp.
Diffstat (limited to 'persistence')
-rw-r--r--persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.h b/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.h
index 449935ef830..9ff4d0493fa 100644
--- a/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.h
+++ b/persistence/src/vespa/persistence/spi/doctype_gid_and_timestamp.h
@@ -3,6 +3,7 @@
#include "types.h"
#include <vespa/document/base/globalid.h>
+#include <vespa/vespalib/stllike/hash_fun.h>
#include <vespa/vespalib/stllike/string.h>
#include <iosfwd>
@@ -30,7 +31,8 @@ struct DocTypeGidAndTimestamp {
DocTypeGidAndTimestamp& operator=(DocTypeGidAndTimestamp&&) noexcept;
bool operator==(const DocTypeGidAndTimestamp& rhs) const noexcept {
- return ((doc_type == rhs.doc_type) && (gid == rhs.gid));
+ return ((doc_type == rhs.doc_type) && (gid == rhs.gid) &&
+ (timestamp == rhs.timestamp));
}
void print(vespalib::asciistream&) const;
@@ -38,7 +40,8 @@ struct DocTypeGidAndTimestamp {
struct hash {
size_t operator()(const DocTypeGidAndTimestamp& dt_gid_ts) const noexcept {
- const size_t h = document::GlobalId::hash()(dt_gid_ts.gid);
+ size_t h = document::GlobalId::hash()(dt_gid_ts.gid);
+ h = h ^ (vespalib::hash<vespalib::string>()(dt_gid_ts.doc_type) + 0x9e3779b9U + (h << 6U) + (h >> 2U));
return h ^ (dt_gid_ts.timestamp + 0x9e3779b9U + (h << 6U) + (h >> 2U)); // Basically boost::hash_combine
}
};