chain_client

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitChainClient

func InitChainClient() error

InitChainClient 初始化链

@return error

func InitChainClientMock

func InitChainClientMock() error

InitChainClientMock 初始化链客户端

@return error

Types

type ChainClient

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

ChainClient 链交互对象结构体

func (*ChainClient) CheckChain

func (c *ChainClient) CheckChain() bool

CheckChain 检查链的连通性

@receiver c
@return bool

func (*ChainClient) GetTxProve

func (c *ChainClient) GetTxProve(tx *peer.ProcessedTransaction, txId, chainRid string) string

GetTxProve 获取交易认证信息

@receiver c
@param tx
@param txId
@param chainRid
@return string

func (*ChainClient) InvokeContract

func (c *ChainClient) InvokeContract(
	chainRid, contractName, method string,
	args [][]byte, needTx bool) (string, string, *peer.ProcessedTransaction, error)

InvokeContract 调用合约

@receiver c
@param chainRid
@param contractName
@param method
@param args
@param needTx
@return string
@return string
@return *peer.ProcessedTransaction
@return error

func (*ChainClient) TxProve

func (c *ChainClient) TxProve(txProve string) bool

TxProve 交易认证

@receiver c
@param txProve
@return bool

type ChainClientItfc

type ChainClientItfc interface {
	InvokeContract(
		chainRid, contractName, method string,
		args [][]byte, needTx bool) (string, string, *peer.ProcessedTransaction, error)
	GetTxProve(tx *peer.ProcessedTransaction, txId, chainRid string) string
	TxProve(txProve string) bool
	CheckChain() bool
}

ChainClientItfc 链客户端接口

var ChainClientV1 ChainClientItfc

ChainClientV1 链交互对象

type ChainClientMock

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

ChainClientMock 链客户端结构体Mock

func (*ChainClientMock) CheckChain

func (c *ChainClientMock) CheckChain() bool

CheckChain 检查链的连通性

@receiver c
@return bool

func (*ChainClientMock) GetTxProve

func (c *ChainClientMock) GetTxProve(tx *peer.ProcessedTransaction, txId, chainId string) string

GetTxProve 获取交易证明

@receiver c
@param tx
@param txId
@param chainId
@return string

func (*ChainClientMock) InvokeContract

func (c *ChainClientMock) InvokeContract(
	chainId, contractName, method string,
	args [][]byte, needTx bool) (string, string, *peer.ProcessedTransaction, error)

InvokeContract invoke合约

@receiver c
@param chainId
@param contractName
@param method
@param args
@param needTx
@return string
@return string
@return *peer.ProcessedTransaction
@return error

func (*ChainClientMock) TxProve

func (c *ChainClientMock) TxProve(txProve string) bool

TxProve 交易认证

@receiver c
@param txProve
@return bool

type Channel

type Channel struct {
	Orderers []string            `yaml:"orderers"`
	Peers    map[string]*PeerOpt `yaml:"peers"`
}

Channel channel结构

type Client

type Client struct {
	Organization string    `yaml:"organization"`
	Logging      *Logging  `yaml:"logging"`
	TlsCerts     *TlsCerts `yaml:"tlsCerts"`
}

Client client结构

type ClientCert

type ClientCert struct {
	Key  *FilePath `yaml:"key"`
	Cert *FilePath `yaml:"cert"`
}

ClientCert client证书结构

type EntityMatchers

type EntityMatchers struct {
	PeerMatcher    []*Matcher `yaml:"peer"`
	OrdererMatcher []*Matcher `yaml:"orderer"`
}

EntityMatchers EntityMatchers

type FabricSDKTemplate

type FabricSDKTemplate struct {
	Version        string                   `yaml:"version"`
	Client         *Client                  `yaml:"client"`
	Channels       map[string]*Channel      `yaml:"channels"`
	Organizations  map[string]*Organization `yaml:"organizations"`
	Peers          map[string]*Peer         `yaml:"peers"`
	Orderers       map[string]*Orderer      `yaml:"orderers"`
	EntityMatchers *EntityMatchers          `yaml:"entityMatchers"`
}

