statelydb 0.18.3 → 0.19.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 +4 -4
- data/lib/statelydb.rb +60 -0
- data/sig/statelydb.rbi +47 -0
- data/sig/statelydb.rbs +43 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48b92c6e1895bb7e7a5a27634f5012e9183b514a1210b25a54528000d8980e5d
|
4
|
+
data.tar.gz: ea786444657ea16320c913c115bac7f2cc17f3a9223d4ff53466504cac3930b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fa6566c111cc334eb9015880f2d5feec32e10e571522a9609e1413ee5b7a455a7858ad599c5fcc8bc0e0ecb6a42175faf1a0aca7ecb6f402426915c7f9bba04
|
7
|
+
data.tar.gz: e4e5b788790d397ff220f28a78221c81a533bf0a8f8c58328dbe85d9085d3074fcce5b5f68fcf06b946c1858225b0ce8eabb7c84fe0641599244961dcc079f0b
|
data/lib/statelydb.rb
CHANGED
@@ -165,6 +165,66 @@ module StatelyDB
|
|
165
165
|
process_list_response(resp)
|
166
166
|
end
|
167
167
|
|
168
|
+
# Initiates a scan request which will scan over the entire store and apply
|
169
|
+
# the provided filters. This API returns a token that you can pass to
|
170
|
+
# continue_scan to paginate through the result set. This can fail if the
|
171
|
+
# caller does not have permission to read Items.
|
172
|
+
#
|
173
|
+
# WARNING: THIS API CAN BE EXTREMELY EXPENSIVE FOR STORES WITH A LARGE NUMBER
|
174
|
+
# OF ITEMS.
|
175
|
+
#
|
176
|
+
# @param limit [Integer] the maximum number of items to return
|
177
|
+
# @param item_types [Array<Class, String>] the item types to filter by. The returned
|
178
|
+
# items will be instances of one of these types.
|
179
|
+
# @param total_segments [Integer] the total number of segments to divide the
|
180
|
+
# scan into. Use this when you want to parallelize your operation.
|
181
|
+
# @param segment_index [Integer] the index of the segment to scan.
|
182
|
+
# Use this when you want to parallelize your operation.
|
183
|
+
# @return [Array<StatelyDB::Item>, StatelyDB::Token] the list of Items and the token
|
184
|
+
#
|
185
|
+
# @example
|
186
|
+
# client.data.begin_scan(limit: 10, item_types: [MyItem])
|
187
|
+
def begin_scan(limit: 100,
|
188
|
+
item_types: [],
|
189
|
+
total_segments: nil,
|
190
|
+
segment_index: nil)
|
191
|
+
if total_segments.nil? != segment_index.nil?
|
192
|
+
raise StatelyDB::Error.new("total_segments and segment_index must both be set or both be nil",
|
193
|
+
code: GRPC::Core::StatusCodes::INVALID_ARGUMENT,
|
194
|
+
stately_code: "InvalidArgument")
|
195
|
+
end
|
196
|
+
req = Stately::Db::BeginScanRequest.new(
|
197
|
+
store_id: @store_id,
|
198
|
+
limit:,
|
199
|
+
filter_condition: item_types.map do |item_type|
|
200
|
+
Stately::Db::FilterCondition.new(item_type: item_type.respond_to?(:name) ? item_type.name.split("::").last : item_type)
|
201
|
+
end,
|
202
|
+
schema_version_id: @schema::SCHEMA_VERSION_ID
|
203
|
+
)
|
204
|
+
resp = @stub.begin_scan(req)
|
205
|
+
process_list_response(resp)
|
206
|
+
end
|
207
|
+
|
208
|
+
# continue_scan takes the token from a begin_scan call and returns more results
|
209
|
+
# based on the original request parameters and pagination options.
|
210
|
+
#
|
211
|
+
# WARNING: THIS API CAN BE EXTREMELY EXPENSIVE FOR STORES WITH A LARGE NUMBER OF ITEMS.
|
212
|
+
#
|
213
|
+
# @param token [StatelyDB::Token] the token to continue from
|
214
|
+
# @return [Array<StatelyDB::Item>, StatelyDB::Token] the list of Items and the token
|
215
|
+
#
|
216
|
+
# @example
|
217
|
+
# (items, token) = client.data.begin_scan(limit: 10, item_types: [MyItem])
|
218
|
+
# client.data.continue_scan(token)
|
219
|
+
def continue_scan(token)
|
220
|
+
req = Stately::Db::ContinueScanRequest.new(
|
221
|
+
token_data: token.token_data,
|
222
|
+
schema_version_id: @schema::SCHEMA_VERSION_ID
|
223
|
+
)
|
224
|
+
resp = @stub.continue_scan(req)
|
225
|
+
process_list_response(resp)
|
226
|
+
end
|
227
|
+
|
168
228
|
# Sync a list of Items from a StatelyDB Store.
|
169
229
|
#
|
170
230
|
# @param token [StatelyDB::Token] the token to sync from
|
data/sig/statelydb.rbi
CHANGED
@@ -297,6 +297,53 @@ module StatelyDB
|
|
297
297
|
sig { params(token: StatelyDB::Token).returns(T.any(T::Array[StatelyDB::Item], StatelyDB::Token)) }
|
298
298
|
def continue_list(token); end
|
299
299
|
|
300
|
+
# Initiates a scan request which will scan over the entire store and apply
|
301
|
+
# the provided filters. This API returns a token that you can pass to
|
302
|
+
# continue_scan to paginate through the result set. This can fail if the
|
303
|
+
# caller does not have permission to read Items.
|
304
|
+
#
|
305
|
+
# WARNING: THIS API CAN BE EXTREMELY EXPENSIVE FOR STORES WITH A LARGE NUMBER
|
306
|
+
# OF ITEMS.
|
307
|
+
#
|
308
|
+
# _@param_ `limit` — the maximum number of items to return
|
309
|
+
#
|
310
|
+
# _@param_ `item_types` — the item types to filter by. The returned items will be instances of one of these types.
|
311
|
+
#
|
312
|
+
# _@param_ `total_segments` — the total number of segments to divide the scan into. Use this when you want to parallelize your operation.
|
313
|
+
#
|
314
|
+
# _@param_ `segment_index` — the index of the segment to scan. Use this when you want to parallelize your operation.
|
315
|
+
#
|
316
|
+
# _@return_ — the list of Items and the token
|
317
|
+
#
|
318
|
+
# ```ruby
|
319
|
+
# client.data.begin_scan(limit: 10, item_types: [MyItem])
|
320
|
+
# ```
|
321
|
+
sig do
|
322
|
+
params(
|
323
|
+
limit: Integer,
|
324
|
+
item_types: T::Array[T.any(Class, String)],
|
325
|
+
total_segments: T.nilable(Integer),
|
326
|
+
segment_index: T.nilable(Integer)
|
327
|
+
).returns(T.any(T::Array[StatelyDB::Item], StatelyDB::Token))
|
328
|
+
end
|
329
|
+
def begin_scan(limit: 100, item_types: [], total_segments: nil, segment_index: nil); end
|
330
|
+
|
331
|
+
# continue_scan takes the token from a begin_scan call and returns more results
|
332
|
+
# based on the original request parameters and pagination options.
|
333
|
+
#
|
334
|
+
# WARNING: THIS API CAN BE EXTREMELY EXPENSIVE FOR STORES WITH A LARGE NUMBER OF ITEMS.
|
335
|
+
#
|
336
|
+
# _@param_ `token` — the token to continue from
|
337
|
+
#
|
338
|
+
# _@return_ — the list of Items and the token
|
339
|
+
#
|
340
|
+
# ```ruby
|
341
|
+
# (items, token) = client.data.begin_scan(limit: 10, item_types: [MyItem])
|
342
|
+
# client.data.continue_scan(token)
|
343
|
+
# ```
|
344
|
+
sig { params(token: StatelyDB::Token).returns(T.any(T::Array[StatelyDB::Item], StatelyDB::Token)) }
|
345
|
+
def continue_scan(token); end
|
346
|
+
|
300
347
|
# Sync a list of Items from a StatelyDB Store.
|
301
348
|
#
|
302
349
|
# _@param_ `token` — the token to sync from
|
data/sig/statelydb.rbs
CHANGED
@@ -252,6 +252,49 @@ module StatelyDB
|
|
252
252
|
# ```
|
253
253
|
def continue_list: (StatelyDB::Token token) -> (::Array[StatelyDB::Item] | StatelyDB::Token)
|
254
254
|
|
255
|
+
# Initiates a scan request which will scan over the entire store and apply
|
256
|
+
# the provided filters. This API returns a token that you can pass to
|
257
|
+
# continue_scan to paginate through the result set. This can fail if the
|
258
|
+
# caller does not have permission to read Items.
|
259
|
+
#
|
260
|
+
# WARNING: THIS API CAN BE EXTREMELY EXPENSIVE FOR STORES WITH A LARGE NUMBER
|
261
|
+
# OF ITEMS.
|
262
|
+
#
|
263
|
+
# _@param_ `limit` — the maximum number of items to return
|
264
|
+
#
|
265
|
+
# _@param_ `item_types` — the item types to filter by. The returned items will be instances of one of these types.
|
266
|
+
#
|
267
|
+
# _@param_ `total_segments` — the total number of segments to divide the scan into. Use this when you want to parallelize your operation.
|
268
|
+
#
|
269
|
+
# _@param_ `segment_index` — the index of the segment to scan. Use this when you want to parallelize your operation.
|
270
|
+
#
|
271
|
+
# _@return_ — the list of Items and the token
|
272
|
+
#
|
273
|
+
# ```ruby
|
274
|
+
# client.data.begin_scan(limit: 10, item_types: [MyItem])
|
275
|
+
# ```
|
276
|
+
def begin_scan: (
|
277
|
+
?limit: Integer,
|
278
|
+
?item_types: ::Array[(Class | String)],
|
279
|
+
?total_segments: Integer?,
|
280
|
+
?segment_index: Integer?
|
281
|
+
) -> (::Array[StatelyDB::Item] | StatelyDB::Token)
|
282
|
+
|
283
|
+
# continue_scan takes the token from a begin_scan call and returns more results
|
284
|
+
# based on the original request parameters and pagination options.
|
285
|
+
#
|
286
|
+
# WARNING: THIS API CAN BE EXTREMELY EXPENSIVE FOR STORES WITH A LARGE NUMBER OF ITEMS.
|
287
|
+
#
|
288
|
+
# _@param_ `token` — the token to continue from
|
289
|
+
#
|
290
|
+
# _@return_ — the list of Items and the token
|
291
|
+
#
|
292
|
+
# ```ruby
|
293
|
+
# (items, token) = client.data.begin_scan(limit: 10, item_types: [MyItem])
|
294
|
+
# client.data.continue_scan(token)
|
295
|
+
# ```
|
296
|
+
def continue_scan: (StatelyDB::Token token) -> (::Array[StatelyDB::Item] | StatelyDB::Token)
|
297
|
+
|
255
298
|
# Sync a list of Items from a StatelyDB Store.
|
256
299
|
#
|
257
300
|
# _@param_ `token` — the token to sync from
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statelydb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stately Cloud, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|