statelydb 0.8.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/api/db/continue_list_pb.rb +1 -1
- data/lib/api/db/list_token_pb.rb +1 -1
- data/lib/api/db/sync_list_pb.rb +1 -1
- data/lib/stately_codes.rb +7 -0
- data/lib/statelydb.rb +8 -4
- data/lib/token.rb +8 -1
- data/lib/transaction/transaction.rb +2 -1
- 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: '039f735f87b49d58192914fdb0ff62cafce5d059980628671854026864248223'
|
4
|
+
data.tar.gz: 0ee06ba443aae408cb3a25d98041560a48f1ac6ddfd2ef9f25f13b62c21ee34c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83ef6dd4a7fc6c98d3668ac42544d568105d78421a7c2bc8d0d56e588b4a39eac823473f2e8e797bb339c6c04459bfc39a07457cadf21590d5d90036ff808e61
|
7
|
+
data.tar.gz: ff67b6ef6513ebe45df1ad0c12ca8d1906cee183e830a3d303d4cd6eda47e2bbf6a22634a55057ece224b13f473df23ad428f324c52806ab7904d76cb47ef159
|
@@ -5,7 +5,7 @@
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
7
|
|
8
|
-
descriptor_data = "\n\x16\x64\x62/continue_list.proto\x12\nstately.db\"
|
8
|
+
descriptor_data = "\n\x16\x64\x62/continue_list.proto\x12\nstately.db\"\xa1\x01\n\x13\x43ontinueListRequest\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12?\n\tdirection\x18\x02 \x01(\x0e\x32!.stately.db.ContinueListDirectionR\tdirection\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId*N\n\x15\x43ontinueListDirection\x12\x19\n\x15\x43ONTINUE_LIST_FORWARD\x10\x00\x12\x1a\n\x16\x43ONTINUE_LIST_BACKWARD\x10\x01\x42l\n\x0e\x63om.stately.dbB\x11\x43ontinueListProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
9
9
|
|
10
10
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
data/lib/api/db/list_token_pb.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
7
|
|
8
|
-
descriptor_data = "\n\x13\x64\x62/list_token.proto\x12\nstately.db\"
|
8
|
+
descriptor_data = "\n\x13\x64\x62/list_token.proto\x12\nstately.db\"\x94\x01\n\tListToken\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12!\n\x0c\x63\x61n_continue\x18\x02 \x01(\x08R\x0b\x63\x61nContinue\x12\x19\n\x08\x63\x61n_sync\x18\x03 \x01(\x08R\x07\x63\x61nSync\x12*\n\x11schema_version_id\x18\x04 \x01(\rR\x0fschemaVersionIdBi\n\x0e\x63om.stately.dbB\x0eListTokenProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
9
9
|
|
10
10
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
data/lib/api/db/sync_list_pb.rb
CHANGED
@@ -8,7 +8,7 @@ require 'db/item_pb'
|
|
8
8
|
require 'db/list_pb'
|
9
9
|
|
10
10
|
|
11
|
-
descriptor_data = "\n\x12\x64\x62/sync_list.proto\x12\nstately.db\x1a\rdb/item.proto\x1a\rdb/list.proto\"
|
11
|
+
descriptor_data = "\n\x12\x64\x62/sync_list.proto\x12\nstately.db\x1a\rdb/item.proto\x1a\rdb/list.proto\"\\\n\x0fSyncListRequest\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\"\xc8\x01\n\x10SyncListResponse\x12\x31\n\x05reset\x18\x01 \x01(\x0b\x32\x19.stately.db.SyncListResetH\x00R\x05reset\x12=\n\x06result\x18\x02 \x01(\x0b\x32#.stately.db.SyncListPartialResponseH\x00R\x06result\x12\x36\n\x08\x66inished\x18\x03 \x01(\x0b\x32\x18.stately.db.ListFinishedH\x00R\x08\x66inishedB\n\n\x08response\"\x0f\n\rSyncListReset\"\xdf\x01\n\x17SyncListPartialResponse\x12\x35\n\rchanged_items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x0c\x63hangedItems\x12<\n\rdeleted_items\x18\x02 \x03(\x0b\x32\x17.stately.db.DeletedItemR\x0c\x64\x65letedItems\x12O\n%updated_item_keys_outside_list_window\x18\x03 \x03(\tR updatedItemKeysOutsideListWindow\"(\n\x0b\x44\x65letedItem\x12\x19\n\x08key_path\x18\x01 \x01(\tR\x07keyPathBh\n\x0e\x63om.stately.dbB\rSyncListProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
12
12
|
|
13
13
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
14
14
|
pool.add_serialized_file(descriptor_data)
|
data/lib/stately_codes.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module StatelyCode
|
4
|
+
# CachedSchemaTooOld indicates that schema was recently updated and internal
|
5
|
+
# caches have not yet caught up. If this problem persists, please contact support.
|
6
|
+
#
|
7
|
+
# - Retryable
|
8
|
+
# This error is immediately retryable.
|
9
|
+
CACHED_SCHEMA_TOO_OLD = "CachedSchemaTooOld"
|
10
|
+
|
4
11
|
# ConcurrentModification indicates the current transaction was aborted
|
5
12
|
# because of a non-serializable interaction with another transaction was
|
6
13
|
# detected, a stale read was detected, or because attempts to resolve an
|
data/lib/statelydb.rb
CHANGED
@@ -142,7 +142,8 @@ module StatelyDB
|
|
142
142
|
# client.data.continue_list(token)
|
143
143
|
def continue_list(token)
|
144
144
|
req = Stately::Db::ContinueListRequest.new(
|
145
|
-
token_data: token.token_data
|
145
|
+
token_data: token.token_data,
|
146
|
+
schema_version_id: @schema::SCHEMA_VERSION_ID
|
146
147
|
)
|
147
148
|
resp = @stub.continue_list(req)
|
148
149
|
process_list_response(resp)
|
@@ -158,7 +159,8 @@ module StatelyDB
|
|
158
159
|
# client.data.sync_list(token)
|
159
160
|
def sync_list(token)
|
160
161
|
req = Stately::Db::SyncListRequest.new(
|
161
|
-
token_data: token.token_data
|
162
|
+
token_data: token.token_data,
|
163
|
+
schema_version_id: @schema::SCHEMA_VERSION_ID
|
162
164
|
)
|
163
165
|
resp = @stub.sync_list(req)
|
164
166
|
process_sync_response(resp)
|
@@ -296,7 +298,8 @@ module StatelyDB
|
|
296
298
|
raw_token = r.finished.token
|
297
299
|
token = StatelyDB::Token.new(token_data: raw_token.token_data,
|
298
300
|
can_continue: raw_token.can_continue,
|
299
|
-
can_sync: raw_token.can_sync
|
301
|
+
can_sync: raw_token.can_sync,
|
302
|
+
schema_version_id: raw_token.schema_version_id)
|
300
303
|
end
|
301
304
|
end
|
302
305
|
[items, token]
|
@@ -332,7 +335,8 @@ module StatelyDB
|
|
332
335
|
raw_token = r.finished.token
|
333
336
|
token = StatelyDB::Token.new(token_data: raw_token.token_data,
|
334
337
|
can_continue: raw_token.can_continue,
|
335
|
-
can_sync: raw_token.can_sync
|
338
|
+
can_sync: raw_token.can_sync,
|
339
|
+
schema_version_id: raw_token.schema_version_id)
|
336
340
|
end
|
337
341
|
end
|
338
342
|
SyncResult.new(changed_items:, deleted_item_paths:, updated_outside_list_window_paths:, is_reset:, token:)
|
data/lib/token.rb
CHANGED
@@ -13,10 +13,12 @@ module StatelyDB
|
|
13
13
|
# @param [String] token_data
|
14
14
|
# @param [Boolean] can_continue
|
15
15
|
# @param [Boolean] can_sync
|
16
|
-
|
16
|
+
# @param [Integer] schema_version_id
|
17
|
+
def initialize(token_data:, can_continue:, can_sync:, schema_version_id:)
|
17
18
|
@token_data = token_data
|
18
19
|
@can_continue = can_continue
|
19
20
|
@can_sync = can_sync
|
21
|
+
@schema_version_id = schema_version_id
|
20
22
|
end
|
21
23
|
|
22
24
|
# Returns true if the list operation can be continued, otherwise false.
|
@@ -30,5 +32,10 @@ module StatelyDB
|
|
30
32
|
def can_sync?
|
31
33
|
!!@can_sync
|
32
34
|
end
|
35
|
+
|
36
|
+
# Returns the schema version ID associated with the token.
|
37
|
+
def schema_version_id
|
38
|
+
!!@schema_version_id
|
39
|
+
end
|
33
40
|
end
|
34
41
|
end
|
@@ -110,7 +110,8 @@ module StatelyDB
|
|
110
110
|
raw_token = resp.finished.token
|
111
111
|
token = StatelyDB::Token.new(token_data: raw_token.token_data,
|
112
112
|
can_continue: raw_token.can_continue,
|
113
|
-
can_sync: raw_token.can_sync
|
113
|
+
can_sync: raw_token.can_sync,
|
114
|
+
schema_version_id: raw_token.schema_version_id)
|
114
115
|
break
|
115
116
|
end
|
116
117
|
yield resp
|
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.10.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: 2024-
|
11
|
+
date: 2024-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|