new Committer(name, client, mspid)
Constructs an Committer object with the given name. An committer object
encapsulates the properties of an committer node and the interactions with it via
the grpc stream API. Committer objects are used by the Client objects to broadcast
requests for creating and updating channels. They are also used by the Channel
objects to broadcast requests for ordering transactions.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of this peer |
client |
Client | The client instance |
mspid |
string | The mspid (organization) of this peer |
Returns:
The Committer instance.
- Type
- Committer
Extends
Methods
-
<async> checkConnection( [reset])
-
Check the connection status
Parameters:
Name Type Argument Default Description reset
boolean <optional>
true Optional, attempt to reconnect if endpoint is not connected - Inherited From:
- Overrides:
-
<async> connect( [endpoint] [, options])
-
Connects this ServiceEndpoint with the given url and opts. If a connect exist an error will be thrown. The application must disconnect the connection before re-connecting to the service.
Parameters:
Name Type Argument Description endpoint
Endpoint <optional>
Service connection options including the url. When an endpoint is not provided, the setEndpoint() must have been called previously. If setEndpoint was previously call and a endpoint is provided here then it will replace the existing endpoint. options
ConnectionOptions <optional>
Any specific options for this instance of the connection to the peer. These will override options from the endpoint service connection options. Endpoint options and option provided here will replace options from the setEndpoint() if previously called. - Inherited From:
- Overrides:
-
disconnect()
-
disconnect the service connection.
- Inherited From:
- Overrides:
-
isConnectable()
-
Check that this ServiceEndpoint could be connected, even if it has failed a previous attempt.
- Inherited From:
- Overrides:
-
isTLS()
-
Determine whether or not this remote endpoint uses TLS.
- Inherited From:
- Overrides:
Throws:
-
if the Service Endpoint has not been connected to an endpoint.
- Type
- Error
Returns:
True if this endpoint uses TLS, false otherwise.- Type
- boolean
-
<async> resetConnection()
-
Reset the connection
- Inherited From:
- Overrides:
-
sendBroadcast(envelope, timeout)
-
Send a Broadcast message to the committer service.
Parameters:
Name Type Description envelope
Array.<byte> Byte data to be included in the broadcast. This must be a protobuf encoded byte array of the common.Envelope that contains either a ConfigUpdateEnvelope or a Transaction in the payload.data
property of the envelope.timeout
Number A number indicating milliseconds to wait on the response before rejecting the promise with a timeout error. This overrides the request-timeout config connection setting of this instance. Throws:
ErrorReturns:
A Promise for a BroadcastResponse object- Type
- Promise
-
setEndpoint(endpoint, options)
-
Use this method to give this service endpoint an endpoint and options that it may connect to at a later time. Use the ServiceEndpoint#connect method without a endpoint or options to connect using the setting provided here.
Parameters:
Name Type Description endpoint
Endpoint Service connection options including the url. options
ConnectionOptions Any specific options for this instance of the connection to the peer. These will override options from the endpoint service connection options. - Inherited From:
- Overrides:
-
toString()
-
return a printable representation of this object
- Inherited From:
- Overrides: