turbopuffer 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42eb95384e9c94a7cc1e8dfea77930d227c6b694f42894337432279a22236c99
4
- data.tar.gz: 57c08feda85626bc9fbbd5198dba60455e379ba648ee59fb44e983dbae46b2eb
3
+ metadata.gz: 07fda2e1e9249b4c16e37504d02f6b65e5cff40d0d8b448b9d58c1ad7432391a
4
+ data.tar.gz: 73ee6163f398dff241b51040941899ee65027ded8bff6ef8ee474e63e8d0cf13
5
5
  SHA512:
6
- metadata.gz: 5d773caf2fe0e92fd6acf8effba09b5c3df6c54e074f269480d21d5dfd5a7a850e5a0f02ca943df2cf3ad6e2cbaa80b34ce8ad683d934ec6b0bcc858218e354a
7
- data.tar.gz: 8e1433a207658e6a44e0b4591e67836c2ea88b1dea16e7c2509b4a8b0b7ba0abf30e296c7662fcdf72ee816b056ea2f9eed231190291f6c86751259473eb4a46
6
+ metadata.gz: 7019c102f0665d6912974007b9ed3d3837e19f210596b4386faeacb028a62c594c60ce39791568721f7873ae56c30062cc28c360efe7be94204db4683d589229
7
+ data.tar.gz: 34ca700c304917dd2e096c660a2db731394dd364bc879d5d76fc2d60ca22e552f568be0dfb5eb9b4f5206035edd580d1c4330fe8fcfa1ae89e7846bc72b1a6fb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.0 (2025-11-06)
4
+
5
+ Full Changelog: [v1.5.0...v1.6.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.5.0...v1.6.0)
6
+
7
+ ### Features
8
+
9
+ * Add vector attribute schema to metadata endpoint ([a509e47](https://github.com/turbopuffer/turbopuffer-ruby/commit/a509e479bc8fdeb6a72b39703636d1ccc331274e))
10
+ * handle thread interrupts in the core HTTP client ([ad531ac](https://github.com/turbopuffer/turbopuffer-ruby/commit/ad531ac4776d6445a23033601d7e46900f8824bc))
11
+ * Make `type` required on `AttributeSchemaConfig` ([c9300f6](https://github.com/turbopuffer/turbopuffer-ruby/commit/c9300f621999c6937d16c363ba7bdb423605a825))
12
+ * openapi: Fix stainless warnings ([1b7685f](https://github.com/turbopuffer/turbopuffer-ruby/commit/1b7685f30fd448eff4d17b809714ee01aa864ffd))
13
+ * openapi: name variants of `NamespaceMetadata.index` ([3b7cd24](https://github.com/turbopuffer/turbopuffer-ruby/commit/3b7cd24aa4f0fbb0c7f805d28f3c0e20726697de))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * better thread safety via early initializing SSL store during HTTP client creation ([588faf7](https://github.com/turbopuffer/turbopuffer-ruby/commit/588faf74de4e21652afadd3eb557062818639cd6))
19
+
20
+
21
+ ### Chores
22
+
23
+ * bump dependency version and update sorbet types ([b8c6c9a](https://github.com/turbopuffer/turbopuffer-ruby/commit/b8c6c9a56cf98142d6736e21b25fa3a541fafd47))
24
+ * **client:** send user-agent header ([dda4633](https://github.com/turbopuffer/turbopuffer-ruby/commit/dda4633d4fe3cfb16b90d5d4b32aa887ee810d52))
25
+
26
+ ## 1.5.0 (2025-10-21)
27
+
28
+ Full Changelog: [v1.4.0...v1.5.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.4.0...v1.5.0)
29
+
30
+ ### Features
31
+
32
+ * Metadata endpoint updates (e.g. to track indexing progress) ([4e631c7](https://github.com/turbopuffer/turbopuffer-ruby/commit/4e631c73375f784d2be0b7acb58c75d336cf1b2c))
33
+ * required for patch_by_filter :facepalm: ([f075887](https://github.com/turbopuffer/turbopuffer-ruby/commit/f0758879e11152cec2506509b5e558c1a6e143c8))
34
+ * stainless: add patch_by_filter ([da661c2](https://github.com/turbopuffer/turbopuffer-ruby/commit/da661c2d9bf4e8eaf3b70ea9430d22998188a02e))
35
+
3
36
  ## 1.4.0 (2025-10-15)
4
37
 
5
38
  Full Changelog: [v1.3.0...v1.4.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.3.0...v1.4.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "turbopuffer", "~> 1.4.0"
20
+ gem "turbopuffer", "~> 1.6.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -201,7 +201,8 @@ module Turbopuffer
201
201
  self.class::PLATFORM_HEADERS,
202
202
  {
203
203
  "accept" => "application/json",
204
- "content-type" => "application/json"
204
+ "content-type" => "application/json",
205
+ "user-agent" => user_agent
205
206
  },
206
207
  headers
207
208
  )
@@ -219,6 +220,11 @@ module Turbopuffer
219
220
  # @return [Hash{String=>String}]
220
221
  private def auth_headers = {}
221
222
 
223
+ # @api private
224
+ #
225
+ # @return [String]
226
+ private def user_agent = "#{self.class.name}/Ruby #{Turbopuffer::VERSION}"
227
+
222
228
  # @api private
223
229
  #
224
230
  # @return [String]
@@ -16,10 +16,11 @@ module Turbopuffer
16
16
  class << self
17
17
  # @api private
18
18
  #
19
+ # @param cert_store [OpenSSL::X509::Store]
19
20
  # @param url [URI::Generic]
20
21
  #
21
22
  # @return [Net::HTTP]
22
- def connect(url)
23
+ def connect(cert_store:, url:)
23
24
  port =
24
25
  case [url.port, url.scheme]
25
26
  in [Integer, _]
@@ -33,6 +34,8 @@ module Turbopuffer
33
34
  Net::HTTP.new(url.host, port).tap do
34
35
  _1.use_ssl = %w[https wss].include?(url.scheme)
35
36
  _1.max_retries = 0
37
+
38
+ (_1.cert_store = cert_store) if _1.use_ssl?
36
39
  end
37
40
  end
38
41
 
@@ -102,7 +105,7 @@ module Turbopuffer
102
105
  pool =
103
106
  @mutex.synchronize do
104
107
  @pools[origin] ||= ConnectionPool.new(size: @size) do
105
- self.class.connect(url)
108
+ self.class.connect(cert_store: @cert_store, url: url)
106
109
  end
107
110
  end
108
111
 
@@ -128,40 +131,48 @@ module Turbopuffer
128
131
  url, deadline = request.fetch_values(:url, :deadline)
129
132
 
130
133
  req = nil
131
- eof = false
132
134
  finished = false
133
- closing = nil
134
135
 
135
136
  # rubocop:disable Metrics/BlockLength
136
137
  enum = Enumerator.new do |y|
137
138
  next if finished
138
139
 
139
140
  with_pool(url, deadline: deadline) do |conn|
140
- req, closing = self.class.build_request(request) do
141
- self.class.calibrate_socket_timeout(conn, deadline)
142
- end
143
-
144
- self.class.calibrate_socket_timeout(conn, deadline)
145
- unless conn.started?
146
- conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
147
- conn.start
148
- end
141
+ eof = false
142
+ closing = nil
143
+ ::Thread.handle_interrupt(Object => :never) do
144
+ ::Thread.handle_interrupt(Object => :immediate) do
145
+ req, closing = self.class.build_request(request) do
146
+ self.class.calibrate_socket_timeout(conn, deadline)
147
+ end
149
148
 
150
- self.class.calibrate_socket_timeout(conn, deadline)
151
- conn.request(req) do |rsp|
152
- y << [req, rsp]
153
- break if finished
154
-
155
- rsp.read_body do |bytes|
156
- y << bytes.force_encoding(Encoding::BINARY)
157
- break if finished
149
+ self.class.calibrate_socket_timeout(conn, deadline)
150
+ unless conn.started?
151
+ conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
152
+ conn.start
153
+ end
158
154
 
159
155
  self.class.calibrate_socket_timeout(conn, deadline)
156
+ conn.request(req) do |rsp|
157
+ y << [req, rsp]
158
+ break if finished
159
+
160
+ rsp.read_body do |bytes|
161
+ y << bytes.force_encoding(Encoding::BINARY)
162
+ break if finished
163
+
164
+ self.class.calibrate_socket_timeout(conn, deadline)
165
+ end
166
+ eof = true
167
+ end
168
+ end
169
+ ensure
170
+ begin
171
+ conn.finish if !eof && conn&.started?
172
+ ensure
173
+ closing&.call
160
174
  end
161
- eof = true
162
175
  end
163
- ensure
164
- conn.finish if !eof && conn&.started?
165
176
  end
166
177
  rescue Timeout::Error
167
178
  raise Turbopuffer::Errors::APITimeoutError.new(url: url, request: req)
@@ -174,8 +185,6 @@ module Turbopuffer
174
185
  body = Turbopuffer::Internal::Util.fused_enum(enum, external: true) do
175
186
  finished = true
176
187
  loop { enum.next }
177
- ensure
178
- closing&.call
179
188
  end
180
189
  [Integer(response.code), response, body]
181
190
  end
@@ -186,6 +195,7 @@ module Turbopuffer
186
195
  def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS)
187
196
  @mutex = Mutex.new
188
197
  @size = size
198
+ @cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
189
199
  @pools = {}
190
200
  end
191
201
 
@@ -11,7 +11,7 @@ module Turbopuffer
11
11
  # when Turbopuffer::AttributeType
12
12
  # # ...
13
13
  # when Turbopuffer::AttributeSchemaConfig
14
- # puts(attribute_schema.ann)
14
+ # puts(attribute_schema.type)
15
15
  # else
16
16
  # puts(attribute_schema)
17
17
  # end
@@ -3,11 +3,20 @@
3
3
  module Turbopuffer
4
4
  module Models
5
5
  class AttributeSchemaConfig < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute type
7
+ # The data type of the attribute. Valid values: string, int, uint, float, uuid,
8
+ # datetime, bool, []string, []int, []uint, []float, []uuid, []datetime, []bool,
9
+ # [DIMS]f16, [DIMS]f32.
10
+ #
11
+ # @return [String]
12
+ required :type, String
13
+
6
14
  # @!attribute ann
7
- # Whether to create an approximate nearest neighbor index for the attribute.
15
+ # Whether to create an approximate nearest neighbor index for the attribute. Can
16
+ # be a boolean or a detailed configuration object.
8
17
  #
9
- # @return [Boolean, nil]
10
- optional :ann, Turbopuffer::Internal::Type::Boolean
18
+ # @return [Boolean, Turbopuffer::Models::AttributeSchemaConfig::Ann::AnnConfig, nil]
19
+ optional :ann, union: -> { Turbopuffer::AttributeSchemaConfig::Ann }
11
20
 
12
21
  # @!attribute filterable
13
22
  # Whether or not the attributes can be used in filters.
@@ -29,29 +38,50 @@ module Turbopuffer
29
38
  # @return [Boolean, nil]
30
39
  optional :regex, Turbopuffer::Internal::Type::Boolean
31
40
 
32
- # @!attribute type
33
- # The data type of the attribute. Valid values: string, int, uint, float, uuid,
34
- # datetime, bool, []string, []int, []uint, []float, []uuid, []datetime, []bool,
35
- # [DIMS]f16, [DIMS]f32.
36
- #
37
- # @return [String, nil]
38
- optional :type, String
39
-
40
- # @!method initialize(ann: nil, filterable: nil, full_text_search: nil, regex: nil, type: nil)
41
+ # @!method initialize(type:, ann: nil, filterable: nil, full_text_search: nil, regex: nil)
41
42
  # Some parameter documentations has been truncated, see
42
43
  # {Turbopuffer::Models::AttributeSchemaConfig} for more details.
43
44
  #
44
45
  # Detailed configuration for an attribute attached to a document.
45
46
  #
46
- # @param ann [Boolean] Whether to create an approximate nearest neighbor index for the attribute.
47
+ # @param type [String] The data type of the attribute. Valid values: string, int, uint, float, uuid, da
48
+ #
49
+ # @param ann [Boolean, Turbopuffer::Models::AttributeSchemaConfig::Ann::AnnConfig] Whether to create an approximate nearest neighbor index for the attribute. Can b
47
50
  #
48
51
  # @param filterable [Boolean] Whether or not the attributes can be used in filters.
49
52
  #
50
53
  # @param full_text_search [Boolean, Turbopuffer::Models::FullTextSearchConfig] Whether this attribute can be used as part of a BM25 full-text search. Requires
51
54
  #
52
55
  # @param regex [Boolean] Whether to enable Regex filters on this attribute.
56
+
57
+ # Whether to create an approximate nearest neighbor index for the attribute. Can
58
+ # be a boolean or a detailed configuration object.
53
59
  #
54
- # @param type [String] The data type of the attribute. Valid values: string, int, uint, float, uuid, da
60
+ # @see Turbopuffer::Models::AttributeSchemaConfig#ann
61
+ module Ann
62
+ extend Turbopuffer::Internal::Type::Union
63
+
64
+ variant Turbopuffer::Internal::Type::Boolean
65
+
66
+ # Configuration options for ANN (Approximate Nearest Neighbor) indexing.
67
+ variant -> { Turbopuffer::AttributeSchemaConfig::Ann::AnnConfig }
68
+
69
+ class AnnConfig < Turbopuffer::Internal::Type::BaseModel
70
+ # @!attribute distance_metric
71
+ # A function used to calculate vector similarity.
72
+ #
73
+ # @return [Symbol, Turbopuffer::Models::DistanceMetric, nil]
74
+ optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }
75
+
76
+ # @!method initialize(distance_metric: nil)
77
+ # Configuration options for ANN (Approximate Nearest Neighbor) indexing.
78
+ #
79
+ # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
80
+ end
81
+
82
+ # @!method self.variants
83
+ # @return [Array(Boolean, Turbopuffer::Models::AttributeSchemaConfig::Ann::AnnConfig)]
84
+ end
55
85
  end
56
86
  end
57
87
  end
@@ -22,13 +22,34 @@ module Turbopuffer
22
22
  # @return [Time]
23
23
  required :created_at, Time
24
24
 
25
+ # @!attribute encryption
26
+ # Indicates that the namespace is encrypted with a customer-managed encryption key
27
+ # (CMEK).
28
+ #
29
+ # @return [Turbopuffer::Models::NamespaceMetadata::Encryption::Sse, Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek]
30
+ required :encryption, union: -> { Turbopuffer::NamespaceMetadata::Encryption }
31
+
32
+ # @!attribute index
33
+ #
34
+ # @return [Turbopuffer::Models::NamespaceMetadata::Index::IndexUpToDate, Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating]
35
+ required :index, union: -> { Turbopuffer::NamespaceMetadata::Index }
36
+
25
37
  # @!attribute schema
26
38
  # The schema of the namespace.
27
39
  #
28
40
  # @return [Hash{Symbol=>Turbopuffer::Models::AttributeSchemaConfig}]
29
41
  required :schema, -> { Turbopuffer::Internal::Type::HashOf[Turbopuffer::AttributeSchemaConfig] }
30
42
 
31
- # @!method initialize(approx_logical_bytes:, approx_row_count:, created_at:, schema:)
43
+ # @!attribute updated_at
44
+ # The timestamp when the namespace was last modified by a write operation.
45
+ #
46
+ # @return [Time]
47
+ required :updated_at, Time
48
+
49
+ # @!method initialize(approx_logical_bytes:, approx_row_count:, created_at:, encryption:, index:, schema:, updated_at:)
50
+ # Some parameter documentations has been truncated, see
51
+ # {Turbopuffer::Models::NamespaceMetadata} for more details.
52
+ #
32
53
  # Metadata about a namespace.
33
54
  #
34
55
  # @param approx_logical_bytes [Integer] The approximate number of logical bytes in the namespace.
@@ -37,7 +58,109 @@ module Turbopuffer
37
58
  #
38
59
  # @param created_at [Time] The timestamp when the namespace was created.
39
60
  #
61
+ # @param encryption [Turbopuffer::Models::NamespaceMetadata::Encryption::Sse, Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek] Indicates that the namespace is encrypted with a customer-managed encryption key
62
+ #
63
+ # @param index [Turbopuffer::Models::NamespaceMetadata::Index::IndexUpToDate, Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating]
64
+ #
40
65
  # @param schema [Hash{Symbol=>Turbopuffer::Models::AttributeSchemaConfig}] The schema of the namespace.
66
+ #
67
+ # @param updated_at [Time] The timestamp when the namespace was last modified by a write operation.
68
+
69
+ # Indicates that the namespace is encrypted with a customer-managed encryption key
70
+ # (CMEK).
71
+ #
72
+ # @see Turbopuffer::Models::NamespaceMetadata#encryption
73
+ module Encryption
74
+ extend Turbopuffer::Internal::Type::Union
75
+
76
+ variant -> { Turbopuffer::NamespaceMetadata::Encryption::Sse }
77
+
78
+ # Indicates that the namespace is encrypted with a customer-managed encryption key (CMEK).
79
+ variant -> { Turbopuffer::NamespaceMetadata::Encryption::Cmek }
80
+
81
+ class Sse < Turbopuffer::Internal::Type::BaseModel
82
+ # @!attribute sse
83
+ # Always true. Indicates that the namespace is encrypted with SSE.
84
+ #
85
+ # @return [Boolean]
86
+ required :sse, Turbopuffer::Internal::Type::Boolean
87
+
88
+ # @!method initialize(sse:)
89
+ # @param sse [Boolean] Always true. Indicates that the namespace is encrypted with SSE.
90
+ end
91
+
92
+ class Cmek < Turbopuffer::Internal::Type::BaseModel
93
+ # @!attribute cmek
94
+ #
95
+ # @return [Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek::Cmek]
96
+ required :cmek, -> { Turbopuffer::NamespaceMetadata::Encryption::Cmek::Cmek }
97
+
98
+ # @!method initialize(cmek:)
99
+ # Indicates that the namespace is encrypted with a customer-managed encryption key
100
+ # (CMEK).
101
+ #
102
+ # @param cmek [Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek::Cmek]
103
+
104
+ # @see Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek#cmek
105
+ class Cmek < Turbopuffer::Internal::Type::BaseModel
106
+ # @!attribute key_name
107
+ # The name of the CMEK key in use.
108
+ #
109
+ # @return [String]
110
+ required :key_name, String
111
+
112
+ # @!method initialize(key_name:)
113
+ # @param key_name [String] The name of the CMEK key in use.
114
+ end
115
+ end
116
+
117
+ # @!method self.variants
118
+ # @return [Array(Turbopuffer::Models::NamespaceMetadata::Encryption::Sse, Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek)]
119
+ end
120
+
121
+ # @see Turbopuffer::Models::NamespaceMetadata#index
122
+ module Index
123
+ extend Turbopuffer::Internal::Type::Union
124
+
125
+ variant -> { Turbopuffer::NamespaceMetadata::Index::IndexUpToDate }
126
+
127
+ variant -> { Turbopuffer::NamespaceMetadata::Index::IndexUpdating }
128
+
129
+ class IndexUpToDate < Turbopuffer::Internal::Type::BaseModel
130
+ # @!attribute status
131
+ #
132
+ # @return [Symbol, :"up-to-date"]
133
+ required :status, const: :"up-to-date"
134
+
135
+ # @!method initialize(status: :"up-to-date")
136
+ # @param status [Symbol, :"up-to-date"]
137
+ end
138
+
139
+ class IndexUpdating < Turbopuffer::Internal::Type::BaseModel
140
+ # @!attribute status
141
+ #
142
+ # @return [Symbol, :updating]
143
+ required :status, const: :updating
144
+
145
+ # @!attribute unindexed_bytes
146
+ # The number of bytes in the namespace that are in the write-ahead log but have
147
+ # not yet been indexed.
148
+ #
149
+ # @return [Integer]
150
+ required :unindexed_bytes, Integer
151
+
152
+ # @!method initialize(unindexed_bytes:, status: :updating)
153
+ # Some parameter documentations has been truncated, see
154
+ # {Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating} for more details.
155
+ #
156
+ # @param unindexed_bytes [Integer] The number of bytes in the namespace that are in the write-ahead log but have no
157
+ #
158
+ # @param status [Symbol, :updating]
159
+ end
160
+
161
+ # @!method self.variants
162
+ # @return [Array(Turbopuffer::Models::NamespaceMetadata::Index::IndexUpToDate, Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating)]
163
+ end
41
164
  end
42
165
  end
43
166
  end
@@ -54,6 +54,12 @@ module Turbopuffer
54
54
  # @return [Turbopuffer::Models::NamespaceWriteParams::Encryption, nil]
55
55
  optional :encryption, -> { Turbopuffer::NamespaceWriteParams::Encryption }
56
56
 
57
+ # @!attribute patch_by_filter
58
+ # The patch and filter specifying which documents to patch.
59
+ #
60
+ # @return [Turbopuffer::Models::NamespaceWriteParams::PatchByFilter, nil]
61
+ optional :patch_by_filter, -> { Turbopuffer::NamespaceWriteParams::PatchByFilter }
62
+
57
63
  # @!attribute patch_columns
58
64
  # A list of documents in columnar format. Each key is a column name, mapped to an
59
65
  # array of values for that column.
@@ -98,7 +104,7 @@ module Turbopuffer
98
104
  # @return [Array<Turbopuffer::Models::Row>, nil]
99
105
  optional :upsert_rows, -> { Turbopuffer::Internal::Type::ArrayOf[Turbopuffer::Row] }
100
106
 
101
- # @!method initialize(namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, schema: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
107
+ # @!method initialize(namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_by_filter: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, schema: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
102
108
  # Some parameter documentations has been truncated, see
103
109
  # {Turbopuffer::Models::NamespaceWriteParams} for more details.
104
110
  #
@@ -118,6 +124,8 @@ module Turbopuffer
118
124
  #
119
125
  # @param encryption [Turbopuffer::Models::NamespaceWriteParams::Encryption] The encryption configuration for a namespace.
120
126
  #
127
+ # @param patch_by_filter [Turbopuffer::Models::NamespaceWriteParams::PatchByFilter] The patch and filter specifying which documents to patch.
128
+ #
121
129
  # @param patch_columns [Turbopuffer::Models::Columns] A list of documents in columnar format. Each key is a column name, mapped to an
122
130
  #
123
131
  # @param patch_condition [Object] A condition evaluated against the current value of each document targeted by a p
@@ -161,6 +169,26 @@ module Turbopuffer
161
169
  # @param key_name [String] The identifier of the CMEK key to use for encryption. For GCP, the fully-qualifi
162
170
  end
163
171
  end
172
+
173
+ class PatchByFilter < Turbopuffer::Internal::Type::BaseModel
174
+ # @!attribute filters
175
+ # Filter by attributes. Same syntax as the query endpoint.
176
+ #
177
+ # @return [Object]
178
+ required :filters, Turbopuffer::Internal::Type::Unknown
179
+
180
+ # @!attribute patch
181
+ #
182
+ # @return [Hash{Symbol=>Object}]
183
+ required :patch, Turbopuffer::Internal::Type::HashOf[Turbopuffer::Internal::Type::Unknown]
184
+
185
+ # @!method initialize(filters:, patch:)
186
+ # The patch and filter specifying which documents to patch.
187
+ #
188
+ # @param filters [Object] Filter by attributes. Same syntax as the query endpoint.
189
+ #
190
+ # @param patch [Hash{Symbol=>Object}]
191
+ end
164
192
  end
165
193
  end
166
194
  end
@@ -305,7 +305,7 @@ module Turbopuffer
305
305
  #
306
306
  # Create, update, or delete documents.
307
307
  #
308
- # @overload write(namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, schema: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
308
+ # @overload write(namespace: nil, copy_from_namespace: nil, delete_by_filter: nil, delete_condition: nil, deletes: nil, disable_backpressure: nil, distance_metric: nil, encryption: nil, patch_by_filter: nil, patch_columns: nil, patch_condition: nil, patch_rows: nil, schema: nil, upsert_columns: nil, upsert_condition: nil, upsert_rows: nil, request_options: {})
309
309
  #
310
310
  # @param namespace [String] Path param: The name of the namespace.
311
311
  #
@@ -323,6 +323,8 @@ module Turbopuffer
323
323
  #
324
324
  # @param encryption [Turbopuffer::Models::NamespaceWriteParams::Encryption] Body param: The encryption configuration for a namespace.
325
325
  #
326
+ # @param patch_by_filter [Turbopuffer::Models::NamespaceWriteParams::PatchByFilter] Body param: The patch and filter specifying which documents to patch.
327
+ #
326
328
  # @param patch_columns [Turbopuffer::Models::Columns] Body param: A list of documents in columnar format. Each key is a column name, m
327
329
  #
328
330
  # @param patch_condition [Object] Body param: A condition evaluated against the current value of each document tar
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Turbopuffer
4
- VERSION = "1.4.0"
4
+ VERSION = "1.6.0"
5
5
  end
data/lib/turbopuffer.rb CHANGED
@@ -9,6 +9,7 @@ require "erb"
9
9
  require "etc"
10
10
  require "json"
11
11
  require "net/http"
12
+ require "openssl"
12
13
  require "pathname"
13
14
  require "rbconfig"
14
15
  require "securerandom"
data/manifest.yaml CHANGED
@@ -6,6 +6,7 @@ dependencies:
6
6
  - etc
7
7
  - json
8
8
  - net/http
9
+ - openssl
9
10
  - pathname
10
11
  - rbconfig
11
12
  - securerandom
@@ -180,6 +180,11 @@ module Turbopuffer
180
180
  private def auth_headers
181
181
  end
182
182
 
183
+ # @api private
184
+ sig { returns(String) }
185
+ private def user_agent
186
+ end
187
+
183
188
  # @api private
184
189
  sig { returns(String) }
185
190
  private def generate_idempotency_key
@@ -26,8 +26,12 @@ module Turbopuffer
26
26
 
27
27
  class << self
28
28
  # @api private
29
- sig { params(url: URI::Generic).returns(Net::HTTP) }
30
- def connect(url)
29
+ sig do
30
+ params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns(
31
+ Net::HTTP
32
+ )
33
+ end
34
+ def connect(cert_store:, url:)
31
35
  end
32
36
 
33
37
  # @api private
@@ -31,7 +31,7 @@ module Turbopuffer
31
31
  #
32
32
  # Assumes superclass fields are totally defined before fields are accessed /
33
33
  # defined on subclasses.
34
- sig { params(child: T.self_type).void }
34
+ sig { params(child: Turbopuffer::Internal::Type::BaseModel).void }
35
35
  def inherited(child)
36
36
  end
37
37
 
@@ -276,9 +276,13 @@ module Turbopuffer
276
276
 
277
277
  # Create a new instance of a model.
278
278
  sig do
279
- params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(
280
- T.attached_class
281
- )
279
+ params(
280
+ data:
281
+ T.any(
282
+ T::Hash[Symbol, T.anything],
283
+ Turbopuffer::Internal::Type::BaseModel
284
+ )
285
+ ).returns(T.attached_class)
282
286
  end
283
287
  def self.new(data = {})
284
288
  end