async-redis 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46c7b31b58959e0fe6165b3c2b506d9948d095477a5c9efd656dbcb590bfbfe1
4
- data.tar.gz: 5d1b6ba10c70e35796b3ee7d02d2be2678dbb99c5fec21be5c2a37eb38aeea41
3
+ metadata.gz: c61c1f4d04e59d7a09f58429a04438e674d7839bc6d6411b3fc33668d4068c4b
4
+ data.tar.gz: f13579f444972e6b5a7d1388f37d20d74978e867130b5cdad303e829905a6ca6
5
5
  SHA512:
6
- metadata.gz: 7c117ee7b68fc57780806754c976686bfff540e22e2077b518892fcd863fe9b86b98dbbf69a37dd7b647f7bf6ad7a4fed1e82071db72c8549fb09bf39e79814a
7
- data.tar.gz: 95870e075f3528b95a3503fc3d597a8e9fefe9e038d2f9f62448a8cb1b6df9fb2ae67dc24e5dbadd4798b3619f09089f6dbe2f1058d53895f2b2636df952152f
6
+ metadata.gz: 99b7e9bb4091f09a6b51a1216a44b69ebd63918df6755d447f327b69bdf148cbf91e7a1b1a5adbe75ccff93f36be93cdf0d5034bed624743fcac23524d285df7
7
+ data.tar.gz: f9afbc599da80472df731cb370c77422184c3a41a4ab0efd0df638fad31f9a68fa7cde775d7451826cf781c1d29e9c86d3d27c0a94a6b1605b121dd33dddd13f
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
5
  # Copyright, 2018, by Huba Nagy.
6
6
  # Copyright, 2019, by Mikael Henriksson.
7
7
  # Copyright, 2019, by David Ortiz.
@@ -10,22 +10,21 @@
10
10
  require_relative 'context/pipeline'
11
11
  require_relative 'context/transaction'
12
12
  require_relative 'context/subscribe'
13
-
14
13
  require_relative 'protocol/resp2'
15
14
 
16
- require 'async/io'
17
- require 'async/io/stream'
15
+ require 'io/endpoint/host_endpoint'
18
16
  require 'async/pool/controller'
19
-
20
17
  require 'protocol/redis/methods'
21
18
 
19
+ require 'io/stream'
20
+
22
21
  module Async
23
22
  module Redis
24
23
  # Legacy.
25
24
  ServerError = ::Protocol::Redis::ServerError
26
25
 
27
26
  def self.local_endpoint(port: 6379)
28
- Async::IO::Endpoint.tcp('localhost', port)
27
+ ::IO::Endpoint.tcp('localhost', port)
29
28
  end
30
29
 
31
30
  class Client
@@ -121,7 +120,7 @@ module Async
121
120
  # We will manage flushing ourselves:
122
121
  peer.sync = true
123
122
 
124
- stream = IO::Stream.new(peer)
123
+ stream = ::IO::Stream(peer)
125
124
 
126
125
  @protocol.client(stream)
127
126
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
5
 
6
6
  require 'protocol/redis'
7
7
 
@@ -15,7 +15,7 @@ module Async
15
15
  end
16
16
 
17
17
  def viable?
18
- @stream.connected?
18
+ @stream.readable?
19
19
  end
20
20
 
21
21
  def reusable?
@@ -2,7 +2,9 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2020, by David Ortiz.
5
- # Copyright, 2023, by Samuel Williams.
5
+ # Copyright, 2023-2024, by Samuel Williams.
6
+
7
+ require 'io/stream'
6
8
 
7
9
  module Async
8
10
  module Redis
@@ -10,7 +12,7 @@ module Async
10
12
  def initialize(master_name, sentinels, role = :master, protocol = Protocol::RESP2, **options)
11
13
  @master_name = master_name
12
14
  @sentinel_endpoints = sentinels.map do |sentinel|
13
- Async::IO::Endpoint.tcp(sentinel[:host], sentinel[:port])
15
+ ::IO::Endpoint.tcp(sentinel[:host], sentinel[:port])
14
16
  end
15
17
  @role = role
16
18
 
