network

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 46 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ChaincodePort  api.PortName = "Chaincode"
	EventsPort     api.PortName = "Events"
	HostPort       api.PortName = "HostPort"
	ListenPort     api.PortName = "Listen"
	ProfilePort    api.PortName = "Profile"
	OperationsPort api.PortName = "Operations"
	ViewPort       api.PortName = "View"
	P2PPort        api.PortName = "P2P"
	ClusterPort    api.PortName = "Cluster"
	WebPort        api.PortName = "Web"
	AdminPort      api.PortName = "Admin"
)
View Source
const (
	FabricBinsPathEnvKey = "FAB_BINS"
)

Variables

This section is empty.

Functions

func ApproveChaincodeForMyOrg

func ApproveChaincodeForMyOrg(n *Network, channel string, orderer *topology.Orderer, chaincode *topology.Chaincode, peers ...*topology.Peer)

func BCCSPOpts

func BCCSPOpts(defaultProvider string) *topology.BCCSP

BCCSPOpts returns a `topology.BCCSP` instance. `defaultProvider` sets the `Default` value of the BCCSP, that is denoting the which provider impl is used. `defaultProvider` currently supports `SW` and `PKCS11`.

func Broadcast

Broadcast sends given env to Broadcast API of specified orderer.

func CheckCommitReadinessUntilReady

func CheckCommitReadinessUntilReady(n *Network, channel string, chaincode *topology.Chaincode, checkOrgs []*topology.Organization, peers ...*topology.Peer)

func CommitChaincode

func CommitChaincode(n *Network, channel string, orderer *topology.Orderer, chaincode *topology.Chaincode, peer *topology.Peer, checkPeers ...*topology.Peer)

func Compute

func Compute(original, updated *cb.Config) (*cb.ConfigUpdate, error)

func ComputeUpdateOrdererConfig

func ComputeUpdateOrdererConfig(updateFile string, n *Network, channel string, current, updated *common.Config, submitter *topology.Peer, additionalSigners ...*topology.Orderer)

func CurrentConfigBlockNumber

func CurrentConfigBlockNumber(n *Network, peer *topology.Peer, orderer *topology.Orderer, channel string) uint64

CurrentConfigBlockNumber retrieves the block number from the header of the current config block. This can be used to detect when configuration change has completed. If an orderer is not provided, the current config block will be fetched from the peer.

func CurrentConfigBlockNumberFromPeer

func CurrentConfigBlockNumberFromPeer(n *Network, peer *topology.Peer, channel, output string) uint64

CurrentConfigBlockNumberFromPeer retrieves the block number from the header of the peer's current config block.

func Deliver

func Deliver(n *Network, o *topology.Orderer, env *common.Envelope) (*common.Block, error)

Deliver sends given env to Deliver API of specified orderer.

func DiscoverPeers

func DiscoverPeers(n *Network, p *topology.Peer, user, channelName string) func() []DiscoveredPeer

running discovery service command discover peers against peer using channel name and user as specified in the function arguments. return a slice of the discovered peers

func EnsureChaincodeCommitted

func EnsureChaincodeCommitted(n *Network, channel, name, version, sequence string, checkOrgs []*topology.Organization, peers ...*topology.Peer)

EnsureChaincodeCommitted polls each supplied peer until the chaincode definition has been committed to the peer's rwset.

func EnsureInstalled

func EnsureInstalled(n *Network, label, packageID string, peers ...*topology.Peer)

func FetchConfigBlock

func FetchConfigBlock(n *Network, peer *topology.Peer, orderer *topology.Orderer, channel string, output string)

FetchConfigBlock fetches latest config block.

func FindOptOrg

func FindOptOrg(orgs []opts.Organization, network string) (opts.Organization, bool)

FindOptOrg searches for the organization matching the passed network.

func GetConfig

func GetConfig(n *Network, peer *topology.Peer, orderer *topology.Orderer, channel string) *common.Config

GetConfig retrieves the last config of the given channel.

func GetConfigBlock

func GetConfigBlock(n *Network, peer *topology.Peer, orderer *topology.Orderer, channel string) *common.Block

GetConfigBlock retrieves the current config block for a channel.

func GetLinkedIdentities

func GetLinkedIdentities(peer *topology.Peer) []string

func GetPersistenceType

func GetPersistenceType(peer *topology.Peer) string

func GetVaultPersistenceOrionCreator

func GetVaultPersistenceOrionCreator(peer *topology.Peer) string

func GetVaultPersistenceOrionDatabase

func GetVaultPersistenceOrionDatabase(peer *topology.Peer) string

