zyre 0.3.1 → 0.4.0
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 +4 -4
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +0 -0
 - data/Authentication.md +30 -0
 - data/History.md +7 -0
 - data/README.md +1 -1
 - data/ext/zyre_ext/cert.c +504 -0
 - data/ext/zyre_ext/event.c +17 -9
 - data/ext/zyre_ext/extconf.rb +5 -0
 - data/ext/zyre_ext/node.c +261 -22
 - data/ext/zyre_ext/poller.c +6 -7
 - data/ext/zyre_ext/zyre_ext.c +43 -1
 - data/ext/zyre_ext/zyre_ext.h +19 -2
 - data/lib/zyre.rb +38 -13
 - data/lib/zyre/cert.rb +75 -0
 - data/lib/zyre/event.rb +1 -0
 - data/lib/zyre/event/stop.rb +5 -0
 - data/lib/zyre/testing.rb +24 -0
 - data/spec/spec_helper.rb +4 -0
 - data/spec/zyre/cert_spec.rb +218 -0
 - data/spec/zyre/node_spec.rb +58 -0
 - data/spec/zyre/testing_spec.rb +36 -0
 - data/spec/zyre_spec.rb +12 -0
 - metadata +21 -17
 - metadata.gz.sig +0 -0
 
    
        data/spec/zyre/node_spec.rb
    CHANGED
    
    | 
         @@ -481,5 +481,63 @@ RSpec.describe( Zyre::Node ) do 
     | 
|
| 
       481 
481 
     | 
    
         
             
            	end
         
     | 
| 
       482 
482 
     | 
    
         | 
| 
       483 
483 
     | 
    
         | 
| 
      
 484 
     | 
    
         
            +
            	context "draft APIs", :draft_api do
         
     | 
| 
      
 485 
     | 
    
         
            +
             
     | 
| 
      
 486 
     | 
    
         
            +
            		it "can specify a port for the ROUTER socket" do
         
     | 
| 
      
 487 
     | 
    
         
            +
            			node = described_class.new
         
     | 
| 
      
 488 
     | 
    
         
            +
             
     | 
| 
      
 489 
     | 
    
         
            +
            			expect {
         
     | 
| 
      
 490 
     | 
    
         
            +
            				node.beacon_peer_port = 16181
         
     | 
| 
      
 491 
     | 
    
         
            +
            			}.to_not raise_error()
         
     | 
| 
      
 492 
     | 
    
         
            +
            		end
         
     | 
| 
      
 493 
     | 
    
         
            +
             
     | 
| 
      
 494 
     | 
    
         
            +
             
     | 
| 
      
 495 
     | 
    
         
            +
            		it "can specify that a node should try to assume leadership of a particular group" do
         
     | 
| 
      
 496 
     | 
    
         
            +
            			node1 = started_node( 'node1' ) do |node|
         
     | 
| 
      
 497 
     | 
    
         
            +
            				# node.verbose!
         
     | 
| 
      
 498 
     | 
    
         
            +
            				node.set_contest_in_group( "GROUP_1" )
         
     | 
| 
      
 499 
     | 
    
         
            +
            				node.join( 'GROUP_1' )
         
     | 
| 
      
 500 
     | 
    
         
            +
            				node.join( 'GROUP_2' )
         
     | 
| 
      
 501 
     | 
    
         
            +
            				node.join( 'GROUP_3' )
         
     | 
| 
      
 502 
     | 
    
         
            +
            			end
         
     | 
| 
      
 503 
     | 
    
         
            +
             
     | 
| 
      
 504 
     | 
    
         
            +
            			node2 = started_node( 'node2' ) do |node|
         
     | 
| 
      
 505 
     | 
    
         
            +
            				# node.verbose!
         
     | 
| 
      
 506 
     | 
    
         
            +
            				node.set_contest_in_group( 'GROUP_1' )
         
     | 
| 
      
 507 
     | 
    
         
            +
            				node.set_contest_in_group( 'GROUP_2' )
         
     | 
| 
      
 508 
     | 
    
         
            +
            				node.join( 'GROUP_1' )
         
     | 
| 
      
 509 
     | 
    
         
            +
            				node.join( 'GROUP_2' )
         
     | 
| 
      
 510 
     | 
    
         
            +
            				node.join( 'GROUP_3' )
         
     | 
| 
      
 511 
     | 
    
         
            +
            			end
         
     | 