@@ -26,7 +28,7 @@ module Async
26
28
  Async::Pool::Controller.wrap(**options) do
27
29
  endpoint = resolve_address
28
30
  peer = endpoint.connect
29
- stream = IO::Stream.new(peer)
31
+ stream = ::IO::Stream(peer)
30
32
 
31
33
  @protocol.client(stream)
32
34
  end
@@ -52,7 +54,7 @@ module Async
52
54
  next
53
55
  end
54
56
 
55
- return Async::IO::Endpoint.tcp(address[0], address[1]) if address
57
+ return ::IO::Endpoint.tcp(address[0], address[1]) if address
56
58
  end
57
59
 
58
60
  nil
@@ -72,7 +74,7 @@ module Async
72
74
  next if slaves.empty?
73
75
 
74
76
  slave = select_slave(slaves)
75
- return Async::IO::Endpoint.tcp(slave['ip'], slave['port'])
77
+ return ::IO::Endpoint.tcp(slave['ip'], slave['port'])
76
78
  end
77
79
 
78
80
  nil
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module Redis
8
- VERSION = "0.8.0"
8
+ VERSION = "0.8.1"
9
9
  end
10
10
  end
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2018-2023, by Samuel Williams.
3
+ Copyright, 2018-2024, by Samuel Williams.
4
4
  Copyright, 2018, by Huba Nagy.
5
5
  Copyright, 2019-2020, by David Ortiz.
6
6
  Copyright, 2019, by Pierre Montelle.
data/readme.md CHANGED
@@ -1,111 +1,14 @@
1
1
  # Async::Redis
2
2
 
