momento 0.2.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.release-please-manifest.json +1 -1
  3. data/.rubocop.yml +14 -1
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +105 -0
  6. data/CONTRIBUTING.md +5 -6
  7. data/Gemfile +1 -6
  8. data/Gemfile.lock +34 -28
  9. data/README.md +64 -44
  10. data/README.template.md +30 -25
  11. data/examples/.gitignore +1 -0
  12. data/examples/Gemfile +1 -1
  13. data/examples/README.md +5 -6
  14. data/examples/compact.rb +13 -9
  15. data/examples/example.rb +24 -8
  16. data/examples/file.rb +7 -6
  17. data/lib/README-generating-pb.txt +1 -1
  18. data/lib/momento/auth/credential_provider.rb +78 -0
  19. data/lib/momento/cache_client.rb +478 -0
  20. data/lib/momento/collection_ttl.rb +79 -0
  21. data/lib/momento/config/configuration.rb +42 -0
  22. data/lib/momento/config/configurations.rb +24 -0
  23. data/lib/momento/config/transport/grpc_configuration.rb +35 -0
  24. data/lib/momento/config/transport/static_transport_strategy.rb +12 -0
  25. data/lib/momento/config/transport/transport_strategy.rb +16 -0
  26. data/lib/momento/error/types.rb +22 -0
  27. data/lib/momento/generated/README.md +16 -0
  28. data/lib/momento/generated/auth_pb.rb +52 -0
  29. data/lib/momento/generated/auth_services_pb.rb +27 -0
  30. data/lib/momento/generated/cacheclient_pb.rb +203 -0
  31. data/lib/momento/generated/cacheclient_services_pb.rb +90 -0
  32. data/lib/momento/generated/cacheping_pb.rb +38 -0
  33. data/lib/momento/generated/cacheping_services_pb.rb +23 -0
  34. data/lib/momento/generated/cachepubsub_pb.rb +48 -0
  35. data/lib/momento/generated/cachepubsub_services_pb.rb +56 -0
  36. data/lib/momento/generated/common_pb.rb +44 -0
  37. data/lib/momento/generated/controlclient_pb.rb +72 -0
  38. data/lib/momento/generated/controlclient_services_pb.rb +35 -0
  39. data/lib/momento/generated/extensions_pb.rb +35 -0
  40. data/lib/momento/generated/generate_protos.sh +47 -0
  41. data/lib/momento/generated/leaderboard_pb.rb +56 -0
  42. data/lib/momento/generated/leaderboard_services_pb.rb +57 -0
  43. data/lib/momento/generated/permissionmessages_pb.rb +48 -0
  44. data/lib/momento/generated/token_pb.rb +43 -0
  45. data/lib/momento/generated/token_services_pb.rb +23 -0
  46. data/lib/momento/generated/webhook_pb.rb +49 -0
  47. data/lib/momento/generated/webhook_services_pb.rb +32 -0
  48. data/lib/momento/response/control/create_cache_response.rb +61 -0
  49. data/lib/momento/{delete_cache_response_builder.rb → response/control/delete_cache_response.rb} +24 -3
  50. data/lib/momento/response/control/list_caches_response.rb +80 -0
  51. data/lib/momento/{delete_response_builder.rb → response/delete_response.rb} +24 -2
  52. data/lib/momento/{get_response.rb → response/get_response.rb} +39 -9
  53. data/lib/momento/{response.rb → response/response.rb} +11 -14
  54. data/lib/momento/response/set_response.rb +59 -0
  55. data/lib/momento/response/sort_order.rb +11 -0
  56. data/lib/momento/response/sorted_set/sorted_set_fetch_response.rb +107 -0
  57. data/lib/momento/response/sorted_set/sorted_set_put_element_response.rb +44 -0
  58. data/lib/momento/response/sorted_set/sorted_set_put_elements_response.rb +44 -0
  59. data/lib/momento/version.rb +1 -1
  60. data/lib/momento.rb +6 -1
  61. data/momento.gemspec +5 -3
  62. data/release-please-config.json +1 -1
  63. data/sig/momento/auth/credential_provider.rbs +11 -0
  64. data/sig/momento/cache_client.rbs +11 -0
  65. data/sig/momento/collection_ttl.rbs +22 -0
  66. data/sig/momento/config/configuration.rbs +13 -0
  67. data/sig/momento/config/configurations.rbs +9 -0
  68. data/sig/momento/config/transport/grpc_configuration.rbs +9 -0
  69. data/sig/momento/config/transport/transport_strategy.rbs +7 -0
  70. data/sig/momento/list_caches_response.rbs +7 -0
  71. data/sig/momento/sorted_set_fetch_response.rbs +13 -0
  72. data/sig/momento/sorted_set_put_element_response.rbs +5 -0
  73. data/sig/momento/sorted_set_put_elements_response.rbs +5 -0
  74. metadata +101 -40
  75. data/lib/momento/cacheclient_pb.rb +0 -334
  76. data/lib/momento/cacheclient_services_pb.rb +0 -44
  77. data/lib/momento/controlclient_pb.rb +0 -73
  78. data/lib/momento/controlclient_services_pb.rb +0 -31
  79. data/lib/momento/create_cache_response.rb +0 -37
  80. data/lib/momento/create_cache_response_builder.rb +0 -27
  81. data/lib/momento/delete_cache_response.rb +0 -24
  82. data/lib/momento/delete_response.rb +0 -24
  83. data/lib/momento/get_response_builder.rb +0 -37
  84. data/lib/momento/list_caches_response.rb +0 -77
  85. data/lib/momento/list_caches_response_builder.rb +0 -25
  86. data/lib/momento/set_response.rb +0 -39
  87. data/lib/momento/set_response_builder.rb +0 -25
  88. data/lib/momento/simple_cache_client.rb +0 -336
  89. /data/lib/momento/{response_builder.rb → response/response_builder.rb} +0 -0