| 
      
 512 
     | 
    
         
            +
             
     | 
| 
      
 513 
     | 
    
         
            +
            			poller = Zyre::Poller.new( node1, node2 )
         
     | 
| 
      
 514 
     | 
    
         
            +
             
     | 
| 
      
 515 
     | 
    
         
            +
            			leaders = {}
         
     | 
| 
      
 516 
     | 
    
         
            +
            			leadership_message_count = 0
         
     | 
| 
      
 517 
     | 
    
         
            +
            			while ( node = poller.wait(0.5) )
         
     | 
| 
      
 518 
     | 
    
         
            +
            				event = node.recv
         
     | 
| 
      
 519 
     | 
    
         
            +
             
     | 
| 
      
 520 
     | 
    
         
            +
            				if event.type == :LEADER
         
     | 
| 
      
 521 
     | 
    
         
            +
            					leadership_message_count += 1
         
     | 
| 
      
 522 
     | 
    
         
            +
            					leaders[ event.group ] = event.peer_uuid
         
     | 
| 
      
 523 
     | 
    
         
            +
            				end
         
     | 
| 
      
 524 
     | 
    
         
            +
            			end
         
     | 
| 
      
 525 
     | 
    
         
            +
             
     | 
| 
      
 526 
     | 
    
         
            +
            			expect( leadership_message_count ).to eq( 4 )
         
     | 
| 
      
 527 
     | 
    
         
            +
            			expect( leaders.keys ).to contain_exactly( 'GROUP_1', 'GROUP_2' )
         
     | 
| 
      
 528 
     | 
    
         
            +
            			expect( leaders['GROUP_1'] ).to eq( node1.uuid ).or( eq node2.uuid )
         
     | 
| 
      
 529 
     | 
    
         
            +
            			expect( leaders['GROUP_2'] ).to eq( node2.uuid )
         
     | 
| 
      
 530 
     | 
    
         
            +
            		end
         
     | 
| 
      
 531 
     | 
    
         
            +
             
     | 
| 
      
 532 
     | 
    
         
            +
             
     | 
| 
      
 533 
     | 
    
         
            +
            		it "supports CURVE authentication"
         
     | 
| 
      
 534 
     | 
    
         
            +
             
     | 
| 
      
 535 
     | 
    
         
            +
            		it "supports advertised_endpoint="
         
     | 
| 
      
 536 
     | 
    
         
            +
            		it "supports gossip_connect_curve"
         
     | 
| 
      
 537 
     | 
    
         
            +
            		it "supports gossip_unpublish"
         
     | 
| 
      
 538 
     | 
    
         
            +
            		it "supports require_peer"
         
     | 
| 
      
 539 
     | 
    
         
            +
             
     | 
| 
      
 540 
     | 
    
         
            +
            	end
         
     | 
| 
      
 541 
     | 
    
         
            +
             
     | 
| 
       484 
542 
     | 
    
         
             
            end
         
     | 
| 
       485 
543 
     | 
    
         | 
    
        data/spec/zyre/testing_spec.rb
    CHANGED
    
    | 
         @@ -266,6 +266,42 @@ RSpec.describe( Zyre::Testing ) do 
     | 
|
| 
       266 
266 
     | 
    
         
             
            		end
         
     | 
| 
       267 
267 
     | 
    
         | 
| 
       268 
268 
     | 
    
         | 
| 
      
 269 
     | 
    
         
            +
            		it "can create a valid LEADER event" do
         
     | 
| 
      
 270 
     | 
    
         
            +
            			event = factory.leader
         
     | 
| 
      
 271 
     | 
    
         
            +
             
     | 
| 
      
 272 
     | 
    
         
            +
            			expect( event ).to be_a( Zyre::Event::Leader )
         
     | 
| 
      
 273 
     | 
    
         
            +
            			expect( event.peer_uuid ).to eq( factory.peer_uuid )
         
     | 
| 
      
 274 
     | 
    
         
            +
            			expect( event.peer_name ).to eq( 'lancer-6' )
         
     | 
| 
      
 275 
     | 
    
         
            +
            			expect( event.headers ).to be_empty
         
     | 
| 
      
 276 
     | 
    
         
            +
            			expect( event.msg ).to be_nil
         
     | 
| 
      
 277 
     | 
    
         
            +
            			expect( event.group ).to eq( 'default' )
         
     | 
