fab

package
v0.0.0-...-84f2696 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConfigEndpointFromOptions

func BuildConfigEndpointFromOptions(opts ...interface{}) (fab.EndpointConfig, error)

BuildConfigEndpointFromOptions will return an EndpointConfig instance pre-built with Optional interfaces provided in fabsdk's WithEndpointConfig(opts...) call

func ConfigFromBackend

func ConfigFromBackend(coreBackend ...core.ConfigBackend) (fab.EndpointConfig, error)

ConfigFromBackend returns endpoint config implementation for given backend

func IsEndpointConfigFullyOverridden

func IsEndpointConfigFullyOverridden(c *EndpointConfigOptions) bool

IsEndpointConfigFullyOverridden will return true if all of the argument's sub interfaces is not nil (ie EndpointConfig interface not fully overridden)

func UpdateMissingOptsWithDefaultConfig

func UpdateMissingOptsWithDefaultConfig(c *EndpointConfigOptions, d fab.EndpointConfig) fab.EndpointConfig

UpdateMissingOptsWithDefaultConfig will verify if any functions of the EndpointConfig were not updated with fabsdk's WithConfigEndpoint(opts...) call, then use default EndpointConfig interface for these functions instead

Types

type BalancerType

type BalancerType string

BalancerType is the load-balancer type

const (
	// RoundRobin (default) chooses endorsers in a round-robin fashion
	RoundRobin BalancerType = "RoundRobin"

	// Random chooses endorsers randomly
	Random BalancerType = "Random"
)

type ChannelEndpointConfig

type ChannelEndpointConfig struct {
	// Orderers list of ordering service nodes
	Orderers []string
	// Peers a list of peer-channels that are part of this organization
	// to get the real Peer config object, use the Name field and fetch NetworkConfig.Peers[Name]
	Peers map[string]PeerChannelConfig
	//Policies list of policies for channel
	Policies ChannelPolicies
}

ChannelEndpointConfig provides the definition of channels for the network

type ChannelPolicies

type ChannelPolicies struct {
	//Policy for querying channel block
	QueryChannelConfig QueryChannelConfigPolicy
	//Policy for querying discovery
	Discovery DiscoveryPolicy
	//Policy for endorser selection
	Selection SelectionPolicy
	//Policy for event service
	EventService EventServicePolicy
}

ChannelPolicies defines list of policies defined for a channel

type ClientConfig

type ClientConfig struct {
	Organization string
	TLSCerts     ClientTLSConfig
}

ClientConfig provides the definition of the client configuration

type ClientTLSConfig

type ClientTLSConfig struct {
	//Client TLS information
	Client endpoint.TLSKeyPair
}

ClientTLSConfig contains the client TLS configuration

type DiscoveryPolicy

type DiscoveryPolicy struct {
	MinResponses int
	MaxTargets   int
	RetryOpts    retry.Opts
}

DiscoveryPolicy defines policy for discovery

type EndpointConfig

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

EndpointConfig represents the endpoint configuration for the client

func (*EndpointConfig) ChannelConfig

func (c *EndpointConfig) ChannelConfig(name string) *fab.ChannelEndpointConfig

ChannelConfig returns the channel configuration

func (*EndpointConfig) ChannelOrderers

func (c *EndpointConfig) ChannelOrderers(name string) []fab.OrdererConfig

ChannelOrderers returns a list of channel orderers

func (*EndpointConfig) ChannelPeers

func (c *EndpointConfig) ChannelPeers(name string) []fab.ChannelPeer

ChannelPeers returns the channel peers configuration

func (*EndpointConfig) CryptoConfigPath

func (c *EndpointConfig) CryptoConfigPath() string

CryptoConfigPath ...

func (*EndpointConfig) NetworkConfig

func (c *EndpointConfig) NetworkConfig() *fab.NetworkConfig

NetworkConfig returns the network configuration defined in the config file

func (*EndpointConfig) NetworkPeers

func (c *EndpointConfig) NetworkPeers() []fab.NetworkPeer

NetworkPeers returns the network peers configuration, all the peers from all the orgs in config.

func (*EndpointConfig) OrdererConfig

func (c *EndpointConfig) OrdererConfig(nameOrURL string) (*fab.OrdererConfig, bool, bool)

OrdererConfig returns the requested orderer

func (*EndpointConfig) OrderersConfig

func (c *EndpointConfig) OrderersConfig() []fab.OrdererConfig

OrderersConfig returns a list of defined orderers

func (*EndpointConfig) PeerConfig

func (c *EndpointConfig) PeerConfig(nameOrURL string) (*fab.PeerConfig, bool)

PeerConfig Retrieves a specific peer from the configuration by name or url

func (*EndpointConfig) PeersConfig

func (c *EndpointConfig) PeersConfig(org string) ([]fab.PeerConfig, bool)

