avro_turf 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/lib/avro_turf/mutable_schema_store.rb +18 -0
- data/lib/avro_turf/schema_store.rb +2 -0
- data/lib/avro_turf/version.rb +1 -1
- data/lib/avro_turf.rb +4 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8e58564680b9399ae8df438412385f23bdabd46cee8deafc0dfa1c8b827d7792
|
4
|
+
data.tar.gz: 1df38f38434777fab06fddec69a8834442a4814e269edbed154fc74153f6b198
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e47f299a673911614be989feefb56f2cd48be6a556e240919ad23b13b55928c3cd0837d5d5f43aa4c2f72e1f416465f811de24ae7e344f858dc147dd23be136
|
7
|
+
data.tar.gz: 187c4f087cf7ed656ef3bfed6bf0593938f57da698b0b99550e476a059e529cf355f33ce5bc1839680c1c0513c730e285a117f33ec9e6947c476f0301ab3c597
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# avro_turf
|
2
2
|
|
3
|
+
## v0.8.1
|
4
|
+
|
5
|
+
- Allow accessing schema store from outside AvroTurf (#68).
|
6
|
+
|
3
7
|
## v0.8.0
|
8
|
+
|
4
9
|
- The names `AvroTurf::SchemaRegistry`, `AvroTurf::CachedSchemaRegistry`, and
|
5
10
|
`FakeSchemaRegistryServer` are deprecated and will be removed in a future release.
|
6
11
|
Use `AvroTurf::ConfluentSchemaRegistry`, `AvroTurf::CachedConfluentSchemaRegistry`,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'avro_turf/schema_store'
|
2
|
+
|
3
|
+
class AvroTurf
|
4
|
+
# A schema store that allows you to add or remove schemas, and to access
|
5
|
+
# them externally.
|
6
|
+
class MutableSchemaStore < SchemaStore
|
7
|
+
attr_accessor :schemas
|
8
|
+
|
9
|
+
# @param schema_hash [Hash]
|
10
|
+
def add_schema(schema_hash)
|
11
|
+
name = schema_hash['name']
|
12
|
+
namespace = schema_hash['namespace']
|
13
|
+
full_name = Avro::Name.make_fullname(name, namespace)
|
14
|
+
return if @schemas.key?(full_name)
|
15
|
+
Avro::Schema.real_parse(schema_hash, @schemas)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/avro_turf/version.rb
CHANGED
data/lib/avro_turf.rb
CHANGED
@@ -15,13 +15,15 @@ class AvroTurf
|
|
15
15
|
# Create a new AvroTurf instance with the specified configuration.
|
16
16
|
#
|
17
17
|
# schemas_path - The String path to the root directory containing Avro schemas (default: "./schemas").
|
18
|
+
# schema_store - A schema store object that responds to #find(schema_name, namespace).
|
18
19
|
# namespace - The String namespace that should be used to qualify schema names (optional).
|
19
20
|
# codec - The String name of a codec that should be used to compress messages (optional).
|
20
21
|
#
|
21
22
|
# Currently, the only valid codec name is `deflate`.
|
22
|
-
def initialize(schemas_path: nil, namespace: nil, codec: nil)
|
23
|
+
def initialize(schemas_path: nil, schema_store: nil, namespace: nil, codec: nil)
|
23
24
|
@namespace = namespace
|
24
|
-
@schema_store =
|
25
|
+
@schema_store = schema_store ||
|
26
|
+
SchemaStore.new(path: schemas_path || DEFAULT_SCHEMAS_PATH)
|
25
27
|
@codec = codec
|
26
28
|
end
|
27
29
|
|
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: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- lib/avro_turf/core_ext/time.rb
|
175
175
|
- lib/avro_turf/core_ext/true_class.rb
|
176
176
|
- lib/avro_turf/messaging.rb
|
177
|
+
- lib/avro_turf/mutable_schema_store.rb
|
177
178
|
- lib/avro_turf/schema_registry.rb
|
178
179
|
- lib/avro_turf/schema_store.rb
|
179
180
|
- lib/avro_turf/schema_to_avro_patch.rb
|
@@ -230,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
231
|
version: '0'
|
231
232
|
requirements: []
|
232
233
|
rubyforge_project:
|
233
|
-
rubygems_version: 2.
|
234
|
+
rubygems_version: 2.7.6
|
234
235
|
signing_key:
|
235
236
|
specification_version: 4
|
236
237
|
summary: A library that makes it easier to use the Avro serialization format from
|