Class: DiscoveryService

DiscoveryService

The DiscoveryService class represents a peer in the target fabric network that is providing the discovery service for the channel.

new DiscoveryService(name, client, channel)

Construct a DiscoveryService object with the name. Use the connect method with options to establish a connection with the fabric network endpoint.
Parameters:
Name Type Description
name string The name of this discovery peer
client Client The client instance
channel Channel
Returns:
The DiscoveryService instance.
Type
DiscoveryService

Extends

Methods


build(idContext, request)

Use this method to build a discovery request.
Parameters:
Name Type Description
idContext IdentityContext Contains the User object needed to build this request.
request BuildDiscoveryRequest The discovery settings of the request.
Overrides:

close()

Close the connection of the discovery service.

<async> getDiscoveryResults( [refresh])

Get the discovered results. The results are from the discovery service of the Peer and based on the discovery request of DiscoveryService#BuildDiscoveryRequest that was sent to the Peer with Discover#discover.
Parameters:
Name Type Argument Description
refresh boolean <optional>
Optional. Refresh the discovery results if results are older then the refresh age.

hasDiscoveryResults()

Indicates if this discovery service has retreived results

newHandler()

Use this method to get a new handler that will use this instance of the DiscoveryService service.
Returns:
Discovery handler
Type
DiscoveryHandler

<async> send(request)

Send a signed transaction proposal to peer(s)
Parameters:
Name Type Description
request DiscoverRequest
Overrides:
Returns:
Type
DiscoveryResults

setTargets()

Use this method to set the ServiceEndpoint for this ServiceAction class The Discoverer a ServiceEndpoint must be connected before making this assignment.
Properties:
Name Type Description
targets Array.<Discoverer> The connected Discoverer instances to be used when no targets are provided on the send.

sign(param)

Use this method with an IdentityContext that contains a User that has a Signing Identity. OR Use this method with a byte[] to set the signature when the application has done the signed externally. Use the results of the build as the bytes that will be signed.
Parameters:
Name Type Description
param IdentityContext | Array.<byte> When 'param' is a IdentityContext the signing identity of the user will sign the current build bytes. When the 'param' is a byte[], the bytes will be used as the final commit signature.
Inherited From:
Overrides:

toString()

return a printable representation of this object
Overrides: