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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a708b9aabeca7d45e1db532e180b2d80e4a5aecb
4
- data.tar.gz: acb21f2435fd5126efed47803395d84eb4f5a220
2
+ SHA256:
3
+ metadata.gz: 8e58564680b9399ae8df438412385f23bdabd46cee8deafc0dfa1c8b827d7792
4
+ data.tar.gz: 1df38f38434777fab06fddec69a8834442a4814e269edbed154fc74153f6b198
5
5
  SHA512:
6
- metadata.gz: 4bcc5e9832804eafb4f295a6fc85273a5a52c17a515f87ab3da0deb31034ed428c6aaee3754abcaa45d78d37daf6062c6c1d1007644f8578e2561b17f70f1614
7
- data.tar.gz: 89071ed406d0be937344cc70814499e29206f05e52484fd4ba4f797f12bcb9236c36c4b080f22ffedd815ac3f6081e13405cb10fa1dc4184cfe73c8bbb279952
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
@@ -1,4 +1,5 @@
1
1
  class AvroTurf::SchemaStore
2
+
2
3
  def initialize(path: nil)
3
4
  @path = path or raise "Please specify a schema path"
4
5
  @schemas = Hash.new
@@ -55,4 +56,5 @@ class AvroTurf::SchemaStore
55
56
  find(schema_name)
56
57
  end
57
58
  end
59
+
58
60
  end
@@ -1,3 +1,3 @@
1
1
  class AvroTurf
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
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 = SchemaStore.new(path: schemas_path || DEFAULT_SCHEMAS_PATH)
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.0
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: 2017-03-06 00:00:00.000000000 Z
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.4.5.1
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