func GetVaultPersistenceOrionNetwork

func GetVaultPersistenceOrionNetwork(peer *topology.Peer) string

func InitChaincode

func InitChaincode(n *Network, channel string, orderer *topology.Orderer, chaincode *topology.Chaincode, peers ...*topology.Peer)

func InstallChaincode

func InstallChaincode(n *Network, chaincode *topology.Chaincode, peers ...*topology.Peer)

func NewEmptyTopology

func NewEmptyTopology() *topology.Topology

func NewIdemixPeerIdentity

func NewIdemixPeerIdentity(id, eid string) *topology.PeerIdentity

func NewX509PeerIdentity

func NewX509PeerIdentity(id, eid, path string, org opts.Organization, bccspDefault string, Default bool) *topology.PeerIdentity

func OrdererPortNames

func OrdererPortNames() []api.PortName

OrdererPortNames returns the list of ports that need to be reserved for an Orderer.

func PackageAndInstallChaincode

func PackageAndInstallChaincode(n *Network, chaincode *topology.Chaincode, peers ...*topology.Peer)

func PackageChaincode

func PackageChaincode(n *Network, chaincode *topology.Chaincode, peer *topology.Peer)

func PackageChaincodeBinary

func PackageChaincodeBinary(c *topology.Chaincode)

PackageChaincodeBinary is a helper function to package an already built chaincode and write it to the location specified by Chaincode.PackageFile.

func PeerPortNames

func PeerPortNames() []api.PortName

PeerPortNames returns the list of ports that need to be reserved for a Peer.

func QueryInstalledReferences

func QueryInstalledReferences(n *Network, channel, label, packageID string, checkPeer *topology.Peer, nameVersions ...[]string)

func UnmarshalBlockFromFile

func UnmarshalBlockFromFile(blockFile string) *common.Block

UnmarshalBlockFromFile unmarshals a proto encoded block from a file.

func UpdateConfig

func UpdateConfig(n *Network, orderer *topology.Orderer, channel string, current, updated *common.Config, getConfigBlockFromOrderer bool, submitter *topology.Peer, additionalSigners ...*topology.Peer)

UpdateConfig computes, signs, and submits a configuration update and waits for the update to complete.

func UpdateConsensusMetadata

func UpdateConsensusMetadata(network *Network, peer *topology.Peer, orderer *topology.Orderer, channel string, mutateMetadata ConsensusMetadataMutator)

UpdateConsensusMetadata executes a config update that updates the consensus metadata according to the given ConsensusMetadataMutator.

func UpdateOrdererConfig

func UpdateOrdererConfig(n *Network, orderer *topology.Orderer, channel string, current, updated *common.Config, submitter *topology.Peer, additionalSigners ...*topology.Orderer)

UpdateOrdererConfig computes, signs, and submits a configuration update which requires orderers signature and waits for the update to complete.

func UpdateOrdererConfigSession

func UpdateOrdererConfigSession(n *Network, orderer *topology.Orderer, channel string, current, updated *common.Config, submitter *topology.Peer, additionalSigners ...*topology.Orderer) *gexec.Session

UpdateOrdererConfigSession computes, signs, and submits a configuration update which requires orderer signatures. The caller should wait on the returned seession retrieve the exit code.

func UpdateOrdererMSP

func UpdateOrdererMSP(network *Network, peer *topology.Peer, orderer *topology.Orderer, channel, orgID string, mutateMSP MSPMutator)

Types

type AdminCredential

type AdminCredential struct {
	Id       string `json:"id"`
	Password string `json:"password"`
}

type Builder

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

func (*Builder) Build

func (c *Builder) Build(path string) string

func (*Builder) FSCCLI

func (c *Builder) FSCCLI() string

func (*Builder) Idemixgen

func (c *Builder) Idemixgen() string

type BuilderClient

type BuilderClient interface {
	Build(path string) string
}

type CertificationAuthority

type CertificationAuthority struct {
	Url         string            `json:"url"`
	CaName      string            `json:"caName"`
	TLSCACerts  map[string]string `json:"tlsCACerts"`
	HttpOptions HttpOptions       `json:"httpOptions"`
}

type ChaincodeProcessor

type ChaincodeProcessor interface {
	Process(network *Network, cc *topology.ChannelChaincode) *topology.ChannelChaincode
}

type Channel

type Channel struct {
	Orderers []string               `json:"orderers"`
	Peers    map[string]ChannelPeer `json:"peers"`
}

type ChannelPeer

