Class: BSV::Overlay::LookupFacilitator

Inherits:
Object
  • Object
show all
Defined in:
lib/bsv/overlay/lookup_facilitator.rb

Overview

Abstract base class defining the interface for lookup facilitators.

A facilitator is responsible for sending a LookupQuestion to a given Overlay Services host URL and returning a LookupAnswer. Concrete subclasses implement the transport mechanism (e.g. HTTPS, in-process).

Implementors must override #lookup.

Direct Known Subclasses

HTTPSLookupFacilitator

Instance Method Summary collapse

Instance Method Details

#lookup(url, question, timeout: 5) ⇒ LookupAnswer

Send a lookup question to the given host URL.

Parameters:

  • url (String)

    base URL of the Overlay Services host

  • question (LookupQuestion)

    the question to ask

  • timeout (Integer) (defaults to: 5)

    seconds to wait for a response

Returns:

Raises:

  • (NotImplementedError)

    always — subclasses must implement this



24
25
26
# File 'lib/bsv/overlay/lookup_facilitator.rb', line 24

def lookup(url, question, timeout: 5)
  raise NotImplementedError, "#{self.class}#lookup must be implemented"
end