statelydb 0.12.1 → 0.13.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/get_pb.rb +1 -1
- data/lib/api/db/list_pb.rb +3 -3
- data/lib/api/db/put_pb.rb +1 -1
- data/lib/api/db/service_pb.rb +8 -8
- data/lib/api/db/service_services_pb.rb +1 -1
- data/lib/api/db/sync_list_pb.rb +2 -2
- data/lib/api/db/transaction_pb.rb +7 -7
- data/lib/common/auth/auth0_token_provider.rb +3 -3
- data/lib/error.rb +0 -5
- data/lib/statelydb.rb +1 -5
- data/lib/token.rb +2 -3
- data/lib/transaction/transaction.rb +1 -1
- data/sig/grpc.rbs +80 -0
- data/sig/statelydb.rbi +1085 -0
- data/sig/statelydb.rbs +952 -0
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1518fe47ef69d7e171862c88f5b8a9425116dc1390623724dc95e285e960b728
|
4
|
+
data.tar.gz: f5e9faad6e851892a695a47590e7430908e419b44c2f94a60087fec4c316c808
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acc4be2621242c08236efdf8e1f9fa48090070c3c4ad12583481bc2a2df4ee5638fbb665059a0138a7bf53270bed8d6bf0f5290843dd5d488b71274f2a3284b8
|
7
|
+
data.tar.gz: ddccab6882a70b7eab33c56893fd9cae614ee67c5343b0953f7af33d3fe487418eb00c3300d3a24ae6e14df88f5cf49609b9e1f4a966db10d646ab184c00a685
|
data/lib/api/db/get_pb.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
|
-
require 'db/item_pb'
|
7
|
+
require 'api/db/item_pb'
|
8
8
|
|
9
9
|
|
10
10
|
descriptor_data = "\n\x0c\x64\x62/get.proto\x12\nstately.db\x1a\rdb/item.proto\"\xa3\x01\n\nGetRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12\'\n\x04gets\x18\x02 \x03(\x0b\x32\x13.stately.db.GetItemR\x04gets\x12\x1f\n\x0b\x61llow_stale\x18\x03 \x01(\x08R\nallowStale\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionIdJ\x04\x08\x04\x10\x05\"$\n\x07GetItem\x12\x19\n\x08key_path\x18\x01 \x01(\tR\x07keyPath\"5\n\x0bGetResponse\x12&\n\x05items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x05itemsBc\n\x0e\x63om.stately.dbB\x08GetProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
data/lib/api/db/list_pb.rb
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
|
-
require 'db/item_pb'
|
8
|
-
require 'db/item_property_pb'
|
9
|
-
require 'db/list_token_pb'
|
7
|
+
require 'api/db/item_pb'
|
8
|
+
require 'api/db/item_property_pb'
|
9
|
+
require 'api/db/list_token_pb'
|
10
10
|
|
11
11
|
|
12
12
|
descriptor_data = "\n\rdb/list.proto\x12\nstately.db\x1a\rdb/item.proto\x1a\x16\x64\x62/item_property.proto\x1a\x13\x64\x62/list_token.proto\"\xbd\x02\n\x10\x42\x65ginListRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12&\n\x0fkey_path_prefix\x18\x02 \x01(\tR\rkeyPathPrefix\x12\x14\n\x05limit\x18\x03 \x01(\rR\x05limit\x12\x1f\n\x0b\x61llow_stale\x18\x04 \x01(\x08R\nallowStale\x12\x41\n\rsort_property\x18\x05 \x01(\x0e\x32\x1c.stately.db.SortablePropertyR\x0csortProperty\x12@\n\x0esort_direction\x18\x06 \x01(\x0e\x32\x19.stately.db.SortDirectionR\rsortDirection\x12*\n\x11schema_version_id\x18\x07 \x01(\rR\x0fschemaVersionId\"\x8b\x01\n\x0cListResponse\x12\x37\n\x06result\x18\x01 \x01(\x0b\x32\x1d.stately.db.ListPartialResultH\x00R\x06result\x12\x36\n\x08\x66inished\x18\x02 \x01(\x0b\x32\x18.stately.db.ListFinishedH\x00R\x08\x66inishedB\n\n\x08response\";\n\x11ListPartialResult\x12&\n\x05items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x05items\";\n\x0cListFinished\x12+\n\x05token\x18\x01 \x01(\x0b\x32\x15.stately.db.ListTokenR\x05token*8\n\rSortDirection\x12\x12\n\x0eSORT_ASCENDING\x10\x00\x12\x13\n\x0fSORT_DESCENDING\x10\x01\x42\x64\n\x0e\x63om.stately.dbB\tListProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
data/lib/api/db/put_pb.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
|
-
require 'db/item_pb'
|
7
|
+
require 'api/db/item_pb'
|
8
8
|
|
9
9
|
|
10
10
|
descriptor_data = "\n\x0c\x64\x62/put.proto\x12\nstately.db\x1a\rdb/item.proto\"|\n\nPutRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12\'\n\x04puts\x18\x02 \x03(\x0b\x32\x13.stately.db.PutItemR\x04puts\x12*\n\x11schema_version_id\x18\x03 \x01(\rR\x0fschemaVersionId\"U\n\x07PutItem\x12$\n\x04item\x18\x01 \x01(\x0b\x32\x10.stately.db.ItemR\x04item\x12$\n\x0emust_not_exist\x18\x03 \x01(\x08R\x0cmustNotExist\"5\n\x0bPutResponse\x12&\n\x05items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x05itemsBc\n\x0e\x63om.stately.dbB\x08PutProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
data/lib/api/db/service_pb.rb
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
|
-
require 'db/continue_list_pb'
|
8
|
-
require 'db/delete_pb'
|
9
|
-
require 'db/get_pb'
|
10
|
-
require 'db/list_pb'
|
11
|
-
require 'db/put_pb'
|
12
|
-
require 'db/scan_root_paths_pb'
|
13
|
-
require 'db/sync_list_pb'
|
14
|
-
require 'db/transaction_pb'
|
7
|
+
require 'api/db/continue_list_pb'
|
8
|
+
require 'api/db/delete_pb'
|
9
|
+
require 'api/db/get_pb'
|
10
|
+
require 'api/db/list_pb'
|
11
|
+
require 'api/db/put_pb'
|
12
|
+
require 'api/db/scan_root_paths_pb'
|
13
|
+
require 'api/db/sync_list_pb'
|
14
|
+
require 'api/db/transaction_pb'
|
15
15
|
|
16
16
|
|
17
17
|
descriptor_data = "\n\x10\x64\x62/service.proto\x12\nstately.db\x1a\x16\x64\x62/continue_list.proto\x1a\x0f\x64\x62/delete.proto\x1a\x0c\x64\x62/get.proto\x1a\rdb/list.proto\x1a\x0c\x64\x62/put.proto\x1a\x18\x64\x62/scan_root_paths.proto\x1a\x12\x64\x62/sync_list.proto\x1a\x14\x64\x62/transaction.proto2\xee\x04\n\x0f\x44\x61tabaseService\x12;\n\x03Put\x12\x16.stately.db.PutRequest\x1a\x17.stately.db.PutResponse\"\x03\x90\x02\x02\x12;\n\x03Get\x12\x16.stately.db.GetRequest\x1a\x17.stately.db.GetResponse\"\x03\x90\x02\x01\x12\x44\n\x06\x44\x65lete\x12\x19.stately.db.DeleteRequest\x1a\x1a.stately.db.DeleteResponse\"\x03\x90\x02\x02\x12J\n\tBeginList\x12\x1c.stately.db.BeginListRequest\x1a\x18.stately.db.ListResponse\"\x03\x90\x02\x01\x30\x01\x12P\n\x0c\x43ontinueList\x12\x1f.stately.db.ContinueListRequest\x1a\x18.stately.db.ListResponse\"\x03\x90\x02\x01\x30\x01\x12L\n\x08SyncList\x12\x1b.stately.db.SyncListRequest\x1a\x1c.stately.db.SyncListResponse\"\x03\x90\x02\x01\x30\x01\x12T\n\x0bTransaction\x12\x1e.stately.db.TransactionRequest\x1a\x1f.stately.db.TransactionResponse\"\x00(\x01\x30\x01\x12Y\n\rScanRootPaths\x12 .stately.db.ScanRootPathsRequest\x1a!.stately.db.ScanRootPathsResponse\"\x03\x90\x02\x01\x42g\n\x0e\x63om.stately.dbB\x0cServiceProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
data/lib/api/db/sync_list_pb.rb
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
|
-
require 'db/item_pb'
|
8
|
-
require 'db/list_pb'
|
7
|
+
require 'api/db/item_pb'
|
8
|
+
require 'api/db/list_pb'
|
9
9
|
|
10
10
|
|
11
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"
|
@@ -4,13 +4,13 @@
|
|
4
4
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
|
-
require 'db/continue_list_pb'
|
8
|
-
require 'db/delete_pb'
|
9
|
-
require 'db/get_pb'
|
10
|
-
require 'db/item_pb'
|
11
|
-
require 'db/item_property_pb'
|
12
|
-
require 'db/list_pb'
|
13
|
-
require 'db/put_pb'
|
7
|
+
require 'api/db/continue_list_pb'
|
8
|
+
require 'api/db/delete_pb'
|
9
|
+
require 'api/db/get_pb'
|
10
|
+
require 'api/db/item_pb'
|
11
|
+
require 'api/db/item_property_pb'
|
12
|
+
require 'api/db/list_pb'
|
13
|
+
require 'api/db/put_pb'
|
14
14
|
require 'google/protobuf/empty_pb'
|
15
15
|
|
16
16
|
|
@@ -115,7 +115,7 @@ module StatelyDB
|
|
115
115
|
end
|
116
116
|
|
117
117
|
# Refresh the access token
|
118
|
-
# @return [
|
118
|
+
# @return [Task] A task that will resolve to the new access token
|
119
119
|
def refresh_token
|
120
120
|
Async do
|
121
121
|
# we use an Async::Condition to dedupe multiple requests here
|
@@ -125,7 +125,7 @@ module StatelyDB
|
|
125
125
|
if @pending_refresh.nil?
|
126
126
|
begin
|
127
127
|
@pending_refresh = Async::Condition.new
|
128
|
-
new_access_token = refresh_token_impl
|
128
|
+
new_access_token = refresh_token_impl
|
129
129
|
# now broadcast the new token to any waiters
|
130
130
|
@pending_refresh.signal(new_access_token)
|
131
131
|
new_access_token
|
@@ -150,7 +150,7 @@ module StatelyDB
|
|
150
150
|
# Refresh the access token implementation
|
151
151
|
# @return [String] The new access token
|
152
152
|
def refresh_token_impl
|
153
|
-
|
153
|
+
Sync do
|
154
154
|
resp_data = make_auth0_request
|
155
155
|
|
156
156
|
new_access_token = resp_data["access_token"]
|
data/lib/error.rb
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Add the pb dir to the LOAD_PATH because generated proto imports are not relative and
|
4
|
-
# we don't want the protos polluting the main namespace.
|
5
|
-
# Tracking here: https://github.com/grpc/grpc/issues/6164
|
6
|
-
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/api"
|
7
|
-
|
8
3
|
require "api/errors/error_details_pb"
|
9
4
|
|
10
5
|
module StatelyDB
|
data/lib/statelydb.rb
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Add the pb dir to the LOAD_PATH because generated proto imports are not relative and
|
4
|
-
# we don't want the protos polluting the main namespace.
|
5
|
-
# Tracking here: https://github.com/grpc/grpc/issues/6164
|
6
|
-
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/api"
|
7
|
-
|
8
3
|
require "api/db/service_services_pb"
|
9
4
|
require "common/auth/auth0_token_provider"
|
10
5
|
require "common/auth/interceptor"
|
@@ -63,6 +58,7 @@ module StatelyDB
|
|
63
58
|
@allow_stale = false
|
64
59
|
end
|
65
60
|
|
61
|
+
# @return [void] nil
|
66
62
|
def close
|
67
63
|
@channel&.close
|
68
64
|
@token_provider&.close
|
data/lib/token.rb
CHANGED
@@ -254,7 +254,7 @@ module StatelyDB
|
|
254
254
|
#
|
255
255
|
# @param items [StatelyDB::Item, Array<StatelyDB::Item>] the items to store. Max
|
256
256
|
# 50 items.
|
257
|
-
# @return [Array<StatelyDB::UUID, String, Integer,
|
257
|
+
# @return [Array<StatelyDB::UUID, String, Integer, NilClass>] the ids of the items
|
258
258
|
#
|
259
259
|
# @example
|
260
260
|
# results = client.data.transaction do |txn|
|
data/sig/grpc.rbs
ADDED
@@ -0,0 +1,80 @@
|
|
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
|