type ChannelPeer struct {
	EndorsingPeer  bool `json:"endorsingPeer"`
	ChaincodeQuery bool `json:"chaincodeQuery"`
	LedgerQuery    bool `json:"ledgerQuery"`
	EventSource    bool `json:"eventSource"`
	Discover       bool `json:"discover"`
}

type Client

type Client struct {
	AdminCredential      AdminCredential `json:"adminCredential"`
	Organization         string          `json:"organization"`
	EnableAuthentication bool            `json:"enableAuthentication"`
	TlsEnable            bool            `json:"tlsEnable"`
	Connection           Connection      `json:"connection"`
}

type Connection

type Connection struct {
	Timeout Timeout `json:"timeout"`
}

type ConnectionProfile

type ConnectionProfile struct {
	Name                   string                            `json:"name"`
	Version                string                            `json:"version"`
	Client                 Client                            `json:"client"`
	Channels               map[string]Channel                `json:"channels"`
	Orderers               map[string]Orderer                `json:"orderers"`
	Organizations          map[string]Organization           `json:"organizations"`
	Peers                  map[string]Peer                   `json:"peers"`
	CertificateAuthorities map[string]CertificationAuthority `json:"certificateAuthorities"`
}

type ConsensusMetadataMutator

type ConsensusMetadataMutator func([]byte) []byte

ConsensusMetadataMutator receives ConsensusType.Metadata and mutates it.

type DiscoveredPeer

type DiscoveredPeer struct {
	MSPID      string   `yaml:"mspid,omitempty"`
	Endpoint   string   `yaml:"endpoint,omitempty"`
	Identity   string   `yaml:"identity,omitempty"`
	Chaincodes []string `yaml:"chaincodes,omitempty"`
}

DiscoveredPeer defines a struct for discovering peers using discovery service. each peer in the result will have these fields

type Extension

type Extension interface {
	CheckTopology()
	GenerateArtifacts()
	PostRun(load bool)
}

type HttpOptions

type HttpOptions struct {
	Verify bool `json:"verify"`
}

type MSPMutator

type MSPMutator func(config msp.FabricMSPConfig) msp.FabricMSPConfig

MSPMutator receives FabricMSPConfig and mutates it.

type Network

type Network struct {
	Context api.Context

	RootDir            string
	Prefix             string
	Builder            *Builder
	ExternalBuilders   []fabricconfig.ExternalBuilder
	NetworkID          string
	EventuallyTimeout  time.Duration
	MetricsProvider    string
	StatsdEndpoint     string
	ClientAuthRequired bool

	Logging           *topology.Logging
	PvtTxSupport      bool
	PvtTxCCSupport    bool
	MSPvtTxSupport    bool
	MSPvtCCSupport    bool
	FabTokenSupport   bool
	FabTokenCCSupport bool
	GRPCLogging       bool
	Organizations     []*topology.Organization
	SystemChannel     *topology.SystemChannel
	Channels          []*topology.Channel
	Consensus         *topology.Consensus
	Orderers          []*topology.Orderer
	Peers             []*topology.Peer
	Profiles          []*topology.Profile
	Consortiums       []*topology.Consortium
	Templates         *topology.Templates
	Resolvers         []*Resolver

	Extensions []Extension
	// contains filtered or unexported fields
}

func New

func New(reg api.Context, topology *topology.Topology, builderClient BuilderClient, ccps []ChaincodeProcessor, NetworkID string) *Network

func (*Network) AddExtension

func (n *Network) AddExtension(ex Extension)

func (*Network) AddOrg

func (n *Network) AddOrg(o *topology.Organization, peers ...*topology.Peer)

AddOrg adds an organization to a network.

func (*Network) AnchorsForChannel

func (n *Network) AnchorsForChannel(chanName string) []*topology.Peer

AnchorsForChannel returns all Peer instances that are anchors for the named channel.

func (*Network) AnchorsInOrg

func (n *Network) AnchorsInOrg(orgName string) []*topology.Peer

AnchorsInOrg returns all peers that are an anchor for at least one channel in the named organization.

func (*Network) AppendPeer added in v0.3.0

func (n *Network) AppendPeer(peer *topology.Peer)

func (*Network) BootstrapNode

func (n *Network) BootstrapNode(me *topology.Peer) string

func (*Network) CACertsBundlePath

func (n *Network) CACertsBundlePath() string

CACertsBundlePath returns the path to the bundle of CA certificates for the network. This bundle is used when connecting to peers.

func (*Network) Chaincodes

func (n *Network) Chaincodes(channel string) []*topology.ChannelChaincode

func (*Network) CheckTopology

func (n *Network) CheckTopology()

CheckTopology checks the topology of the network

func (*Network) CheckTopologyExtensions

