discovery

package
v1.4.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PeersCommand     = "peers"
	ConfigCommand    = "config"
	EndorsersCommand = "endorsers"
)

Variables

This section is empty.

Functions

func AddCommands

func AddCommands(cli CommandRegistrar)

AddCommands registers the discovery commands to the given CommandRegistrar

Types

type ClientStub

type ClientStub struct {
}

ClientStub is a stub that communicates with the discovery service using the discovery client implementation

func (*ClientStub) Send

func (stub *ClientStub) Send(server string, conf common.Config, req *discovery.Request) (ServiceResponse, error)

Send sends the request, and receives a response

type CommandRegistrar

type CommandRegistrar interface {
	// Command adds a new top-level command to the CLI
	Command(name, help string, onCommand common.CLICommand) *kingpin.CmdClause
}

CommandRegistrar registers commands

type ConfigCmd

type ConfigCmd struct {
	// contains filtered or unexported fields
}

ConfigCmd executes a command that retrieves config

func NewConfigCmd

func NewConfigCmd(stub Stub, parser ResponseParser) *ConfigCmd

NewConfigCmd creates a new ConfigCmd

func (*ConfigCmd) Execute

func (pc *ConfigCmd) Execute(conf common.Config) error

Execute executes the command

func (*ConfigCmd) SetChannel

func (pc *ConfigCmd) SetChannel(channel *string)

SetChannel sets the channel of the ConfigCmd

func (*ConfigCmd) SetServer

func (pc *ConfigCmd) SetServer(server *string)

SetServer sets the server of the ConfigCmd

type ConfigResponseParser

type ConfigResponseParser struct {
	io.Writer
}

ConfigResponseParser parses config responses

func (*ConfigResponseParser) ParseResponse

func (parser *ConfigResponseParser) ParseResponse(channel string, res ServiceResponse) error

ParseResponse parses the given response for the given channel

type EndorserResponseParser

type EndorserResponseParser struct {
	io.Writer
}

EndorserResponseParser parses endorsement responses from the peer

func (*EndorserResponseParser) ParseResponse

func (parser *EndorserResponseParser) ParseResponse(channel string, res ServiceResponse) error

ParseResponse parses the given response for the given channel

type EndorsersCmd

type EndorsersCmd struct {
	// contains filtered or unexported fields
}

EndorsersCmd executes a command that retrieves endorsers for a chaincode invocation chain

func NewEndorsersCmd

func NewEndorsersCmd(stub Stub, parser ResponseParser) *EndorsersCmd

NewEndorsersCmd creates a new EndorsersCmd

func (*EndorsersCmd) Execute

func (pc *EndorsersCmd) Execute(conf common.Config) error

Execute executes the command

func (*EndorsersCmd) SetChaincodes

func (pc *EndorsersCmd) SetChaincodes(chaincodes *[]string)

SetChaincodes sets the chaincodes to be the given chaincodes

func (*EndorsersCmd) SetChannel

func (pc *EndorsersCmd) SetChannel(channel *string)

SetChannel sets the channel

func (*EndorsersCmd) SetCollections

func (pc *EndorsersCmd) SetCollections(collections *map[string]string)

SetCollections sets the collections to be the given collections

func (*EndorsersCmd) SetServer

func (pc *EndorsersCmd) SetServer(server *string)

SetServer sets the server

type PeerCmd

type PeerCmd struct {
	// contains filtered or unexported fields
}

PeerCmd executes channelPeer listing command

func NewPeerCmd

func NewPeerCmd(stub Stub, parser ResponseParser) *PeerCmd

NewPeerCmd creates a new PeerCmd with the given Stub and ResponseParser

func (*PeerCmd) Execute

func (pc *PeerCmd) Execute(conf common.Config) error

Execute executes the command

func (*PeerCmd) SetChannel

func (pc *PeerCmd) SetChannel(channel *string)

SetChannel sets the channel of the PeerCmd

func (*PeerCmd) SetServer

func (pc *PeerCmd) SetServer(server *string)

SetServer sets the server of the PeerCmd

type PeerResponseParser

type PeerResponseParser struct {
	io.Writer
}

PeerResponseParser parses a channelPeer response

func (*PeerResponseParser) ParseResponse

func (parser *PeerResponseParser) ParseResponse(channel string, res ServiceResponse) error

ParseResponse parses the given response about the given channel

type RawStub

type RawStub struct {
}

RawStub is a stub that communicates with the discovery service without any intermediary.

func (*RawStub) Send

func (stub *RawStub) Send(server string, conf common.Config, req *discovery.Request) (ServiceResponse, error)

Send sends the request, and receives a response

type ResponseParser

type ResponseParser interface {
	// ParseResponse parses the response and uses the given output when emitting data
	ParseResponse(channel string, response ServiceResponse) error
}

ResponseParser parses responses sent from the server

type ServiceResponse

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
}

ServiceResponse represents a response sent from the discovery service

type Stub

type Stub interface {
	// Send sends the request, and receives a response
	Send(server string, conf common.Config, req *discovery.Request) (ServiceResponse, error)
}

Stub represents the remote discovery service

Directories

Path Synopsis
Code generated by mockery v1.0.0.
Code generated by mockery v1.0.0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL