@@ -519,12 +519,14 @@ public protocol SuggestStoreProtocol : AnyObject {
519
519
520
520
func fetchProviderConfig( provider: SuggestionProvider ) throws -> SuggestProviderConfig ?
521
521
522
- func ingest( constraints: SuggestIngestionConstraints ) throws
522
+ func ingest( constraints: SuggestIngestionConstraints ) throws -> SuggestIngestionMetrics
523
523
524
524
func interrupt( kind: InterruptKind ? )
525
525
526
526
func query( query: SuggestionQuery ) throws -> [ Suggestion ]
527
527
528
+ func queryWithMetrics( query: SuggestionQuery ) throws -> QueryWithMetricsResult
529
+
528
530
}
529
531
open class SuggestStore :
530
532
SuggestStoreProtocol {
@@ -610,11 +612,12 @@ open func fetchProviderConfig(provider: SuggestionProvider)throws -> SuggestPro
610
612
} )
611
613
}
612
614
613
- open func ingest( constraints: SuggestIngestionConstraints ) throws { try rustCallWithError ( FfiConverterTypeSuggestApiError . lift) {
615
+ open func ingest( constraints: SuggestIngestionConstraints ) throws -> SuggestIngestionMetrics {
616
+ return try FfiConverterTypeSuggestIngestionMetrics . lift ( try rustCallWithError ( FfiConverterTypeSuggestApiError . lift) {
614
617
uniffi_suggest_fn_method_suggeststore_ingest ( self . uniffiClonePointer ( ) ,
615
618
FfiConverterTypeSuggestIngestionConstraints . lower ( constraints) , $0
616
619
)
617
- }
620
+ } )
618
621
}
619
622
620
623
open func interrupt( kind: InterruptKind ? = nil ) { try ! rustCall ( ) {
@@ -632,6 +635,14 @@ open func query(query: SuggestionQuery)throws -> [Suggestion] {
632
635
} )
633
636
}
634
637
638
+ open func queryWithMetrics( query: SuggestionQuery ) throws -> QueryWithMetricsResult {
639
+ return try FfiConverterTypeQueryWithMetricsResult . lift ( try rustCallWithError ( FfiConverterTypeSuggestApiError . lift) {
640
+ uniffi_suggest_fn_method_suggeststore_query_with_metrics ( self . uniffiClonePointer ( ) ,
641
+ FfiConverterTypeSuggestionQuery . lower ( query) , $0
642
+ )
643
+ } )
644
+ }
645
+
635
646
636
647
}
637
648
@@ -837,6 +848,123 @@ public func FfiConverterTypeSuggestStoreBuilder_lower(_ value: SuggestStoreBuild
837
848
}
838
849
839
850
851
+ /**
852
+ * A single sample for a labeled timing distribution metric
853
+ */
854
+ public struct LabeledTimingSample {
855
+ public var label : String
856
+ public var value : UInt64
857
+
858
+ // Default memberwise initializers are never public by default, so we
859
+ // declare one manually.
860
+ public init ( label: String , value: UInt64 ) {
861
+ self . label = label
862
+ self . value = value
863
+ }
864
+ }
865
+
866
+
867
+
868
+ extension LabeledTimingSample : Equatable , Hashable {
869
+ public static func == ( lhs: LabeledTimingSample , rhs: LabeledTimingSample ) -> Bool {
870
+ if lhs. label != rhs. label {
871
+ return false
872
+ }
873
+ if lhs. value != rhs. value {
874
+ return false
875
+ }
876
+ return true
877
+ }
878
+
879
+ public func hash( into hasher: inout Hasher ) {
880
+ hasher. combine ( label)
881
+ hasher. combine ( value)
882
+ }
883
+ }
884
+
885
+
886
+ public struct FfiConverterTypeLabeledTimingSample : FfiConverterRustBuffer {
887
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> LabeledTimingSample {
888
+ return
889
+ try LabeledTimingSample (
890
+ label: FfiConverterString . read ( from: & buf) ,
891
+ value: FfiConverterUInt64 . read ( from: & buf)
892
+ )
893
+ }
894
+
895
+ public static func write( _ value: LabeledTimingSample , into buf: inout [ UInt8 ] ) {
896
+ FfiConverterString . write ( value. label, into: & buf)
897
+ FfiConverterUInt64 . write ( value. value, into: & buf)
898
+ }
899
+ }
900
+
901
+
902
+ public func FfiConverterTypeLabeledTimingSample_lift( _ buf: RustBuffer ) throws -> LabeledTimingSample {
903
+ return try FfiConverterTypeLabeledTimingSample . lift ( buf)
904
+ }
905
+
906
+ public func FfiConverterTypeLabeledTimingSample_lower( _ value: LabeledTimingSample ) -> RustBuffer {
907
+ return FfiConverterTypeLabeledTimingSample . lower ( value)
908
+ }
909
+
910
+
911
+ public struct QueryWithMetricsResult {
912
+ public var suggestions : [ Suggestion ]
913
+ public var queryTimes : [ LabeledTimingSample ]
914
+
915
+ // Default memberwise initializers are never public by default, so we
916
+ // declare one manually.
917
+ public init ( suggestions: [ Suggestion ] , queryTimes: [ LabeledTimingSample ] ) {
918
+ self . suggestions = suggestions
919
+ self . queryTimes = queryTimes
920
+ }
921
+ }
922
+
923
+
924
+
925
+ extension QueryWithMetricsResult : Equatable , Hashable {
926
+ public static func == ( lhs: QueryWithMetricsResult , rhs: QueryWithMetricsResult ) -> Bool {
927
+ if lhs. suggestions != rhs. suggestions {
928
+ return false
929
+ }
930
+ if lhs. queryTimes != rhs. queryTimes {
931
+ return false
932
+ }
933
+ return true
934
+ }
935
+
936
+ public func hash( into hasher: inout Hasher ) {
937
+ hasher. combine ( suggestions)
938
+ hasher. combine ( queryTimes)
939
+ }
940
+ }
941
+
942
+
943
+ public struct FfiConverterTypeQueryWithMetricsResult : FfiConverterRustBuffer {
944
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> QueryWithMetricsResult {
945
+ return
946
+ try QueryWithMetricsResult (
947
+ suggestions: FfiConverterSequenceTypeSuggestion . read ( from: & buf) ,
948
+ queryTimes: FfiConverterSequenceTypeLabeledTimingSample . read ( from: & buf)
949
+ )
950
+ }
951
+
952
+ public static func write( _ value: QueryWithMetricsResult , into buf: inout [ UInt8 ] ) {
953
+ FfiConverterSequenceTypeSuggestion . write ( value. suggestions, into: & buf)
954
+ FfiConverterSequenceTypeLabeledTimingSample . write ( value. queryTimes, into: & buf)
955
+ }
956
+ }
957
+
958
+
959
+ public func FfiConverterTypeQueryWithMetricsResult_lift( _ buf: RustBuffer ) throws -> QueryWithMetricsResult {
960
+ return try FfiConverterTypeQueryWithMetricsResult . lift ( buf)
961
+ }
962
+
963
+ public func FfiConverterTypeQueryWithMetricsResult_lower( _ value: QueryWithMetricsResult ) -> RustBuffer {
964
+ return FfiConverterTypeQueryWithMetricsResult . lower ( value)
965
+ }
966
+
967
+
840
968
public struct SuggestGlobalConfig {
841
969
public var showLessFrequentlyCap : Int32
842
970
@@ -943,6 +1071,63 @@ public func FfiConverterTypeSuggestIngestionConstraints_lower(_ value: SuggestIn
943
1071
}
944
1072
945
1073
1074
+ public struct SuggestIngestionMetrics {
1075
+ public var ingestionTimes : [ LabeledTimingSample ]
1076
+ public var downloadTimes : [ LabeledTimingSample ]
1077
+
1078
+ // Default memberwise initializers are never public by default, so we
1079
+ // declare one manually.
1080
+ public init ( ingestionTimes: [ LabeledTimingSample ] , downloadTimes: [ LabeledTimingSample ] ) {
1081
+ self . ingestionTimes = ingestionTimes
1082
+ self . downloadTimes = downloadTimes
1083
+ }
1084
+ }
1085
+
1086
+
1087
+
1088
+ extension SuggestIngestionMetrics : Equatable , Hashable {
1089
+ public static func == ( lhs: SuggestIngestionMetrics , rhs: SuggestIngestionMetrics ) -> Bool {
1090
+ if lhs. ingestionTimes != rhs. ingestionTimes {
1091
+ return false
1092
+ }
1093
+ if lhs. downloadTimes != rhs. downloadTimes {
1094
+ return false
1095
+ }
1096
+ return true
1097
+ }
1098
+
1099
+ public func hash( into hasher: inout Hasher ) {
1100
+ hasher. combine ( ingestionTimes)
1101
+ hasher. combine ( downloadTimes)
1102
+ }
1103
+ }
1104
+
1105
+
1106
+ public struct FfiConverterTypeSuggestIngestionMetrics : FfiConverterRustBuffer {
1107
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> SuggestIngestionMetrics {
1108
+ return
1109
+ try SuggestIngestionMetrics (
1110
+ ingestionTimes: FfiConverterSequenceTypeLabeledTimingSample . read ( from: & buf) ,
1111
+ downloadTimes: FfiConverterSequenceTypeLabeledTimingSample . read ( from: & buf)
1112
+ )
1113
+ }
1114
+
1115
+ public static func write( _ value: SuggestIngestionMetrics , into buf: inout [ UInt8 ] ) {
1116
+ FfiConverterSequenceTypeLabeledTimingSample . write ( value. ingestionTimes, into: & buf)
1117
+ FfiConverterSequenceTypeLabeledTimingSample . write ( value. downloadTimes, into: & buf)
1118
+ }
1119
+ }
1120
+
1121
+
1122
+ public func FfiConverterTypeSuggestIngestionMetrics_lift( _ buf: RustBuffer ) throws -> SuggestIngestionMetrics {
1123
+ return try FfiConverterTypeSuggestIngestionMetrics . lift ( buf)
1124
+ }
1125
+
1126
+ public func FfiConverterTypeSuggestIngestionMetrics_lower( _ value: SuggestIngestionMetrics ) -> RustBuffer {
1127
+ return FfiConverterTypeSuggestIngestionMetrics . lower ( value)
1128
+ }
1129
+
1130
+
946
1131
public struct SuggestionQuery {
947
1132
public var keyword : String
948
1133
public var providers : [ SuggestionProvider ]
@@ -1632,6 +1817,28 @@ fileprivate struct FfiConverterSequenceUInt8: FfiConverterRustBuffer {
1632
1817
}
1633
1818
}
1634
1819
1820
+ fileprivate struct FfiConverterSequenceTypeLabeledTimingSample : FfiConverterRustBuffer {
1821
+ typealias SwiftType = [ LabeledTimingSample ]
1822
+
1823
+ public static func write( _ value: [ LabeledTimingSample ] , into buf: inout [ UInt8 ] ) {
1824
+ let len = Int32 ( value. count)
1825
+ writeInt ( & buf, len)
1826
+ for item in value {
1827
+ FfiConverterTypeLabeledTimingSample . write ( item, into: & buf)
1828
+ }
1829
+ }
1830
+
1831
+ public static func read( from buf: inout ( data: Data , offset: Data . Index ) ) throws -> [ LabeledTimingSample ] {
1832
+ let len : Int32 = try readInt ( & buf)
1833
+ var seq = [ LabeledTimingSample] ( )
1834
+ seq. reserveCapacity ( Int ( len) )
1835
+ for _ in 0 ..< len {
1836
+ seq. append ( try FfiConverterTypeLabeledTimingSample . read ( from: & buf) )
1837
+ }
1838
+ return seq
1839
+ }
1840
+ }
1841
+
1635
1842
fileprivate struct FfiConverterSequenceTypeSuggestion : FfiConverterRustBuffer {
1636
1843
typealias SwiftType = [ Suggestion ]
1637
1844
@@ -1721,7 +1928,7 @@ private var initializationResult: InitializationResult {
1721
1928
if ( uniffi_suggest_checksum_method_suggeststore_fetch_provider_config ( ) != 5906 ) {
1722
1929
return InitializationResult . apiChecksumMismatch
1723
1930
}
1724
- if ( uniffi_suggest_checksum_method_suggeststore_ingest ( ) != 4478 ) {
1931
+ if ( uniffi_suggest_checksum_method_suggeststore_ingest ( ) != 27906 ) {
1725
1932
return InitializationResult . apiChecksumMismatch
1726
1933
}
1727
1934
if ( uniffi_suggest_checksum_method_suggeststore_interrupt ( ) != 17785 ) {
@@ -1730,6 +1937,9 @@ private var initializationResult: InitializationResult {
1730
1937
if ( uniffi_suggest_checksum_method_suggeststore_query ( ) != 12875 ) {
1731
1938
return InitializationResult . apiChecksumMismatch
1732
1939
}
1940
+ if ( uniffi_suggest_checksum_method_suggeststore_query_with_metrics ( ) != 29421 ) {
1941
+ return InitializationResult . apiChecksumMismatch
1942
+ }
1733
1943
if ( uniffi_suggest_checksum_method_suggeststorebuilder_build ( ) != 28243 ) {
1734
1944
return InitializationResult . apiChecksumMismatch
1735
1945
}
0 commit comments