| 
      
 278 
     | 
    
         
            +
            		end
         
     | 
| 
      
 279 
     | 
    
         
            +
             
     | 
| 
      
 280 
     | 
    
         
            +
             
     | 
| 
      
 281 
     | 
    
         
            +
            		it "can create a valid LEAVE event with overridden config" do
         
     | 
| 
      
 282 
     | 
    
         
            +
            			event = factory.leader( group: 'control' )
         
     | 
| 
      
 283 
     | 
    
         
            +
             
     | 
| 
      
 284 
     | 
    
         
            +
            			expect( event ).to be_a( Zyre::Event::Leader )
         
     | 
| 
      
 285 
     | 
    
         
            +
            			expect( event.peer_uuid ).to eq( factory.peer_uuid )
         
     | 
| 
      
 286 
     | 
    
         
            +
            			expect( event.peer_name ).to eq( 'lancer-6' )
         
     | 
| 
      
 287 
     | 
    
         
            +
            			expect( event.headers ).to be_empty
         
     | 
| 
      
 288 
     | 
    
         
            +
            			expect( event.msg ).to be_nil
         
     | 
| 
      
 289 
     | 
    
         
            +
            			expect( event.group ).to eq( 'control' )
         
     | 
| 
      
 290 
     | 
    
         
            +
            		end
         
     | 
| 
      
 291 
     | 
    
         
            +
             
     | 
| 
      
 292 
     | 
    
         
            +
             
     | 
| 
      
 293 
     | 
    
         
            +
            		it "can create a valid STOP event" do
         
     | 
| 
      
 294 
     | 
    
         
            +
            			event = factory.stop
         
     | 
| 
      
 295 
     | 
    
         
            +
             
     | 
| 
      
 296 
     | 
    
         
            +
            			expect( event ).to be_a( Zyre::Event::Stop )
         
     | 
| 
      
 297 
     | 
    
         
            +
            			expect( event.peer_uuid ).to eq( factory.peer_uuid )
         
     | 
| 
      
 298 
     | 
    
         
            +
            			expect( event.peer_name ).to eq( 'lancer-6' )
         
     | 
| 
      
 299 
     | 
    
         
            +
            			expect( event.headers ).to be_empty
         
     | 
| 
      
 300 
     | 
    
         
            +
            			expect( event.msg ).to be_nil
         
     | 
| 
      
 301 
     | 
    
         
            +
            			expect( event.group ).to be_nil
         
     | 
| 
      
 302 
     | 
    
         
            +
            		end
         
     | 
| 
      
 303 
     | 
    
         
            +
             
     | 
| 
      
 304 
     | 
    
         
            +
             
     | 
| 
       269 
305 
     | 
    
         
             
            		it "can create a valid EXIT event" do
         
     | 
| 
       270 
306 
     | 
    
         
             
            			event = factory.exit
         
     | 
| 
       271 
307 
     | 
    
         | 
    
        data/spec/zyre_spec.rb
    CHANGED
    
    | 
         @@ -51,5 +51,17 @@ RSpec.describe Zyre do 
     | 
|
| 
       51 
51 
     | 
    
         
             
            		expect( result['disposition'].encoding ).to eq( Encoding::US_ASCII )
         
     | 
| 
       52 
52 
     | 
    
         
             
            	end
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            	it "can disable the CZMQ TERM/INT signal handler" do
         
     | 
| 
      
 56 
     | 
    
         
            +
            		expect {
         
     | 
| 
      
 57 
     | 
    
         
            +
            			described_class.disable_zsys_handler
         
     | 
| 
      
 58 
     | 
    
         
            +
            		}.to_not raise_error()
         
     | 
| 
      
 59 
     | 
    
         
            +
            	end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            	it "knows whether or not it's been built with draft APIs" do
         
     | 
| 
      
 63 
     | 
    
         
            +
            		expect( described_class.has_draft_apis? ).to eq( true ).or( eq false )
         
     | 
| 
      
 64 
     | 
    
         
            +
            	end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
       54 
66 
     | 
    
         
             
            end
         
     | 
| 
       55 
67 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: zyre
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Michael Granger
         
     | 
| 
         @@ -10,9 +10,9 @@ bindir: bin 
     | 
|
| 
       10 
10 
     | 
    
         
             
            cert_chain:
         
     | 
| 
       11 
