statelydb 0.18.3 → 0.20.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: e07b296b0a2f8dda95a010bd074b91c653f8a5c45cf2a6fc0418d7b158644ca8
4
- data.tar.gz: cf3895a85a5090c62c87bda2d2bf75d0d6ae7a668c1f8dfb5bb2e4068399fdeb
3
+ metadata.gz: f2596e8fefad5c493ca74719bd8d88366196aa67060aa8bf7f235426b4042b76
4
+ data.tar.gz: 9a01f05434b629b8d7056fa9bf24b1e310d9377b8d853779a5a2402939ecb598
5
5
  SHA512:
6
- metadata.gz: 0644d032470017c1a692713fd1a9f06633e836af51c59a20bf4859c21d94e67031c58db6fa70e72ef5055594eb305cad2b961cd4437c280d8147d7ed9e8aefea
7
- data.tar.gz: 64d33d0c37809b0a819014ea38cba6ec506d313a163e09286dbd20944291d9d49f34cfc21d042f80a85aeb2050bccc72d8b843061bbae5dc63e882b09802ca41
6
+ metadata.gz: d071adf0dba8e6981ec77346b80502a69c2424a9a165c55acbbacba62ca424df341efa5e36215294da76595666371c90c0575046d78eb4527039a6b75d4499dd
7
+ data.tar.gz: 0eda4f14edcf95b3f317e5b82a70b86e5502ac2c970a6940c592f5d3bfd0b1e93ab0d302de94bb47091d71b709f411576928a9e9ac50727e423e91083108688e
@@ -41,6 +41,7 @@ module StatelyDB
41
41
 
42
42
  # Close the token provider and kill any background operations
43
43
  # This just invokes the close method on the actor which should do the cleanup
44
+ # @return [void]
44
45
  def close
45
46
  @actor.close
46
47
  end
@@ -81,6 +82,7 @@ module StatelyDB
81
82
 
82
83
  # Initialize the actor. This runs on the actor thread which means
83
84
  # we can dispatch async operations here.
85
+ # @return [void]
84
86
  def init
85
87
  # disable the async lib logger. We do our own error handling and propagation
86
88
  Console.logger.disable(Async::Task)
@@ -88,6 +90,7 @@ module StatelyDB
88
90
  end
89
91
 
90
92
  # Close the token provider and kill any background operations
93
+ # @return [void]
91
94
  def close
92
95
  @scheduled&.stop
93
96
  @token_fetcher&.close
@@ -117,7 +120,7 @@ module StatelyDB
117
120
  end
118
121
 
119
122
  # Refresh the access token
120
- # @return [Task] A task that will resolve to the new access token
123
+ # @return [::Async::Task] A task that will resolve to the new access token
121
124
  def refresh_token
122
125
  Async do
123
126
  # we use an Async::Condition to dedupe multiple requests here
@@ -187,6 +190,11 @@ module StatelyDB
187
190
  end
188
191
 
189
192
  # Persistent state for the token provider
193
+ #
194
+ # @!attribute [r] token
195
+ # @return [String] The token string.
196
+ # @!attribute [r] expires_at_unix_secs
197
+ # @return [Integer] The expiration time in unix seconds.
190
198
  class TokenState
191
199
  attr_reader :token, :expires_at_unix_secs
192
200
 
@@ -20,7 +20,7 @@ module StatelyDB
20
20
  # gRPC client unary interceptor
21
21
  #
22
22
  # @param [Object] request The request object
23
- # @param [GRPC::ActiveCall] call The active call object
23
+ # @param [::GRPC::ActiveCall] call The active call object
24
24
  # @param [Symbol] method The method being called
25
25
  # @param [Hash] metadata The metadata hash
26
26
  # @return [Object] The response object
@@ -33,7 +33,7 @@ module StatelyDB
33
33
  # gRPC client streaming interceptor
34
34
  #
35
35
  # @param [Enumerable] requests The list of requests
36
- # @param [GRPC::ActiveCall] call The active call object
36
+ # @param [::GRPC::ActiveCall] call The active call object
37
37
  # @param [Symbol] method The method being called
38
38
  # @param [Hash] metadata The metadata hash
39
39
  # @return [Enumerator] The response enumerator
@@ -46,7 +46,7 @@ module StatelyDB
46
46
  # gRPC server streaming interceptor
47
47
  #
48
48
  # @param [Object] request The request object
49
- # @param [GRPC::ActiveCall] call The active call object
49
+ # @param [::GRPC::ActiveCall] call The active call object
50
50
  # @param [Symbol] method The method being called
51
51
  # @param [Hash] metadata The metadata hash
52
52
  # @return [Enumerator] The response enumerator
@@ -59,7 +59,7 @@ module StatelyDB
59
59
  # gRPC bidirectional streaming interceptor
60
60
  #
61
61
  # @param [Enumerable] requests The list of requests
62
- # @param [GRPC::ActiveCall] call The active call object
62
+ # @param [::GRPC::ActiveCall] call The active call object
63
63
  # @param [Symbol] method The method being called
64
64
  # @param [Hash] metadata The metadata hash
65
65
  # @return [Enumerator] The response enumerator
@@ -10,6 +10,11 @@ module StatelyDB
10
10
  # A module for Stately Cloud auth code
11
11
  module Auth
12
12
  # Result from a token fetch operation
13
+ #
14
+ # @!attribute [r] token
15
+ # @return [String] The token string.
16
+ # @!attribute [r] expires_in_secs
17
+ # @return [Integer] The expiration time in seconds.
13
18
  class TokenResult
14
19
  attr_reader :token, :expires_in_secs
15
20
 
@@ -32,6 +37,7 @@ module StatelyDB
32
37
  end
33
38
 
34
39
  # Close the token provider and kill any background operations
40
+ # @return [void]
35
41
  def close
36
42
  raise "Not Implemented"
37
43
  end
@@ -39,6 +45,9 @@ module StatelyDB
39
45
 
40
46
  # StatelyAccessTokenFetcher is a TokenFetcher that fetches tokens from the StatelyDB API
41
47
  class StatelyAccessTokenFetcher < TokenFetcher