func (n *Network) CheckTopologyExtensions()

CheckTopologyExtensions checks the topology of each extension

func (*Network) CheckTopologyFSCNodes

func (n *Network) CheckTopologyFSCNodes() (users map[string]int, userSpecs map[string][]topology.UserSpec)

CheckTopologyFSCNodes checks that the FSC nodes' are well configured. It returns the parameters to be used for cryptogen.

func (*Network) CheckTopologyFabricPeers

func (n *Network) CheckTopologyFabricPeers()

CheckTopologyFabricPeers checks that the fabric peers' ports are allocated

func (*Network) CheckTopologyOrderers

func (n *Network) CheckTopologyOrderers()

CheckTopologyOrderers checks that the orderers' ports are allocated

func (*Network) CheckTopologyOrgs

func (n *Network) CheckTopologyOrgs(users map[string]int, userSpecs map[string][]topology.UserSpec)

CheckTopologyOrgs allocates users for each organization

func (*Network) Cleanup

func (n *Network) Cleanup()

func (*Network) ConcatenateTLSCACertificates

func (n *Network) ConcatenateTLSCACertificates()

ConcatenateTLSCACertificates concatenates all TLS CA certificates into a single file to be used by peer CLI.

func (*Network) ConfigDir

func (n *Network) ConfigDir() string

func (*Network) ConfigTxConfigPath

func (n *Network) ConfigTxConfigPath() string

ConfigTxPath returns the path to the generated configtxgen configuration file.

func (*Network) ConfigTxGen

func (n *Network) ConfigTxGen(command common.Command) (*gexec.Session, error)

ConfigTxGen starts a gexec.Session for the provided configtxgen command.

func (*Network) Consortium

func (n *Network) Consortium(name string) *topology.Consortium

Consortium returns information about the named Consortium.

func (*Network) CreateAndJoinChannel

func (n *Network) CreateAndJoinChannel(o *topology.Orderer, channelName string)

CreateAndJoinChannel will create the specified channel. The referencing peers will then be joined to the channel.

The network must be running before this is called.

func (*Network) CreateAndJoinChannels

func (n *Network) CreateAndJoinChannels(o *topology.Orderer)

CreateAndJoinChannels will create all channels specified in the config that are referenced by peers. The referencing peers will then be joined to the channel(s).

The network must be running before this is called.

func (*Network) CreateChannel

func (n *Network) CreateChannel(channelName string, o *topology.Orderer, p *topology.Peer, additionalSigners ...interface{})

CreateChannel will submit an existing create channel transaction to the specified orderer. The channel transaction must exist at the location returned by CreateChannelTxPath. Optionally, additional signers may be included in the case where the channel creation tx modifies other aspects of the channel config for the new channel.

The orderer must be running when this is called.

func (*Network) CreateChannelExitCode

func (n *Network) CreateChannelExitCode(channelName string, o *topology.Orderer, p *topology.Peer, additionalSigners ...interface{}) int

CreateChannelExitCode will submit an existing create channel transaction to the specified orderer, wait for the operation to complete, and return the exit status of the "peer channel create" command.

The channel transaction must exist at the location returned by CreateChannelTxPath and the orderer must be running when this is called.

func (*Network) CreateChannelTxPath

func (n *Network) CreateChannelTxPath(channelName string) string

CreateChannelTxPath returns the path to the create channel transaction for the named channel.

func (*Network) CryptoConfigPath

func (n *Network) CryptoConfigPath() string

CryptoConfigPath returns the path to the generated cryptogen configuration file.

func (*Network) CryptoPath

func (n *Network) CryptoPath() string

CryptoPath returns the path to the directory where cryptogen will place its generated artifacts.

func (*Network) Cryptogen

func (n *Network) Cryptogen(command common.Command) (*gexec.Session, error)

Cryptogen starts a gexec.Session for the provided cryptogen command.

func (*Network) DefaultIdemixOrgMSPDir

func (n *Network) DefaultIdemixOrgMSPDir() string

func (*Network) DeployChaincode

func (n *Network) DeployChaincode(chaincode *topology.ChannelChaincode)

func (*Network) Discover

func (n *Network) Discover(command common.Command) (*gexec.Session, error)

Discover starts a gexec.Session for the provided discover command.

func (*Network) DiscoveredPeer

func (n *Network) DiscoveredPeer(p *topology.Peer, chaincodes ...string) DiscoveredPeer

DiscoveredPeer creates a new DiscoveredPeer from the peer and chaincodes passed as arguments.

func (*Network) DiscoveredPeerMatcher

