storage_type.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Tencent is pleased to support the open source community by making wwsearch
  3. * available.
  4. *
  5. * Copyright (C) 2018-present Tencent. All Rights Reserved.
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  8. * use this file except in compliance with the License. You may obtain a copy of
  9. * the License at
  10. *
  11. * https://opensource.org/licenses/Apache-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OF ANY KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations under the License.
  17. */
  18. #pragma once
  19. #include <string>
  20. namespace wwsearch {
  21. // Document id
  22. typedef uint64_t DocumentID;
  23. // Cost
  24. typedef uint32_t CostType;
  25. // Score
  26. typedef uint32_t ScoreType;
  27. // Field id
  28. typedef uint8_t FieldID;
  29. #define MaxFieldID 255;
  30. typedef double DocumentScore;
  31. typedef struct TableID {
  32. uint8_t business_type;
  33. uint64_t partition_set;
  34. std::string PrintToStr() const {
  35. char buffer[20];
  36. snprintf(buffer, 20, "%u:%llu", business_type, partition_set);
  37. return std::string(buffer);
  38. }
  39. } TableID;
  40. typedef uint8_t FieldType;
  41. typedef enum StorageColumnType {
  42. // WARNING:
  43. // DO NOT CHANGE ORDER
  44. // IF ADD NEW COLUMN,MUST CHECK CERTIAN'S GETALL ROUTINE.
  45. kStoredFieldColumn = 0, // store document
  46. kInvertedIndexColumn = 1, // store invert doc list of match term
  47. kDocValueColumn = 2, // store table doc value of every document
  48. kMetaColumn = 3, // store user'id mapping currently
  49. kDictionaryColumn = 4, // store nothing
  50. // NOTICE:
  51. // BELOW COLUMN WILL NOT USE FOR CERTAIN'S GETALL ROUTINE.
  52. kPaxosLogColumn = 5,
  53. kPaxosDataMetaColumn = 6,
  54. kPaxosLogMetaColumn = 7,
  55. // MAX
  56. kMaxColumn = 8
  57. } StorageColumnType;
  58. } // namespace wwsearch