11 
     | 
    
         
             
            - |
         
     | 
| 
       12 
12 
     | 
    
         
             
              -----BEGIN CERTIFICATE-----
         
     | 
| 
       13 
     | 
    
         
            -
              MIID+ 
     | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
       15 
     | 
    
         
            -
               
     | 
| 
      
 13 
     | 
    
         
            +
              MIID+DCCAmCgAwIBAgIBAzANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdnZWQv
         
     | 
| 
      
 14 
     | 
    
         
            +
              REM9RmFlcmllTVVEL0RDPW9yZzAeFw0yMDEyMjQyMDU1MjlaFw0yMTEyMjQyMDU1
         
     | 
| 
      
 15 
     | 
    
         
            +
              MjlaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
         
     | 
| 
       16 
16 
     | 
    
         
             
              hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAvyVhkRzvlEs0fe7145BYLfN6njX9ih5H
         
     | 
| 
       17 
17 
     | 
    
         
             
              L60U0p0euIurpv84op9CNKF9tx+1WKwyQvQP7qFGuZxkSUuWcP/sFhDXL1lWUuIl
         
     | 
| 
       18 
18 
     | 
    
         
             
              M4uHbGCRmOshDrF4dgnBeOvkHr1fIhPlJm5FO+Vew8tSQmlDsosxLUx+VB7DrVFO
         
     | 
| 
         @@ -23,17 +23,17 @@ cert_chain: 
     | 
|
| 
       23 
23 
     | 
    
         
             
              ozilJg4aar2okb/RA6VS87o+d7g6LpDDMMQjH4G9OPnJENLdhu8KnPw/ivSVvQw7
         
     | 
| 
       24 
24 
     | 
    
         
             
              N2I4L/ZOIe2DIVuYH7aLHfjZDQv/mNgpAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYD
         
     | 
| 
       25 
25 
     | 
    
         
             
              VR0PBAQDAgSwMB0GA1UdDgQWBBRyjf55EbrHagiRLqt5YAd3yb8k4DANBgkqhkiG
         
     | 
| 
       26 
     | 
    
         
            -
               
     | 
| 
       27 
     | 
    
         
            -
               
     | 
| 
       28 
     | 
    
         
            -
               
     | 
| 
       29 
     | 
    
         
            -
               
     | 
| 
       30 
     | 
    
         
            -
               
     | 
| 
       31 
     | 
    
         
            -
               
     | 
| 
       32 
     | 
    
         
            -
               
     | 
| 
       33 
     | 
    
         
            -
               
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
      
 26 
     | 
    
         
            +
              9w0BAQsFAAOCAYEAMYegZanJi8zq7QKPT7wqXefX4C88I5JWeBHR3PvvWK0CwyMV
         
     | 
| 
      
 27 
     | 
    
         
            +
              peyiu5I13w/lYX+HUZjE4qsSpJMJFXWl4WZCOo+AMprOcf0PxfuJpxCej5D4tavf
         
     | 
| 
      
 28 
     | 
    
         
            +
              vRfhahSw7XJrcZih/3J+/UgoH7R05MJ+8LTcy3HGrB3a0vTafjm8OY7Xpa0LJDoN
         
     | 
| 
      
 29 
     | 
    
         
            +
              JDqxK321VIHyTibbKeA1hWSE6ljlQDvFbTqiCj3Ulp1jTv3TOlvRl8fqcfhxUJI0
         
     | 
| 
      
 30 
     | 
    
         
            +
              +5Q82jJODjEN+GaWs0V+NlrbU94cXwS2PH5dXogftB5YYA5Ex8A0ikZ73xns4Hdo
         
     | 
| 
      
 31 
     | 
    
         
            +
              XxdLdd92F5ovxA23j/rKe/IDwqr6FpDkU3nPXH/Qp0TVGv9zZnVJc/Z6ChkuWj8z
         
     | 
| 
      
 32 
     | 
    
         
            +
              pW7JAyyiiHZgKKDReDrA2LA7Zs3o/7KA6UtUH0FHf8LYhcK+pfHk6RtjRe65ffw+
         
     | 
| 
      
 33 
     | 
    
         
            +
              MCh97sQ/Z/MOusb5+QddBmB+k8EicXyGNl4b5L4XpL7fIQu+Y96TB3JEJlShxFD9
         
     | 