func (n *Network) DiscoveredPeerMatcher(p *topology.Peer, chaincodes ...string) types.GomegaMatcher

func (*Network) FSCNodeLocalTLSDir

func (n *Network) FSCNodeLocalTLSDir(p *topology.Peer) string

FSCNodeLocalTLSDir returns the path to the local TLS directory for the peer.

func (*Network) FSCNodeVaultDir

func (n *Network) FSCNodeVaultDir(peer *topology.Peer) string

func (*Network) FSCPeerByName

func (n *Network) FSCPeerByName(name string) *topology.Peer

func (*Network) GenerateArtifacts

func (n *Network) GenerateArtifacts()

func (*Network) GenerateConfigTree

func (n *Network) GenerateConfigTree()

func (*Network) GenerateConfigTxConfig

func (n *Network) GenerateConfigTxConfig()

func (*Network) GenerateCoreConfig

func (n *Network) GenerateCoreConfig(p *topology.Peer)

func (*Network) GenerateCryptoConfig

func (n *Network) GenerateCryptoConfig()

func (*Network) GenerateOrdererConfig

func (n *Network) GenerateOrdererConfig(o *topology.Orderer)

func (*Network) GenerateResolverMap

func (n *Network) GenerateResolverMap()

func (*Network) IdemixOrgMSPDir

func (n *Network) IdemixOrgMSPDir(org *topology.Organization) string

func (*Network) IdemixOrgs

func (n *Network) IdemixOrgs() []*topology.Organization

IdemixOrgs returns all Organizations of type idemix.

func (*Network) IdemixUserMSPDir

func (n *Network) IdemixUserMSPDir(o *topology.Organization, user string) string

IdemixUserMSPDir returns the path to the MSP directory containing the idemix-related crypto material for the specified user of the organization.

func (*Network) Idemixgen

func (n *Network) Idemixgen(command common.Command) (*gexec.Session, error)

Idemixgen starts a gexec.Session for the provided idemixgen command.

func (*Network) JoinChannel

func (n *Network) JoinChannel(name string, o *topology.Orderer, peers ...*topology.Peer)

JoinChannel will join peers to the specified channel. The orderer is used to obtain the current configuration block for the channel.

The orderer and listed peers must be running before this is called.

func (*Network) ListTLSCACertificates

func (n *Network) ListTLSCACertificates() []string

ListTLSCACertificates returns the paths of all TLS CA certificates in the network, across all organizations.

func (*Network) Load

func (n *Network) Load()

func (*Network) LogFormat

func (n *Network) LogFormat() string

func (*Network) LogSpec

func (n *Network) LogSpec() string

func (*Network) Members

func (n *Network) Members() []grouper.Member

func (*Network) Orderer

func (n *Network) Orderer(name string) *topology.Orderer

Orderer returns the information about the named Orderer.

func (*Network) OrdererAddress

func (n *Network) OrdererAddress(o *topology.Orderer, portName api.PortName) string

OrdererAddress returns the address (host and port) exposed by the Orderer for the named port. Commands line tools should use the returned address when connecting to the orderer.

This assumes that the orderer is listening on 0.0.0.0 or 127.0.0.1 and is available on the loopback address.

func (*Network) OrdererAdminSession

func (n *Network) OrdererAdminSession(o *topology.Orderer, p *topology.Peer, command common.Command) (*gexec.Session, error)

OrdererAdminSession starts a gexec.Session as an orderer admin user. This is used primarily to generate orderer configuration updates.

func (*Network) OrdererBootstrapFile

func (n *Network) OrdererBootstrapFile() string

func (*Network) OrdererConfigPath

func (n *Network) OrdererConfigPath(o *topology.Orderer) string

OrdererConfigPath returns the path to the orderer configuration document for the specified Orderer.

func (*Network) OrdererDir

func (n *Network) OrdererDir(o *topology.Orderer) string

OrdererDir returns the path to the configuration directory for the specified Orderer.

func (*Network) OrdererGroupRunner

func (n *Network) OrdererGroupRunner() ifrit.Runner

OrdererGroupRunner returns a runner that can be used to start and stop all orderers in a network.

func (*Network) OrdererHost added in v0.3.0

func (n *Network) OrdererHost(o *topology.Orderer) string

OrdererHost returns the hostname of the Orderer instance.

func (*Network) OrdererLocalCryptoDir

func (n *Network) OrdererLocalCryptoDir(o *topology.Orderer, cryptoType string) string

OrdererLocalCryptoDir returns the path to the local crypto directory for the Orderer.

func (*Network) OrdererLocalMSPDir