3
- An asynchronous client for Redis including TLS. Support for streaming requests and responses. Built on top of [async](https://github.com/socketry/async) and [async-io](https://github.com/socketry/async-io).
3
+ An asynchronous client for Redis including TLS. Support for streaming requests and responses. Built on top of [async](https://github.com/socketry/async).
4
4
 
5
5
  [![Development Status](https://github.com/socketry/async-redis/workflows/Test/badge.svg)](https://github.com/socketry/async-redis/actions?workflow=Test)
6
6
 
7
- ## Installation
8
-
9
- ``` shell
10
- $ bundle add async-redis
11
- ```
12
-
13
7
  ## Usage
14
8
 
15
- ### Basic Local Connection
16
-
17
- ``` ruby
18
- require 'async/redis'
19
-
20
- endpoint = Async::Redis.local_endpoint
21
- client = Async::Redis::Client.new(endpoint)
22
-
23
- Async do
24
- pp client.info
25
- ensure
26
- client.close
27
- end
28
- ```
29
-
30
- ### Connecting to Redis SSL Endpoint
31
-
32
- This example demonstrates parsing an environment variable with a `redis://` or SSL `rediss://` scheme, and demonstrates how you can specify SSL parameters on the SSLContext object.
33
-
34
- ``` ruby
35
- require 'async/redis'
36
-
37
- def make_redis_endpoint(uri)
38
- tcp_endpoint = Async::IO::Endpoint.tcp(uri.hostname, uri.port)
39
- case uri.scheme
40
- when 'redis'
41
- tcp_endpoint
42
- when 'rediss'
43
- ssl_context = OpenSSL::SSL::SSLContext.new
44
- ssl_context.set_params(
45
- ca_file: "/path/to/ca.crt",
46
- cert: OpenSSL::X509::Certificate.new(File.read("client.crt")),
47
- key: OpenSSL::PKey::RSA.new(File.read("client.key")),
48
- )
49
- Async::IO::SSLEndpoint.new(tcp_endpoint, ssl_context: ssl_context)
50
- else
51
- raise ArgumentError
52
- end
53
- end
54
-
55
- endpoint = make_redis_endpoint(URI(ENV['REDIS_URL']))
56
- client = Async::Redis::Client.new(endpoint)
57
-
58
- # ...
59
- ```
9
+ Please see the [project documentation](https://github.com/socketry/async-redis) for more details.
60
10
 
61
- ### Variables
62
-
63
- ``` ruby
64
- require 'async'
65
- require 'async/redis'
66
-
67
- endpoint = Async::Redis.local_endpoint
68
- client = Async::Redis::Client.new(endpoint)
69
-
70
- Async do
71
- client.set('X', 10)
72
- pp client.get('X')
73
- ensure
74
- client.close
75
- end
76
- ```
77
-
78
- ### Subscriptions
79
-
80
- ``` ruby
81
- require 'async'
82
- require 'async/redis'
83
-
84
- endpoint = Async::Redis.local_endpoint
85
- client = Async::Redis::Client.new(endpoint)
86
-
87
- Async do |task|
88
- condition = Async::Condition.new
89
-
90
- publisher = task.async do
91
- condition.wait
92
-
93
- client.publish 'status.frontend', 'good'
94
- end
95
-
96
- subscriber = task.async do
97
- client.subscribe 'status.frontend' do |context|
98
- condition.signal # We are waiting for messages.
99
-
100
- type, name, message = context.listen
101
-
102
- pp type, name, message
103
- end
104
- end
105
- ensure
106
- client.close
107
- end
108
- ```
11
+ - [Getting Started](https://github.com/socketry/async-redisguides/getting-started/index) - This guide explains how to use the `async-redis` gem to connect to a Redis server and perform basic operations.
109
12
 
110
13
  ## Contributing
111
14
 
@@ -116,3 +19,11 @@ We welcome contributions to this project.
116
19
  3. Commit your changes (`git commit -am 'Add some feature'`).
117
20
  4. Push to the branch (`git push origin my-new-feature`).
118
21
  5. Create new Pull Request.
22
+
23
+ ### Developer Certificate of Origin
24
+
25
+ This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
26
+
27
+ ### Contributor Covenant
28
+
29
+ This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -48,7 +48,7 @@ cert_chain:
48
48
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
49
49
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
50
50
  -----END CERTIFICATE-----
51
- date: 2023-06-13 00:00:00.000000000 Z
51
+ date: 2024-04-24 00:00:00.000000000 Z
52
52
  dependencies:
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: async
@@ -71,33 +71,47 @@ dependencies:
71
71
  - !ruby/object:Gem::Version
72
72
  version: '3.0'
73
73
  - !ruby/object:Gem::Dependency
74
- name: async-io
74
+ name: async-pool
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: '1.10'
79
+ version: '0.2'
80
80
  type: :runtime
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - "~>"
85
85
  - !ruby/object:Gem::Version
86
- version: '1.10'
86
+ version: '0.2'
87
87
  - !ruby/object:Gem::Dependency
88
- name: async-pool
88
+ name: io-endpoint
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '0.2'
93
+ version: '0.10'
94
94
  type: :runtime
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - "~>"
99
99
  - !ruby/object:Gem::Version
100
- version: '0.2'
100
+ version: '0.10'
101
+ - !ruby/object:Gem::Dependency
102
+ name: io-stream
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: '0.4'
108
+ type: :runtime
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - "~>"
113
+ - !ruby/object:Gem::Version
114
+ version: '0.4'
101
115
  - !ruby/object:Gem::Dependency
102
116
  name: protocol-redis
103
117
  requirement: !ruby/object:Gem::Requirement
@@ -133,7 +147,8 @@ files:
133
147
  homepage: https://github.com/socketry/async-redis
134
148
  licenses:
135
149
  - MIT
136
- metadata: {}
150
+ metadata:
151
+ source_code_uri: https://github.com/socketry/async-redis.git
137
152
  post_install_message:
138
153
  rdoc_options: []
139
154
  require_paths:
@@ -142,14 +157,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
157
  requirements:
143
158
  - - ">="
144
159
  - !ruby/object:Gem::Version
145
- version: '0'
160
+ version: '3.1'
146
161
  required_rubygems_version: !ruby/object:Gem::Requirement
147
162
  requirements:
148
163
  - - ">="
149
164
  - !ruby/object:Gem::Version
150
165
  version: '0'
151
166
  requirements: []
152
- rubygems_version: 3.2.33
167
+ rubygems_version: 3.5.3
153
168
  signing_key:
154
169
  specification_version: 4
155
170
  summary: A Redis client library.
metadata.gz.sig CHANGED
Binary file