statelydb 0.25.0 → 0.28.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/README.md +1 -6
- data/lib/api/auth/get_auth_token_pb.rb +1 -1
- data/lib/api/auth/service_pb.rb +1 -1
- data/lib/api/db/continue_list_pb.rb +1 -1
- data/lib/api/db/continue_scan_pb.rb +1 -1
- data/lib/api/db/delete_pb.rb +1 -1
- data/lib/api/db/get_pb.rb +1 -1
- data/lib/api/db/item_pb.rb +1 -1
- data/lib/api/db/item_property_pb.rb +1 -1
- data/lib/api/db/list_filters_pb.rb +17 -0
- data/lib/api/db/list_pb.rb +5 -2
- data/lib/api/db/list_token_pb.rb +1 -1
- data/lib/api/db/put_pb.rb +1 -1
- data/lib/api/db/scan_pb.rb +4 -3
- data/lib/api/db/service_pb.rb +2 -3
- data/lib/api/db/service_services_pb.rb +0 -6
- data/lib/api/db/sync_list_pb.rb +1 -1
- data/lib/api/db/transaction_pb.rb +3 -2
- data/lib/api/errors/error_details_pb.rb +1 -1
- data/lib/common/auth/auth_token_provider.rb +25 -7
- data/lib/common/auth/interceptor.rb +3 -2
- data/lib/common/auth/token_provider.rb +7 -0
- data/lib/statelydb.rb +6 -4
- data/lib/uuid.rb +1 -1
- data/lib/version.rb +5 -0
- data/rbi/db/delete_pb.rbi +3 -3
- data/rbi/db/get_pb.rbi +15 -21
- data/rbi/db/list_filters_pb.rbi +69 -0
- data/rbi/db/list_pb.rbi +275 -20
- data/rbi/db/put_pb.rbi +15 -21
- data/rbi/db/scan_pb.rbi +12 -81
- data/rbi/db/service_services_pb.rbi +0 -13
- data/rbi/db/transaction_pb.rbi +34 -11
- data/rbi/statelydb.rbi +19 -9
- data/sig/statelydb.rbs +21 -12
- metadata +10 -6
- data/lib/api/db/scan_root_paths_pb.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b94f8450c52c3516c73d06b1a031eda14b971cc357c8a8dcd5194864ecfdf89
|
4
|
+
data.tar.gz: 33ed8865a216af57d1ea99ffe9c24cd37a078e2ba555d3a04b654e8f25f9fdb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e163f64ad570dff9ace904d59137e2134a215d28da6540422943ba6b9b4ea2c23b95863aa6195e84ec06e617a3b494f487851174fe6bf6e05eb5bb09d9a3f88
|
7
|
+
data.tar.gz: bc39bdaa7a57f7e7610cfdbd3b0bc088086d166f122f7355cc57db01c6cfd8d119a2a470a4ff103f38aefa3f43b1493958e39be0d3f6b342fb97c1d99df0ae23
|
data/README.md
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
# StatelyDB SDK for Ruby
|
2
2
|
|
3
|
-
This is the Ruby SDK for [StatelyDB](https://stately.cloud).
|
3
|
+
This is the Ruby SDK for [StatelyDB](https://stately.cloud). StatelyDB is a document database built on top of DynamoDB. It uses Elastic Schema to allow you to update your data model at any time, with automatic backwards and forwards compatibility.
|
4
4
|
|
5
5
|
### Getting started:
|
6
6
|
|
7
|
-
##### Disclaimer:
|
8
|
-
|
9
|
-
We're still in an invite-only preview mode - if you're interested, please reach out to [preview@stately.cloud](mailto:preview@stately.cloud?subject=Early%20Access%20Program).
|
10
|
-
|
11
7
|
Begin by following our [Getting Started Guide] which will help you define, generate, and publish a DB schema so that it can be used.
|
12
8
|
|
13
9
|
##### Install the SDK
|
@@ -16,7 +12,6 @@ Begin by following our [Getting Started Guide] which will help you define, gener
|
|
16
12
|
gem install statelydb
|
17
13
|
```
|
18
14
|
|
19
|
-
|
20
15
|
### Usage:
|
21
16
|
|
22
17
|
Create an authenticated client, then import your item types from your generated schema module and use the client!
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x19\x61uth/get_auth_token.proto\x12\x0cstately.auth\"B\n\x13GetAuthTokenRequest\x12\x1f\n\naccess_key\x18\x01 \x01(\tH\x00R\taccessKeyB\n\n\x08identity\"W\n\x14GetAuthTokenResponse\x12\x1d\n\nauth_token\x18\x01 \x01(\tR\tauthToken\x12 \n\x0c\x65xpires_in_s\x18\x02 \x01(\x04R\nexpiresInSBv\n\x10\x63om.stately.authB\x11GetAuthTokenProtoP\x01\xa2\x02\x03SAX\xaa\x02\x0cStately.Auth\xca\x02\x0cStately\\Auth\xe2\x02\x18Stately\\Auth\\GPBMetadata\xea\x02\rStately::Authb\x06proto3"
|
9
9
|
|
10
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
data/lib/api/auth/service_pb.rb
CHANGED
@@ -9,7 +9,7 @@ require 'api/auth/get_auth_token_pb'
|
|
9
9
|
|
10
10
|
descriptor_data = "\n\x12\x61uth/service.proto\x12\x0cstately.auth\x1a\x19\x61uth/get_auth_token.proto2i\n\x0b\x41uthService\x12Z\n\x0cGetAuthToken\x12!.stately.auth.GetAuthTokenRequest\x1a\".stately.auth.GetAuthTokenResponse\"\x03\x90\x02\x01\x42q\n\x10\x63om.stately.authB\x0cServiceProtoP\x01\xa2\x02\x03SAX\xaa\x02\x0cStately.Auth\xca\x02\x0cStately\\Auth\xe2\x02\x18Stately\\Auth\\GPBMetadata\xea\x02\rStately::Authb\x06proto3"
|
11
11
|
|
12
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
13
13
|
pool.add_serialized_file(descriptor_data)
|
14
14
|
|
15
15
|
module Stately
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x16\x64\x62/continue_list.proto\x12\nstately.db\"\xbe\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\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaId*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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x16\x64\x62/continue_scan.proto\x12\nstately.db\"}\n\x13\x43ontinueScanRequest\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12*\n\x11schema_version_id\x18\x02 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x03 \x01(\x04R\x08schemaIdBl\n\x0e\x63om.stately.dbB\x11\x43ontinueScanProtoP\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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
data/lib/api/db/delete_pb.rb
CHANGED
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x0f\x64\x62/delete.proto\x12\nstately.db\"\xab\x01\n\rDeleteRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12\x30\n\x07\x64\x65letes\x18\x03 \x03(\x0b\x32\x16.stately.db.DeleteItemR\x07\x64\x65letes\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaIdJ\x04\x08\x04\x10\x05\"\'\n\nDeleteItem\x12\x19\n\x08key_path\x18\x01 \x01(\tR\x07keyPath\"/\n\x0c\x44\x65leteResult\x12\x19\n\x08key_path\x18\x01 \x01(\tR\x07keyPathJ\x04\x08\x02\x10\x03\"D\n\x0e\x44\x65leteResponse\x12\x32\n\x07results\x18\x01 \x03(\x0b\x32\x18.stately.db.DeleteResultR\x07resultsBf\n\x0e\x63om.stately.dbB\x0b\x44\x65leteProtoP\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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
data/lib/api/db/get_pb.rb
CHANGED
@@ -9,7 +9,7 @@ require 'api/db/item_pb'
|
|
9
9
|
|
10
10
|
descriptor_data = "\n\x0c\x64\x62/get.proto\x12\nstately.db\x1a\rdb/item.proto\"\xc0\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\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaIdJ\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"
|
11
11
|
|
12
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
13
13
|
pool.add_serialized_file(descriptor_data)
|
14
14
|
|
15
15
|
module Stately
|
data/lib/api/db/item_pb.rb
CHANGED
@@ -9,7 +9,7 @@ require 'google/protobuf/struct_pb'
|
|
9
9
|
|
10
10
|
descriptor_data = "\n\rdb/item.proto\x12\nstately.db\x1a\x1cgoogle/protobuf/struct.proto\"u\n\x04Item\x12\x1b\n\titem_type\x18\x01 \x01(\tR\x08itemType\x12\x16\n\x05proto\x18\x02 \x01(\x0cH\x00R\x05proto\x12-\n\x04json\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructH\x00R\x04jsonB\t\n\x07payloadBd\n\x0e\x63om.stately.dbB\tItemProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
11
11
|
|
12
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
13
13
|
pool.add_serialized_file(descriptor_data)
|
14
14
|
|
15
15
|
module Stately
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x16\x64\x62/item_property.proto\x12\nstately.db*\x8b\x02\n\x10SortableProperty\x12\x1e\n\x1aSORTABLE_PROPERTY_KEY_PATH\x10\x00\x12+\n\'SORTABLE_PROPERTY_LAST_MODIFIED_VERSION\x10\x01\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_1\x10\x08\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_2\x10\t\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_3\x10\n\x12)\n%SORTABLE_PROPERTY_GROUP_LOCAL_INDEX_4\x10\x0b\x42l\n\x0e\x63om.stately.dbB\x11ItemPropertyProtoP\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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: db/list_filters.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
|
8
|
+
descriptor_data = "\n\x15\x64\x62/list_filters.proto\x12\nstately.db\"9\n\x0f\x46ilterCondition\x12\x1d\n\titem_type\x18\x01 \x01(\tH\x00R\x08itemTypeB\x07\n\x05valueBk\n\x0e\x63om.stately.dbB\x10ListFiltersProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
9
|
+
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
12
|
+
|
13
|
+
module Stately
|
14
|
+
module Db
|
15
|
+
FilterCondition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.FilterCondition").msgclass
|
16
|
+
end
|
17
|
+
end
|
data/lib/api/db/list_pb.rb
CHANGED
@@ -6,12 +6,13 @@ require 'google/protobuf'
|
|
6
6
|
|
7
7
|
require 'api/db/item_pb'
|
8
8
|
require 'api/db/item_property_pb'
|
9
|
+
require 'api/db/list_filters_pb'
|
9
10
|
require 'api/db/list_token_pb'
|
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\"\
|
13
|
+
descriptor_data = "\n\rdb/list.proto\x12\nstately.db\x1a\rdb/item.proto\x1a\x16\x64\x62/item_property.proto\x1a\x15\x64\x62/list_filters.proto\x1a\x13\x64\x62/list_token.proto\"\xe5\x03\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\x12\x1b\n\tschema_id\x18\x08 \x01(\x04R\x08schemaId\x12H\n\x11\x66ilter_conditions\x18\t \x03(\x0b\x32\x1b.stately.db.FilterConditionR\x10\x66ilterConditions\x12?\n\x0ekey_conditions\x18\n \x03(\x0b\x32\x18.stately.db.KeyConditionR\rkeyConditions\"\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\"[\n\x0cKeyCondition\x12\x19\n\x08key_path\x18\x01 \x01(\tR\x07keyPath\x12\x30\n\x08operator\x18\x02 \x01(\x0e\x32\x14.stately.db.OperatorR\x08operator*8\n\rSortDirection\x12\x12\n\x0eSORT_ASCENDING\x10\x00\x12\x13\n\x0fSORT_DESCENDING\x10\x01*\x9c\x01\n\x08Operator\x12\x18\n\x14OPERATOR_UNSPECIFIED\x10\x00\x12\x19\n\x15OPERATOR_GREATER_THAN\x10\x04\x12\"\n\x1eOPERATOR_GREATER_THAN_OR_EQUAL\x10\x05\x12\x16\n\x12OPERATOR_LESS_THAN\x10\x06\x12\x1f\n\x1bOPERATOR_LESS_THAN_OR_EQUAL\x10\x07\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"
|
13
14
|
|
14
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
15
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
15
16
|
pool.add_serialized_file(descriptor_data)
|
16
17
|
|
17
18
|
module Stately
|
@@ -20,6 +21,8 @@ module Stately
|
|
20
21
|
ListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.ListResponse").msgclass
|
21
22
|
ListPartialResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.ListPartialResult").msgclass
|
22
23
|
ListFinished = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.ListFinished").msgclass
|
24
|
+
KeyCondition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.KeyCondition").msgclass
|
23
25
|
SortDirection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.SortDirection").enummodule
|
26
|
+
Operator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.Operator").enummodule
|
24
27
|
end
|
25
28
|
end
|
data/lib/api/db/list_token_pb.rb
CHANGED
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
data/lib/api/db/put_pb.rb
CHANGED
@@ -9,7 +9,7 @@ require 'api/db/item_pb'
|
|
9
9
|
|
10
10
|
descriptor_data = "\n\x0c\x64\x62/put.proto\x12\nstately.db\x1a\rdb/item.proto\"\x99\x01\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\x12\x1b\n\tschema_id\x18\x04 \x01(\x04R\x08schemaId\"\x99\x01\n\x07PutItem\x12$\n\x04item\x18\x01 \x01(\x0b\x32\x10.stately.db.ItemR\x04item\x12\x42\n\x1doverwrite_metadata_timestamps\x18\x02 \x01(\x08R\x1boverwriteMetadataTimestamps\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"
|
11
11
|
|
12
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
13
13
|
pool.add_serialized_file(descriptor_data)
|
14
14
|
|
15
15
|
module Stately
|
data/lib/api/db/scan_pb.rb
CHANGED
@@ -4,15 +4,16 @@
|
|
4
4
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
|
+
require 'api/db/list_filters_pb'
|
7
8
|
|
8
|
-
descriptor_data = "\n\rdb/scan.proto\x12\nstately.db\"9\n\x0f\x46ilterCondition\x12\x1d\n\titem_type\x18\x01 \x01(\tH\x00R\x08itemTypeB\x07\n\x05value\"\xa5\x02\n\x10\x42\x65ginScanRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12\x46\n\x10\x66ilter_condition\x18\x02 \x03(\x0b\x32\x1b.stately.db.FilterConditionR\x0f\x66ilterCondition\x12\x14\n\x05limit\x18\x03 \x01(\rR\x05limit\x12O\n\x13segmentation_params\x18\x04 \x01(\x0b\x32\x1e.stately.db.SegmentationParamsR\x12segmentationParams\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaId\"`\n\x12SegmentationParams\x12%\n\x0etotal_segments\x18\x05 \x01(\rR\rtotalSegments\x12#\n\rsegment_index\x18\x06 \x01(\rR\x0csegmentIndexBd\n\x0e\x63om.stately.dbB\tScanProtoP\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
|
+
descriptor_data = "\n\rdb/scan.proto\x12\nstately.db\x1a\x15\x64\x62/list_filters.proto\"\xa5\x02\n\x10\x42\x65ginScanRequest\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12\x46\n\x10\x66ilter_condition\x18\x02 \x03(\x0b\x32\x1b.stately.db.FilterConditionR\x0f\x66ilterCondition\x12\x14\n\x05limit\x18\x03 \x01(\rR\x05limit\x12O\n\x13segmentation_params\x18\x04 \x01(\x0b\x32\x1e.stately.db.SegmentationParamsR\x12segmentationParams\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaId\"`\n\x12SegmentationParams\x12%\n\x0etotal_segments\x18\x05 \x01(\rR\rtotalSegments\x12#\n\rsegment_index\x18\x06 \x01(\rR\x0csegmentIndexBd\n\x0e\x63om.stately.dbB\tScanProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
11
|
+
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
13
|
pool.add_serialized_file(descriptor_data)
|
12
14
|
|
13
15
|
module Stately
|
14
16
|
module Db
|
15
|
-
FilterCondition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.FilterCondition").msgclass
|
16
17
|
BeginScanRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.BeginScanRequest").msgclass
|
17
18
|
SegmentationParams = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("stately.db.SegmentationParams").msgclass
|
18
19
|
end
|
data/lib/api/db/service_pb.rb
CHANGED
@@ -11,14 +11,13 @@ require 'api/db/get_pb'
|
|
11
11
|
require 'api/db/list_pb'
|
12
12
|
require 'api/db/put_pb'
|
13
13
|
require 'api/db/scan_pb'
|
14
|
-
require 'api/db/scan_root_paths_pb'
|
15
14
|
require 'api/db/sync_list_pb'
|
16
15
|
require 'api/db/transaction_pb'
|
17
16
|
|
18
17
|
|
19
|
-
descriptor_data = "\n\x10\x64\x62/service.proto\x12\nstately.db\x1a\x16\x64\x62/continue_list.proto\x1a\x16\x64\x62/continue_scan.proto\x1a\x0f\x64\x62/delete.proto\x1a\x0c\x64\x62/get.proto\x1a\rdb/list.proto\x1a\x0c\x64\x62/put.proto\x1a\rdb/scan.proto\x1a\
|
18
|
+
descriptor_data = "\n\x10\x64\x62/service.proto\x12\nstately.db\x1a\x16\x64\x62/continue_list.proto\x1a\x16\x64\x62/continue_scan.proto\x1a\x0f\x64\x62/delete.proto\x1a\x0c\x64\x62/get.proto\x1a\rdb/list.proto\x1a\x0c\x64\x62/put.proto\x1a\rdb/scan.proto\x1a\x12\x64\x62/sync_list.proto\x1a\x14\x64\x62/transaction.proto2\xb1\x05\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\x12J\n\tBeginScan\x12\x1c.stately.db.BeginScanRequest\x1a\x18.stately.db.ListResponse\"\x03\x90\x02\x01\x30\x01\x12P\n\x0c\x43ontinueScan\x12\x1f.stately.db.ContinueScanRequest\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\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"
|
20
19
|
|
21
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
20
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
22
21
|
pool.add_serialized_file(descriptor_data)
|
23
22
|
|
24
23
|
module Stately
|
@@ -105,12 +105,6 @@ module Stately
|
|
105
105
|
# fail if another transaction commits before this one finishes - in that
|
106
106
|
# case, you should retry your transaction.
|
107
107
|
rpc :Transaction, stream(::Stately::Db::TransactionRequest), stream(::Stately::Db::TransactionResponse)
|
108
|
-
# ScanRootPaths lists root paths (Groups) in the Store. This is a very
|
109
|
-
# expensive operation, as it must consult multiple partitions and it reads
|
110
|
-
# and ignores a lot of data. It is provided for use in the web console's data
|
111
|
-
# browser and is not exposed to customers. This operation will fail if the
|
112
|
-
# caller does not have permission to read Items.
|
113
|
-
rpc :ScanRootPaths, ::Stately::Db::ScanRootPathsRequest, ::Stately::Db::ScanRootPathsResponse
|
114
108
|
end
|
115
109
|
|
116
110
|
Stub = Service.rpc_stub_class
|
data/lib/api/db/sync_list_pb.rb
CHANGED
@@ -10,7 +10,7 @@ require 'api/db/list_pb'
|
|
10
10
|
|
11
11
|
descriptor_data = "\n\x12\x64\x62/sync_list.proto\x12\nstately.db\x1a\rdb/item.proto\x1a\rdb/list.proto\"y\n\x0fSyncListRequest\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12*\n\x11schema_version_id\x18\x05 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x06 \x01(\x04R\x08schemaId\"\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
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
13
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
14
14
|
pool.add_serialized_file(descriptor_data)
|
15
15
|
|
16
16
|
module Stately
|
@@ -10,13 +10,14 @@ require 'api/db/get_pb'
|
|
10
10
|
require 'api/db/item_pb'
|
11
11
|
require 'api/db/item_property_pb'
|
12
12
|
require 'api/db/list_pb'
|
13
|
+
require 'api/db/list_filters_pb'
|
13
14
|
require 'api/db/put_pb'
|
14
15
|
require 'google/protobuf/empty_pb'
|
15
16
|
|
16
17
|
|
17
|
-
descriptor_data = "\n\x14\x64\x62/transaction.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/item.proto\x1a\x16\x64\x62/item_property.proto\x1a\rdb/list.proto\x1a\x0c\x64\x62/put.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x9f\x04\n\x12TransactionRequest\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x34\n\x05\x62\x65gin\x18\x02 \x01(\x0b\x32\x1c.stately.db.TransactionBeginH\x00R\x05\x62\x65gin\x12\x39\n\tget_items\x18\x03 \x01(\x0b\x32\x1a.stately.db.TransactionGetH\x00R\x08getItems\x12\x41\n\nbegin_list\x18\x04 \x01(\x0b\x32 .stately.db.TransactionBeginListH\x00R\tbeginList\x12J\n\rcontinue_list\x18\x05 \x01(\x0b\x32#.stately.db.TransactionContinueListH\x00R\x0c\x63ontinueList\x12\x39\n\tput_items\x18\x06 \x01(\x0b\x32\x1a.stately.db.TransactionPutH\x00R\x08putItems\x12\x42\n\x0c\x64\x65lete_items\x18\x07 \x01(\x0b\x32\x1d.stately.db.TransactionDeleteH\x00R\x0b\x64\x65leteItems\x12\x30\n\x06\x63ommit\x18\x08 \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x06\x63ommit\x12.\n\x05\x61\x62ort\x18\t \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x05\x61\x62ortB\t\n\x07\x63ommand\"\xc8\x02\n\x13TransactionResponse\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x45\n\x0bget_results\x18\x02 \x01(\x0b\x32\".stately.db.TransactionGetResponseH\x00R\ngetResults\x12\x38\n\x07put_ack\x18\x03 \x01(\x0b\x32\x1d.stately.db.TransactionPutAckH\x00R\x06putAck\x12H\n\x0clist_results\x18\x04 \x01(\x0b\x32#.stately.db.TransactionListResponseH\x00R\x0blistResults\x12=\n\x08\x66inished\x18\x05 \x01(\x0b\x32\x1f.stately.db.TransactionFinishedH\x00R\x08\x66inishedB\x08\n\x06result\"v\n\x10TransactionBegin\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12*\n\x11schema_version_id\x18\x02 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x03 \x01(\x04R\x08schemaId\"9\n\x0eTransactionGet\x12\'\n\x04gets\x18\x01 \x03(\x0b\x32\x13.stately.db.GetItemR\x04gets\"\
|
18
|
+
descriptor_data = "\n\x14\x64\x62/transaction.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/item.proto\x1a\x16\x64\x62/item_property.proto\x1a\rdb/list.proto\x1a\x15\x64\x62/list_filters.proto\x1a\x0c\x64\x62/put.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x9f\x04\n\x12TransactionRequest\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x34\n\x05\x62\x65gin\x18\x02 \x01(\x0b\x32\x1c.stately.db.TransactionBeginH\x00R\x05\x62\x65gin\x12\x39\n\tget_items\x18\x03 \x01(\x0b\x32\x1a.stately.db.TransactionGetH\x00R\x08getItems\x12\x41\n\nbegin_list\x18\x04 \x01(\x0b\x32 .stately.db.TransactionBeginListH\x00R\tbeginList\x12J\n\rcontinue_list\x18\x05 \x01(\x0b\x32#.stately.db.TransactionContinueListH\x00R\x0c\x63ontinueList\x12\x39\n\tput_items\x18\x06 \x01(\x0b\x32\x1a.stately.db.TransactionPutH\x00R\x08putItems\x12\x42\n\x0c\x64\x65lete_items\x18\x07 \x01(\x0b\x32\x1d.stately.db.TransactionDeleteH\x00R\x0b\x64\x65leteItems\x12\x30\n\x06\x63ommit\x18\x08 \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x06\x63ommit\x12.\n\x05\x61\x62ort\x18\t \x01(\x0b\x32\x16.google.protobuf.EmptyH\x00R\x05\x61\x62ortB\t\n\x07\x63ommand\"\xc8\x02\n\x13TransactionResponse\x12\x1d\n\nmessage_id\x18\x01 \x01(\rR\tmessageId\x12\x45\n\x0bget_results\x18\x02 \x01(\x0b\x32\".stately.db.TransactionGetResponseH\x00R\ngetResults\x12\x38\n\x07put_ack\x18\x03 \x01(\x0b\x32\x1d.stately.db.TransactionPutAckH\x00R\x06putAck\x12H\n\x0clist_results\x18\x04 \x01(\x0b\x32#.stately.db.TransactionListResponseH\x00R\x0blistResults\x12=\n\x08\x66inished\x18\x05 \x01(\x0b\x32\x1f.stately.db.TransactionFinishedH\x00R\x08\x66inishedB\x08\n\x06result\"v\n\x10TransactionBegin\x12\x19\n\x08store_id\x18\x01 \x01(\x04R\x07storeId\x12*\n\x11schema_version_id\x18\x02 \x01(\rR\x0fschemaVersionId\x12\x1b\n\tschema_id\x18\x03 \x01(\x04R\x08schemaId\"9\n\x0eTransactionGet\x12\'\n\x04gets\x18\x01 \x03(\x0b\x32\x13.stately.db.GetItemR\x04gets\"\xa3\x02\n\x14TransactionBeginList\x12&\n\x0fkey_path_prefix\x18\x01 \x01(\tR\rkeyPathPrefix\x12\x14\n\x05limit\x18\x02 \x01(\rR\x05limit\x12\x41\n\rsort_property\x18\x03 \x01(\x0e\x32\x1c.stately.db.SortablePropertyR\x0csortProperty\x12@\n\x0esort_direction\x18\x04 \x01(\x0e\x32\x19.stately.db.SortDirectionR\rsortDirection\x12H\n\x11\x66ilter_conditions\x18\t \x03(\x0b\x32\x1b.stately.db.FilterConditionR\x10\x66ilterConditions\"y\n\x17TransactionContinueList\x12\x1d\n\ntoken_data\x18\x01 \x01(\x0cR\ttokenData\x12?\n\tdirection\x18\x04 \x01(\x0e\x32!.stately.db.ContinueListDirectionR\tdirection\"9\n\x0eTransactionPut\x12\'\n\x04puts\x18\x01 \x03(\x0b\x32\x13.stately.db.PutItemR\x04puts\"E\n\x11TransactionDelete\x12\x30\n\x07\x64\x65letes\x18\x01 \x03(\x0b\x32\x16.stately.db.DeleteItemR\x07\x64\x65letes\"@\n\x16TransactionGetResponse\x12&\n\x05items\x18\x01 \x03(\x0b\x32\x10.stately.db.ItemR\x05items\"D\n\x0bGeneratedID\x12\x14\n\x04uint\x18\x01 \x01(\x04H\x00R\x04uint\x12\x16\n\x05\x62ytes\x18\x02 \x01(\x0cH\x00R\x05\x62ytesB\x07\n\x05value\"Q\n\x11TransactionPutAck\x12<\n\rgenerated_ids\x18\x01 \x03(\x0b\x32\x17.stately.db.GeneratedIDR\x0cgeneratedIds\"\x96\x01\n\x17TransactionListResponse\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\"\xa7\x01\n\x13TransactionFinished\x12\x1c\n\tcommitted\x18\x01 \x01(\x08R\tcommitted\x12\x31\n\x0bput_results\x18\x02 \x03(\x0b\x32\x10.stately.db.ItemR\nputResults\x12?\n\x0e\x64\x65lete_results\x18\x03 \x03(\x0b\x32\x18.stately.db.DeleteResultR\rdeleteResultsBk\n\x0e\x63om.stately.dbB\x10TransactionProtoP\x01\xa2\x02\x03SDX\xaa\x02\nStately.Db\xca\x02\nStately\\Db\xe2\x02\x16Stately\\Db\\GPBMetadata\xea\x02\x0bStately::Dbb\x06proto3"
|
18
19
|
|
19
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
20
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
20
21
|
pool.add_serialized_file(descriptor_data)
|
21
22
|
|
22
23
|
module Stately
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
7
7
|
|
8
8
|
descriptor_data = "\n\x1a\x65rrors/error_details.proto\x12\x0estately.errors\"\x8d\x01\n\x13StatelyErrorDetails\x12!\n\x0cstately_code\x18\x01 \x01(\tR\x0bstatelyCode\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\x12%\n\x0eupstream_cause\x18\x03 \x01(\tR\rupstreamCause\x12\x12\n\x04\x63ode\x18\x04 \x01(\rR\x04\x63odeB\x80\x01\n\x12\x63om.stately.errorsB\x11\x45rrorDetailsProtoP\x01\xa2\x02\x03SEX\xaa\x02\x0eStately.Errors\xca\x02\x0eStately\\Errors\xe2\x02\x1aStately\\Errors\\GPBMetadata\xea\x02\x0fStately::Errorsb\x06proto3"
|
9
9
|
|
10
|
-
pool = Google::Protobuf::DescriptorPool.generated_pool
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
11
11
|
pool.add_serialized_file(descriptor_data)
|
12
12
|
|
13
13
|
module Stately
|
@@ -24,31 +24,49 @@ module StatelyDB
|
|
24
24
|
# It will default to using the value of `STATELY_ACCESS_KEY` if
|
25
25
|
# no credentials are explicitly passed and will throw an error if no credentials are found.
|
26
26
|
class AuthTokenProvider < TokenProvider
|
27
|
-
# @param [String] endpoint The endpoint of the auth server
|
28
27
|
# @param [String] access_key The StatelyDB access key credential
|
29
28
|
# @param [Float] base_retry_backoff_secs The base retry backoff in seconds
|
30
29
|
def initialize(
|
31
|
-
endpoint: "https://api.stately.cloud",
|
32
30
|
access_key: ENV.fetch("STATELY_ACCESS_KEY", nil),
|
33
31
|
base_retry_backoff_secs: 1
|
34
32
|
)
|
35
33
|
super()
|
36
|
-
@
|
34
|
+
@access_key = access_key
|
35
|
+
@base_retry_backoff_secs = base_retry_backoff_secs
|
36
|
+
end
|
37
|
+
|
38
|
+
# Start the token provider. Starting multiple times is a no-op.
|
39
|
+
def start(
|
40
|
+
endpoint: "https://api.stately.cloud"
|
41
|
+
)
|
42
|
+
# If the actor is already started, do nothing
|
43
|
+
return unless @actor.nil?
|
44
|
+
|
45
|
+
@actor = Async::Actor.new(Actor.new(endpoint:, access_key: @access_key,
|
46
|
+
base_retry_backoff_secs: @base_retry_backoff_secs))
|
37
47
|
# this initialization cannot happen in the constructor because it is async and must run on the event loop
|
38
48
|
# which is not available in the constructor
|
39
|
-
@actor.
|
49
|
+
@actor.start
|
40
50
|
end
|
41
51
|
|
42
52
|
# Close the token provider and kill any background operations
|
43
53
|
# This just invokes the close method on the actor which should do the cleanup
|
44
54
|
# @return [void]
|
45
55
|
def close
|
46
|
-
@actor.close
|
56
|
+
@actor.close unless @actor.nil?
|
57
|
+
@actor = nil
|
47
58
|
end
|
48
59
|
|
49
60
|
# Get the current access token
|
50
61
|
# @return [String] The current access token
|
51
62
|
def get_token(force: false)
|
63
|
+
if @actor.nil?
|
64
|
+
raise StatelyDB::Error.new(
|
65
|
+
"Token provider has not been started. Call start() before get_token().",
|
66
|
+
code: GRPC::Core::StatusCodes::FAILED_PRECONDITION,
|
67
|
+
stately_code: "FailedPrecondition"
|
68
|
+
)
|
69
|
+
end
|
52
70
|
@actor.get_token(force: force)
|
53
71
|
end
|
54
72
|
|
@@ -80,10 +98,10 @@ module StatelyDB
|
|
80
98
|
@pending_refresh = nil
|
81
99
|
end
|
82
100
|
|
83
|
-
#
|
101
|
+
# Start the actor. This runs on the actor thread which means
|
84
102
|
# we can dispatch async operations here.
|
85
103
|
# @return [void]
|
86
|
-
def
|
104
|
+
def start
|
87
105
|
# disable the async lib logger. We do our own error handling and propagation
|
88
106
|
Console.logger.disable(Async::Task)
|
89
107
|
refresh_token
|
@@ -9,9 +9,10 @@ module StatelyDB
|
|
9
9
|
module Auth
|
10
10
|
# GRPC interceptor to authenticate against Stately and append bearer tokens to outgoing requests
|
11
11
|
class Interceptor < GRPC::ClientInterceptor
|
12
|
-
# @param [StatelyDB::Common::Auth::TokenProvider] token_provider The token provider to use for authentication
|
12
|
+
# @param [StatelyDB::Common::Auth::TokenProvider] token_provider The token provider to use for authentication.
|
13
|
+
# This must have been started already.
|
13
14
|
def initialize(
|
14
|
-
token_provider:
|
15
|
+
token_provider:
|
15
16
|
)
|
16
17
|
super()
|
17
18
|
@token_provider = token_provider
|
@@ -7,6 +7,13 @@ module StatelyDB
|
|
7
7
|
# TokenProvider is an abstract base class that should be extended
|
8
8
|
# for individual token provider implementations
|
9
9
|
class TokenProvider
|
10
|
+
# Start the token provider. Starting multiple times should be a no-op.
|
11
|
+
# @param [String] endpoint The endpoint to connect to
|
12
|
+
# @return [void]
|
13
|
+
def start(endpoint: "https://api.stately.cloud") # rubocop:disable Lint/UnusedMethodArgument
|
14
|
+
raise "Not Implemented"
|
15
|
+
end
|
16
|
+
|
10
17
|
# Get the current access token
|
11
18
|
# @param [Boolean] force Whether to force a refresh of the token
|
12
19
|
# @return [String] The current access token
|
data/lib/statelydb.rb
CHANGED
@@ -49,11 +49,13 @@ module StatelyDB
|
|
49
49
|
|
50
50
|
endpoint = self.class.make_endpoint(endpoint:, region:)
|
51
51
|
@channel = Common::Net.new_channel(endpoint:)
|
52
|
-
# Make sure to use the correct endpoint for the default token provider
|
53
|
-
@token_provider = token_provider || Common::Auth::AuthTokenProvider.new(endpoint:)
|
54
|
-
|
55
52
|
interceptors = [Common::ErrorInterceptor.new]
|
56
|
-
|
53
|
+
# Make sure to use the correct endpoint for the default token provider
|
54
|
+
unless no_auth
|
55
|
+
@token_provider = token_provider || Common::Auth::AuthTokenProvider.new
|
56
|
+
@token_provider.start(endpoint: endpoint)
|
57
|
+
interceptors << Common::Auth::Interceptor.new(token_provider: @token_provider)
|
58
|
+
end
|
57
59
|
|
58
60
|
@stub = Stately::Db::DatabaseService::Stub.new(nil, nil,
|
59
61
|
channel_override: @channel, interceptors:)
|
data/lib/uuid.rb
CHANGED
@@ -19,7 +19,7 @@ module StatelyDB
|
|
19
19
|
to_str
|
20
20
|
end
|
21
21
|
|
22
|
-
# to_str returns the UUID as a base16 string (eg: "f4a8a24a-129d-411f-91d2-6d19d0eaa096")
|
22
|
+
# to_str returns the UUID as a base16 string (eg: "f4a8a24a-129d-411f-91d2-6d19d0eaa096").
|
23
23
|
#
|
24
24
|
# Note: to_str is a type coercion method that is called by Ruby when an object is coerced to a string.
|
25
25
|
# @return [String]
|
data/lib/version.rb
ADDED
data/rbi/db/delete_pb.rbi
CHANGED
@@ -40,17 +40,17 @@ class Stately::Db::DeleteRequest
|
|
40
40
|
def clear_store_id
|
41
41
|
end
|
42
42
|
|
43
|
-
#
|
43
|
+
# key paths of items to delete.
|
44
44
|
sig { returns(T::Array[T.nilable(Stately::Db::DeleteItem)]) }
|
45
45
|
def deletes
|
46
46
|
end
|
47
47
|
|
48
|
-
#
|
48
|
+
# key paths of items to delete.
|
49
49
|
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
50
50
|
def deletes=(value)
|
51
51
|
end
|
52
52
|
|
53
|
-
#
|
53
|
+
# key paths of items to delete.
|
54
54
|
sig { void }
|
55
55
|
def clear_deletes
|
56
56
|
end
|
data/rbi/db/get_pb.rbi
CHANGED
@@ -42,17 +42,17 @@ class Stately::Db::GetRequest
|
|
42
42
|
def clear_store_id
|
43
43
|
end
|
44
44
|
|
45
|
-
#
|
45
|
+
# key paths to of each item to get.
|
46
46
|
sig { returns(T::Array[T.nilable(Stately::Db::GetItem)]) }
|
47
47
|
def gets
|
48
48
|
end
|
49
49
|
|
50
|
-
#
|
50
|
+
# key paths to of each item to get.
|
51
51
|
sig { params(value: ::Google::Protobuf::RepeatedField).void }
|
52
52
|
def gets=(value)
|
53
53
|
end
|
54
54
|
|
55
|
-
#
|
55
|
+
# key paths to of each item to get.
|
56
56
|
sig { void }
|
57
57
|
def clear_gets
|
58
58
|
end
|
@@ -81,32 +81,26 @@ class Stately::Db::GetRequest
|
|
81
81
|
def clear_allow_stale
|
82
82
|
end
|
83
83
|
|
84
|
-
# schema_version_id
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
# set this manually as your generated SDK should know its schema version
|
89
|
-
# and wire this in for you.
|
84
|
+
# schema_version_id is the version of the store's schema to use to interpret
|
85
|
+
# items. If there is no version with this ID, the operation will error with
|
86
|
+
# SchemaVersionNotFound error. You should not have to set this manually as
|
87
|
+
# your generated SDK should know its schema version and wire this in for you.
|
90
88
|
sig { returns(Integer) }
|
91
89
|
def schema_version_id
|
92
90
|
end
|
93
91
|
|
94
|
-
# schema_version_id
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
# set this manually as your generated SDK should know its schema version
|
99
|
-
# and wire this in for you.
|
92
|
+
# schema_version_id is the version of the store's schema to use to interpret
|
93
|
+
# items. If there is no version with this ID, the operation will error with
|
94
|
+
# SchemaVersionNotFound error. You should not have to set this manually as
|
95
|
+
# your generated SDK should know its schema version and wire this in for you.
|
100
96
|
sig { params(value: Integer).void }
|
101
97
|
def schema_version_id=(value)
|
102
98
|
end
|
103
99
|
|
104
|
-
# schema_version_id
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
# set this manually as your generated SDK should know its schema version
|
109
|
-
# and wire this in for you.
|
100
|
+
# schema_version_id is the version of the store's schema to use to interpret
|
101
|
+
# items. If there is no version with this ID, the operation will error with
|
102
|
+
# SchemaVersionNotFound error. You should not have to set this manually as
|
103
|
+
# your generated SDK should know its schema version and wire this in for you.
|
110
104
|
sig { void }
|
111
105
|
def clear_schema_version_id
|
112
106
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Code generated by protoc-gen-rbi. DO NOT EDIT.
|
2
|
+
# source: db/list_filters.proto
|
3
|
+
# typed: strict
|
4
|
+
|
5
|
+
class Stately::Db::FilterCondition
|
6
|
+
include ::Google::Protobuf::MessageExts
|
7
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
8
|
+
|
9
|
+
sig do
|
10
|
+
params(
|
11
|
+
item_type: T.nilable(String)
|
12
|
+
).void
|
13
|
+
end
|
14
|
+
def initialize(
|
15
|
+
item_type: ""
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
# item_type is the type of item to filter by.
|
20
|
+
sig { returns(String) }
|
21
|
+
def item_type
|
22
|
+
end
|
23
|
+
|
24
|
+
# item_type is the type of item to filter by.
|
25
|
+
sig { params(value: String).void }
|
26
|
+
def item_type=(value)
|
27
|
+
end
|
28
|
+
|
29
|
+
# item_type is the type of item to filter by.
|
30
|
+
sig { void }
|
31
|
+
def clear_item_type
|
32
|
+
end
|
33
|
+
|
34
|
+
sig { returns(T.nilable(Symbol)) }
|
35
|
+
def value
|
36
|
+
end
|
37
|
+
|
38
|
+
sig { params(field: String).returns(T.untyped) }
|
39
|
+
def [](field)
|
40
|
+
end
|
41
|
+
|
42
|
+
sig { params(field: String, value: T.untyped).void }
|
43
|
+
def []=(field, value)
|
44
|
+
end
|
45
|
+
|
46
|
+
sig { returns(T::Hash[Symbol, T.untyped]) }
|
47
|
+
def to_h
|
48
|
+
end
|
49
|
+
|
50
|
+
sig { params(str: String).returns(Stately::Db::FilterCondition) }
|
51
|
+
def self.decode(str)
|
52
|
+
end
|
53
|
+
|
54
|
+
sig { params(msg: Stately::Db::FilterCondition).returns(String) }
|
55
|
+
def self.encode(msg)
|
56
|
+
end
|
57
|
+
|
58
|
+
sig { params(str: String, kw: T.untyped).returns(Stately::Db::FilterCondition) }
|
59
|
+
def self.decode_json(str, **kw)
|
60
|
+
end
|
61
|
+
|
62
|
+
sig { params(msg: Stately::Db::FilterCondition, kw: T.untyped).returns(String) }
|
63
|
+
def self.encode_json(msg, **kw)
|
64
|
+
end
|
65
|
+
|
66
|
+
sig { returns(::Google::Protobuf::Descriptor) }
|
67
|
+
def self.descriptor
|
68
|
+
end
|
69
|
+
end
|