@@ -730,15 +730,34 @@ class LevelDbNamedQueryKey {
730
730
std::string name_;
731
731
};
732
732
733
+ /* *
734
+ * A key in the index_configuration table, storing the index definition proto,
735
+ * and the collection (group) it applies to.
736
+ */
733
737
class LevelDbIndexConfigurationKey {
734
738
public:
739
+ /* *
740
+ * Creates a key prefix that points just before the first key of the table.
741
+ */
735
742
static std::string KeyPrefix ();
736
743
744
+ /* *
745
+ * Creates a key that points to the key for the given index id.
746
+ */
737
747
static std::string Key (int32_t id);
738
748
749
+ /* *
750
+ * Decodes the given complete key, storing the decoded values in this
751
+ * instance.
752
+ *
753
+ * @return true if the key successfully decoded, false otherwise. If false is
754
+ * returned, this instance is in an undefined state until the next call to
755
+ * `Decode()`.
756
+ */
739
757
ABSL_MUST_USE_RESULT
740
758
bool Decode (absl::string_view key);
741
759
760
+ /* * The index id for this entry. */
742
761
int32_t index_id () const {
743
762
return index_id_;
744
763
}
@@ -747,19 +766,39 @@ class LevelDbIndexConfigurationKey {
747
766
int32_t index_id_;
748
767
};
749
768
769
+ /* *
770
+ * A key in the index_state table, storing the per index per user state tracking
771
+ * backfilling state for each index.
772
+ */
750
773
class LevelDbIndexStateKey {
751
774
public:
775
+ /* *
776
+ * Creates a key prefix that points just before the first key of the table.
777
+ */
752
778
static std::string KeyPrefix ();
753
779
780
+ /* *
781
+ * Creates a key that points to the key for the given index id and user id.
782
+ */
754
783
static std::string Key (int32_t index_id, absl::string_view user_id);
755
784
785
+ /* *
786
+ * Decodes the given complete key, storing the decoded values in this
787
+ * instance.
788
+ *
789
+ * @return true if the key successfully decoded, false otherwise. If false is
790
+ * returned, this instance is in an undefined state until the next call to
791
+ * `Decode()`.
792
+ */
756
793
ABSL_MUST_USE_RESULT
757
794
bool Decode (absl::string_view key);
758
795
796
+ /* * The index id for this entry. */
759
797
int32_t index_id () const {
760
798
return index_id_;
761
799
}
762
800
801
+ /* * The user id for this entry. */
763
802
const std::string& user_id () const {
764
803
return user_id_;
765
804
}
@@ -769,34 +808,60 @@ class LevelDbIndexStateKey {
769
808
std::string user_id_;
770
809
};
771
810
811
+ /* *
812
+ * A key in the index_entries table, storing the the encoded entries for all
813
+ * fields used by a given index.
814
+ *
815
+ * Note: `array_value` is expected to be set for all queries.
816
+ */
772
817
class LevelDbIndexEntryKey {
773
818
public:
819
+ /* *
820
+ * Creates a key prefix that points just before the first key of the table.
821
+ */
774
822
static std::string KeyPrefix ();
775
823
824
+ /* *
825
+ * Creates a key that points to the key for the given index entry fields.
826
+ */
776
827
static std::string Key (int32_t index_id,
777
828
absl::string_view user_id,
778
829
absl::string_view array_value,
779
830
absl::string_view directional_value,
780
831
absl::string_view document_name);
781
832
833
+ /* *
834
+ * Decodes the given complete key, storing the decoded values in this
835
+ * instance.
836
+ *
837
+ * @return true if the key successfully decoded, false otherwise. If false is
838
+ * returned, this instance is in an undefined state until the next call to
839
+ * `Decode()`.
840
+ */
782
841
ABSL_MUST_USE_RESULT
783
842
bool Decode (absl::string_view key);
784
843
844
+ /* * The index id for this entry. */
785
845
int32_t index_id () const {
786
846
return index_id_;
787
847
}
788
848
849
+ /* * The user id for this entry. */
789
850
const std::string& user_id () const {
790
851
return user_id_;
791
852
}
792
853
854
+ /* * The array index value encoded for this entry. */
793
855
const std::string& array_value () const {
794
856
return array_value_;
795
857
}
796
858
859
+ /* * The directional index value encoded for this entry. */
797
860
const std::string& directional_value () const {
798
861
return directional_value_;
799
862
}
863
+
864
+ /* * The document name this entry points to. */
800
865
const std::string& document_name () const {
801
866
return document_name_;
802
867
}
0 commit comments