48
+ # Non-retryable errors that will not be retried.
49
+ #
50
+ # @return [Array<::GRPC::Core::StatusCodes>]
42
51
  NON_RETRYABLE_ERRORS = [
43
52
  GRPC::Core::StatusCodes::UNAUTHENTICATED,
44
53
  GRPC::Core::StatusCodes::PERMISSION_DENIED,
@@ -46,6 +55,10 @@ module StatelyDB
46
55
  GRPC::Core::StatusCodes::UNIMPLEMENTED,
47
56
  GRPC::Core::StatusCodes::INVALID_ARGUMENT
48
57
  ].freeze
58
+
59
+ # Number of retry attempts for requests.
60
+ #
61
+ # @return [Integer]
49
62
  RETRY_ATTEMPTS = 10
50
63
 
51
64
  # @param [String] endpoint The endpoint of the OAuth server
@@ -76,6 +89,8 @@ module StatelyDB
76
89
  end
77
90
  end
78
91
 
92
+ # Close the token provider and kill any background operations
93
+ # @return [void]
79
94
  def close
80
95
  @channel&.close
81
96
  end
@@ -15,6 +15,7 @@ module StatelyDB
15
15
  end
16
16
 
17
17
  # Close the token provider and kill any background operations
18
+ # @return [void]
18
19
  def close
19
20
  raise "Not Implemented"
20
21
  end
@@ -9,7 +9,7 @@ module StatelyDB
9
9
  module Net
10
10
  # Create a new gRPC channel
11
11
  # @param [String] endpoint The endpoint to connect to
12
- # @return [GRPC::Core::Channel] The new channel
12
+ # @return [::GRPC::Core::Channel] The new channel
13
13
  def self.new_channel(endpoint:)
14
14
  endpoint_uri = URI(endpoint)
15
15
  creds = GRPC::Core::ChannelCredentials.new
data/lib/key_path.rb CHANGED
@@ -9,8 +9,8 @@ module StatelyDB
9
9
  end
10
10
 
11
11
  # Appends a new path segment.
12
- # @param [String] namespace
13
- # @param [String, StatelyDB::UUID, #to_s] identifier
12
+ # @param namespace [String]
13
+ # @param identifier [String, StatelyDB::UUID, #to_s]
14
14
  # @return [KeyPath]
15
15
  def with(namespace, identifier = nil)
16
16
  if identifier.nil?
@@ -37,8 +37,8 @@ module StatelyDB
37
37
  end
38
38
 
39
39
  # Appends a new path segment.
40
- # @param [String] namespace
41
- # @param [String, StatelyDB::UUID, #to_s] identifier
40
+ # @param namespace [String]
41
+ # @param identifier [String, StatelyDB::UUID, #to_s]
42
42
  # @return [KeyPath]
43
43
  #
44
44
  # @example
@@ -49,7 +49,7 @@ module StatelyDB
49
49
 
50
50
  # If the value is a binary string, encode it as a url-safe base64 string with padding removed.
51
51
  #
52
- # @param [String, StatelyDB::UUID, #to_s] value The value to convert to a key id.
52
+ # @param value [String, StatelyDB::UUID, #to_s] The value to convert to a key id.
53
53
  # @return [String]
54
54
  def self.to_key_id(value)
55
55
  if value.is_a?(StatelyDB::UUID)
data/lib/stately_codes.rb CHANGED
@@ -6,6 +6,7 @@ module StatelyCode
6
6
  #
7
7
  # - Retryable
8
8
  # This error is immediately retryable.
9
+ # @return [String]
9
10
  CACHED_SCHEMA_TOO_OLD = "CachedSchemaTooOld"
10
11
 
11
12
  # ConcurrentModification indicates the current transaction was aborted
@@ -34,6 +35,7 @@ module StatelyCode
34
35
  #
35
36
  # - Retryable
36
37
  # This error is immediately retryable.
38
+ # @return [String]
37
39
  CONCURRENT_MODIFICATION = "ConcurrentModification"
38
40
 
39
41
  # ConditionalCheckFailed indicates that conditions provided to perform an
@@ -45,6 +47,7 @@ module StatelyCode
45
47
  # - Not Retryable
46
48
  # Typically a conditional check failure is not retryable
47
49
  # unless the conditions for the operation are changed.
50
+ # @return [String]
48
51
  CONDITIONAL_CHECK_FAILED = "ConditionalCheckFailed"
49
52
 
50
53
  # ItemReusedWithDifferentKeyPath occurs when a client reads an Item, then
@@ -57,6 +60,7 @@ module StatelyCode
57
60
  # new instance of the Item rather than reusing the read result.
58
61
  #
59
62
  # - Not Retryable
63
+ # @return [String]
60
64
  ITEM_REUSED_WITH_DIFFERENT_KEY_PATH = "ItemReusedWithDifferentKeyPath"
61
65
 
62
66
  # NonRecoverableTransaction indicates that conditions required for the
@@ -68,6 +72,7 @@ module StatelyCode
68
72
  # independent records with aliases pointing to the same item.
69
73
  #
70
74
  # - Not Retryable
75
+ # @return [String]
71
76
  NON_RECOVERABLE_TRANSACTION = "NonRecoverableTransaction"
72
77
 
73
78
  # StoreInUse indicates that the underlying Store is currently in being
@@ -76,6 +81,7 @@ module StatelyCode
76
81
  #
77
82
  # - Retryable
78
83
  # This can be retried with backoff.
84
+ # @return [String]
79
85
  STORE_IN_USE = "StoreInUse"
80
86
 
81
87
  # StoreRequestLimitExceeded indicates that an attempt to modify a Store has
@@ -85,6 +91,7 @@ module StatelyCode
85
91
  # please contact support.
86
92
  #
87
93
  # - Retryable
94
+ # @return [String]
88
95
  STORE_REQUEST_LIMIT_EXCEEDED = "StoreRequestLimitExceeded"
89
96
 
90
97
  # StoreThroughputExceeded indicates that the underlying Store does not have
@@ -94,5 +101,6 @@ module StatelyCode
94
101
  #
95
102
  # - Retryable
96
103
  # With an exponential backoff.
104
+ # @return [String]
97
105
  STORE_THROUGHPUT_EXCEEDED = "StoreThroughputExceeded"
98
106
  end
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
@@ -309,7 +369,7 @@ module StatelyDB
309
369
  # then the default endpoint will be returned.
310
370
  #
311
371
  # @param endpoint [String] the endpoint to connect to
312
- # @param region [Region] the region to connect to
372
+ # @param region [String] the region to connect to
313
373
  # @return [String] the constructed endpoint
314
374
  def self.make_endpoint(endpoint: nil, region: nil)
