chconfig

package
v0.0.0-...-b27bbda Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRefCache

func NewRefCache(opts ...options.Opt) *lazycache.Cache

NewRefCache a cache of channel config references that refreshed with the given interval

func WithErrorHandler

func WithErrorHandler(value fab.ErrorHandler) coptions.Opt

WithErrorHandler sets the error handler

func WithRefreshInterval

func WithRefreshInterval(value time.Duration) coptions.Opt

WithRefreshInterval sets the interval in which the channel config cache is refreshed

Types

type CacheKey

type CacheKey interface {
	lazycache.Key
	Context() fab.ClientContext
	ChannelID() string
	Provider() Provider
}

CacheKey channel config reference cache key

func NewCacheKey

func NewCacheKey(ctx fab.ClientContext, pvdr Provider, channelID string) (CacheKey, error)

NewCacheKey returns a new CacheKey

type ChannelCfg

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

ChannelCfg contains channel configuration

func NewChannelCfg

func NewChannelCfg(channelID string) *ChannelCfg

NewChannelCfg creates channel cfg TODO: This is temporary, Remove once we have config injected in sdk

func (*ChannelCfg) AnchorPeers

func (cfg *ChannelCfg) AnchorPeers() []*fab.OrgAnchorPeer

AnchorPeers returns anchor peers

func (*ChannelCfg) BlockNumber

func (cfg *ChannelCfg) BlockNumber() uint64

BlockNumber returns the channel config block number

func (*ChannelCfg) HasCapability

func (cfg *ChannelCfg) HasCapability(group fab.ConfigGroupKey, capability string) bool

HasCapability indicates whether or not the given group has the given capability

func (*ChannelCfg) ID

func (cfg *ChannelCfg) ID() string

ID returns the channel ID

func (*ChannelCfg) MSPs

func (cfg *ChannelCfg) MSPs() []*mb.MSPConfig

MSPs returns msps

func (*ChannelCfg) Orderers

func (cfg *ChannelCfg) Orderers() []string

Orderers returns orderers

func (*ChannelCfg) Versions

func (cfg *ChannelCfg) Versions() *fab.Versions

Versions returns versions

type ChannelConfig

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

ChannelConfig implements query channel configuration

func New

func New(channelID string, options ...Option) (*ChannelConfig, error)

New channel config implementation

func (*ChannelConfig) Query

func (c *ChannelConfig) Query(reqCtx reqContext.Context) (fab.ChannelCfg, error)

Query returns channel configuration

func (*ChannelConfig) QueryBlock

func (c *ChannelConfig) QueryBlock(reqCtx reqContext.Context) (*common.Block, error)

QueryBlock returns channel configuration

type ChannelConfigError

type ChannelConfigError error

ChannelConfigError is returned when the channel config could not be refreshed

type Context

type Context struct {
	context.Providers
	msp.Identity
}

Context holds the providers and identity

type Option

type Option func(opts *Opts) error

Option func for each Opts argument

func WithMaxTargets

func WithMaxTargets(maxTargets int) Option

WithMaxTargets encapsulates minTargets to Option

func WithMinResponses

func WithMinResponses(min int) Option

WithMinResponses encapsulates minimum responses to Option

func WithOrderer

func WithOrderer(orderer fab.Orderer) Option

WithOrderer encapsulates orderer to Option

func WithPeers

func WithPeers(peers []fab.Peer) Option

WithPeers encapsulates peers to Option

func WithRetryOpts

func WithRetryOpts(retryOpts retry.Opts) Option

WithRetryOpts encapsulates retry opts to Option

type Opts

type Opts struct {
	Orderer      fab.Orderer // if configured, channel config will be retrieved from this orderer
	Targets      []fab.Peer  // if configured, channel config will be retrieved from peers (targets)
	MinResponses int         // used with targets option; min number of success responses (from targets/peers)
	MaxTargets   int         //if configured, channel config will be retrieved for these number of random targets
	RetryOpts    retry.Opts  //opts for channel query retry handler
}

Opts contains options for retrieving channel configuration

type Provider

type Provider func(channelID string) (fab.ChannelConfig, error)

Provider provides ChannelConfig

type Ref

type Ref struct {
	*lazyref.Reference
	// contains filtered or unexported fields
}

Ref channel configuration lazy reference

func NewRef

func NewRef(ctx fab.ClientContext, pvdr Provider, channel string, opts ...options.Opt) *Ref

NewRef returns a new channel config reference

Jump to

Keyboard shortcuts

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