aboutsummaryrefslogtreecommitdiff
path: root/icing/index/lite/lite-index-header.h
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2024-01-17 22:13:52 -0800
committerXin Li <delphij@google.com>2024-01-17 22:13:52 -0800
commitb6d2d80d87a6b4096bb32833cc6ac67295713f55 (patch)
tree9892cbbd0fb247ce252a38f258e33741ca025a45 /icing/index/lite/lite-index-header.h
parent95f4ed2f5a7365814321253aea37ce9cd9572dc6 (diff)
parentad9e08ff59020f5b52410dc093061d8ef715a781 (diff)
downloadicing-b6d2d80d87a6b4096bb32833cc6ac67295713f55.tar.gz
Merge Android 24Q1 Release (ab/11220357)temp_319669529
Bug: 319669529 Merged-In: I9f448463ecaae2b44ce31833a90d9672c33907b1 Change-Id: I986936f038c20a9b2579d658eea5176ede545011
Diffstat (limited to 'icing/index/lite/lite-index-header.h')
-rw-r--r--icing/index/lite/lite-index-header.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/icing/index/lite/lite-index-header.h b/icing/index/lite/lite-index-header.h
index 58379d6..75de8fa 100644
--- a/icing/index/lite/lite-index-header.h
+++ b/icing/index/lite/lite-index-header.h
@@ -15,6 +15,9 @@
#ifndef ICING_LEGACY_INDEX_ICING_LITE_INDEX_HEADER_H_
#define ICING_LEGACY_INDEX_ICING_LITE_INDEX_HEADER_H_
+#include <cstddef>
+#include <cstdint>
+
#include "icing/legacy/core/icing-string-util.h"
#include "icing/store/document-id.h"
@@ -50,7 +53,14 @@ class LiteIndex_Header {
class LiteIndex_HeaderImpl : public LiteIndex_Header {
public:
struct HeaderData {
- static const uint32_t kMagic = 0xb4fb8792;
+ static uint32_t GetCurrentMagic(
+ bool include_property_existence_metadata_hits) {
+ if (!include_property_existence_metadata_hits) {
+ return 0x01c61418;
+ } else {
+ return 0x56e07d5b;
+ }
+ }
uint32_t lite_index_crc;
uint32_t magic;
@@ -66,10 +76,15 @@ class LiteIndex_HeaderImpl : public LiteIndex_Header {
uint32_t searchable_end;
};
- explicit LiteIndex_HeaderImpl(HeaderData *hdr) : hdr_(hdr) {}
+ explicit LiteIndex_HeaderImpl(HeaderData *hdr,
+ bool include_property_existence_metadata_hits)
+ : hdr_(hdr),
+ include_property_existence_metadata_hits_(
+ include_property_existence_metadata_hits) {}
bool check_magic() const override {
- return hdr_->magic == HeaderData::kMagic;
+ return hdr_->magic == HeaderData::GetCurrentMagic(
+ include_property_existence_metadata_hits_);
}
uint32_t lite_index_crc() const override { return hdr_->lite_index_crc; }
@@ -96,7 +111,8 @@ class LiteIndex_HeaderImpl : public LiteIndex_Header {
void Reset() override {
hdr_->lite_index_crc = 0;
- hdr_->magic = HeaderData::kMagic;
+ hdr_->magic =
+ HeaderData::GetCurrentMagic(include_property_existence_metadata_hits_);
hdr_->last_added_docid = kInvalidDocumentId;
hdr_->cur_size = 0;
hdr_->searchable_end = 0;
@@ -104,6 +120,7 @@ class LiteIndex_HeaderImpl : public LiteIndex_Header {
private:
HeaderData *hdr_;
+ bool include_property_existence_metadata_hits_;
};
static_assert(24 == sizeof(LiteIndex_HeaderImpl::HeaderData),
"sizeof(HeaderData) != 24");