func (n *Network) OrdererLocalMSPDir(o *topology.Orderer) string

OrdererLocalMSPDir returns the path to the local MSP directory for the Orderer.

func (*Network) OrdererLocalTLSDir

func (n *Network) OrdererLocalTLSDir(o *topology.Orderer) string

OrdererLocalTLSDir returns the path to the local TLS directory for the Orderer.

func (*Network) OrdererLogsFolder

func (n *Network) OrdererLogsFolder() string

func (*Network) OrdererOrgMSPDir

func (n *Network) OrdererOrgMSPDir(o *topology.Organization) string

OrdererOrgMSPDir returns the path to the MSP directory of the Orderer organization.

func (*Network) OrdererOrgs

func (n *Network) OrdererOrgs() []*topology.Organization

OrdererOrgs returns all Organization instances that own at least one orderer.

func (*Network) OrdererPort

func (n *Network) OrdererPort(o *topology.Orderer, portName api.PortName) uint16

OrdererPort returns the named port reserved for the Orderer instance.

func (*Network) OrdererRunner

func (n *Network) OrdererRunner(o *topology.Orderer) *runner2.Runner

OrdererRunner returns an ifrit.Runner for the specified orderer. The runner can be used to start and manage an orderer process.

func (*Network) OrdererUserCert

func (n *Network) OrdererUserCert(o *topology.Orderer, user string) string

OrdererUserCert returns the path to the certificate for the specified user in the orderer organization.

func (*Network) OrdererUserKey

func (n *Network) OrdererUserKey(o *topology.Orderer, user string) string

OrdererUserKey returns the path to the private key for the specified user in the orderer organization.

func (*Network) OrdererUserMSPDir

func (n *Network) OrdererUserMSPDir(o *topology.Orderer, user string) string

OrdererUserMSPDir returns the path to the MSP directory containing the certificates and keys for the specified user of the peer.

func (*Network) OrderersInOrg

func (n *Network) OrderersInOrg(orgName string) []*topology.Orderer

OrderersInOrg returns all Orderer instances owned by the named organaiztion.

func (*Network) OrgOrdererCACertificatePath added in v0.3.0

func (n *Network) OrgOrdererCACertificatePath(org *topology.Organization) string

func (*Network) OrgOrdererTLSCACertificatePath added in v0.3.0

func (n *Network) OrgOrdererTLSCACertificatePath(org *topology.Organization) string

func (*Network) OrgPeerCACertificatePath

func (n *Network) OrgPeerCACertificatePath(org *topology.Organization) string

func (*Network) Organization

func (n *Network) Organization(orgName string) *topology.Organization

Organization returns the information about the named Organization.

func (*Network) OrgsForOrderers

func (n *Network) OrgsForOrderers(ordererNames []string) []*topology.Organization

OrgsForOrderers returns all Organization instances that own at least one of the named orderers.

func (*Network) OutputBlockPath

func (n *Network) OutputBlockPath(channelName string) string

OutputBlockPath returns the path to the genesis block for the named system channel.

func (*Network) Peer

func (n *Network) Peer(orgName, peerName string) *topology.Peer

Peer returns the information about the named Peer in the named organization.

func (*Network) PeerAddress

func (n *Network) PeerAddress(p *topology.Peer, portName api.PortName) string

PeerAddress returns the address (host and port) exposed by the Peer for the named port. Commands line tools should use the returned address when connecting to a peer.

This assumes that the peer is listening on 0.0.0.0 and is available on the loopback address.

func (*Network) PeerAddressByName

func (n *Network) PeerAddressByName(p *topology.Peer, portName api.PortName) string

func (*Network) PeerAdminSession

func (n *Network) PeerAdminSession(p *topology.Peer, command common.Command) (*gexec.Session, error)

PeerAdminSession starts a gexec.Session as a peer admin for the provided peer command. This is intended to be used by short running peer fsccli commands that execute in the context of a peer configuration.

func (*Network) PeerByName

func (n *Network) PeerByName(name string) *topology.Peer

func (*Network) PeerCert

func (n *Network) PeerCert(p *topology.Peer) string

PeerCert returns the path to the peer's certificate.

func (*Network) PeerConfigPath

func (n *Network) PeerConfigPath(p *topology.Peer) string

PeerConfigPath returns the path to the peer configuration document for the specified peer.

func (*Network) PeerDir

func (n *Network) PeerDir(p *topology.Peer) string

PeerDir returns the path to the configuration directory for the specified Peer.

func (*Network) PeerGroupRunner

func (n *Network) PeerGroupRunner() ifrit.Runner

PeerGroupRunner returns a runner that can be used to start and stop all peers in a network.

