Class: DEVp2p::WiredService

Inherits:
Service
  • Object
show all
Defined in:
lib/devp2p/wired_service.rb

Overview

A service which has an associated WireProtocol.

peermanager checks all services registered with app.services

if service is instance of WiredService
  add WiredService.wire_protocol to announced capabilities
  if a peer with the same protocol is connected
    a WiredService.wire_protocol instance is created
      with instances of Peer and WiredService
    WiredService.wire_protocol(Peer.new, WiredService.new)

Direct Known Subclasses

PeerManager

Instance Attribute Summary collapse

Attributes inherited from Service

#app

Instance Method Summary collapse

Methods inherited from Service

#initialize, register_with_app, #start, #stop, #to_s

Methods included from Configurable

#add_config

Constructor Details

This class inherits a constructor from DEVp2p::Service

Instance Attribute Details

#wire_protocolObject

Returns the value of attribute wire_protocol.



18
19
20
# File 'lib/devp2p/wired_service.rb', line 18

def wire_protocol
  @wire_protocol
end

Instance Method Details

#on_wire_protocol_start(proto) ⇒ Object

Raises:

  • (ArgumentError)


20
21
22
# File 'lib/devp2p/wired_service.rb', line 20

def on_wire_protocol_start(proto)
  raise ArgumentError, "argument is not a protocol" unless proto.is_a?(::DEVp2p::Protocol)
end

#on_wire_protocol_stop(proto) ⇒ Object

Raises:

  • (ArgumentError)


24
25
26
# File 'lib/devp2p/wired_service.rb', line 24

def on_wire_protocol_stop(proto)
  raise ArgumentError, "argument is not a protocol" unless proto.is_a?(::DEVp2p::Protocol)
end