FabricSDKTemplate 长安链SDK模板类

func (*FabricSDKTemplate) SetChannel

func (t *FabricSDKTemplate) SetChannel(name string, channel *Channel)

SetChannel 设置channel

@receiver t
@param name
@param channel

func (*FabricSDKTemplate) SetClient

func (t *FabricSDKTemplate) SetClient(client *Client)

SetClient 设置client

@receiver t
@param client

func (*FabricSDKTemplate) SetEntityMatchers

func (t *FabricSDKTemplate) SetEntityMatchers(entityMatchers *EntityMatchers)

SetEntityMatchers 设置EntityMatchers

@receiver t
@param entityMatchers

func (*FabricSDKTemplate) SetOrderer

func (t *FabricSDKTemplate) SetOrderer(name string, orderer *Orderer)

SetOrderer 设置orderer节点

@receiver t
@param name
@param orderer

func (*FabricSDKTemplate) SetOrderers

func (t *FabricSDKTemplate) SetOrderers(orderers map[string]*Orderer)

SetOrderers 设置orderer节点

@receiver t
@param orderers

func (*FabricSDKTemplate) SetOrganization

func (t *FabricSDKTemplate) SetOrganization(name string, organization *Organization)

SetOrganization 设置组织

@receiver t
@param name
@param organization

func (*FabricSDKTemplate) SetPeer

func (t *FabricSDKTemplate) SetPeer(name string, peer *Peer)

SetPeer 设置peer节点

@receiver t
@param name
@param peer

func (*FabricSDKTemplate) SetPeers

func (t *FabricSDKTemplate) SetPeers(peers map[string]*Peer)

SetPeers 设置peer节点

@receiver t
@param peers

type FilePath

type FilePath struct {
	Path string `yaml:"path"`
}

FilePath 文件路径

type GRPCOptions

type GRPCOptions struct {
	Override      string `yaml:"ssl-target-name-override"`
	AliveTime     string `yaml:"keep-alive-time"`
	AliveTimeOut  string `yaml:"keep-alive-timeout"`
	AlivePermit   bool   `yaml:"keep-alive-permit"`
	FailFast      bool   `yaml:"fail-fast"`
	AllowInsecure bool   `yaml:"allow-insecure"`
}

GRPCOptions grpc配置

type Logging

type Logging struct {
	Level string `yaml:"level"`
}

Logging 日志结构

type Matcher

type Matcher struct {
	Pattern    string `yaml:"pattern"`
	MappedHost string `yaml:"mappedHost"`
}

Matcher Matcher

type Orderer

type Orderer struct {
	URL         string       `yaml:"url"`
	GRPCOptions *GRPCOptions `yaml:"grpcOptions"`
	TlsCACerts  *FilePath    `yaml:"tlsCACerts"`
}

Orderer 配置内容与Peer一致

type Organization

type Organization struct {
	MspID string           `yaml:"mspid"`
	Peers []string         `yaml:"peers"`
	Users map[string]*User `yaml:"users"`
}

Organization 组织结构

type Peer

type Peer struct {
	URL         string       `yaml:"url"`
	GRPCOptions *GRPCOptions `yaml:"grpcOptions"`
	TlsCACerts  *FilePath    `yaml:"tlsCACerts"`
}

Peer peer节点

type PeerOpt

type PeerOpt struct {
	EndorsingPeer  bool `yaml:"endorsingPeer"`
	ChaincodeQuery bool `yaml:"chaincodeQuery"`
	LedgerQuery    bool `yaml:"ledgerQuery"`
	EventSource    bool `yaml:"eventSource"`
}

PeerOpt peer选项

type TlsCerts

type TlsCerts struct {
	SystemCertPool bool        `yaml:"systemCertPool"`
	ClientCert     *ClientCert `yaml:"client"`
}

TlsCerts tls证书结构

type User

type User struct {
	KeyFile  *FilePath `yaml:"key"`
	CertFile *FilePath `yaml:"cert"`
	// contains filtered or unexported fields
}

User user结构

Jump to

Keyboard shortcuts

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