315
375
  return endpoint unless endpoint.nil?
@@ -324,7 +384,7 @@ module StatelyDB
324
384
 
325
385
  # Process a list response from begin_list or continue_list
326
386
  #
327
- # @param resp [Stately::Db::ListResponse] the response to process
387
+ # @param resp [::Stately::Db::ListResponse] the response to process
328
388
  # @return [(Array<StatelyDB::Item>, StatelyDB::Token)] the list of Items and the token
329
389
  # @api private
330
390
  # @!visibility private
@@ -350,7 +410,7 @@ module StatelyDB
350
410
 
351
411
  # Process a sync response from sync_list
352
412
  #
353
- # @param resp [Stately::Db::SyncResponse] the response to process
413
+ # @param resp [::Stately::Db::SyncResponse] the response to process
354
414
  # @return [StatelyDB::SyncResult] the result of the sync operation
355
415
  # @api private
356
416
  # @!visibility private
@@ -42,9 +42,9 @@ module StatelyDB
42
42
 
43
43
  # Initialize a new Transaction
44
44
  #
45
- # @param stub [Stately::Db::DatabaseService::Stub] a StatelyDB gRPC stub
45
+ # @param stub [::Stately::Db::DatabaseService::Stub] a StatelyDB gRPC stub
46
46
  # @param store_id [Integer] the StatelyDB Store to transact against
47
- # @param schema [StatelyDB::Schema] the schema to use for marshalling and unmarshalling Items
47
+ # @param schema [::StatelyDB::Schema] the schema to use for marshalling and unmarshalling Items
48
48
  def initialize(stub:, store_id:, schema:)
49
49
  @stub = stub
50
50
  @store_id = store_id
@@ -57,8 +57,8 @@ module StatelyDB
57
57
 
58
58
  # Send a request and wait for a response
59
59
  #
60
- # @param req [Stately::Db::TransactionRequest] the request to send
61
- # @return [Stately::Db::TransactionResponse] the response
60
+ # @param req [::Stately::Db::TransactionRequest] the request to send
61
+ # @return [::Stately::Db::TransactionResponse] the response
62
62
  # @api private
63
63
  # @!visibility private
64
64
  def request_response(req)
@@ -78,7 +78,7 @@ module StatelyDB
78
78
 
79
79
  # Send a request and don't wait for a response
80
80
  #
81
- # @param req [Stately::Db::TransactionRequest] the request to send
81
+ # @param req [::Stately::Db::TransactionRequest] the request to send
82
82
  # @return [void] nil
83
83
  # @api private
84
84
  # @!visibility private
@@ -91,9 +91,9 @@ module StatelyDB
91
91
  # Send a request and process all responses, until we receive a finished message. This is used for list operations.
92
92
  # Each response is processed by the block passed to this method, and the response for this method is a token.
93
93
  #
94
- # @param req [Stately::Db::TransactionRequest] the request to send
95
- # @yieldparam resp [Stately::Db::TransactionListResponse] the response
96
- # @return [Stately::Db::ListToken] the token
94
+ # @param req [::Stately::Db::TransactionRequest] the request to send
95
+ # @yieldparam resp [::Stately::Db::TransactionListResponse] the response
96
+ # @return [::Stately::Db::ListToken] the token
97
97
  # @example
98
98
  # request_list_responses(req) do |resp|
99
99
  # resp.result.items.each do |result|
@@ -153,7 +153,7 @@ module StatelyDB
153
153
  end
154
154
 
155
155
  # Abort a transaction. Abort is called implicitly if an exception is raised within the block passed to transaction.
156
- # @return [Stately::Db::TransactionResponse]
156
+ # @return [::Stately::Db::TransactionResponse]
157
157
  # @api private
158
158
  # @!visibility private
159
159
  def abort
@@ -333,7 +333,7 @@ module StatelyDB
333
333
  # @param limit [Integer] the maximum number of items to return
334
334
  # @param sort_property [String] the property to sort by
335
335
  # @param sort_direction [Symbol] the direction to sort by (:ascending or :descending)
336
- # @return [(Array<StatelyDB::Item>, Stately::Db::ListToken)] the list of Items and the token
336
+ # @return [(Array<StatelyDB::Item>, ::Stately::Db::ListToken)] the list of Items and the token
337
337
  #
338
338
  # Example:
339
339
  # client.data.transaction do |txn|
@@ -363,9 +363,9 @@ module StatelyDB
363
363
 
364
364
  # Continue listing Items from a StatelyDB Store using a token.
365
365
  #
366
- # @param token [Stately::Db::ListToken] the token to continue from
366
+ # @param token [::Stately::Db::ListToken] the token to continue from
367
367
  # @param continue_direction [Symbol] the direction to continue by (:forward or :backward)
368
- # @return [(Array<StatelyDB::Item>, Stately::Db::ListToken)] the list of Items and the token
368
+ # @return [(Array<StatelyDB::Item>, ::Stately::Db::ListToken)] the list of Items and the token
369
369
  #
370
370
  # Example:
371
371
  # client.data.transaction do |txn|
@@ -388,8 +388,8 @@ module StatelyDB
388
388
 
389
389
  # Processes a list response from begin_list or continue_list
390
390
  #
391
- # @param req [Stately::Db::TransactionRequest] the request to send
392
- # @return [(Array<StatelyDB::Item>, Stately::Db::ListToken)] the list of Items and the token
391
+ # @param req [::Stately::Db::TransactionRequest] the request to send
392
+ # @return [(Array<StatelyDB::Item>, ::Stately::Db::ListToken)] the list of Items and the token
393
393
  # @api private
394
394
  # @!visibility private
395
395
  def do_list_request_response(req)
@@ -405,7 +405,7 @@ module StatelyDB
405
405
  # We are using a oneof inside the TransactionRequest to determine the type of request. The ruby
406
406
  # generated code does not have a helper for the internal request type so we need to infer it.
407
407
  #
408
- # @param req [Stately::Db::TransactionRequest] the request
408
+ # @param req [::Stately::Db::TransactionRequest] the request
409
409
  # @return [Class] the response type
410
410
  # @api private
411
411
  # @!visibility private
@@ -422,7 +422,7 @@ module StatelyDB
422
422
  # We are using a oneof inside the TransactionResponse to determine the type of response. The ruby
423
423
  # generated code does not have a helper for the internal response type so we need to infer it.
424
424
  #
