Documentation ¶
Index ¶
- func BroadcastReceive(broadcast Broadcast, addr string, responses chan common.Status, ...)
- func BroadcastSend(broadcast Broadcast, addr string, envelope *common.Envelope) error
- func BroadcastWaitForResponse(responses chan common.Status, errs chan error) (common.Status, error)
- func CreateDeliverEnvelope(channelId string, creator []byte, signer SignerIdentity, cert *tls.Certificate) (*common.Envelope, error)
- func CreateEnvelope(data []byte, header *common.Header, signer SignerIdentity) (*common.Envelope, error)
- func CreateHeader(txType common.HeaderType, channelId string, creator []byte, tlsCertHash []byte) (string, *common.Header, error)
- func DeliverReceive(df DeliverFiltered, address string, txid string, eventCh chan TxEvent) error
- func DeliverSend(df DeliverFiltered, address string, envelope *common.Envelope) error
- func DeliverWaitForResponse(ctx context.Context, eventCh chan TxEvent, txid string) (bool, error)
- func ValidateClientConfig(config *ClientConfig) error
- type Broadcast
- type Client
- type ClientConfig
- type ConnectionConfig
- type DeliverClient
- type DeliverFiltered
- type FabricTxSubmitter
- type OrdererClient
- type Prover
- type ProverPeer
- func (prover *ProverPeer) CreateSignedCommand(payload interface{}, signingIdentity tk.SigningIdentity) (*token.SignedCommand, error)
- func (prover *ProverPeer) RequestImport(tokensToIssue []*token.TokenToIssue, signingIdentity tk.SigningIdentity) ([]byte, error)
- func (prover *ProverPeer) RequestTransfer(tokenIDs [][]byte, shares []*token.RecipientTransferShare, ...) ([]byte, error)
- type Signer
- type SignerIdentity
- type TimeFunc
- type TxEvent
- type TxSubmitter
- func (s *TxSubmitter) CreateTxEnvelope(txBytes []byte) (string, *common.Envelope, error)
- func (s *TxSubmitter) SubmitTransaction(txEnvelope *common.Envelope, waitTimeInSeconds int) (committed bool, txId string, err error)
- func (s *TxSubmitter) SubmitTransactionWithChan(txEnvelope *common.Envelope, eventCh chan TxEvent) (committed bool, txId string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastReceive ¶
func BroadcastReceive(broadcast Broadcast, addr string, responses chan common.Status, errs chan error)
BroadReceive等待,直到它收到广播流的响应
func BroadcastSend ¶
BroadcastSend向订购方服务发送事务信封
func BroadcastWaitForResponse ¶
BroadcastWaitForResponse从响应和错误通道读取,直到响应通道关闭。
func CreateDeliverEnvelope ¶
func CreateDeliverEnvelope(channelId string, creator []byte, signer SignerIdentity, cert *tls.Certificate) (*common.Envelope, error)
用seekposition_new for block创建签名信封
func CreateEnvelope ¶
func CreateEnvelope(data []byte, header *common.Header, signer SignerIdentity) (*common.Envelope, error)
CreateEnvelope使用给定的Tx字节、头和签名者创建一个common.Envelope
func CreateHeader ¶
func CreateHeader(txType common.HeaderType, channelId string, creator []byte, tlsCertHash []byte) (string, *common.Header, error)
CreateHeader为令牌事务创建common.Header tlscerthash用于客户端tls证书,仅在clientauthRequired为true时适用。
func DeliverReceive ¶
func DeliverReceive(df DeliverFiltered, address string, txid string, eventCh chan TxEvent) error
func DeliverSend ¶
func DeliverSend(df DeliverFiltered, address string, envelope *common.Envelope) error
func DeliverWaitForResponse ¶
deliverwaitforresponse等待eventchan有值(即已收到响应)或ctx超时 此函数假定eventch仅用于指定的txid 如果一个事件被多个事务共享,那么应该使用一个循环来监听来自多个事务的事件。
func ValidateClientConfig ¶
func ValidateClientConfig(config *ClientConfig) error
Types ¶
type Broadcast ¶
type Broadcast interface { Send(m *common.Envelope) error Recv() (*ab.BroadcastResponse, error) CloseSend() error }
broadcast定义将GRPC调用抽象为将事务广播给订购方的接口
type Client ¶
type Client struct { SigningIdentity tk.SigningIdentity Prover Prover TxSubmitter FabricTxSubmitter }
客户端表示调用prover和txsubmitter的客户端结构
type ClientConfig ¶
type ClientConfig struct { ChannelId string MspDir string MspId string TlsEnabled bool OrdererCfg ConnectionConfig CommitPeerCfg ConnectionConfig ProverPeerCfg ConnectionConfig }
在合并令牌客户端配置的CR后,将更新client config,其中config数据 将根据配置文件填充。
type ConnectionConfig ¶
connectionconfig包含与对等方或订购方建立GRPC连接所需的数据
type DeliverClient ¶
type DeliverClient interface { //newdeliverfilterd返回deliverfiltered NewDeliverFiltered(ctx context.Context, opts ...grpc.CallOption) (DeliverFiltered, error) //证书返回传递客户端提交对等端的TLS证书 Certificate() *tls.Certificate }
DeliverClient定义用于创建DeliverFiltered客户端的接口
func NewDeliverClient ¶
func NewDeliverClient(config *ClientConfig) (DeliverClient, error)
type DeliverFiltered ¶
type DeliverFiltered interface { Send(*common.Envelope) error Recv() (*pb.DeliverResponse, error) CloseSend() error }
deliver filtered定义抽象传递筛选后的grpc调用以提交对等方的接口
type FabricTxSubmitter ¶
type OrdererClient ¶
type OrdererClient interface { //Newbroadcast返回广播 NewBroadcast(ctx context.Context, opts ...grpc.CallOption) (Broadcast, error) //证书返回订购方客户端的TLS证书 Certificate() *tls.Certificate }
orderclient定义用于创建广播的接口
func NewOrdererClient ¶
func NewOrdererClient(config *ClientConfig) (OrdererClient, error)
type Prover ¶
type Prover interface { //requestimport允许客户机向验证程序对等服务提交问题请求; //该函数作为参数tokenstoissue和客户端的签名标识; //它以字节为单位返回响应,并在请求失败时返回错误消息。 //响应对应于序列化的令牌事务Protobuf消息。 RequestImport(tokensToIssue []*token.TokenToIssue, signingIdentity tk.SigningIdentity) ([]byte, error) //RequestTransfer允许客户端向验证程序对等服务提交传输请求; //函数将fabtoken应用程序凭证(令牌的标识符)作为参数。 //转让人和描述如何分配的股份 //在接收者之间;如果 //请求失败 RequestTransfer(tokenIDs [][]byte, shares []*token.RecipientTransferShare, signingIdentity tk.SigningIdentity) ([]byte, error) }
type ProverPeer ¶
type ProverPeer struct { ChannelID string ProverClient token.ProverClient RandomnessReader io.Reader Time TimeFunc }
func (*ProverPeer) CreateSignedCommand ¶
func (prover *ProverPeer) CreateSignedCommand(payload interface{}, signingIdentity tk.SigningIdentity) (*token.SignedCommand, error)
func (*ProverPeer) RequestImport ¶
func (prover *ProverPeer) RequestImport(tokensToIssue []*token.TokenToIssue, signingIdentity tk.SigningIdentity) ([]byte, error)
func (*ProverPeer) RequestTransfer ¶
func (prover *ProverPeer) RequestTransfer( tokenIDs [][]byte, shares []*token.RecipientTransferShare, signingIdentity tk.SigningIdentity) ([]byte, error)
type SignerIdentity ¶
type SignerIdentity interface { Signer //serialize返回用于验证的此标识的字节表示形式 //此SignerIdentity签名的邮件 Serialize() ([]byte, error) }
SignerIdentity对消息进行签名并将其公共标识序列化为字节
type TxEvent ¶
TxEvent包含令牌事务提交的信息 如果应用程序希望在提交令牌事务时得到通知, 执行以下操作: -创建大小为1或更大的事件chan,例如txchan:=make(chan txevent,1) -调用client.submitTransactionWithChan(txBytes,txChan) -实现从txchan读取txevent的函数,以便在事务提交或失败时通知它。
type TxSubmitter ¶
type TxSubmitter struct { Config *ClientConfig Signer SignerIdentity Creator []byte OrdererClient OrdererClient DeliverClient DeliverClient }
func NewTxSubmitter ¶
func NewTxSubmitter(config *ClientConfig) (*TxSubmitter, error)
NewTransactionSubmitter从令牌客户端配置创建新的TxSubmitter
func (*TxSubmitter) CreateTxEnvelope ¶
func (*TxSubmitter) SubmitTransaction ¶
func (s *TxSubmitter) SubmitTransaction(txEnvelope *common.Envelope, waitTimeInSeconds int) (committed bool, txId string, err error)
SubmitTransaction向Fabric提交令牌事务。 它将tokenTransaction字节和waitTimeInSeconds作为输入参数。 “waitTimeInSeconds”表示等待事务提交事件的时间。 如果为0,函数将不等待提交事务。 如果它大于0,函数将等待直到提交超时或事务,以较早者为准。
func (*TxSubmitter) SubmitTransactionWithChan ¶
func (s *TxSubmitter) SubmitTransactionWithChan(txEnvelope *common.Envelope, eventCh chan TxEvent) (committed bool, txId string, err error)
SubmitTransactionWithChan使用事件通道向Fabric提交令牌事务。 此函数不等待事务提交,并在订购方客户机收到响应后立即返回。 在事务完成时,将通过从事件ch中读取事件来通知应用程序。 当事务提交或失败时,将向Eventch添加一个事件,以便通知应用程序。 如果eventch的缓冲区大小为0或其缓冲区已满,将返回一个错误。
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
此源码被清华学神尹成大魔王专业翻译分析并修改 尹成QQ77025077 尹成微信18510341407 尹成所在QQ群721929980 尹成邮箱 yinc13@mails.tsinghua.edu.cn 尹成毕业于清华大学,微软区块链领域全球最有价值专家 https://mvp.microsoft.com/zh-cn/PublicProfile/4033620 伪造者生成的代码。
|
此源码被清华学神尹成大魔王专业翻译分析并修改 尹成QQ77025077 尹成微信18510341407 尹成所在QQ群721929980 尹成邮箱 yinc13@mails.tsinghua.edu.cn 尹成毕业于清华大学,微软区块链领域全球最有价值专家 https://mvp.microsoft.com/zh-cn/PublicProfile/4033620 伪造者生成的代码。 |