const ( PeersCommand = "peers" ConfigCommand = "config" EndorsersCommand = "endorsers" )
func AddCommands(cli CommandRegistrar)
AddCommands registers the discovery commands to the given CommandRegistrar
ClientStub is a stub that communicates with the discovery service using the discovery client implementation
type ClientStub struct { }
func (stub *ClientStub) Send(server string, conf common.Config, req *discovery.Request) (ServiceResponse, error)
Send sends the request, and receives a response
CommandRegistrar registers commands
type CommandRegistrar interface { // Command adds a new top-level command to the CLI Command(name, help string, onCommand common.CLICommand) *kingpin.CmdClause }
ConfigCmd executes a command that retrieves config
type ConfigCmd struct {
// contains filtered or unexported fields
}
func NewConfigCmd(stub Stub, parser ResponseParser) *ConfigCmd
NewConfigCmd creates a new ConfigCmd
func (pc *ConfigCmd) Execute(conf common.Config) error
Execute executes the command
func (pc *ConfigCmd) SetChannel(channel *string)
SetChannel sets the channel of the ConfigCmd
func (pc *ConfigCmd) SetServer(server *string)
SetServer sets the server of the ConfigCmd
ConfigResponseParser parses config responses
type ConfigResponseParser struct { io.Writer }
func (parser *ConfigResponseParser) ParseResponse(channel string, res ServiceResponse) error
ParseResponse parses the given response for the given channel
EndorserResponseParser parses endorsement responses from the peer
type EndorserResponseParser struct { io.Writer }
func (parser *EndorserResponseParser) ParseResponse(channel string, res ServiceResponse) error
ParseResponse parses the given response for the given channel
EndorsersCmd executes a command that retrieves endorsers for a chaincode invocation chain
type EndorsersCmd struct {
// contains filtered or unexported fields
}
func NewEndorsersCmd(stub Stub, parser ResponseParser) *EndorsersCmd
NewEndorsersCmd creates a new EndorsersCmd
func (pc *EndorsersCmd) Execute(conf common.Config) error
Execute executes the command
func (pc *EndorsersCmd) SetChaincodes(chaincodes *[]string)
SetChaincodes sets the chaincodes to be the given chaincodes
func (pc *EndorsersCmd) SetChannel(channel *string)
SetChannel sets the channel
func (pc *EndorsersCmd) SetCollections(collections *map[string]string)
SetCollections sets the collections to be the given collections
func (pc *EndorsersCmd) SetServer(server *string)
SetServer sets the server
PeerCmd executes channelPeer listing command
type PeerCmd struct {
// contains filtered or unexported fields
}
func NewPeerCmd(stub Stub, parser ResponseParser) *PeerCmd
NewPeerCmd creates a new PeerCmd with the given Stub and ResponseParser
func (pc *PeerCmd) Execute(conf common.Config) error
Execute executes the command
func (pc *PeerCmd) SetChannel(channel *string)
SetChannel sets the channel of the PeerCmd
func (pc *PeerCmd) SetServer(server *string)
SetServer sets the server of the PeerCmd
PeerResponseParser parses a channelPeer response
type PeerResponseParser struct { io.Writer }
func (parser *PeerResponseParser) ParseResponse(channel string, res ServiceResponse) error
ParseResponse parses the given response about the given channel
RawStub is a stub that communicates with the discovery service without any intermediary.
type RawStub struct { }
func (stub *RawStub) Send(server string, conf common.Config, req *discovery.Request) (ServiceResponse, error)
Send sends the request, and receives a response
ResponseParser parses responses sent from the server
type ResponseParser interface { // ParseResponse parses the response and uses the given output when emitting data ParseResponse(channel string, response ServiceResponse) error }
ServiceResponse represents a response sent from the discovery service
type ServiceResponse interface { // ForChannel returns a ChannelResponse in the context of a given channel ForChannel(string) discovery.ChannelResponse // ForLocal returns a LocalResponse in the context of no channel ForLocal() discovery.LocalResponse // Raw returns the raw response from the server Raw() *Response }
Stub represents the remote discovery service
type Stub interface { // Send sends the request, and receives a response Send(server string, conf common.Config, req *discovery.Request) (ServiceResponse, error) }