425
- # @param resp [Stately::Db::TransactionResponse] the response
425
+ # @param resp [::Stately::Db::TransactionResponse] the response
426
426
  # @return [Class] the response type
427
427
  # @api private
428
428
  # @!visibility private
@@ -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
@@ -387,7 +434,7 @@ module StatelyDB
387
434
  # _@param_ `region` — the region to connect to
388
435
  #
389
436
  # _@return_ — the constructed endpoint
390
- sig { params(endpoint: T.nilable(String), region: T.nilable(Region)).returns(String) }
437
+ sig { params(endpoint: T.nilable(String), region: T.nilable(String)).returns(String) }
391
438
  def self.make_endpoint(endpoint: nil, region: nil); end
392
439
 
393
440
  # Process a list response from begin_list or continue_list
@@ -395,7 +442,7 @@ module StatelyDB
395
442
  # _@param_ `resp` — the response to process
396
443
  #
397
444
  # _@return_ — the list of Items and the token
398
- sig { params(resp: Stately::Db::ListResponse).returns([T::Array[StatelyDB::Item], StatelyDB::Token]) }
445
+ sig { params(resp: ::Stately::Db::ListResponse).returns([T::Array[StatelyDB::Item], StatelyDB::Token]) }
399
446
  def process_list_response(resp); end
400
447
 
401
448
  # Process a sync response from sync_list
@@ -403,7 +450,7 @@ module StatelyDB
403
450
  # _@param_ `resp` — the response to process
404
451
  #
405
452
  # _@return_ — the result of the sync operation
406
- sig { params(resp: Stately::Db::SyncResponse).returns(StatelyDB::SyncResult) }
453
+ sig { params(resp: ::Stately::Db::SyncResponse).returns(StatelyDB::SyncResult) }
407
454
  def process_sync_response(resp); end
408
455
  end
409
456
 
@@ -474,7 +521,7 @@ module StatelyDB
474
521
  # _@param_ `endpoint` — The endpoint to connect to
475
522
  #
476
523
  # _@return_ — The new channel
477
- sig { params(endpoint: String).returns(GRPC::Core::Channel) }
524
+ sig { params(endpoint: String).returns(::GRPC::Core::Channel) }
478
525
  def self.new_channel(endpoint:); end
479
526
  end
480
527
 
@@ -500,7 +547,7 @@ module StatelyDB
500
547
  sig do
501
548
  params(
502
549
  request: Object,
503
- call: GRPC::ActiveCall,
550
+ call: ::GRPC::ActiveCall,
504
551
  method: Symbol,
505
552
  metadata: T::Hash[T.untyped, T.untyped]
506
553
  ).returns(Object)
@@ -521,7 +568,7 @@ module StatelyDB
521
568
  sig do
522
569
  params(
523
570
  requests: T::Enumerable[T.untyped],
524
- call: GRPC::ActiveCall,
571
+ call: ::GRPC::ActiveCall,
525
572
  method: Symbol,
526
573
  metadata: T::Hash[T.untyped, T.untyped]
527
574
  ).returns(T::Enumerator[T.untyped])
@@ -542,7 +589,7 @@ module StatelyDB
542
589
  sig do
543
590
  params(
544
591
  request: Object,
545
- call: GRPC::ActiveCall,
592
+ call: ::GRPC::ActiveCall,
546
593
  method: Symbol,
547
594
  metadata: T::Hash[T.untyped, T.untyped]
548
595
  ).returns(T::Enumerator[T.untyped])
@@ -563,7 +610,7 @@ module StatelyDB
563
610
  sig do
564
611
  params(
565
612
  requests: T::Enumerable[T.untyped],
566
- call: GRPC::ActiveCall,
613
+ call: ::GRPC::ActiveCall,
567
614
  method: Symbol,
568
615
  metadata: T::Hash[T.untyped, T.untyped]
569
616
  ).returns(T::Enumerator[T.untyped])
@@ -578,6 +625,11 @@ module StatelyDB
578
625
  end
579
626
 
580
627
  # Result from a token fetch operation
628
+ #
629
+ # @!attribute [r] token
630
+ # @return [String] The token string.
631
+ # @!attribute [r] expires_in_secs
632
+ # @return [Integer] The expiration time in seconds.
581
633
  class TokenResult
582
634
  # Create a new TokenResult
583
635
  #
@@ -587,12 +639,12 @@ module StatelyDB
587
639
  sig { params(token: String, expires_in_secs: Integer).void }
588
640
  def initialize(token:, expires_in_secs:); end
589
641
 
590
- # Returns the value of attribute token.
591
- sig { returns(T.untyped) }
642
+ # _@return_ The token string.
643
+ sig { returns(String) }
592
644
  attr_reader :token
593
645
 
594
- # Returns the value of attribute expires_in_secs.
595
- sig { returns(T.untyped) }
646
+ # _@return_ The expiration time in seconds.
647
+ sig { returns(Integer) }
596
648
  attr_reader :expires_in_secs
597
649
  end
598
650
 
@@ -606,7 +658,7 @@ module StatelyDB
606
658
  def fetch; end
607
659
 
608
660
  # Close the token provider and kill any background operations
609
- sig { returns(T.untyped) }
661
+ sig { void }
610
662
  def close; end
611
663
  end
612
664
 
@@ -635,7 +687,8 @@ module StatelyDB
635
687
  sig { returns(TokenResult) }
636
688
  def fetch; end
637
689
 
638
- sig { returns(T.untyped) }
690
+ # Close the token provider and kill any background operations
691
+ sig { void }
639
692
  def close; end
640
693
 
641
694
  # Check if an error is retryable
@@ -659,7 +712,7 @@ module StatelyDB
659
712
  def get_token(force: false); end
660
713
 
661
714
  # Close the token provider and kill any background operations
662
- sig { returns(T.untyped) }
715
+ sig { void }
663
716
  def close; end
664
717
  end
665
718
 
@@ -678,7 +731,7 @@ module StatelyDB
678
731
 
679
732
  # Close the token provider and kill any background operations
680
733
  # This just invokes the close method on the actor which should do the cleanup
681
- sig { returns(T.untyped) }
734
+ sig { void }
682
735
  def close; end
683
736
 
684
737
  # Get the current access token
@@ -700,11 +753,11 @@ module StatelyDB
700
753
 
701
754
  # Initialize the actor. This runs on the actor thread which means
702
755
  # we can dispatch async operations here.
