action

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitGlobalFlags

func InitGlobalFlags(flags *pflag.FlagSet)

InitGlobalFlags initializes the global command flags

func NewMockPeer

func NewMockPeer(url string, mspID string) apifabclient.Peer

NewMockPeer creates a mock peer

func YesNoPrompt

func YesNoPrompt(prompt string, args ...interface{}) bool

YesNoPrompt prompts the user to enter Y/N. If the user enters 'y' then true is returned.

Types

type Action

type Action interface {
	Initialize() error
	ChannelClient() (apitxn.ChannelClient, error)
	Peers() []apifabclient.Peer
	ProposalProcessors() []apitxn.ProposalProcessor
	OrgID() string
	Query(chaincodeID, fctn string, args [][]byte) ([]byte, error)
	ExecuteTx(chaincodeID, fctn string, args [][]byte) error
	ConfigKey() (*mgmtapi.ConfigKey, error)
}

Action defines the common methods for an command action

func New

func New() Action

New returns a new Action

type MockAction

type MockAction struct {
	Invoker  MockInvoker
	Response []byte
	// contains filtered or unexported fields
}

MockAction provides a mock implementation of Action

func (*MockAction) ChannelClient

func (a *MockAction) ChannelClient() (apitxn.ChannelClient, error)

ChannelClient creates a new channel client

func (*MockAction) ConfigKey

func (a *MockAction) ConfigKey() (*mgmtapi.ConfigKey, error)

ConfigKey resolves a ConfigKey from the command-line arguments

func (*MockAction) ExecuteTx

func (a *MockAction) ExecuteTx(chaincodeID, fctn string, args [][]byte) error

ExecuteTx executes a transaction on the given chaincode with the given function and args

func (*MockAction) Initialize

func (a *MockAction) Initialize() error

Initialize initializes the action

func (*MockAction) OrgID

func (a *MockAction) OrgID() string

OrgID returns the organization ID of the first peer in the list of peers

func (*MockAction) Peers

func (a *MockAction) Peers() []apifabclient.Peer

Peers returns the peers

func (*MockAction) ProposalProcessors

func (a *MockAction) ProposalProcessors() []apitxn.ProposalProcessor

ProposalProcessors returns the proposal processors

func (*MockAction) Query

func (a *MockAction) Query(chaincodeID, fctn string, args [][]byte) ([]byte, error)

Query queries the given chaincode with the given function and args and returns a response

type MockInvoker

type MockInvoker func(chaincodeID, fctn string, args [][]byte) ([]byte, error)

MockInvoker allows mock implementation for the ExecuteTx and Query functions

Jump to

Keyboard shortcuts

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