MCPcopy
hub / github.com/hyperledger/fabric / QueryCommittedCmd

Function QueryCommittedCmd

internal/peer/lifecycle/chaincode/querycommitted.go:47–98  ·  view source on GitHub ↗

QueryCommittedCmd returns the cobra command for querying a committed chaincode definition given the chaincode name

(c *CommittedQuerier, cryptoProvider bccsp.BCCSP)

Source from the content-addressed store, hash-verified

45// querying a committed chaincode definition given
46// the chaincode name
47func QueryCommittedCmd(c *CommittedQuerier, cryptoProvider bccsp.BCCSP) *cobra.Command {
48 chaincodeQueryCommittedCmd := &cobra.Command{
49 Use: "querycommitted",
50 Short: "Query the committed chaincode definitions by channel on a peer.",
51 Long: "Query the committed chaincode definitions by channel on a peer. Optional: provide a chaincode name to query a specific definition.",
52 RunE: func(cmd *cobra.Command, args []string) error {
53 if c == nil {
54 ccInput := &ClientConnectionsInput{
55 CommandName: cmd.Name(),
56 EndorserRequired: true,
57 ChannelID: channelID,
58 PeerAddresses: peerAddresses,
59 TLSRootCertFiles: tlsRootCertFiles,
60 ConnectionProfilePath: connectionProfilePath,
61 TLSEnabled: viper.GetBool("peer.tls.enabled"),
62 }
63
64 cc, err := NewClientConnections(ccInput, cryptoProvider)
65 if err != nil {
66 return err
67 }
68
69 cqInput := &CommittedQueryInput{
70 ChannelID: channelID,
71 Name: chaincodeName,
72 OutputFormat: output,
73 }
74
75 c = &CommittedQuerier{
76 Command: cmd,
77 EndorserClient: cc.EndorserClients[0],
78 Input: cqInput,
79 Signer: cc.Signer,
80 Writer: os.Stdout,
81 }
82 }
83 return c.Query()
84 },
85 }
86
87 flagList := []string{
88 "channelID",
89 "name",
90 "peerAddresses",
91 "tlsRootCertFiles",
92 "connectionProfile",
93 "output",
94 }
95 attachFlags(chaincodeQueryCommittedCmd, flagList)
96
97 return chaincodeQueryCommittedCmd
98}
99
100// Query returns the committed chaincode definition
101// for a given channel and chaincode name

Callers 2

CmdFunction · 0.85

Calls 4

NewClientConnectionsFunction · 0.85
attachFlagsFunction · 0.70
NameMethod · 0.65
QueryMethod · 0.45

Tested by

no test coverage detected