func (*Network) PeerHost added in v0.3.0

func (n *Network) PeerHost(o *topology.Peer) string

PeerHost returns the hostname of the Peer instance.

func (*Network) PeerKey

func (n *Network) PeerKey(p *topology.Peer) string

func (*Network) PeerLedgerDir

func (n *Network) PeerLedgerDir(p *topology.Peer) string

PeerLedgerDir returns the rwset root directory for the specified peer.

func (*Network) PeerLocalExtraIdentityDir

func (n *Network) PeerLocalExtraIdentityDir(p *topology.Peer, id string) string

func (*Network) PeerLocalIdemixExtraIdentitiesDir

func (n *Network) PeerLocalIdemixExtraIdentitiesDir(p *topology.Peer) string

func (*Network) PeerLocalMSP

func (n *Network) PeerLocalMSP(p *topology.Peer) string

func (*Network) PeerLocalMSPDir

func (n *Network) PeerLocalMSPDir(p *topology.Peer) string

PeerLocalMSPDir returns the path to the local MSP directory for the peer.

func (*Network) PeerLocalMSPIdentityCert

func (n *Network) PeerLocalMSPIdentityCert(p *topology.Peer) string

func (*Network) PeerLocalTLSDir

func (n *Network) PeerLocalTLSDir(p *topology.Peer) string

PeerLocalTLSDir returns the path to the local TLS directory for the peer.

func (*Network) PeerLogsFolder

func (n *Network) PeerLogsFolder() string

func (*Network) PeerOrgMSPDir

func (n *Network) PeerOrgMSPDir(org *topology.Organization) string

PeerOrgMSPDir returns the path to the MSP directory of the Peer organization.

func (*Network) PeerOrgs

func (n *Network) PeerOrgs() []*topology.Organization

PeerOrgs returns all Organizations associated with at least one Peer.

func (*Network) PeerOrgsByPeers

func (n *Network) PeerOrgsByPeers(peers []*topology.Peer) []*topology.Organization

func (*Network) PeerPort

func (n *Network) PeerPort(p *topology.Peer, portName api.PortName) uint16

PeerPort returns the named port reserved for the Peer instance.

func (*Network) PeerPortByName

func (n *Network) PeerPortByName(p *topology.Peer, portName api.PortName) uint16

func (*Network) PeerRunner

func (n *Network) PeerRunner(p *topology.Peer, env ...string) *runner2.Runner

PeerRunner returns an ifrit.Runner for the specified peer. The runner can be used to start and manage a peer process.

func (*Network) PeerUserCert

func (n *Network) PeerUserCert(p *topology.Peer, user string) string

PeerUserCert returns the path to the certificate for the specified user in the peer organization.

func (*Network) PeerUserKey

func (n *Network) PeerUserKey(p *topology.Peer, user string) string

PeerUserKey returns the path to the private key for the specified user in the peer organization.

func (*Network) PeerUserLocalMSP

func (n *Network) PeerUserLocalMSP(p *topology.Peer, user string) string

func (*Network) PeerUserLocalMSPIdentityCert

func (n *Network) PeerUserLocalMSPIdentityCert(p *topology.Peer, user string) string

func (*Network) PeerUserMSPDir

func (n *Network) PeerUserMSPDir(p *topology.Peer, user string) string

PeerUserMSPDir returns the path to the MSP directory containing the certificates and keys for the specified user of the peer.

func (*Network) PeerUserSession

func (n *Network) PeerUserSession(p *topology.Peer, user string, command common.Command) (*gexec.Session, error)

PeerUserSession starts a gexec.Session as a peer user for the provided peer command. This is intended to be used by short running peer fsccli commands that execute in the context of a peer configuration.

func (*Network) PeerUserTLSDir

func (n *Network) PeerUserTLSDir(p *topology.Peer, user string) string

PeerUserTLSDir returns the path to the TLS directory containing the certificates and keys for the specified user of the peer.

func (*Network) PeersByName

func (n *Network) PeersByName(names []string) []*topology.Peer

func (*Network) PeersForChaincodeByName added in v0.3.0

func (n *Network) PeersForChaincodeByName(names []string) []*topology.Peer

func (*Network) PeersInOrg

func (n *Network) PeersInOrg(orgName string) []*topology.Peer

PeersInOrg returns all Peer instances that are owned by the named organization.

func (*Network) PeersInOrgWithOptions

func (n *Network) PeersInOrgWithOptions(orgName string, includeAll bool) []*topology.Peer

func (*Network) PeersWithChannel

func (n *Network) PeersWithChannel(chanName string) []*topology.Peer