| 
      
 34 
     | 
    
         
            +
              k9FjI4d9EP54gS/4
         
     | 
| 
       35 
35 
     | 
    
         
             
              -----END CERTIFICATE-----
         
     | 
| 
       36 
     | 
    
         
            -
            date:  
     | 
| 
      
 36 
     | 
    
         
            +
            date: 2021-02-19 00:00:00.000000000 Z
         
     | 
| 
       37 
37 
     | 
    
         
             
            dependencies:
         
     | 
| 
       38 
38 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       39 
39 
     | 
    
         
             
              name: loggability
         
     | 
| 
         @@ -41,14 +41,14 @@ dependencies: 
     | 
|
| 
       41 
41 
     | 
    
         
             
                requirements:
         
     | 
| 
       42 
42 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       43 
43 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       44 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 44 
     | 
    
         
            +
                    version: '0.18'
         
     | 
| 
       45 
45 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       46 
46 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       47 
47 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       48 
48 
     | 
    
         
             
                requirements:
         
     | 
| 
       49 
49 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       50 
50 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       51 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 51 
     | 
    
         
            +
                    version: '0.18'
         
     | 
| 
       52 
52 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       53 
53 
     | 
    
         
             
              name: rake-deveiate
         
     | 
| 
       54 
54 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -163,9 +163,11 @@ extensions: 
     | 
|
| 
       163 
163 
     | 
    
         
             
            - ext/zyre_ext/extconf.rb
         
     | 
| 
       164 
164 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       165 
165 
     | 
    
         
             
            files:
         
     | 
| 
      
 166 
     | 
    
         
            +
            - Authentication.md
         
     | 
| 
       166 
167 
     | 
    
         
             
            - History.md
         
     | 
| 
       167 
168 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       168 
169 
     | 
    
         
             
            - README.md
         
     | 
| 
      
 170 
     | 
    
         
            +
            - ext/zyre_ext/cert.c
         
     | 
| 
       169 
171 
     | 
    
         
             
            - ext/zyre_ext/event.c
         
     | 
| 
       170 
172 
     | 
    
         
             
            - ext/zyre_ext/extconf.rb
         
     | 
| 
       171 
173 
     | 
    
         
             
            - ext/zyre_ext/node.c
         
     | 
| 
         @@ -174,6 +176,7 @@ files: 
     | 
|
| 
       174 
176 
     | 
    
         
             
            - ext/zyre_ext/zyre_ext.h
         
     | 
| 
       175 
177 
     | 
    
         
             
            - lib/observability/instrumentation/zyre.rb
         
     | 
| 
       176 
178 
     | 
    
         
             
            - lib/zyre.rb
         
     | 
| 
      
 179 
     | 
    
         
            +
            - lib/zyre/cert.rb
         
     | 
| 
       177 
180 
     | 
    
         
             
            - lib/zyre/event.rb
         
     | 
| 
       178 
181 
     | 
    
         
             
            - lib/zyre/event/enter.rb
         
     | 
| 
       179 
182 
     | 
    
         
             
            - lib/zyre/event/evasive.rb
         
     | 
| 
         @@ -189,6 +192,7 @@ files: 
     | 
|
| 
       189 
192 
     | 
    
         
             
            - lib/zyre/testing.rb
         
     | 
| 
       190 
193 
     | 
    
         
             
            - spec/observability/instrumentation/zyre_spec.rb
         
     | 
| 
       191 
194 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
      
 195 
     | 
    
         
            +
            - spec/zyre/cert_spec.rb
         
     | 
| 
       192 
196 
     | 
    
         
             
            - spec/zyre/event_spec.rb
         
     | 
| 
       193 
197 
     | 
    
         
             
            - spec/zyre/node_spec.rb
         
     | 
| 
       194 
198 
     | 
    
         
             
            - spec/zyre/poller_spec.rb
         
     | 
| 
         @@ -217,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       217 
221 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       218 
222 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       219 
223 
     | 
    
         
             
            requirements: []
         
     | 
| 
       220 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 224 
     | 
    
         
            +
            rubygems_version: 3.2.11
         
     | 
| 
       221 
225 
     | 
    
         
             
            signing_key:
         
     | 
| 
       222 
226 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       223 
227 
     | 
    
         
             
            summary: A ZRE library for Ruby.
         
     | 
    
        metadata.gz.sig
    CHANGED
    
    | 
         Binary file 
     |