@@ -0,0 +1,90 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: cacheclient.proto for package 'cache_client'
3
+
4
+ require 'grpc'
5
+ require_relative 'cacheclient_pb'
6
+
7
+ module MomentoProtos
8
+ module CacheClient
9
+ module Scs
10
+ class Service
11
+ include ::GRPC::GenericService
12
+
13
+ self.marshal_class_method = :encode
14
+ self.unmarshal_class_method = :decode
15
+ self.service_name = 'cache_client.Scs'
16
+
17
+ rpc :Get, ::MomentoProtos::CacheClient::PB__GetRequest, ::MomentoProtos::CacheClient::PB__GetResponse
18
+ rpc :GetBatch, ::MomentoProtos::CacheClient::PB__GetBatchRequest, stream(::MomentoProtos::CacheClient::PB__GetResponse)
19
+ rpc :Set, ::MomentoProtos::CacheClient::PB__SetRequest, ::MomentoProtos::CacheClient::PB__SetResponse
20
+ rpc :SetBatch, ::MomentoProtos::CacheClient::PB__SetBatchRequest, stream(::MomentoProtos::CacheClient::PB__SetResponse)
21
+ rpc :SetIf, ::MomentoProtos::CacheClient::PB__SetIfRequest, ::MomentoProtos::CacheClient::PB__SetIfResponse
22
+ # Deprecated because we have SetIf - Absent to cover this case.
23
+ rpc :SetIfNotExists, ::MomentoProtos::CacheClient::PB__SetIfNotExistsRequest, ::MomentoProtos::CacheClient::PB__SetIfNotExistsResponse
24
+ rpc :Delete, ::MomentoProtos::CacheClient::PB__DeleteRequest, ::MomentoProtos::CacheClient::PB__DeleteResponse
25
+ rpc :KeysExist, ::MomentoProtos::CacheClient::PB__KeysExistRequest, ::MomentoProtos::CacheClient::PB__KeysExistResponse
26
+ rpc :Increment, ::MomentoProtos::CacheClient::PB__IncrementRequest, ::MomentoProtos::CacheClient::PB__IncrementResponse
27
+ rpc :UpdateTtl, ::MomentoProtos::CacheClient::PB__UpdateTtlRequest, ::MomentoProtos::CacheClient::PB__UpdateTtlResponse
28
+ rpc :ItemGetTtl, ::MomentoProtos::CacheClient::PB__ItemGetTtlRequest, ::MomentoProtos::CacheClient::PB__ItemGetTtlResponse
29
+ rpc :ItemGetType, ::MomentoProtos::CacheClient::PB__ItemGetTypeRequest, ::MomentoProtos::CacheClient::PB__ItemGetTypeResponse
30
+ rpc :DictionaryGet, ::MomentoProtos::CacheClient::PB__DictionaryGetRequest, ::MomentoProtos::CacheClient::PB__DictionaryGetResponse
31
+ rpc :DictionaryFetch, ::MomentoProtos::CacheClient::PB__DictionaryFetchRequest, ::MomentoProtos::CacheClient::PB__DictionaryFetchResponse
32
+ rpc :DictionarySet, ::MomentoProtos::CacheClient::PB__DictionarySetRequest, ::MomentoProtos::CacheClient::PB__DictionarySetResponse
33
+ rpc :DictionaryIncrement, ::MomentoProtos::CacheClient::PB__DictionaryIncrementRequest, ::MomentoProtos::CacheClient::PB__DictionaryIncrementResponse
34
+ rpc :DictionaryDelete, ::MomentoProtos::CacheClient::PB__DictionaryDeleteRequest, ::MomentoProtos::CacheClient::PB__DictionaryDeleteResponse
35
+ rpc :DictionaryLength, ::MomentoProtos::CacheClient::PB__DictionaryLengthRequest, ::MomentoProtos::CacheClient::PB__DictionaryLengthResponse
36
+ rpc :SetFetch, ::MomentoProtos::CacheClient::PB__SetFetchRequest, ::MomentoProtos::CacheClient::PB__SetFetchResponse
37
+ rpc :SetSample, ::MomentoProtos::CacheClient::PB__SetSampleRequest, ::MomentoProtos::CacheClient::PB__SetSampleResponse
38
+ rpc :SetUnion, ::MomentoProtos::CacheClient::PB__SetUnionRequest, ::MomentoProtos::CacheClient::PB__SetUnionResponse
39
+ rpc :SetDifference, ::MomentoProtos::CacheClient::PB__SetDifferenceRequest, ::MomentoProtos::CacheClient::PB__SetDifferenceResponse
40
+ rpc :SetContains, ::MomentoProtos::CacheClient::PB__SetContainsRequest, ::MomentoProtos::CacheClient::PB__SetContainsResponse
41
+ rpc :SetLength, ::MomentoProtos::CacheClient::PB__SetLengthRequest, ::MomentoProtos::CacheClient::PB__SetLengthResponse
42
+ rpc :SetPop, ::MomentoProtos::CacheClient::PB__SetPopRequest, ::MomentoProtos::CacheClient::PB__SetPopResponse
43
+ rpc :ListPushFront, ::MomentoProtos::CacheClient::PB__ListPushFrontRequest, ::MomentoProtos::CacheClient::PB__ListPushFrontResponse
44
+ rpc :ListPushBack, ::MomentoProtos::CacheClient::PB__ListPushBackRequest, ::MomentoProtos::CacheClient::PB__ListPushBackResponse
45
+ rpc :ListPopFront, ::MomentoProtos::CacheClient::PB__ListPopFrontRequest, ::MomentoProtos::CacheClient::PB__ListPopFrontResponse
46
+ rpc :ListPopBack, ::MomentoProtos::CacheClient::PB__ListPopBackRequest, ::MomentoProtos::CacheClient::PB__ListPopBackResponse
47
+ rpc :ListErase, ::MomentoProtos::CacheClient::PB__ListEraseRequest, ::MomentoProtos::CacheClient::PB__ListEraseResponse
48
+ rpc :ListRemove, ::MomentoProtos::CacheClient::PB__ListRemoveRequest, ::MomentoProtos::CacheClient::PB__ListRemoveResponse
49
+ rpc :ListFetch, ::MomentoProtos::CacheClient::PB__ListFetchRequest, ::MomentoProtos::CacheClient::PB__ListFetchResponse
50
+ rpc :ListLength, ::MomentoProtos::CacheClient::PB__ListLengthRequest, ::MomentoProtos::CacheClient::PB__ListLengthResponse
51
+ rpc :ListConcatenateFront, ::MomentoProtos::CacheClient::PB__ListConcatenateFrontRequest, ::MomentoProtos::CacheClient::PB__ListConcatenateFrontResponse
52
+ rpc :ListConcatenateBack, ::MomentoProtos::CacheClient::PB__ListConcatenateBackRequest, ::MomentoProtos::CacheClient::PB__ListConcatenateBackResponse
53
+ rpc :ListRetain, ::MomentoProtos::CacheClient::PB__ListRetainRequest, ::MomentoProtos::CacheClient::PB__ListRetainResponse
54
+ # Sorted Set Operations
55
+ # A sorted set is a collection of elements ordered by their score.
56
+ # The elements with same score are ordered lexicographically.
57
+ #
58
+ # Add or Updates new element with its score to the Sorted Set.
59
+ # If sorted set doesn't exist, a new one is created with the specified
60
+ # element and its associated score.
61
+ # If an element exists, then its associate score gets overridden with the one
62
+ # provided in this operation.
63
+ rpc :SortedSetPut, ::MomentoProtos::CacheClient::PB__SortedSetPutRequest, ::MomentoProtos::CacheClient::PB__SortedSetPutResponse
64
+ # Fetches a subset of elements in the sorted set.
65
+ rpc :SortedSetFetch, ::MomentoProtos::CacheClient::PB__SortedSetFetchRequest, ::MomentoProtos::CacheClient::PB__SortedSetFetchResponse
66
+ # Gets the specified element and its associated score if it exists in the
67
+ # sorted set.
68
+ rpc :SortedSetGetScore, ::MomentoProtos::CacheClient::PB__SortedSetGetScoreRequest, ::MomentoProtos::CacheClient::PB__SortedSetGetScoreResponse
69
+ # Removes specified elements and their associated scores
70
+ rpc :SortedSetRemove, ::MomentoProtos::CacheClient::PB__SortedSetRemoveRequest, ::MomentoProtos::CacheClient::PB__SortedSetRemoveResponse
71
+ # Changes the score associated with the element by specified amount.
72
+ # If the provided amount is negative, then the score associated with the
73
+ # element is decremented.
74
+ # If the element that needs to be incremented isn't present in the sorted
75
+ # set, it is added with specified number as the score.
76
+ # If the set itself doesn't exist then a new one with specified element and
77
+ # score is created.
78
+ rpc :SortedSetIncrement, ::MomentoProtos::CacheClient::PB__SortedSetIncrementRequest, ::MomentoProtos::CacheClient::PB__SortedSetIncrementResponse
79
+ # Gives the rank of an element.
80
+ rpc :SortedSetGetRank, ::MomentoProtos::CacheClient::PB__SortedSetGetRankRequest, ::MomentoProtos::CacheClient::PB__SortedSetGetRankResponse
81
+ # Returns length of the sorted set
82
+ rpc :SortedSetLength, ::MomentoProtos::CacheClient::PB__SortedSetLengthRequest, ::MomentoProtos::CacheClient::PB__SortedSetLengthResponse
83
+ # Returns number of elements in the sorted set between a given min and max score
84
+ rpc :SortedSetLengthByScore, ::MomentoProtos::CacheClient::PB__SortedSetLengthByScoreRequest, ::MomentoProtos::CacheClient::PB__SortedSetLengthByScoreResponse
85
+ end
86
+
87
+ Stub = Service.rpc_stub_class
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
4
+ # source: cacheping.proto
5
+
6
+ require 'google/protobuf'
7
+
8
+ descriptor_data = "\n\x0f\x63\x61\x63heping.proto\x12\x0c\x63\x61\x63he_client\"\x0e\n\x0c_PingRequest\"\x0f\n\r_PingResponse2I\n\x04Ping\x12\x41\n\x04Ping\x12\x1a.cache_client._PingRequest\x1a\x1b.cache_client._PingResponse\"\x00\x42\x62\n\x11grpc.cache_clientP\x01Z0github.com/momentohq/client-sdk-go;client_sdk_go\xaa\x02\x18Momento.Protos.CachePingb\x06proto3"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+
12
+ begin
13
+ pool.add_serialized_file(descriptor_data)
14
+ rescue TypeError
15
+ # Compatibility code: will be removed in the next major version.
16
+ require_relative 'google/protobuf/descriptor_pb'
17
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
18
+ parsed.clear_dependency
19
+ serialized = parsed.class.encode(parsed)
20
+ file = pool.add_serialized_file(serialized)
21
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
22
+ imports = []
23
+ imports.each do |type_name, expected_filename|
24
+ import_file = pool.lookup(type_name).file_descriptor
25
+ if import_file.name != expected_filename
26
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
27
+ end
28
+ end
29
+ warn "Each proto file must use a consistent fully-qualified name."
30
+ warn "This will become an error in the next major version."
31
+ end
32
+
33
+ module MomentoProtos
34
+ module CacheClient
35
+ PB__PingRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cache_client._PingRequest").msgclass
36
+ PB__PingResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cache_client._PingResponse").msgclass
37
+ end
38
+ end
@@ -0,0 +1,23 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: cacheping.proto for package 'cache_client'
3
+
4
+ require 'grpc'
5
+ require_relative 'cacheping_pb'
6
+
7
+ module MomentoProtos
8
+ module CacheClient
9
+ module Ping
10
+ class Service
11
+ include ::GRPC::GenericService
12
+
13
+ self.marshal_class_method = :encode
14
+ self.unmarshal_class_method = :decode
15
+ self.service_name = 'cache_client.Ping'
16
+
17
+ rpc :Ping, ::MomentoProtos::CacheClient::PB__PingRequest, ::MomentoProtos::CacheClient::PB__PingResponse
18
+ end
19
+
20
+ Stub = Service.rpc_stub_class
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
4
+ # source: cachepubsub.proto
5
+
6
+ require 'google/protobuf'
7
+
8
+ require_relative 'common_pb'
9
+ require_relative 'extensions_pb'
10
+
11
+ descriptor_data = "\n\x11\x63\x61\x63hepubsub.proto\x12\x13\x63\x61\x63he_client.pubsub\x1a\x0c\x63ommon.proto\x1a\x10\x65xtensions.proto\"k\n\x0f_PublishRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\x12\r\n\x05topic\x18\x02 \x01(\t\x12/\n\x05value\x18\x03 \x01(\x0b\x32 .cache_client.pubsub._TopicValue:\x04\x80\xb5\x18\x00\"h\n\x14_SubscriptionRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\x12\r\n\x05topic\x18\x02 \x01(\t\x12'\n\x1fresume_at_topic_sequence_number\x18\x03 \x01(\x04:\x04\x80\xb5\x18\x01\"\xc0\x01\n\x11_SubscriptionItem\x12/\n\x04item\x18\x01 \x01(\x0b\x32\x1f.cache_client.pubsub._TopicItemH\x00\x12<\n\rdiscontinuity\x18\x02 \x01(\x0b\x32#.cache_client.pubsub._DiscontinuityH\x00\x12\x34\n\theartbeat\x18\x03 \x01(\x0b\x32\x1f.cache_client.pubsub._HeartbeatH\x00\x42\x06\n\x04kind\"r\n\n_TopicItem\x12\x1d\n\x15topic_sequence_number\x18\x01 \x01(\x04\x12/\n\x05value\x18\x02 \x01(\x0b\x32 .cache_client.pubsub._TopicValue\x12\x14\n\x0cpublisher_id\x18\x03 \x01(\t\"7\n\x0b_TopicValue\x12\x0e\n\x04text\x18\x01 \x01(\tH\x00\x12\x10\n\x06\x62inary\x18\x02 \x01(\x0cH\x00\x42\x06\n\x04kind\"I\n\x0e_Discontinuity\x12\x1b\n\x13last_topic_sequence\x18\x01 \x01(\x04\x12\x1a\n\x12new_topic_sequence\x18\x02 \x01(\x04\"\x0c\n\n_Heartbeat2\xab\x01\n\x06Pubsub\x12?\n\x07Publish\x12$.cache_client.pubsub._PublishRequest\x1a\x0e.common._Empty\x12`\n\tSubscribe\x12).cache_client.pubsub._SubscriptionRequest\x1a&.cache_client.pubsub._SubscriptionItem0\x01\x42r\n\x18grpc.cache_client.pubsubP\x01Z0github.com/momentohq/client-sdk-go;client_sdk_go\xaa\x02!Momento.Protos.CacheClient.Pubsubb\x06proto3"
12
+
13
+ pool = Google::Protobuf::DescriptorPool.generated_pool
14
+
15
+ begin
16
+ pool.add_serialized_file(descriptor_data)
17
+ rescue TypeError
18
+ # Compatibility code: will be removed in the next major version.
19
+ require_relative 'google/protobuf/descriptor_pb'
20
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
21
+ parsed.clear_dependency
22
+ serialized = parsed.class.encode(parsed)
23
+ file = pool.add_serialized_file(serialized)
24
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
25
+ imports = []
26
+ imports.each do |type_name, expected_filename|
27
+ import_file = pool.lookup(type_name).file_descriptor
28
+ if import_file.name != expected_filename
29
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
30
+ end
31
+ end
32
+ warn "Each proto file must use a consistent fully-qualified name."
33
+ warn "This will become an error in the next major version."
34
+ end
35
+
36
+ module MomentoProtos
37
+ module CacheClient
38
+ module Pubsub
39
+ PB__PublishRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cache_client.pubsub._PublishRequest").msgclass
40
+ PB__SubscriptionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cache_client.pubsub._SubscriptionRequest").msgclass
41
+ PB__SubscriptionItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cache_client.pubsub._SubscriptionItem").msgclass
42
+ PB__TopicItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cache_client.pubsub._TopicItem").msgclass
43
+ PB__TopicValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cache_client.pubsub._TopicValue").msgclass
44
+ PB__Discontinuity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cache_client.pubsub._Discontinuity").msgclass
45
+ PB__Heartbeat = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("cache_client.pubsub._Heartbeat").msgclass
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,56 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: cachepubsub.proto for package 'cache_client.pubsub'
3
+
4
+ require 'grpc'
5
+ require_relative 'cachepubsub_pb'
6
+
7
+ module MomentoProtos
8
+ module CacheClient
9
+ module Pubsub
10
+ module Pubsub
11
+ # For working with topics in a cache.
12
+ # Momento topics are conceptually located on a cache. They are best-effort multicast.
13
+ # To use them, create a cache then start subscribing and publishing!
14
+ #
15
+ # Momento topic subscriptions try to give you information about the quality of the
16
+ # stream you are receiving. For example, you might miss messages if your network
17
+ # is slow, or if some intermediate switch fails, or due to rate limiting. It is
18
+ # also possible, though we try to avoid it, that messages could briefly come out
19
+ # of order between subscribers.
20
+ # We try to tell you when things like this happen via a Discontinuity in your
21
+ # subscription stream. If you do not care about occasional discontinuities then
22
+ # don't bother handling them! You might still want to log them just in case ;-)
23
+ class Service
24
+ include ::GRPC::GenericService
25
+
26
+ self.marshal_class_method = :encode
27
+ self.unmarshal_class_method = :decode
28
+ self.service_name = 'cache_client.pubsub.Pubsub'
29
+
30
+ # Publish a message to a topic.
31
+ #
32
+ # If a topic has no subscribers, then the effect of Publish MAY be either of:
33
+ # * It is dropped and the topic is nonexistent.
34
+ # * It is accepted to the topic as the next message.
35
+ #
36
+ # Publish() does not wait for subscribers to accept. It returns Ok upon accepting
37
+ # the topic value. It also returns Ok if there are no subscribers and the value
38
+ # happens to be dropped. Publish() can not guarantee delivery in theory but in
39
+ # practice it should almost always deliver to subscribers.
40
+ #
41
+ # REQUIRES HEADER authorization: Momento auth token
42
+ rpc :Publish, ::MomentoProtos::CacheClient::Pubsub::PB__PublishRequest, ::Common::PB__Empty
43
+ # Subscribe to notifications from a topic.
44
+ #
45
+ # You will receive a stream of values and (hopefully occasional) discontinuities.
46
+ # Values will appear as copies of the payloads you Publish() to the topic.
47
+ #
48
+ # REQUIRES HEADER authorization: Momento auth token
49
+ rpc :Subscribe, ::MomentoProtos::CacheClient::Pubsub::PB__SubscriptionRequest, stream(::MomentoProtos::CacheClient::Pubsub::PB__SubscriptionItem)
50
+ end
51
+
52
+ Stub = Service.rpc_stub_class
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
4
+ # source: common.proto
5
+
6
+ require 'google/protobuf'
7
+
8
+ descriptor_data = "\n\x0c\x63ommon.proto\x12\x06\x63ommon\"\t\n\x07Present\",\n\x12PresentAndNotEqual\x12\x16\n\x0evalue_to_check\x18\x01 \x01(\x0c\"\x08\n\x06\x41\x62sent\"\x1f\n\x05\x45qual\x12\x16\n\x0evalue_to_check\x18\x01 \x01(\x0c\"'\n\rAbsentOrEqual\x12\x16\n\x0evalue_to_check\x18\x01 \x01(\x0c\"\"\n\x08NotEqual\x12\x16\n\x0evalue_to_check\x18\x01 \x01(\x0c\"\x0c\n\n_Unbounded\"\x08\n\x06_EmptyBY\n\x0bgrpc.commonP\x01Z0github.com/momentohq/client-sdk-go;client_sdk_go\xaa\x02\x15Momento.Protos.Commonb\x06proto3"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+
12
+ begin
13
+ pool.add_serialized_file(descriptor_data)
14
+ rescue TypeError
15
+ # Compatibility code: will be removed in the next major version.
16
+ require_relative 'google/protobuf/descriptor_pb'
17
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
18
+ parsed.clear_dependency
19
+ serialized = parsed.class.encode(parsed)
20
+ file = pool.add_serialized_file(serialized)
21
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
22
+ imports = []
23
+ imports.each do |type_name, expected_filename|
24
+ import_file = pool.lookup(type_name).file_descriptor
25
+ if import_file.name != expected_filename
26
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
27
+ end
28
+ end
29
+ warn "Each proto file must use a consistent fully-qualified name."
30
+ warn "This will become an error in the next major version."
31
+ end
32
+
33
+ module MomentoProtos
34
+ module Common
35
+ Present = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("common.Present").msgclass
36
+ PresentAndNotEqual = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("common.PresentAndNotEqual").msgclass
37
+ Absent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("common.Absent").msgclass
38
+ Equal = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("common.Equal").msgclass
39
+ AbsentOrEqual = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("common.AbsentOrEqual").msgclass
40
+ NotEqual = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("common.NotEqual").msgclass
41
+ PB__Unbounded = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("common._Unbounded").msgclass
42
+ PB__Empty = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("common._Empty").msgclass
43
+ end
44
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
4
+ # source: controlclient.proto
5
+
6
+ require 'google/protobuf'
7
+
8
+ descriptor_data = "\n\x13\x63ontrolclient.proto\x12\x0e\x63ontrol_client\")\n\x13_CreateStoreRequest\x12\x12\n\nstore_name\x18\x01 \x01(\t\"\x16\n\x14_CreateStoreResponse\")\n\x13_DeleteStoreRequest\x12\x12\n\nstore_name\x18\x01 \x01(\t\"\x16\n\x14_DeleteStoreResponse\"(\n\x12_ListStoresRequest\x12\x12\n\nnext_token\x18\x01 \x01(\t\"P\n\x13_ListStoresResponse\x12%\n\x05store\x18\x01 \x03(\x0b\x32\x16.control_client._Store\x12\x12\n\nnext_token\x18\x02 \x01(\t\"\x1c\n\x06_Store\x12\x12\n\nstore_name\x18\x01 \x01(\t\"\xda\x02\n\x11_SimilarityMetric\x12V\n\x14\x65uclidean_similarity\x18\x01 \x01(\x0b\x32\x36.control_client._SimilarityMetric._EuclideanSimilarityH\x00\x12H\n\rinner_product\x18\x02 \x01(\x0b\x32/.control_client._SimilarityMetric._InnerProductH\x00\x12P\n\x11\x63osine_similarity\x18\x03 \x01(\x0b\x32\x33.control_client._SimilarityMetric._CosineSimilarityH\x00\x1a\x16\n\x14_EuclideanSimilarity\x1a\x0f\n\r_InnerProduct\x1a\x13\n\x11_CosineSimilarityB\x13\n\x11similarity_metric\"\x7f\n\x13_CreateIndexRequest\x12\x12\n\nindex_name\x18\x01 \x01(\t\x12\x16\n\x0enum_dimensions\x18\x02 \x01(\x04\x12<\n\x11similarity_metric\x18\x03 \x01(\x0b\x32!.control_client._SimilarityMetric\"\x16\n\x14_CreateIndexResponse\")\n\x13_DeleteIndexRequest\x12\x12\n\nindex_name\x18\x01 \x01(\t\"\x16\n\x14_DeleteIndexResponse\"\x15\n\x13_ListIndexesRequest\"\xc8\x01\n\x14_ListIndexesResponse\x12<\n\x07indexes\x18\x01 \x03(\x0b\x32+.control_client._ListIndexesResponse._Index\x1ar\n\x06_Index\x12\x12\n\nindex_name\x18\x01 \x01(\t\x12\x16\n\x0enum_dimensions\x18\x02 \x01(\x04\x12<\n\x11similarity_metric\x18\x03 \x01(\x0b\x32!.control_client._SimilarityMetric\")\n\x13_DeleteCacheRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\"\x16\n\x14_DeleteCacheResponse\")\n\x13_CreateCacheRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\"\x16\n\x14_CreateCacheResponse\"(\n\x12_ListCachesRequest\x12\x12\n\nnext_token\x18\x01 \x01(\t\"x\n\x0c_CacheLimits\x12\x18\n\x10max_traffic_rate\x18\x01 \x01(\r\x12\x1b\n\x13max_throughput_kbps\x18\x02 \x01(\r\x12\x18\n\x10max_item_size_kb\x18\x03 \x01(\r\x12\x17\n\x0fmax_ttl_seconds\x18\x04 \x01(\x04\"m\n\x0c_TopicLimits\x12\x18\n\x10max_publish_rate\x18\x01 \x01(\r\x12\x1e\n\x16max_subscription_count\x18\x02 \x01(\r\x12#\n\x1bmax_publish_message_size_kb\x18\x03 \x01(\r\"\x84\x01\n\x06_Cache\x12\x12\n\ncache_name\x18\x01 \x01(\t\x12\x32\n\x0c\x63\x61\x63he_limits\x18\x02 \x01(\x0b\x32\x1c.control_client._CacheLimits\x12\x32\n\x0ctopic_limits\x18\x03 \x01(\x0b\x32\x1c.control_client._TopicLimits\"P\n\x13_ListCachesResponse\x12%\n\x05\x63\x61\x63he\x18\x01 \x03(\x0b\x32\x16.control_client._Cache\x12\x12\n\nnext_token\x18\x02 \x01(\t\"/\n\x18_CreateSigningKeyRequest\x12\x13\n\x0bttl_minutes\x18\x01 \x01(\r\"<\n\x19_CreateSigningKeyResponse\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x12\n\nexpires_at\x18\x02 \x01(\x04\"*\n\x18_RevokeSigningKeyRequest\x12\x0e\n\x06key_id\x18\x01 \x01(\t\"\x1b\n\x19_RevokeSigningKeyResponse\"1\n\x0b_SigningKey\x12\x0e\n\x06key_id\x18\x01 \x01(\t\x12\x12\n\nexpires_at\x18\x02 \x01(\x04\"-\n\x17_ListSigningKeysRequest\x12\x12\n\nnext_token\x18\x01 \x01(\t\"`\n\x18_ListSigningKeysResponse\x12\x30\n\x0bsigning_key\x18\x01 \x03(\x0b\x32\x1b.control_client._SigningKey\x12\x12\n\nnext_token\x18\x02 \x01(\t\"(\n\x12_FlushCacheRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\"\x15\n\x13_FlushCacheResponse2\xd9\t\n\nScsControl\x12Z\n\x0b\x43reateCache\x12#.control_client._CreateCacheRequest\x1a$.control_client._CreateCacheResponse\"\x00\x12Z\n\x0b\x44\x65leteCache\x12#.control_client._DeleteCacheRequest\x1a$.control_client._DeleteCacheResponse\"\x00\x12W\n\nListCaches\x12\".control_client._ListCachesRequest\x1a#.control_client._ListCachesResponse\"\x00\x12W\n\nFlushCache\x12\".control_client._FlushCacheRequest\x1a#.control_client._FlushCacheResponse\"\x00\x12i\n\x10\x43reateSigningKey\x12(.control_client._CreateSigningKeyRequest\x1a).control_client._CreateSigningKeyResponse\"\x00\x12i\n\x10RevokeSigningKey\x12(.control_client._RevokeSigningKeyRequest\x1a).control_client._RevokeSigningKeyResponse\"\x00\x12\x66\n\x0fListSigningKeys\x12'.control_client._ListSigningKeysRequest\x1a(.control_client._ListSigningKeysResponse\"\x00\x12Z\n\x0b\x43reateIndex\x12#.control_client._CreateIndexRequest\x1a$.control_client._CreateIndexResponse\"\x00\x12Z\n\x0b\x44\x65leteIndex\x12#.control_client._DeleteIndexRequest\x1a$.control_client._DeleteIndexResponse\"\x00\x12Z\n\x0bListIndexes\x12#.control_client._ListIndexesRequest\x1a$.control_client._ListIndexesResponse\"\x00\x12Z\n\x0b\x43reateStore\x12#.control_client._CreateStoreRequest\x1a$.control_client._CreateStoreResponse\"\x00\x12Z\n\x0b\x44\x65leteStore\x12#.control_client._DeleteStoreRequest\x1a$.control_client._DeleteStoreResponse\"\x00\x12W\n\nListStores\x12\".control_client._ListStoresRequest\x1a#.control_client._ListStoresResponse\"\x00\x42h\n\x13grpc.control_clientP\x01Z0github.com/momentohq/client-sdk-go;client_sdk_go\xaa\x02\x1cMomento.Protos.ControlClientb\x06proto3"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+
12
+ begin
13
+ pool.add_serialized_file(descriptor_data)
14
+ rescue TypeError
15
+ # Compatibility code: will be removed in the next major version.
16
+ require_relative 'google/protobuf/descriptor_pb'
17
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
18
+ parsed.clear_dependency
19
+ serialized = parsed.class.encode(parsed)
20
+ file = pool.add_serialized_file(serialized)
21
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
22
+ imports = []
23
+ imports.each do |type_name, expected_filename|
24
+ import_file = pool.lookup(type_name).file_descriptor
25
+ if import_file.name != expected_filename
26
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
27
+ end
28
+ end
29
+ warn "Each proto file must use a consistent fully-qualified name."
30
+ warn "This will become an error in the next major version."
31
+ end
32
+
33
+ module MomentoProtos
34
+ module ControlClient
35
+ PB__CreateStoreRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._CreateStoreRequest").msgclass
36
+ PB__CreateStoreResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._CreateStoreResponse").msgclass
37
+ PB__DeleteStoreRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._DeleteStoreRequest").msgclass
38
+ PB__DeleteStoreResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._DeleteStoreResponse").msgclass
39
+ PB__ListStoresRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._ListStoresRequest").msgclass
40
+ PB__ListStoresResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._ListStoresResponse").msgclass
41
+ PB__Store = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._Store").msgclass
42
+ PB__SimilarityMetric = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._SimilarityMetric").msgclass
43
+ PB__SimilarityMetric::PB__EuclideanSimilarity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._SimilarityMetric._EuclideanSimilarity").msgclass
44
+ PB__SimilarityMetric::PB__InnerProduct = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._SimilarityMetric._InnerProduct").msgclass
45
+ PB__SimilarityMetric::PB__CosineSimilarity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._SimilarityMetric._CosineSimilarity").msgclass
46
+ PB__CreateIndexRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._CreateIndexRequest").msgclass
47
+ PB__CreateIndexResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._CreateIndexResponse").msgclass
48
+ PB__DeleteIndexRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._DeleteIndexRequest").msgclass
49
+ PB__DeleteIndexResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._DeleteIndexResponse").msgclass
50
+ PB__ListIndexesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._ListIndexesRequest").msgclass
51
+ PB__ListIndexesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._ListIndexesResponse").msgclass
52
+ PB__ListIndexesResponse::PB__Index = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._ListIndexesResponse._Index").msgclass
53
+ PB__DeleteCacheRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._DeleteCacheRequest").msgclass
54
+ PB__DeleteCacheResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._DeleteCacheResponse").msgclass
55
+ PB__CreateCacheRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._CreateCacheRequest").msgclass
56
+ PB__CreateCacheResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._CreateCacheResponse").msgclass
57
+ PB__ListCachesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._ListCachesRequest").msgclass
58
+ PB__CacheLimits = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._CacheLimits").msgclass
59
+ PB__TopicLimits = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._TopicLimits").msgclass
60
+ PB__Cache = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._Cache").msgclass
61
+ PB__ListCachesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._ListCachesResponse").msgclass
62
+ PB__CreateSigningKeyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._CreateSigningKeyRequest").msgclass
63
+ PB__CreateSigningKeyResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._CreateSigningKeyResponse").msgclass
64
+ PB__RevokeSigningKeyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._RevokeSigningKeyRequest").msgclass
65
+ PB__RevokeSigningKeyResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._RevokeSigningKeyResponse").msgclass
66
+ PB__SigningKey = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._SigningKey").msgclass
67
+ PB__ListSigningKeysRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._ListSigningKeysRequest").msgclass
68
+ PB__ListSigningKeysResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._ListSigningKeysResponse").msgclass
69
+ PB__FlushCacheRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._FlushCacheRequest").msgclass
70
+ PB__FlushCacheResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("control_client._FlushCacheResponse").msgclass
71
+ end
72
+ end
@@ -0,0 +1,35 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: controlclient.proto for package 'control_client'
3
+
4
+ require 'grpc'
5
+ require_relative 'controlclient_pb'
6
+
7
+ module MomentoProtos
8
+ module ControlClient
9
+ module ScsControl
10
+ class Service
11
+ include ::GRPC::GenericService
12
+
13
+ self.marshal_class_method = :encode
14
+ self.unmarshal_class_method = :decode
15
+ self.service_name = 'control_client.ScsControl'
16
+
17
+ rpc :CreateCache, ::MomentoProtos::ControlClient::PB__CreateCacheRequest, ::MomentoProtos::ControlClient::PB__CreateCacheResponse
18
+ rpc :DeleteCache, ::MomentoProtos::ControlClient::PB__DeleteCacheRequest, ::MomentoProtos::ControlClient::PB__DeleteCacheResponse
19
+ rpc :ListCaches, ::MomentoProtos::ControlClient::PB__ListCachesRequest, ::MomentoProtos::ControlClient::PB__ListCachesResponse
20
+ rpc :FlushCache, ::MomentoProtos::ControlClient::PB__FlushCacheRequest, ::MomentoProtos::ControlClient::PB__FlushCacheResponse
21
+ rpc :CreateSigningKey, ::MomentoProtos::ControlClient::PB__CreateSigningKeyRequest, ::MomentoProtos::ControlClient::PB__CreateSigningKeyResponse
22
+ rpc :RevokeSigningKey, ::MomentoProtos::ControlClient::PB__RevokeSigningKeyRequest, ::MomentoProtos::ControlClient::PB__RevokeSigningKeyResponse
23
+ rpc :ListSigningKeys, ::MomentoProtos::ControlClient::PB__ListSigningKeysRequest, ::MomentoProtos::ControlClient::PB__ListSigningKeysResponse
24
+ rpc :CreateIndex, ::MomentoProtos::ControlClient::PB__CreateIndexRequest, ::MomentoProtos::ControlClient::PB__CreateIndexResponse
25
+ rpc :DeleteIndex, ::MomentoProtos::ControlClient::PB__DeleteIndexRequest, ::MomentoProtos::ControlClient::PB__DeleteIndexResponse
26
+ rpc :ListIndexes, ::MomentoProtos::ControlClient::PB__ListIndexesRequest, ::MomentoProtos::ControlClient::PB__ListIndexesResponse
27
+ rpc :CreateStore, ::MomentoProtos::ControlClient::PB__CreateStoreRequest, ::MomentoProtos::ControlClient::PB__CreateStoreResponse
28
+ rpc :DeleteStore, ::MomentoProtos::ControlClient::PB__DeleteStoreRequest, ::MomentoProtos::ControlClient::PB__DeleteStoreResponse
29
+ rpc :ListStores, ::MomentoProtos::ControlClient::PB__ListStoresRequest, ::MomentoProtos::ControlClient::PB__ListStoresResponse
30
+ end
31
+
32
+ Stub = Service.rpc_stub_class
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
4
+ # source: extensions.proto
5
+
6
+ require 'google/protobuf'
7
+
8
+ require_relative 'google/protobuf/descriptor_pb'
9
+
10
+ descriptor_data = "\n\x10\x65xtensions.proto\x1a google/protobuf/descriptor.proto*0\n\rRetrySemantic\x12\x10\n\x0cNotRetryable\x10\x00\x12\r\n\tRetryable\x10\x01:I\n\x0eretry_semantic\x12\x1f.google.protobuf.MessageOptions\x18\xd0\x86\x03 \x01(\x0e\x32\x0e.RetrySemanticB_\n\x0fgrpc.extensionsZ0github.com/momentohq/client-sdk-go;client_sdk_go\xaa\x02\x19Momento.Protos.Extensionsb\x06proto3"
11
+
12
+ pool = Google::Protobuf::DescriptorPool.generated_pool
13
+
14
+ begin
15
+ pool.add_serialized_file(descriptor_data)
16
+ rescue TypeError
17
+ # Compatibility code: will be removed in the next major version.
18
+ require_relative 'google/protobuf/descriptor_pb'
19
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
20
+ parsed.clear_dependency
21
+ serialized = parsed.class.encode(parsed)
22
+ file = pool.add_serialized_file(serialized)
23
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
24
+ imports = []
25
+ imports.each do |type_name, expected_filename|
26
+ import_file = pool.lookup(type_name).file_descriptor
27
+ if import_file.name != expected_filename
28
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
29
+ end
30
+ end
31
+ warn "Each proto file must use a consistent fully-qualified name."
32
+ warn "This will become an error in the next major version."
33
+ end
34
+
35
+ RetrySemantic = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("RetrySemantic").enummodule
@@ -0,0 +1,47 @@
1
+ #!/bin/bash
2
+ set -e
3
+ set -x
4
+
5
+ # Must specify the path to the proto files
6
+ if [ -z "${PROTO_PATH}" ]; then
7
+ echo "PROTO_PATH is not set, please specify the path to the client-protos/proto directory"
8
+ exit 1
9
+ fi
10
+
11
+ # Remove existing generated code
12
+ rm -f *_pb.rb
13
+
14
+ # Copy files over temporarily
15
+ cp ${PROTO_PATH}/*.proto ./
16
+
17
+ # Remove files we don't want to generate code from
18
+ rm -f ./httpcache.proto
19
+ rm -f ./vectorindex.proto
20
+
21
+ # Generate the code
22
+ grpc_tools_ruby_protoc -I ./ --ruby_out=./ --grpc_out=./ ./*.proto
23
+
24
+ # Remove the protos
25
+ rm -f ./*.proto
26
+
27
+ # In the *_pb.rb files, replace the require with require_relative
28
+ sed -i '' -E "s/require '(.*)_pb'/require_relative '\1_pb'/g" *_pb.rb
29
+
30
+ # Wrap the generated code in a module named MomentoProtos, but only the top-level modules
31
+ for file in *_pb.rb; do
32
+ sed -i '' -E 's/^module (.*)/module MomentoProtos::\1/g' $file
33
+ done
34
+
35
+ # Run the linter, converts from :: syntax to nested modules
36
+ rubocop -A --disable-uncorrectable *_pb.rb
37
+
38
+ # In the *_services_pb.rb files, change the module names.
39
+ # * rename ::ControlClient to ::MomentoProtos::ControlClient
40
+ # * rename ::CacheClient to ::MomentoProtos::CacheClient
41
+ for file in *_services_pb.rb; do
42
+ sed -i '' -E 's/::ControlClient::/::MomentoProtos::ControlClient::/g' $file
43
+ sed -i '' -E 's/::CacheClient::/::MomentoProtos::CacheClient::/g' $file
44
+ done
45
+
46
+ # Run the linter
47
+ rubocop -A *_pb.rb
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
4
+ # source: leaderboard.proto
5
+
6
+ require 'google/protobuf'
7
+
8
+ require_relative 'common_pb'
9
+
10
+ descriptor_data = "\n\x11leaderboard.proto\x12\x0bleaderboard\x1a\x0c\x63ommon.proto\"+\n\x08_Element\x12\n\n\x02id\x18\x01 \x01(\r\x12\r\n\x05score\x18\x03 \x01(\x01J\x04\x08\x02\x10\x03\"?\n\x0e_RankedElement\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0c\n\x04rank\x18\x03 \x01(\r\x12\r\n\x05score\x18\x04 \x01(\x01J\x04\x08\x02\x10\x03\"<\n\n_RankRange\x12\x17\n\x0fstart_inclusive\x18\x01 \x01(\r\x12\x15\n\rend_exclusive\x18\x02 \x01(\r\"\xb3\x01\n\x0b_ScoreRange\x12+\n\runbounded_min\x18\x01 \x01(\x0b\x32\x12.common._UnboundedH\x00\x12\x17\n\rmin_inclusive\x18\x05 \x01(\x01H\x00\x12+\n\runbounded_max\x18\x03 \x01(\x0b\x32\x12.common._UnboundedH\x01\x12\x17\n\rmax_exclusive\x18\x06 \x01(\x01H\x01\x42\x05\n\x03minB\x05\n\x03maxJ\x04\x08\x02\x10\x03J\x04\x08\x04\x10\x05\"D\n\x19_DeleteLeaderboardRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\x12\x13\n\x0bleaderboard\x18\x02 \x01(\t\"G\n\x1c_GetLeaderboardLengthRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\x12\x13\n\x0bleaderboard\x18\x02 \x01(\t\".\n\x1d_GetLeaderboardLengthResponse\x12\r\n\x05\x63ount\x18\x01 \x01(\r\"j\n\x16_UpsertElementsRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\x12\x13\n\x0bleaderboard\x18\x02 \x01(\t\x12'\n\x08\x65lements\x18\x03 \x03(\x0b\x32\x15.leaderboard._Element\"\x8d\x01\n\x11_GetByRankRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\x12\x13\n\x0bleaderboard\x18\x02 \x01(\t\x12+\n\nrank_range\x18\x03 \x01(\x0b\x32\x17.leaderboard._RankRange\x12\"\n\x05order\x18\x04 \x01(\x0e\x32\x13.leaderboard._Order\"C\n\x12_GetByRankResponse\x12-\n\x08\x65lements\x18\x01 \x03(\x0b\x32\x1b.leaderboard._RankedElement\"k\n\x0f_GetRankRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\x12\x13\n\x0bleaderboard\x18\x02 \x01(\t\x12\x0b\n\x03ids\x18\x03 \x03(\r\x12\"\n\x05order\x18\x04 \x01(\x0e\x32\x13.leaderboard._Order\"A\n\x10_GetRankResponse\x12-\n\x08\x65lements\x18\x01 \x03(\x0b\x32\x1b.leaderboard._RankedElement\"N\n\x16_RemoveElementsRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\x12\x13\n\x0bleaderboard\x18\x02 \x01(\t\x12\x0b\n\x03ids\x18\x03 \x03(\r\"\xb8\x01\n\x12_GetByScoreRequest\x12\x12\n\ncache_name\x18\x01 \x01(\t\x12\x13\n\x0bleaderboard\x18\x02 \x01(\t\x12-\n\x0bscore_range\x18\x03 \x01(\x0b\x32\x18.leaderboard._ScoreRange\x12\x0e\n\x06offset\x18\x04 \x01(\r\x12\x16\n\x0elimit_elements\x18\x05 \x01(\r\x12\"\n\x05order\x18\x06 \x01(\x0e\x32\x13.leaderboard._Order\"D\n\x13_GetByScoreResponse\x12-\n\x08\x65lements\x18\x01 \x03(\x0b\x32\x1b.leaderboard._RankedElement*'\n\x06_Order\x12\r\n\tASCENDING\x10\x00\x12\x0e\n\nDESCENDING\x10\x01\x32\xbe\x04\n\x0bLeaderboard\x12K\n\x11\x44\x65leteLeaderboard\x12&.leaderboard._DeleteLeaderboardRequest\x1a\x0e.common._Empty\x12\x45\n\x0eUpsertElements\x12#.leaderboard._UpsertElementsRequest\x1a\x0e.common._Empty\x12\x45\n\x0eRemoveElements\x12#.leaderboard._RemoveElementsRequest\x1a\x0e.common._Empty\x12m\n\x14GetLeaderboardLength\x12).leaderboard._GetLeaderboardLengthRequest\x1a*.leaderboard._GetLeaderboardLengthResponse\x12L\n\tGetByRank\x12\x1e.leaderboard._GetByRankRequest\x1a\x1f.leaderboard._GetByRankResponse\x12\x46\n\x07GetRank\x12\x1c.leaderboard._GetRankRequest\x1a\x1d.leaderboard._GetRankResponse\x12O\n\nGetByScore\x12\x1f.leaderboard._GetByScoreRequest\x1a .leaderboard._GetByScoreResponseBc\n\x10grpc.leaderboardP\x01Z0github.com/momentohq/client-sdk-go;client_sdk_go\xaa\x02\x1aMomento.Protos.Leaderboardb\x06proto3"
11
+
12
+ pool = Google::Protobuf::DescriptorPool.generated_pool
13
+
14
+ begin
15
+ pool.add_serialized_file(descriptor_data)
16
+ rescue TypeError
17
+ # Compatibility code: will be removed in the next major version.
18
+ require_relative 'google/protobuf/descriptor_pb'
19
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
20
+ parsed.clear_dependency
21
+ serialized = parsed.class.encode(parsed)
22
+ file = pool.add_serialized_file(serialized)
23
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
24
+ imports = [
25
+ ["common._Unbounded", "common.proto"]
26
+ ]
27
+ imports.each do |type_name, expected_filename|
28
+ import_file = pool.lookup(type_name).file_descriptor
29
+ if import_file.name != expected_filename
30
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
31
+ end
32
+ end
33
+ warn "Each proto file must use a consistent fully-qualified name."
34
+ warn "This will become an error in the next major version."
35
+ end
36
+
37
+ module MomentoProtos
38
+ module Leaderboard
39
+ PB__Element = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._Element").msgclass
40
+ PB__RankedElement = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._RankedElement").msgclass
41
+ PB__RankRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._RankRange").msgclass
42
+ PB__ScoreRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._ScoreRange").msgclass
43
+ PB__DeleteLeaderboardRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._DeleteLeaderboardRequest").msgclass
44
+ PB__GetLeaderboardLengthRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._GetLeaderboardLengthRequest").msgclass
45
+ PB__GetLeaderboardLengthResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._GetLeaderboardLengthResponse").msgclass
46
+ PB__UpsertElementsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._UpsertElementsRequest").msgclass
47
+ PB__GetByRankRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._GetByRankRequest").msgclass
48
+ PB__GetByRankResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._GetByRankResponse").msgclass
49
+ PB__GetRankRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._GetRankRequest").msgclass
50
+ PB__GetRankResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._GetRankResponse").msgclass
51
+ PB__RemoveElementsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._RemoveElementsRequest").msgclass
52
+ PB__GetByScoreRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._GetByScoreRequest").msgclass
53
+ PB__GetByScoreResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._GetByScoreResponse").msgclass
54
+ PB__Order = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("leaderboard._Order").enummodule
55
+ end
56
+ end
@@ -0,0 +1,57 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: leaderboard.proto for package 'leaderboard'
3
+
4
+ require 'grpc'
5
+ require_relative 'leaderboard_pb'
6
+
7
+ module MomentoProtos
8
+ module Leaderboard
9
+ module Leaderboard
10
+ # Like a sorted set, but for leaderboards!
11
+ #
12
+ # Elements in a leaderboard are keyed by an ID, which is an unsigned 64 bit integer.
13
+ # Scores are single-precision floating point numbers.
14
+ #
15
+ # Each ID can have only 1 score.
16
+ #
17
+ # For batchy, multi-element apis, limits are 8192 elements per api call.
18
+ #
19
+ # Scores are IEEE 754 single-precision floating point numbers. This has a few
20
+ # implications you should be aware of, but the one most likely to affect you is that
21
+ # below -16777216 and above 16777216, not all integers are able to be represented.
22
+ class Service
23
+ include ::GRPC::GenericService
24
+
25
+ self.marshal_class_method = :encode
26
+ self.unmarshal_class_method = :decode
27
+ self.service_name = 'leaderboard.Leaderboard'
28
+
29
+ # Deletes a leaderboard. After this call, you're not incurring storage cost for this leaderboard anymore.
30
+ rpc :DeleteLeaderboard, ::Leaderboard::PB__DeleteLeaderboardRequest, ::Common::PB__Empty
31
+ # Insert or update elements in a leaderboard. You can do up to 8192 elements per call.
32
+ # There is no partial failure: Upsert succeeds or fails.
33
+ rpc :UpsertElements, ::Leaderboard::PB__UpsertElementsRequest, ::Common::PB__Empty
34
+ # Remove up to 8192 elements at a time from a leaderboard. Elements are removed by id.
35
+ rpc :RemoveElements, ::Leaderboard::PB__RemoveElementsRequest, ::Common::PB__Empty
36
+ # Returns the length of a leaderboard in terms of ID count.
37
+ rpc :GetLeaderboardLength, ::Leaderboard::PB__GetLeaderboardLengthRequest, ::Leaderboard::PB__GetLeaderboardLengthResponse
38
+ # Get a range of elements.
39
+ # * Ordinal, 0-based rank.
40
+ # * Range can span up to 8192 elements.
41
+ # See RankRange for details about permissible ranges.
42
+ rpc :GetByRank, ::Leaderboard::PB__GetByRankRequest, ::Leaderboard::PB__GetByRankResponse
43
+ # Get the rank of a list of particular ids in the leaderboard.
44
+ # * Ordinal, 0-based rank.
45
+ rpc :GetRank, ::Leaderboard::PB__GetRankRequest, ::Leaderboard::PB__GetRankResponse
46
+ # Get a range of elements by a score range.
47
+ # * Ordinal, 0-based rank.
48
+ #
49
+ # You can request up to 8192 elements at a time. To page through many elements that all
50
+ # fall into a score range you can repeatedly invoke this api with the offset parameter.
51
+ rpc :GetByScore, ::Leaderboard::PB__GetByScoreRequest, ::Leaderboard::PB__GetByScoreResponse
52
+ end
53
+
54
+ Stub = Service.rpc_stub_class
55
+ end
56
+ end
57
+ end