avro_turf 1.12.0 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/avro_turf.gemspec +2 -1
- data/lib/avro_turf/confluent_schema_registry.rb +16 -13
- data/lib/avro_turf/messaging.rb +5 -2
- data/lib/avro_turf/version.rb +1 -1
- data/spec/messaging_spec.rb +24 -0
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1c7e87bc8dc94207072e7d09f7ddc844c31b81d3ff46825fa49b5c2548d316c
|
4
|
+
data.tar.gz: 83b58c9806c7b24096f6c615e5d9e0c260cb1cf37e95e7f87134fbfc8c35bdf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c8e705866a589d86bbfcb44f4715b4fc089968a329fbbdd00b56476f905d096b224d013fb8db115c2c307b438d58e37d3a7be184a46dfdc5bf8cc3d4c9710a5
|
7
|
+
data.tar.gz: deb82d030abf247b7d1616250d964c6ade5c91fa4e8fcf5247d5157d9d013efe387b3255da0b1364855a28a0a7282de8dd1e29b5e616aba63a5f400400049287
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## v1.14.0
|
6
|
+
|
7
|
+
- Add `resolv_resolver` parameter to `AvroTurf::Messaging` to make use of custom domain name resolvers and their options, for example `nameserver` and `timeouts` (#202)
|
8
|
+
- Stop using `Excon`'s `dns_timeouts` in favour of `resolv_resolver` because `dns_timeouts` is now deprecated due to https://github.com/excon/excon/issues/832 (#202)
|
9
|
+
|
10
|
+
## v1.13.0
|
11
|
+
|
12
|
+
- Set `idempotent: true` for the request except one that registers a new schema (#199)
|
13
|
+
- Use `connect_timeout` for `Excon`'s `dns_timeouts` that set the timeout for the connection to the Domain Name Server (#201)
|
14
|
+
|
5
15
|
## v1.12.0
|
6
16
|
|
7
17
|
- Add `connect_timeout` parameter to `AvroTurf::Messaging` to set the timeout for the connection to the schema registry (#197)
|
data/avro_turf.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_dependency "avro", ">= 1.8.0", "< 1.12"
|
23
|
-
spec.add_dependency "excon", "~> 0.
|
23
|
+
spec.add_dependency "excon", "~> 0.104"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 2.0"
|
26
26
|
spec.add_development_dependency "rake", "~> 13.0"
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency "sinatra"
|
31
31
|
spec.add_development_dependency "json_spec"
|
32
32
|
spec.add_development_dependency "rack-test"
|
33
|
+
spec.add_development_dependency "resolv"
|
33
34
|
|
34
35
|
spec.post_install_message = %{
|
35
36
|
avro_turf v0.8.0 deprecates the names AvroTurf::SchemaRegistry,
|
@@ -16,7 +16,8 @@ class AvroTurf::ConfluentSchemaRegistry
|
|
16
16
|
client_cert_data: nil,
|
17
17
|
client_key_data: nil,
|
18
18
|
path_prefix: nil,
|
19
|
-
connect_timeout: nil
|
19
|
+
connect_timeout: nil,
|
20
|
+
resolv_resolver: nil
|
20
21
|
)
|
21
22
|
@path_prefix = path_prefix
|
22
23
|
@logger = logger
|
@@ -35,13 +36,14 @@ class AvroTurf::ConfluentSchemaRegistry
|
|
35
36
|
client_key_pass: client_key_pass,
|
36
37
|
client_cert_data: client_cert_data,
|
37
38
|
client_key_data: client_key_data,
|
38
|
-
connect_timeout: connect_timeout
|
39
|
+
connect_timeout: connect_timeout,
|
40
|
+
resolv_resolver: resolv_resolver
|
39
41
|
)
|
40
42
|
end
|
41
43
|
|
42
44
|
def fetch(id)
|
43
45
|
@logger.info "Fetching schema with id #{id}"
|
44
|
-
data = get("/schemas/ids/#{id}")
|
46
|
+
data = get("/schemas/ids/#{id}", idempotent: true)
|
45
47
|
data.fetch("schema")
|
46
48
|
end
|
47
49
|
|
@@ -57,29 +59,30 @@ class AvroTurf::ConfluentSchemaRegistry
|
|
57
59
|
|
58
60
|
# List all subjects
|
59
61
|
def subjects
|
60
|
-
get('/subjects')
|
62
|
+
get('/subjects', idempotent: true)
|
61
63
|
end
|
62
64
|
|
63
65
|
# List all versions for a subject
|
64
66
|
def subject_versions(subject)
|
65
|
-
get("/subjects/#{subject}/versions")
|
67
|
+
get("/subjects/#{subject}/versions", idempotent: true)
|
66
68
|
end
|
67
69
|
|
68
70
|
# Get a specific version for a subject
|
69
71
|
def subject_version(subject, version = 'latest')
|
70
|
-
get("/subjects/#{subject}/versions/#{version}")
|
72
|
+
get("/subjects/#{subject}/versions/#{version}", idempotent: true)
|
71
73
|
end
|
72
74
|
|
73
75
|
# Get the subject and version for a schema id
|
74
76
|
def schema_subject_versions(schema_id)
|
75
|
-
get("/schemas/ids/#{schema_id}/versions")
|
77
|
+
get("/schemas/ids/#{schema_id}/versions", idempotent: true)
|
76
78
|
end
|
77
79
|
|
78
80
|
# Check if a schema exists. Returns nil if not found.
|
79
81
|
def check(subject, schema)
|
80
82
|
data = post("/subjects/#{subject}",
|
81
83
|
expects: [200, 404],
|
82
|
-
body: { schema: schema.to_s }.to_json
|
84
|
+
body: { schema: schema.to_s }.to_json,
|
85
|
+
idempotent: true)
|
83
86
|
data unless data.has_key?("error_code")
|
84
87
|
end
|
85
88
|
|
@@ -91,28 +94,28 @@ class AvroTurf::ConfluentSchemaRegistry
|
|
91
94
|
# http://docs.confluent.io/3.1.2/schema-registry/docs/api.html#compatibility
|
92
95
|
def compatible?(subject, schema, version = 'latest')
|
93
96
|
data = post("/compatibility/subjects/#{subject}/versions/#{version}",
|
94
|
-
expects: [200, 404], body: { schema: schema.to_s }.to_json)
|
97
|
+
expects: [200, 404], body: { schema: schema.to_s }.to_json, idempotent: true)
|
95
98
|
data.fetch('is_compatible', false) unless data.has_key?('error_code')
|
96
99
|
end
|
97
100
|
|
98
101
|
# Get global config
|
99
102
|
def global_config
|
100
|
-
get("/config")
|
103
|
+
get("/config", idempotent: true)
|
101
104
|
end
|
102
105
|
|
103
106
|
# Update global config
|
104
107
|
def update_global_config(config)
|
105
|
-
put("/config", body: config.to_json)
|
108
|
+
put("/config", body: config.to_json, idempotent: true)
|
106
109
|
end
|
107
110
|
|
108
111
|
# Get config for subject
|
109
112
|
def subject_config(subject)
|
110
|
-
get("/config/#{subject}")
|
113
|
+
get("/config/#{subject}", idempotent: true)
|
111
114
|
end
|
112
115
|
|
113
116
|
# Update config for subject
|
114
117
|
def update_subject_config(subject, config)
|
115
|
-
put("/config/#{subject}", body: config.to_json)
|
118
|
+
put("/config/#{subject}", body: config.to_json, idempotent: true)
|
116
119
|
end
|
117
120
|
|
118
121
|
private
|
data/lib/avro_turf/messaging.rb
CHANGED
@@ -56,6 +56,7 @@ class AvroTurf
|
|
56
56
|
# client_cert_data - In-memory client certificate (optional).
|
57
57
|
# client_key_data - In-memory client private key to go with client_cert_data (optional).
|
58
58
|
# connect_timeout - Timeout to use in the connection with the schema registry (optional).
|
59
|
+
# resolv_resolver - Custom domain name resolver (optional).
|
59
60
|
def initialize(
|
60
61
|
registry: nil,
|
61
62
|
registry_url: nil,
|
@@ -73,7 +74,8 @@ class AvroTurf
|
|
73
74
|
client_key_pass: nil,
|
74
75
|
client_cert_data: nil,
|
75
76
|
client_key_data: nil,
|
76
|
-
connect_timeout: nil
|
77
|
+
connect_timeout: nil,
|
78
|
+
resolv_resolver: nil
|
77
79
|
)
|
78
80
|
@logger = logger || Logger.new($stderr)
|
79
81
|
@namespace = namespace
|
@@ -92,7 +94,8 @@ class AvroTurf
|
|
92
94
|
client_cert_data: client_cert_data,
|
93
95
|
client_key_data: client_key_data,
|
94
96
|
path_prefix: registry_path_prefix,
|
95
|
-
connect_timeout: connect_timeout
|
97
|
+
connect_timeout: connect_timeout,
|
98
|
+
resolv_resolver: resolv_resolver
|
96
99
|
)
|
97
100
|
)
|
98
101
|
@schemas_by_id = {}
|
data/lib/avro_turf/version.rb
CHANGED
data/spec/messaging_spec.rb
CHANGED
@@ -448,4 +448,28 @@ describe AvroTurf::Messaging do
|
|
448
448
|
avro
|
449
449
|
end
|
450
450
|
end
|
451
|
+
|
452
|
+
context 'with a custom domain name resolver' do
|
453
|
+
let(:resolv_resolver) { Resolv.new([Resolv::Hosts.new, Resolv::DNS.new(nameserver: ['127.0.0.1', '127.0.0.1'])]) }
|
454
|
+
let(:avro) {
|
455
|
+
AvroTurf::Messaging.new(
|
456
|
+
registry_url: registry_url,
|
457
|
+
schemas_path: "spec/schemas",
|
458
|
+
logger: logger,
|
459
|
+
client_cert: client_cert,
|
460
|
+
client_key: client_key,
|
461
|
+
client_key_pass: client_key_pass,
|
462
|
+
resolv_resolver: resolv_resolver
|
463
|
+
)
|
464
|
+
}
|
465
|
+
|
466
|
+
it_behaves_like "encoding and decoding with the schema from schema store"
|
467
|
+
it_behaves_like 'encoding and decoding with the schema from registry'
|
468
|
+
it_behaves_like 'encoding and decoding with the schema_id from registry'
|
469
|
+
|
470
|
+
it 'passes the domain name resolver setting to Excon' do
|
471
|
+
expect(Excon).to receive(:new).with(anything, hash_including(resolv_resolver: resolv_resolver)).and_call_original
|
472
|
+
avro
|
473
|
+
end
|
474
|
+
end
|
451
475
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avro_turf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.104'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.104'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +156,20 @@ dependencies:
|
|
156
156
|
- - ">="
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: resolv
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
159
173
|
description:
|
160
174
|
email:
|
161
175
|
- dasch@zendesk.com
|