avro_turf 1.11.0 → 1.13.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 +9 -0
- data/avro_turf.gemspec +1 -1
- data/lib/avro_turf/confluent_schema_registry.rb +17 -13
- data/lib/avro_turf/messaging.rb +5 -2
- data/lib/avro_turf/version.rb +1 -1
- data/spec/confluent_schema_registry_spec.rb +12 -0
- data/spec/messaging_spec.rb +24 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72327ac5cc542eaaf881cd7ab9fc6ad3189f488abdcd6119a39b7e51c9545e6e
|
4
|
+
data.tar.gz: e5af812736913725238ac20778151c706776cc619625e60ec6448460289827c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 404704ea23a71ccbfd34354904c3a45ef52abf6c6d75c67570355e67a83b33a3f1b694baf6134e5d539c062aebd7509ee65da5ca8a9684f973d749860288f66b
|
7
|
+
data.tar.gz: bd5ffed0531358a52c355d73994ab6daec49f8da69b96f914d0f75dfcf8f049a84c02d8ac6f3b25cabe416640cfb82130c97ebfa6253c2321cefdafca44b1a32
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## v1.13.0
|
6
|
+
|
7
|
+
- Set `idempotent: true` for the request except one that registers a new schema (#199)
|
8
|
+
- Use `connect_timeout` for `Excon`'s `dns_timeouts` that set the timeout for the connection to the Domain Name Server (#201)
|
9
|
+
|
10
|
+
## v1.12.0
|
11
|
+
|
12
|
+
- Add `connect_timeout` parameter to `AvroTurf::Messaging` to set the timeout for the connection to the schema registry (#197)
|
13
|
+
|
5
14
|
## v1.11.0
|
6
15
|
|
7
16
|
- Add `decode_all` and `decode_all_from_stream` methods to return all entries in a data file (#194)
|
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.103"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 2.0"
|
26
26
|
spec.add_development_dependency "rake", "~> 13.0"
|
@@ -15,7 +15,8 @@ class AvroTurf::ConfluentSchemaRegistry
|
|
15
15
|
client_key_pass: nil,
|
16
16
|
client_cert_data: nil,
|
17
17
|
client_key_data: nil,
|
18
|
-
path_prefix: nil
|
18
|
+
path_prefix: nil,
|
19
|
+
connect_timeout: nil
|
19
20
|
)
|
20
21
|
@path_prefix = path_prefix
|
21
22
|
@logger = logger
|
@@ -33,13 +34,15 @@ class AvroTurf::ConfluentSchemaRegistry
|
|
33
34
|
client_key: client_key,
|
34
35
|
client_key_pass: client_key_pass,
|
35
36
|
client_cert_data: client_cert_data,
|
36
|
-
client_key_data: client_key_data
|
37
|
+
client_key_data: client_key_data,
|
38
|
+
connect_timeout: connect_timeout,
|
39
|
+
dns_timeouts: connect_timeout
|
37
40
|
)
|
38
41
|
end
|
39
42
|
|
40
43
|
def fetch(id)
|
41
44
|
@logger.info "Fetching schema with id #{id}"
|
42
|
-
data = get("/schemas/ids/#{id}")
|
45
|
+
data = get("/schemas/ids/#{id}", idempotent: true)
|
43
46
|
data.fetch("schema")
|
44
47
|
end
|
45
48
|
|
@@ -55,29 +58,30 @@ class AvroTurf::ConfluentSchemaRegistry
|
|
55
58
|
|
56
59
|
# List all subjects
|
57
60
|
def subjects
|
58
|
-
get('/subjects')
|
61
|
+
get('/subjects', idempotent: true)
|
59
62
|
end
|
60
63
|
|
61
64
|
# List all versions for a subject
|
62
65
|
def subject_versions(subject)
|
63
|
-
get("/subjects/#{subject}/versions")
|
66
|
+
get("/subjects/#{subject}/versions", idempotent: true)
|
64
67
|
end
|
65
68
|
|
66
69
|
# Get a specific version for a subject
|
67
70
|
def subject_version(subject, version = 'latest')
|
68
|
-
get("/subjects/#{subject}/versions/#{version}")
|
71
|
+
get("/subjects/#{subject}/versions/#{version}", idempotent: true)
|
69
72
|
end
|
70
73
|
|
71
74
|
# Get the subject and version for a schema id
|
72
75
|
def schema_subject_versions(schema_id)
|
73
|
-
get("/schemas/ids/#{schema_id}/versions")
|
76
|
+
get("/schemas/ids/#{schema_id}/versions", idempotent: true)
|
74
77
|
end
|
75
78
|
|
76
79
|
# Check if a schema exists. Returns nil if not found.
|
77
80
|
def check(subject, schema)
|
78
81
|
data = post("/subjects/#{subject}",
|
79
82
|
expects: [200, 404],
|
80
|
-
body: { schema: schema.to_s }.to_json
|
83
|
+
body: { schema: schema.to_s }.to_json,
|
84
|
+
idempotent: true)
|
81
85
|
data unless data.has_key?("error_code")
|
82
86
|
end
|
83
87
|
|
@@ -89,28 +93,28 @@ class AvroTurf::ConfluentSchemaRegistry
|
|
89
93
|
# http://docs.confluent.io/3.1.2/schema-registry/docs/api.html#compatibility
|
90
94
|
def compatible?(subject, schema, version = 'latest')
|
91
95
|
data = post("/compatibility/subjects/#{subject}/versions/#{version}",
|
92
|
-
expects: [200, 404], body: { schema: schema.to_s }.to_json)
|
96
|
+
expects: [200, 404], body: { schema: schema.to_s }.to_json, idempotent: true)
|
93
97
|
data.fetch('is_compatible', false) unless data.has_key?('error_code')
|
94
98
|
end
|
95
99
|
|
96
100
|
# Get global config
|
97
101
|
def global_config
|
98
|
-
get("/config")
|
102
|
+
get("/config", idempotent: true)
|
99
103
|
end
|
100
104
|
|
101
105
|
# Update global config
|
102
106
|
def update_global_config(config)
|
103
|
-
put("/config", body: config.to_json)
|
107
|
+
put("/config", body: config.to_json, idempotent: true)
|
104
108
|
end
|
105
109
|
|
106
110
|
# Get config for subject
|
107
111
|
def subject_config(subject)
|
108
|
-
get("/config/#{subject}")
|
112
|
+
get("/config/#{subject}", idempotent: true)
|
109
113
|
end
|
110
114
|
|
111
115
|
# Update config for subject
|
112
116
|
def update_subject_config(subject, config)
|
113
|
-
put("/config/#{subject}", body: config.to_json)
|
117
|
+
put("/config/#{subject}", body: config.to_json, idempotent: true)
|
114
118
|
end
|
115
119
|
|
116
120
|
private
|
data/lib/avro_turf/messaging.rb
CHANGED
@@ -55,6 +55,7 @@ class AvroTurf
|
|
55
55
|
# client_key_pass - Password to go with client_key (optional).
|
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
|
+
# connect_timeout - Timeout to use in the connection with the domain name server and the schema registry (optional).
|
58
59
|
def initialize(
|
59
60
|
registry: nil,
|
60
61
|
registry_url: nil,
|
@@ -71,7 +72,8 @@ class AvroTurf
|
|
71
72
|
client_key: nil,
|
72
73
|
client_key_pass: nil,
|
73
74
|
client_cert_data: nil,
|
74
|
-
client_key_data: nil
|
75
|
+
client_key_data: nil,
|
76
|
+
connect_timeout: nil
|
75
77
|
)
|
76
78
|
@logger = logger || Logger.new($stderr)
|
77
79
|
@namespace = namespace
|
@@ -89,7 +91,8 @@ class AvroTurf
|
|
89
91
|
client_key_pass: client_key_pass,
|
90
92
|
client_cert_data: client_cert_data,
|
91
93
|
client_key_data: client_key_data,
|
92
|
-
path_prefix: registry_path_prefix
|
94
|
+
path_prefix: registry_path_prefix,
|
95
|
+
connect_timeout: connect_timeout
|
93
96
|
)
|
94
97
|
)
|
95
98
|
@schemas_by_id = {}
|
data/lib/avro_turf/version.rb
CHANGED
@@ -8,6 +8,7 @@ describe AvroTurf::ConfluentSchemaRegistry do
|
|
8
8
|
let(:client_cert) { "test client cert" }
|
9
9
|
let(:client_key) { "test client key" }
|
10
10
|
let(:client_key_pass) { "test client key password" }
|
11
|
+
let(:connect_timeout) { 10 }
|
11
12
|
|
12
13
|
it_behaves_like "a confluent schema registry client" do
|
13
14
|
let(:registry) {
|
@@ -30,4 +31,15 @@ describe AvroTurf::ConfluentSchemaRegistry do
|
|
30
31
|
)
|
31
32
|
}
|
32
33
|
end
|
34
|
+
|
35
|
+
it_behaves_like "a confluent schema registry client" do
|
36
|
+
let(:registry) {
|
37
|
+
described_class.new(
|
38
|
+
registry_url,
|
39
|
+
user: user,
|
40
|
+
password: password,
|
41
|
+
connect_timeout: connect_timeout
|
42
|
+
)
|
43
|
+
}
|
44
|
+
end
|
33
45
|
end
|
data/spec/messaging_spec.rb
CHANGED
@@ -425,4 +425,27 @@ describe AvroTurf::Messaging do
|
|
425
425
|
it_behaves_like 'encoding and decoding with the schema from registry'
|
426
426
|
it_behaves_like 'encoding and decoding with the schema_id from registry'
|
427
427
|
end
|
428
|
-
|
428
|
+
|
429
|
+
context 'with a connect timeout' do
|
430
|
+
let(:avro) {
|
431
|
+
AvroTurf::Messaging.new(
|
432
|
+
registry_url: registry_url,
|
433
|
+
schemas_path: "spec/schemas",
|
434
|
+
logger: logger,
|
435
|
+
client_cert: client_cert,
|
436
|
+
client_key: client_key,
|
437
|
+
client_key_pass: client_key_pass,
|
438
|
+
connect_timeout: 10
|
439
|
+
)
|
440
|
+
}
|
441
|
+
|
442
|
+
it_behaves_like "encoding and decoding with the schema from schema store"
|
443
|
+
it_behaves_like 'encoding and decoding with the schema from registry'
|
444
|
+
it_behaves_like 'encoding and decoding with the schema_id from registry'
|
445
|
+
|
446
|
+
it 'passes the connect timeout setting to Excon' do
|
447
|
+
expect(Excon).to receive(:new).with(anything, hash_including(connect_timeout: 10, dns_timeouts: 10)).and_call_original
|
448
|
+
avro
|
449
|
+
end
|
450
|
+
end
|
451
|
+
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.13.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-09-14 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.103'
|
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.103'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|