diff options
author | Jiayu Hu <hujiayu@google.com> | 2022-05-03 20:50:03 -0700 |
---|---|---|
committer | Jiayu Hu <hujiayu@google.com> | 2022-05-03 20:50:03 -0700 |
commit | 21441c71652b1116c467e106e1b735a9bd90541d (patch) | |
tree | e2083eac148d0fcfb7470064e8abe2369af8e1a0 /icing/util/fingerprint-util.h | |
parent | 156c55e27d7a8fdf9c26e30dcbf09e97231efd68 (diff) | |
download | icing-21441c71652b1116c467e106e1b735a9bd90541d.tar.gz |
Sync from upstream.
Descriptions:
======================================================================
Export Icing logging control to JNI
======================================================================
Prepare Icing logging class for JNI export
======================================================================
Export getDebugInfo to JNI
======================================================================
Expose the return_deleted_document_info parameter for deleteByQuery JNI
======================================================================
Enable runtime log control for Icing Library
======================================================================
Fix 1 ClangTidyBuild finding:
======================================================================
Update comments to run benchmarks.
======================================================================
Making icing's own logging class
======================================================================
Convert the string lexicon debug information to a protocol buffer
======================================================================
Fix issue with printing fingerprinted key in our error logs.
======================================================================
Support dump function for IcingSearchEngine
======================================================================
Bug: 146903474
Bug: 229778472
Bug: 209071710
Bug: 222349894
Bug: 225914361
Change-Id: I9750149d1ed0b59f345b8828ff312a62773667fe
Diffstat (limited to 'icing/util/fingerprint-util.h')
-rw-r--r-- | icing/util/fingerprint-util.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/icing/util/fingerprint-util.h b/icing/util/fingerprint-util.h new file mode 100644 index 0000000..9e98617 --- /dev/null +++ b/icing/util/fingerprint-util.h @@ -0,0 +1,47 @@ +// Copyright (C) 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef ICING_UTIL_FINGERPRINT_UTIL_H_ +#define ICING_UTIL_FINGERPRINT_UTIL_H_ + +#include <cstdint> +#include <string> +#include <string_view> + +namespace icing { +namespace lib { + +namespace fingerprint_util { + +// Converts from a fingerprint to a fingerprint string. +std::string GetFingerprintString(uint64_t fingerprint); + +// Converts from a fingerprint string to a fingerprint. +uint64_t GetFingerprint(std::string_view fingerprint_string); + +// A formatter to properly handle a string that is actually just a hash value. +class FingerprintStringFormatter { + public: + std::string operator()(std::string_view fingerprint_string) { + uint64_t fingerprint = GetFingerprint(fingerprint_string); + return std::to_string(fingerprint); + } +}; + +} // namespace fingerprint_util + +} // namespace lib +} // namespace icing + +#endif // ICING_UTIL_FINGERPRINT_UTIL_H_ |