703
- sig { returns(T.untyped) }
756
+ sig { void }
704
757
  def init; end
705
758
 
706
759
  # Close the token provider and kill any background operations
707
- sig { returns(T.untyped) }
760
+ sig { void }
708
761
  def close; end
709
762
 
710
763
  # Get the current access token
@@ -724,7 +777,7 @@ module StatelyDB
724
777
  # Refresh the access token
725
778
  #
726
779
  # _@return_ — A task that will resolve to the new access token
727
- sig { returns(Task) }
780
+ sig { returns(::Async::Task) }
728
781
  def refresh_token; end
729
782
 
730
783
  # Refresh the access token implementation
@@ -735,6 +788,11 @@ module StatelyDB
735
788
  end
736
789
 
737
790
  # Persistent state for the token provider
791
+ #
792
+ # @!attribute [r] token
793
+ # @return [String] The token string.
794
+ # @!attribute [r] expires_at_unix_secs
795
+ # @return [Integer] The expiration time in unix seconds.
738
796
  class TokenState
739
797
  # Create a new TokenState
740
798
  #
@@ -744,12 +802,12 @@ module StatelyDB
744
802
  sig { params(token: String, expires_at_unix_secs: Integer).void }
745
803
  def initialize(token:, expires_at_unix_secs:); end
746
804
 
747
- # Returns the value of attribute token.
748
- sig { returns(T.untyped) }
805
+ # _@return_ The token string.
806
+ sig { returns(String) }
749
807
  attr_reader :token
750
808
 
751
- # Returns the value of attribute expires_at_unix_secs.
752
- sig { returns(T.untyped) }
809
+ # _@return_ The expiration time in unix seconds.
810
+ sig { returns(Integer) }
753
811
  attr_reader :expires_at_unix_secs
754
812
  end
755
813
  end
@@ -805,7 +863,7 @@ module StatelyDB
805
863
  # _@param_ `store_id` — the StatelyDB Store to transact against
806
864
  #
807
865
  # _@param_ `schema` — the schema to use for marshalling and unmarshalling Items
808
- sig { params(stub: Stately::Db::DatabaseService::Stub, store_id: Integer, schema: StatelyDB::Schema).void }
866
+ sig { params(stub: ::Stately::Db::DatabaseService::Stub, store_id: Integer, schema: ::StatelyDB::Schema).void }
809
867
  def initialize(stub:, store_id:, schema:); end
810
868
 
811
869
  # Send a request and wait for a response
@@ -813,7 +871,7 @@ module StatelyDB
813
871
  # _@param_ `req` — the request to send
814
872
  #
815
873
  # _@return_ — the response
816
- sig { params(req: Stately::Db::TransactionRequest).returns(Stately::Db::TransactionResponse) }
874
+ sig { params(req: ::Stately::Db::TransactionRequest).returns(::Stately::Db::TransactionResponse) }
817
875
  def request_response(req); end
818
876
 
819
877
  # Send a request and don't wait for a response
@@ -821,7 +879,7 @@ module StatelyDB
821
879
  # _@param_ `req` — the request to send
822
880
  #
823
881
  # _@return_ — nil
824
- sig { params(req: Stately::Db::TransactionRequest).void }
882
+ sig { params(req: ::Stately::Db::TransactionRequest).void }
825
883
  def request_only(req); end
826
884
 
827
885
  # Send a request and process all responses, until we receive a finished message. This is used for list operations.
@@ -837,7 +895,7 @@ module StatelyDB
837
895
  # puts result.item.key_path
838
896
  # end
839
897
  # ```
840
- sig { params(req: Stately::Db::TransactionRequest, blk: T.proc.params(resp: Stately::Db::TransactionListResponse).void).returns(Stately::Db::ListToken) }
898
+ sig { params(req: ::Stately::Db::TransactionRequest, blk: T.proc.params(resp: ::Stately::Db::TransactionListResponse).void).returns(::Stately::Db::ListToken) }
841
899
  def request_list_responses(req, &blk); end
842
900
 
843
901
  # Begin a transaction. Begin is called implicitly when the block passed to transaction is called.
@@ -851,7 +909,7 @@ module StatelyDB
851
909
  def commit; end
852
910
 
853
911
  # Abort a transaction. Abort is called implicitly if an exception is raised within the block passed to transaction.
854
- sig { returns(Stately::Db::TransactionResponse) }
912
+ sig { returns(::Stately::Db::TransactionResponse) }
855
913
  def abort; end
856
914
 
857
915
  # Check if a transaction is open. A transaction is open if begin has been called and commit or abort has not been called.
@@ -974,7 +1032,7 @@ module StatelyDB
974
1032
  limit: Integer,
975
1033
  sort_property: T.nilable(String),
976
1034
  sort_direction: Symbol
977
- ).returns([T::Array[StatelyDB::Item], Stately::Db::ListToken])
1035
+ ).returns([T::Array[StatelyDB::Item], ::Stately::Db::ListToken])
978
1036
  end
979
1037
  def begin_list(prefix, limit: 100, sort_property: nil, sort_direction: :ascending); end
980
1038
 
@@ -991,7 +1049,7 @@ module StatelyDB
991
1049
  # _@param_ `continue_direction` — the direction to continue by (:forward or :backward)
992
1050
  #
993
1051
  # _@return_ — the list of Items and the token
994
- sig { params(token: Stately::Db::ListToken, continue_direction: Symbol).returns([T::Array[StatelyDB::Item], Stately::Db::ListToken]) }
1052
+ sig { params(token: ::Stately::Db::ListToken, continue_direction: Symbol).returns([T::Array[StatelyDB::Item], ::Stately::Db::ListToken]) }
995
1053
  def continue_list(token, continue_direction: :forward); end
996
1054
 
997
1055
  # Processes a list response from begin_list or continue_list
@@ -999,7 +1057,7 @@ module StatelyDB
999
1057
  # _@param_ `req` — the request to send
1000
1058
  #
1001
1059
  # _@return_ — the list of Items and the token
1002
- sig { params(req: Stately::Db::TransactionRequest).returns([T::Array[StatelyDB::Item], Stately::Db::ListToken]) }
1060
+ sig { params(req: ::Stately::Db::TransactionRequest).returns([T::Array[StatelyDB::Item], ::Stately::Db::ListToken]) }
1003
1061
  def do_list_request_response(req); end
1004
1062
 