PeersWithChannel returns all Peer instances that have joined the named channel.

func (*Network) PostRun

func (n *Network) PostRun(load bool)

func (*Network) ProfileForChannel

func (n *Network) ProfileForChannel(channelName string) string

ProfileForChannel gets the configtxgen profile name associated with the specified channel.

func (*Network) ReadConfigTxConfig

func (n *Network) ReadConfigTxConfig() *fabricconfig.ConfigTx

ReadConfigTxConfig unmarshals the configtx.yaml and returns an object approximating its contents.

func (*Network) ReadOrdererConfig

func (n *Network) ReadOrdererConfig(o *topology.Orderer) *fabricconfig.Orderer

ReadOrdererConfig unmarshals an orderer's orderer.yaml and returns an object approximating its contents.

func (*Network) ReadPeerConfig

func (n *Network) ReadPeerConfig(p *topology.Peer) *fabricconfig.Core

ReadPeerConfig unmarshals a peer's core.yaml and returns an object approximating its contents.

func (*Network) ResolverMapPath

func (n *Network) ResolverMapPath(p *topology.Peer) string

ResolverMapPath returns the path to the generated resolver map configuration file.

func (*Network) StartSession

func (n *Network) StartSession(cmd *exec.Cmd, name string) (*gexec.Session, error)

StartSession executes a command session. This should be used to launch command line tools that are expected to run to completion.

func (*Network) Topology

func (n *Network) Topology() *topology.Topology

func (*Network) UpdateChaincode

func (n *Network) UpdateChaincode(chaincodeId string, version string, path string, packageFile string)

UpdateChaincode deploys the new version of the chaincode passed by chaincodeId

func (*Network) UpdateChannelAnchors

func (n *Network) UpdateChannelAnchors(o *topology.Orderer, channelName string)

UpdateChannelAnchors determines the anchor peers for the specified channel, creates an anchor peer update transaction for each organization, and submits the update transactions to the orderer.

func (*Network) VerifyMembership

func (n *Network) VerifyMembership(expectedPeers []*topology.Peer, channel string, chaincodes ...string)

VerifyMembership checks that each peer has discovered the expected peers in the network

func (*Network) ViewNodeLocalCertPath

func (n *Network) ViewNodeLocalCertPath(peer *topology.Peer) string

func (*Network) ViewNodeLocalPrivateKeyPath

func (n *Network) ViewNodeLocalPrivateKeyPath(peer *topology.Peer) string

func (*Network) ViewNodeMSPDir

func (n *Network) ViewNodeMSPDir(p *topology.Peer) string

func (*Network) WriteConfigTxConfig

func (n *Network) WriteConfigTxConfig(config *fabricconfig.ConfigTx)

WriteConfigTxConfig serializes the provided configuration to configtx.yaml.

func (*Network) WriteOrdererConfig

func (n *Network) WriteOrdererConfig(o *topology.Orderer, config *fabricconfig.Orderer)

WriteOrdererConfig serializes the provided configuration as the specified orderer's orderer.yaml document.

func (*Network) WritePeerConfig

func (n *Network) WritePeerConfig(p *topology.Peer, config *fabricconfig.Core)

WritePeerConfig serializes the provided configuration as the specified peer's core.yaml document.

type Orderer

type Orderer struct {
	URL         string                 `json:"url"`
	TLSCACerts  map[string]interface{} `json:"tlsCACerts"`
	GrpcOptions map[string]interface{} `json:"grpcOptions"`
}

type Organization

type Organization struct {
	MSPID                  string                 `json:"mspid"`
	Peers                  []string               `json:"peers"`
	CertificateAuthorities []string               `json:"certificateAuthorities,omitempty"`
	SignedCert             map[string]interface{} `json:"signedCert,omitempty"`
	AdminPrivateKey        map[string]interface{} `json:"adminPrivateKey,omitempty"`
}

type Peer

type Peer struct {
	URL         string                 `json:"url"`
	TLSCACerts  map[string]interface{} `json:"tlsCACerts"`
	GrpcOptions map[string]interface{} `json:"grpcOptions"`
}

type Resolver

type Resolver struct {
	Name      string
	Domain    string
	Identity  ResolverIdentity
	Addresses map[api.PortName]string
	Port      int
	Aliases   []string
}

type ResolverIdentity

type ResolverIdentity struct {
	ID      string
	MSPType string
	MSPID   string
	Path    string
}

type T

type T struct {
}

type Timeout

type Timeout struct {
	Peer map[string]string `json:"peer"`
}

Jump to

Keyboard shortcuts

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