PeersConfig Retrieves the fabric peers for the specified org from the config file provided

func (*EndpointConfig) ResetNetworkConfig

func (c *EndpointConfig) ResetNetworkConfig() error

ResetNetworkConfig clears network config cache

func (*EndpointConfig) TLSCACertPool

func (c *EndpointConfig) TLSCACertPool() commtls.CertPool

TLSCACertPool returns the configured cert pool. If a certConfig is provided, the certificate is added to the pool

func (*EndpointConfig) TLSClientCerts

func (c *EndpointConfig) TLSClientCerts() []tls.Certificate

TLSClientCerts loads the client's certs for mutual TLS

func (*EndpointConfig) Timeout

func (c *EndpointConfig) Timeout(tType fab.TimeoutType) time.Duration

Timeout reads timeouts for the given timeout type, if type is not found in the config then default is set as per the const value above for the corresponding type

type EndpointConfigOptions

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

EndpointConfigOptions represents EndpointConfig interface with overridable interface functions if a function is not overridden, the default EndpointConfig implementation will be used.

type EventServicePolicy

type EventServicePolicy struct {
	ResolverStrategy                 string
	MinBlockHeightResolverMode       string
	Balancer                         BalancerType
	BlockHeightLagThreshold          int
	PeerMonitor                      string
	ReconnectBlockHeightLagThreshold int
	PeerMonitorPeriod                time.Duration
}

EventServicePolicy specifies the policy for the event service

type MatchConfig

type MatchConfig struct {
	Pattern string

	// these are used for hostname mapping
	URLSubstitutionExp                  string
	SSLTargetOverrideURLSubstitutionExp string
	MappedHost                          string

	// this is used for Name mapping instead of hostname mappings
	MappedName string

	//IgnoreEndpoint option to exclude given entity from any kind of search or from entity list
	IgnoreEndpoint bool
}

MatchConfig contains match pattern and substitution pattern for pattern matching of network configured hostnames or channel names with static config

type OrdererConfig

type OrdererConfig struct {
	URL         string
	GRPCOptions map[string]interface{}
	TLSCACerts  endpoint.TLSConfig
}

OrdererConfig defines an orderer configuration

type OrganizationConfig

type OrganizationConfig struct {
	MSPID                  string
	CryptoPath             string
	Users                  map[string]endpoint.TLSKeyPair
	Peers                  []string
	CertificateAuthorities []string
}

OrganizationConfig provides the definition of an organization in the network

type PeerChannelConfig

type PeerChannelConfig struct {
	EndorsingPeer  bool
	ChaincodeQuery bool
	LedgerQuery    bool
	EventSource    bool
}

PeerChannelConfig defines the peer capabilities

type PeerConfig

type PeerConfig struct {
	URL         string
	GRPCOptions map[string]interface{}
	TLSCACerts  endpoint.TLSConfig
}

PeerConfig defines a peer configuration

type QueryChannelConfigPolicy

type QueryChannelConfigPolicy struct {
	MinResponses int
	MaxTargets   int
	RetryOpts    retry.Opts
}

QueryChannelConfigPolicy defines opts for channelConfigBlock

type SelectionPolicy

type SelectionPolicy struct {
	// SortingStrategy is the endorser sorting strategy to use
	SortingStrategy SelectionSortingStrategy

	// BalancerType is the balancer to use in order to load-balance calls to endorsers
	Balancer BalancerType

	// BlockHeightLagThreshold is the number of blocks from the highest block number of a group of peers
	// that a peer can lag behind and still be considered to be up-to-date. These peers will be sorted
	// using the given Balancer. If a peer's block height falls behind this threshold then it will be
	// demoted to a lower priority list of peers which will be sorted according to block height.
	// Note: This property only applies to BlockHeightPriority sorter
	BlockHeightLagThreshold int
}

SelectionPolicy defines policy for selection

type SelectionSortingStrategy

type SelectionSortingStrategy string

SelectionSortingStrategy is the endorser selection sorting strategy

const (
	// BlockHeightPriority (default) is a load-balancing selection sorting strategy
	// which also prioritizes peers at a block height that is above a certain "lag" threshold.
	BlockHeightPriority SelectionSortingStrategy = "BlockHeightPriority"

	// Balanced is a load-balancing selection sorting strategy
	Balanced SelectionSortingStrategy = "Balanced"
)

Directories

Path Synopsis
ccpackager
events
api
Package resource provides access to fabric network resource management, typically using system channel queries.
Package resource provides access to fabric network resource management, typically using system channel queries.
Package txn enables creating, endorsing and sending transactions to Fabric peers and orderers.
Package txn enables creating, endorsing and sending transactions to Fabric peers and orderers.

Jump to

Keyboard shortcuts

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