1005
1063
  # We are using a oneof inside the TransactionRequest to determine the type of request. The ruby
@@ -1008,7 +1066,7 @@ module StatelyDB
1008
1066
  # _@param_ `req` — the request
1009
1067
  #
1010
1068
  # _@return_ — the response type
1011
- sig { params(req: Stately::Db::TransactionRequest).returns(Class) }
1069
+ sig { params(req: ::Stately::Db::TransactionRequest).returns(Class) }
1012
1070
  def infer_response_type_from_request(req); end
1013
1071
 
1014
1072
  # We are using a oneof inside the TransactionResponse to determine the type of response. The ruby
@@ -1017,7 +1075,7 @@ module StatelyDB
1017
1075
  # _@param_ `resp` — the response
1018
1076
  #
1019
1077
  # _@return_ — the response type
1020
- sig { params(resp: Stately::Db::TransactionResponse).returns(Class) }
1078
+ sig { params(resp: ::Stately::Db::TransactionResponse).returns(Class) }
1021
1079
  def infer_response_type_from_response(resp); end
1022
1080
 
1023
1081
  # Result represents the results of a transaction
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
@@ -337,21 +380,21 @@ module StatelyDB
337
380
  # _@param_ `region` — the region to connect to
338
381
  #
339
382
  # _@return_ — the constructed endpoint
340
- def self.make_endpoint: (?endpoint: String?, ?region: Region?) -> String
383
+ def self.make_endpoint: (?endpoint: String?, ?region: String?) -> String
341
384
 
342
385
  # Process a list response from begin_list or continue_list
343
386
  #
344
387
  # _@param_ `resp` — the response to process
345
388
  #
346
389
  # _@return_ — the list of Items and the token
347
- def process_list_response: (Stately::Db::ListResponse resp) -> [::Array[StatelyDB::Item], StatelyDB::Token]
390
+ def process_list_response: (::Stately::Db::ListResponse resp) -> [::Array[StatelyDB::Item], StatelyDB::Token]
348
391
 
349
392
  # Process a sync response from sync_list
350
393
  #
351
394
  # _@param_ `resp` — the response to process
352
395
  #
353
396
  # _@return_ — the result of the sync operation
354
- def process_sync_response: (Stately::Db::SyncResponse resp) -> StatelyDB::SyncResult
397
+ def process_sync_response: (::Stately::Db::SyncResponse resp) -> StatelyDB::SyncResult
355
398
  end
356
399
 
357
400
  # SyncResult represents the results of a sync operation.
@@ -413,7 +456,7 @@ module StatelyDB
413
456
  # _@param_ `endpoint` — The endpoint to connect to
414
457
  #
415
458
  # _@return_ — The new channel
416
- def self.new_channel: (endpoint: String) -> GRPC::Core::Channel
459
+ def self.new_channel: (endpoint: String) -> ::GRPC::Core::Channel
417
460
  end
418
461
 
419
462
  # A module for Stately Cloud auth code
@@ -436,7 +479,7 @@ module StatelyDB
436
479
  # _@return_ — The response object
437
480
  def request_response: (
438
481
  request: Object,
439
- call: GRPC::ActiveCall,
482
+ call: ::GRPC::ActiveCall,
440
483
  method: Symbol,
441
484
  metadata: ::Hash[untyped, untyped]
442
485
  ) -> Object
@@ -454,7 +497,7 @@ module StatelyDB
454
497
  # _@return_ — The response enumerator
455
498
  def client_streamer: (
456
499
  requests: ::Enumerable[untyped],
457
- call: GRPC::ActiveCall,
500
+ call: ::GRPC::ActiveCall,
458
501
  method: Symbol,
459
502
  metadata: ::Hash[untyped, untyped]
460
503
  ) -> ::Enumerator[untyped]
@@ -472,7 +515,7 @@ module StatelyDB
472
515
  # _@return_ — The response enumerator
473
516
  def server_streamer: (
474
517
  request: Object,
475
- call: GRPC::ActiveCall,
518
+ call: ::GRPC::ActiveCall,
476
519
  method: Symbol,
477
520
  metadata: ::Hash[untyped, untyped]
478
521
  ) -> ::Enumerator[untyped]
@@ -490,7 +533,7 @@ module StatelyDB
490
533
  # _@return_ — The response enumerator
491
534
  def bidi_streamer: (
492
535
  requests: ::Enumerable[untyped],
493
- call: GRPC::ActiveCall,
536
+ call: ::GRPC::ActiveCall,
494
537
  method: Symbol,
495
538
  metadata: ::Hash[untyped, untyped]
496
539
  ) -> ::Enumerator[untyped]
@@ -502,6 +545,11 @@ module StatelyDB
502
545
  end
503
546
 
504
547
  # Result from a token fetch operation
548
+ #
549
+ # @!attribute [r] token
550
+ # @return [String] The token string.
551
+ # @!attribute [r] expires_in_secs
552
+ # @return [Integer] The expiration time in seconds.
505
553
  class TokenResult
506
554
  # Create a new TokenResult
507
555
  #
@@ -510,11 +558,11 @@ module StatelyDB
510
558
  # _@param_ `expires_in_secs` — The number of seconds until the token expires
511
559
  def initialize: (token: String, expires_in_secs: Integer) -> void
512
560
 
513
- # Returns the value of attribute token.
514
- attr_reader token: untyped
561
+ # _@return_ The token string.
562
+ attr_reader token: String
515
563
 
516
- # Returns the value of attribute expires_in_secs.
517
- attr_reader expires_in_secs: untyped
564
+ # _@return_ The expiration time in seconds.
565
+ attr_reader expires_in_secs: Integer
518
566
  end
519
567
 
520
568
  # TokenFetcher is an abstract base class that should be extended
@@ -526,13 +574,13 @@ module StatelyDB
526
574
  def fetch: () -> TokenResult
527
575
 
528
576
  # Close the token provider and kill any background operations
529
- def close: () -> untyped
577
+ def close: () -> void
530
578
  end
531
579
 
532
580
  # StatelyAccessTokenFetcher is a TokenFetcher that fetches tokens from the StatelyDB API
533
581
  class StatelyAccessTokenFetcher < StatelyDB::Common::Auth::TokenFetcher
534
- NON_RETRYABLE_ERRORS: untyped
535
- RETRY_ATTEMPTS: untyped
582
+ NON_RETRYABLE_ERRORS: ::Array[::GRPC::Core::StatusCodes]
583
+ RETRY_ATTEMPTS: Integer
536
584
 
