discovery

package
Version: v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 20 Imported by: 140

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 ChannelResponse

type ChannelResponse interface {
	discoveryclient.ChannelResponse
}

ChannelResponse is the local interface used to generate mocks for foreign interface.

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 *discoveryclient.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) SetNoPrivateReads

func (pc *EndorsersCmd) SetNoPrivateReads(noPrivReads *[]string)

SetNoPrivateReads sets the collections that are expected not to have private reads

func (*EndorsersCmd) SetServer

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

SetServer sets the server

type LocalResponse

type LocalResponse interface {
	discoveryclient.LocalResponse
}

LocalResponse is the local interface used to generate mocks for foreign interface.

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 *discoveryclient.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) discoveryclient.ChannelResponse

	// ForLocal returns a LocalResponse in the context of no channel
	ForLocal() discoveryclient.LocalResponse

	// Raw returns the raw response from the server
	Raw() *discovery.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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL