fabric_gateway_pool_go

package module
v0.0.0-...-edbde60 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 13 Imported by: 0

README

GoDoc Go Report Card LICENSE

fabric-gateway-pool-go

gateway client pool for Fabric 2.4+

features

  • unit test
  • 更好的心跳检测方式
  • examples

Getting started

install

Import package:

import "github.com/VegetableDoggies/fabric-gateway-pool-go"

go get github.com/VegetableDoggies/fabric-gateway-pool-go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGateway

func NewGateway(option *Options) (*client.Gateway, error)

Types

type HlfGWPool

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

func NewHlfGWPool

func NewHlfGWPool(option *Options) (*HlfGWPool, error)

func (*HlfGWPool) Close

func (pool *HlfGWPool) Close() (err error)

Close releases all resources used by the connection pool

func (*HlfGWPool) GetConnection

func (pool *HlfGWPool) GetConnection() (*client.Gateway, error)

GetConnection retrieves a Fabric Gateway connection from the pool

func (*HlfGWPool) ReleaseConnection

func (pool *HlfGWPool) ReleaseConnection(conn *client.Gateway)

ReleaseConnection releases a Fabric Gateway connection back to the pool

type Options

type Options struct {
	PoolSize          int           `json:"poolSize"`                               // 连接池大小
	HeartbeatCheck    bool          `json:"heartbeatCheck"`                         // 是否开启心跳检测
	HeartbeatInterval time.Duration `json:"heartbeatInterval"`                      // 心跳检测间隔
	MspID             string        `json:"mspID" yaml:"mspID"`                     // mspID
	CertPath          string        `json:"certPath" yaml:"certPath"`               // certPath
	KeyPath           string        `json:"keyPath" yaml:"keyPath"`                 // keyPath
	TlsCertPath       string        `json:"tlsCertPath" yaml:"tlsCertPath"`         // tls证书路径
	PeerEndpoint      string        `json:"peerEndpoint" yaml:"peerEndpoint"`       // peer访问地址
	GatewayPeer       string        `json:"gatewayPeer" yaml:"gatewayPeer"`         // peer id
	GrpcTimeout       time.Duration `json:"grpcTimeout" yaml:"grpcTimeout"`         // grpc心跳超时时间
	GrpcInterval      time.Duration `json:"interval" yaml:"interval"`               // gprc心跳间隔
	EndorseTimeout    time.Duration `json:"endorseTimeout" yaml:"endorseTimeout"`   // 背书超时时间
	SubmitTimeout     time.Duration `json:"submitTimeout" yaml:"submitTimeout"`     // 交易提交时间
	CommitTimeout     time.Duration `json:"commitTimeout" yaml:"commitTimeout"`     // 节点提交超时时间
	EvaluateTimeout   time.Duration `json:"evaluateTimeout" yaml:"evaluateTimeout"` // 查询超时
	ChannelName       string        `json:"channelName" yaml:"channelName"`         // 通道名
}

Jump to

Keyboard shortcuts

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