537
585
  # _@param_ `endpoint` — The endpoint of the OAuth server
538
586
  #
@@ -546,7 +594,8 @@ module StatelyDB
546
594
  # _@return_ — The fetched TokenResult
547
595
  def fetch: () -> TokenResult
548
596
 
549
- def close: () -> untyped
597
+ # Close the token provider and kill any background operations
598
+ def close: () -> void
550
599
 
551
600
  # Check if an error is retryable
552
601
  #
@@ -567,7 +616,7 @@ module StatelyDB
567
616
  def get_token: (?force: bool) -> String
568
617
 
569
618
  # Close the token provider and kill any background operations
570
- def close: () -> untyped
619
+ def close: () -> void
571
620
  end
572
621
 
573
622
  # AuthTokenProvider is an implementation of the TokenProvider abstract base class
@@ -584,7 +633,7 @@ module StatelyDB
584
633
 
585
634
  # Close the token provider and kill any background operations
586
635
  # This just invokes the close method on the actor which should do the cleanup
587
- def close: () -> untyped
636
+ def close: () -> void
588
637
 
589
638
  # Get the current access token
590
639
  #
@@ -603,10 +652,10 @@ module StatelyDB
603
652
 
604
653
  # Initialize the actor. This runs on the actor thread which means
605
654
  # we can dispatch async operations here.
606
- def init: () -> untyped
655
+ def init: () -> void
607
656
 
608
657
  # Close the token provider and kill any background operations
609
- def close: () -> untyped
658
+ def close: () -> void
610
659
 
611
660
  # Get the current access token
612
661
  #
@@ -623,7 +672,7 @@ module StatelyDB
623
672
  # Refresh the access token
624
673
  #
625
674
  # _@return_ — A task that will resolve to the new access token
626
- def refresh_token: () -> Task
675
+ def refresh_token: () -> ::Async::Task
627
676
 
628
677
  # Refresh the access token implementation
629
678
  #
@@ -632,6 +681,11 @@ module StatelyDB
632
681
  end
633
682
 
634
683
  # Persistent state for the token provider
684
+ #
685
+ # @!attribute [r] token
686
+ # @return [String] The token string.
687
+ # @!attribute [r] expires_at_unix_secs
688
+ # @return [Integer] The expiration time in unix seconds.
635
689
  class TokenState
636
690
  # Create a new TokenState
637
691
  #
@@ -640,11 +694,11 @@ module StatelyDB
640
694
  # _@param_ `expires_at_unix_secs` — The unix timestamp when the token expires
641
695
  def initialize: (token: String, expires_at_unix_secs: Integer) -> void
642
696
 
643
- # Returns the value of attribute token.
644
- attr_reader token: untyped
697
+ # _@return_ The token string.
698
+ attr_reader token: String
645
699
 
646
- # Returns the value of attribute expires_at_unix_secs.
647
- attr_reader expires_at_unix_secs: untyped
700
+ # _@return_ The expiration time in unix seconds.
701
+ attr_reader expires_at_unix_secs: Integer
648
702
  end
649
703
  end
650
704
  end
@@ -694,21 +748,21 @@ module StatelyDB
694
748
  # _@param_ `store_id` — the StatelyDB Store to transact against
695
749
  #
696
750
  # _@param_ `schema` — the schema to use for marshalling and unmarshalling Items
697
- def initialize: (stub: Stately::Db::DatabaseService::Stub, store_id: Integer, schema: StatelyDB::Schema) -> void
751
+ def initialize: (stub: ::Stately::Db::DatabaseService::Stub, store_id: Integer, schema: ::StatelyDB::Schema) -> void
698
752
 
699
753
  # Send a request and wait for a response
700
754
  #
701
755
  # _@param_ `req` — the request to send
702
756
  #
703
757
  # _@return_ — the response
704
- def request_response: (Stately::Db::TransactionRequest req) -> Stately::Db::TransactionResponse
758
+ def request_response: (::Stately::Db::TransactionRequest req) -> ::Stately::Db::TransactionResponse
705
759
 
706
760
  # Send a request and don't wait for a response
707
761
  #
708
762
  # _@param_ `req` — the request to send
709
763
  #
710
764
  # _@return_ — nil
711
- def request_only: (Stately::Db::TransactionRequest req) -> void
765
+ def request_only: (::Stately::Db::TransactionRequest req) -> void
712
766
 
713
767
  # Send a request and process all responses, until we receive a finished message. This is used for list operations.
714
768
  # Each response is processed by the block passed to this method, and the response for this method is a token.
@@ -723,7 +777,7 @@ module StatelyDB
723
777
  # puts result.item.key_path
724
778
  # end
725
779
  # ```
726
- def request_list_responses: (Stately::Db::TransactionRequest req) ?{ (Stately::Db::TransactionListResponse resp) -> void } -> Stately::Db::ListToken
780
+ def request_list_responses: (::Stately::Db::TransactionRequest req) ?{ (::Stately::Db::TransactionListResponse resp) -> void } -> ::Stately::Db::ListToken
727
781
 
728
782
  # Begin a transaction. Begin is called implicitly when the block passed to transaction is called.
729
783
  #
@@ -734,7 +788,7 @@ module StatelyDB
734
788
  def commit: () -> StatelyDB::Transaction::Transaction::Result
735
789
 
736
790
  # Abort a transaction. Abort is called implicitly if an exception is raised within the block passed to transaction.
737
- def abort: () -> Stately::Db::TransactionResponse
791
+ def abort: () -> ::Stately::Db::TransactionResponse
738
792
 
739
793
  # Check if a transaction is open. A transaction is open if begin has been called and commit or abort has not been called.
740
794
  #
@@ -849,7 +903,7 @@ module StatelyDB
849
903
  ?limit: Integer,
850
904
  ?sort_property: String?,
851
905
  ?sort_direction: Symbol
852
- ) -> [::Array[StatelyDB::Item], Stately::Db::ListToken]
906
+ ) -> [::Array[StatelyDB::Item], ::Stately::Db::ListToken]
853
907
 
854
908
  # Continue listing Items from a StatelyDB Store using a token.
855
909
  #
@@ -864,14 +918,14 @@ module StatelyDB
864
918
  # _@param_ `continue_direction` — the direction to continue by (:forward or :backward)
865
919
  #
866
920
  # _@return_ — the list of Items and the token
867
- def continue_list: (Stately::Db::ListToken token, ?continue_direction: Symbol) -> [::Array[StatelyDB::Item], Stately::Db::ListToken]
921
+ def continue_list: (::Stately::Db::ListToken token, ?continue_direction: Symbol) -> [::Array[StatelyDB::Item], ::Stately::Db::ListToken]
868
922
 
869
923
  # Processes a list response from begin_list or continue_list
870
924
  #
871
925
  # _@param_ `req` — the request to send
872
926
  #
873
927
  # _@return_ — the list of Items and the token
874
- def do_list_request_response: (Stately::Db::TransactionRequest req) -> [::Array[StatelyDB::Item], Stately::Db::ListToken]
928
+ def do_list_request_response: (::Stately::Db::TransactionRequest req) -> [::Array[StatelyDB::Item], ::Stately::Db::ListToken]
875
929
 
876
930
  # We are using a oneof inside the TransactionRequest to determine the type of request. The ruby
877
931
  # generated code does not have a helper for the internal request type so we need to infer it.
@@ -879,7 +933,7 @@ module StatelyDB
879
933
  # _@param_ `req` — the request
880
934
  #
881
935
  # _@return_ — the response type
882
- def infer_response_type_from_request: (Stately::Db::TransactionRequest req) -> Class
936
+ def infer_response_type_from_request: (::Stately::Db::TransactionRequest req) -> Class
883
937
 
884
938
  # We are using a oneof inside the TransactionResponse to determine the type of response. The ruby
885
939
  # generated code does not have a helper for the internal response type so we need to infer it.
@@ -887,7 +941,7 @@ module StatelyDB
887
941
  # _@param_ `resp` — the response
888
942
  #
889
943
  # _@return_ — the response type
890
- def infer_response_type_from_response: (Stately::Db::TransactionResponse resp) -> Class
944
+ def infer_response_type_from_response: (::Stately::Db::TransactionResponse resp) -> Class
891
945
 
892
946
  # Result represents the results of a transaction
893
947
  #
@@ -993,12 +1047,12 @@ module Stately
993
1047
  end
994
1048
 
995
1049
  module StatelyCode
996
- CACHED_SCHEMA_TOO_OLD: untyped
997
- CONCURRENT_MODIFICATION: untyped
998
- CONDITIONAL_CHECK_FAILED: untyped
999
- ITEM_REUSED_WITH_DIFFERENT_KEY_PATH: untyped
1000
- NON_RECOVERABLE_TRANSACTION: untyped
1001
- STORE_IN_USE: untyped
1002
- STORE_REQUEST_LIMIT_EXCEEDED: untyped
1003
- STORE_THROUGHPUT_EXCEEDED: untyped
1050
+ CACHED_SCHEMA_TOO_OLD: String
1051
+ CONCURRENT_MODIFICATION: String
1052
+ CONDITIONAL_CHECK_FAILED: String
1053
+ ITEM_REUSED_WITH_DIFFERENT_KEY_PATH: String
1054
+ NON_RECOVERABLE_TRANSACTION: String
1055
+ STORE_IN_USE: String
1056
+ STORE_REQUEST_LIMIT_EXCEEDED: String
1057
+ STORE_THROUGHPUT_EXCEEDED: String
1004
1058
  end
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.18.3
4
+ version: 0.20.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-09 00:00:00.000000000 Z
11
+ date: 2025-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -107,8 +107,7 @@ files:
107
107
  - lib/transaction/queue.rb
108
108
  - lib/transaction/transaction.rb
109
109
  - lib/uuid.rb
110
- - sig/grpc.rbs
111
- - sig/statelydb.rbi
110
+ - rbi/statelydb.rbi
112
111
  - sig/statelydb.rbs
113
112
  homepage: https://docs.stately.cloud/clients/ruby/
114
113
  licenses:
data/sig/grpc.rbs DELETED
@@ -1,80 +0,0 @@
1
- module GRPC
2
- class ActiveCall
3
- end
4
-
5
- class Interceptor
6
- end
7
- class ClientInterceptor < Interceptor
8
- # gRPC client unary interceptor
9
- #
10
- # _@param_ `request` — The request object
11
- #
12
- # _@param_ `call` — The active call object
13
- #
14
- # _@param_ `method` — The method being called
15
- #
16
- # _@param_ `metadata` — The metadata hash
17
- #
18
- # _@return_ — The response object
19
- def request_response: (
20
- request: Object,
21
- call: GRPC::ActiveCall,
22
- method: Symbol,
23
- metadata: ::Hash[untyped, untyped]
24
- ) -> Object
25
-
26
- # gRPC client streaming interceptor
27
- #
28
- # _@param_ `requests` — The list of requests
29
- #
30
- # _@param_ `call` — The active call object
31
- #
32
- # _@param_ `method` — The method being called
33
- #
34
- # _@param_ `metadata` — The metadata hash
35
- #
36
- # _@return_ — The response enumerator
37
- def client_streamer: (
38
- requests: ::Enumerable[untyped],
39
- call: GRPC::ActiveCall,
40
- method: Symbol,
41
- metadata: ::Hash[untyped, untyped]
42
- ) -> ::Enumerator[untyped]
43
-
44
- # gRPC server streaming interceptor
45
- #
46
- # _@param_ `request` — The request object
47
- #
48
- # _@param_ `call` — The active call object
49
- #
50
- # _@param_ `method` — The method being called
51
- #
52
- # _@param_ `metadata` — The metadata hash
53
- #
54
- # _@return_ — The response enumerator
55
- def server_streamer: (
56
- request: Object,
57
- call: GRPC::ActiveCall,
58
- method: Symbol,
59
- metadata: ::Hash[untyped, untyped]
60
- ) -> ::Enumerator[untyped]
61
-
62
- # gRPC bidirectional streaming interceptor
63
- #
64
- # _@param_ `requests` — The list of requests
65
- #
66
- # _@param_ `call` — The active call object
67
- #
68
- # _@param_ `method` — The method being called
69
- #
70
- # _@param_ `metadata` — The metadata hash
71
- #
72
- # _@return_ — The response enumerator
73
- def bidi_streamer: (
74
- requests: ::Enumerable[untyped],
75
- call: GRPC::ActiveCall,
76
- method: Symbol,
77
- metadata: ::Hash[untyped, untyped]
78
- ) -> ::Enumerator[untyped]
79
- end
80
- end