fabric: github.com/hyperledger/fabric/integration/nwo Index | Files | Directories

package nwo

import "github.com/hyperledger/fabric/integration/nwo"

Index

Package Files

buildserver.go command.go components.go config.go configblock.go configtx_template.go core_template.go crypto_template.go deploy.go discover.go network.go orderer_client.go orderer_template.go package.go standard_networks.go templates.go

Constants

const CCEnvDefaultImage = "hyperledger/fabric-ccenv:latest"
const DefaultConfigTxTemplate = "" /* 5685 byte string literal not displayed */
const DefaultCoreTemplate = "" /* 5750 byte string literal not displayed */
const DefaultCryptoTemplate = "" /* 847 byte string literal not displayed */
const DefaultOrdererTemplate = "" /* 2973 byte string literal not displayed */
const OrgUpdateConfigTxTemplate = "" /* 648 byte string literal not displayed */
const OrgUpdateCryptoTemplate = "" /* 478 byte string literal not displayed */

Variables

var RequiredImages = []string{
    CCEnvDefaultImage,
    runner.CouchDBDefaultImage,
    runner.KafkaDefaultImage,
    runner.ZooKeeperDefaultImage,
}

func ApproveChaincodeForMyOrg Uses

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

func Broadcast Uses

func Broadcast(n *Network, o *Orderer, env *common.Envelope) (*orderer.BroadcastResponse, error)

Broadcast sends given env to Broadcast API of specified orderer.

func CheckCommitReadinessUntilReady Uses

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

func ClientAuthEnabled Uses

func ClientAuthEnabled(c Command) bool

func CommitChaincode Uses

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

func ComputeUpdateOrdererConfig Uses

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

func ConnectsToOrderer Uses

func ConnectsToOrderer(c Command) bool

func CurrentConfigBlockNumber Uses

func CurrentConfigBlockNumber(n *Network, peer *Peer, orderer *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 Uses

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

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

func Deliver Uses

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

Deliver sends given env to Deliver API of specified orderer.

func DeployChaincode Uses

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

DeployChaincode is a helper that will install chaincode to all peers that are connected to the specified channel, approve the chaincode on one of the peers of each organization in the network, commit the chaincode definition on the channel using one of the peers, and wait for the chaincode commit to complete on all of the peers. It uses the _lifecycle implementation. NOTE V2_0 capabilities must be enabled for this functionality to work.

func DeployChaincodeLegacy Uses

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

DeployChaincodeLegacy is a helper that will install chaincode to all peers that are connected to the specified channel, instantiate the chaincode on one of the peers, and wait for the instantiation to complete on all of the peers. It uses the legacy lifecycle (lscc) implementation.

NOTE: This helper should not be used to deploy the same chaincode on multiple channels as the install will fail on subsequent calls. Instead, simply use InstantiateChaincode().

func DiscoverPeers Uses

func DiscoverPeers(n *Network, p *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 EnableCapabilities Uses

func EnableCapabilities(network *Network, channel, capabilitiesGroup, capabilitiesVersion string, orderer *Orderer, peers ...*Peer)

EnableCapabilities enables a specific capabilities flag for a running network. It generates the config update using the first peer, signs the configuration with the subsequent peers, and then submits the config update using the first peer.

func EnsureChaincodeCommitted Uses

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

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

func EnsureInstalled Uses

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

func EnsureInstantiatedLegacy Uses

func EnsureInstantiatedLegacy(n *Network, channel, name, version string, peers ...*Peer)

func FetchConfigBlock Uses

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

FetchConfigBlock fetches latest config block.

func GetConfig Uses

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

GetConfig retrieves the last config of the given channel.

func GetConfigBlock Uses

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

GetConfigBlock retrieves the current config block for a channel.

func GetLedgerHeight Uses

func GetLedgerHeight(n *Network, peer *Peer, channel string) int

GetLedgerHeight returns the current ledger height for a peer on a channel

func GetMaxLedgerHeight Uses

func GetMaxLedgerHeight(n *Network, channel string, peers ...*Peer) int

GetMaxLedgerHeight returns the maximum ledger height for the peers on a channel

func InitChaincode Uses

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

func InstallChaincode Uses

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

func InstallChaincodeLegacy Uses

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

func InstantiateChaincodeLegacy Uses

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

func NewCommand Uses

func NewCommand(path string, command Command) *exec.Cmd

func PackageAndInstallChaincode Uses

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

func PackageChaincode Uses

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

func PackageChaincodeBinary Uses

func PackageChaincodeBinary(c Chaincode)

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

func PackageChaincodeLegacy Uses

func PackageChaincodeLegacy(n *Network, chaincode Chaincode, peer *Peer)

func QueryInstalled Uses

func QueryInstalled(n *Network, peer *Peer) func() []lifecycle.QueryInstalledChaincodesResult_InstalledChaincode

func QueryInstalledNoReferences Uses

func QueryInstalledNoReferences(n *Network, channel, label, packageID string, checkPeer *Peer)

func QueryInstalledReferences Uses

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

func UnmarshalBlockFromFile Uses

func UnmarshalBlockFromFile(blockFile string) *common.Block

UnmarshalBlockFromFile unmarshals a proto encoded block from a file.

func UpdateConfig Uses

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

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

func UpdateConsensusMetadata Uses

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

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

func UpdateOrdererConfig Uses

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

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

func UpdateOrdererConfigSession Uses

func UpdateOrdererConfigSession(n *Network, orderer *Orderer, channel string, current, updated *common.Config, submitter *Peer, additionalSigners ...*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 Uses

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

func UpgradeChaincodeLegacy Uses

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

func WaitUntilEqualLedgerHeight Uses

func WaitUntilEqualLedgerHeight(n *Network, channel string, height int, peers ...*Peer)

WaitUntilEqualLedgerHeight waits until all specified peers have the provided ledger height on a channel

type BuildServer Uses

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

func NewBuildServer Uses

func NewBuildServer(args ...string) *BuildServer

func (*BuildServer) Components Uses

func (s *BuildServer) Components() *Components

func (*BuildServer) Serve Uses

func (s *BuildServer) Serve()

func (*BuildServer) Shutdown Uses

func (s *BuildServer) Shutdown()

type CA Uses

type CA struct {
    Hostname string `yaml:"hostname,omitempty"`
}

type Chaincode Uses

type Chaincode struct {
    Name                string
    Version             string
    Path                string
    Ctor                string
    Policy              string // only used for legacy lifecycle. For new lifecycle use SignaturePolicy
    Lang                string
    CollectionsConfig   string // optional
    PackageFile         string
    PackageID           string            // if unspecified, chaincode won't be executable. Can use SetPackageIDFromPackageFile() to set.
    CodeFiles           map[string]string // map from paths on the filesystem to code.tar.gz paths
    Sequence            string
    EndorsementPlugin   string
    ValidationPlugin    string
    InitRequired        bool
    Label               string
    SignaturePolicy     string
    ChannelConfigPolicy string
}

func (*Chaincode) SetPackageIDFromPackageFile Uses

func (c *Chaincode) SetPackageIDFromPackageFile()

type Channel Uses

type Channel struct {
    Name        string `yaml:"name,omitempty"`
    Profile     string `yaml:"profile,omitempty"`
    BaseProfile string `yaml:"baseprofile,omitempty"`
}

Channel associates a channel name with a configtxgen profile name.

type Command Uses

type Command interface {
    Args() []string
    SessionName() string
}

type Components Uses

type Components struct {
    ServerAddress string `json:"server_address"`
}

func (*Components) Build Uses

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

func (*Components) Cleanup Uses

func (c *Components) Cleanup()

func (*Components) ConfigTxGen Uses

func (c *Components) ConfigTxGen() string

func (*Components) Cryptogen Uses

func (c *Components) Cryptogen() string

func (*Components) Discover Uses

func (c *Components) Discover() string

func (*Components) Idemixgen Uses

func (c *Components) Idemixgen() string

func (*Components) Orderer Uses

func (c *Components) Orderer() string

func (*Components) Peer Uses

func (c *Components) Peer() string

type Config Uses

type Config struct {
    Organizations []*Organization `yaml:"organizations,omitempty"`
    Consortiums   []*Consortium   `yaml:"consortiums,omitempty"`
    SystemChannel *SystemChannel  `yaml:"system_channel,omitempty"`
    Channels      []*Channel      `yaml:"channels,omitempty"`
    Consensus     *Consensus      `yaml:"consensus,omitempty"`
    Orderers      []*Orderer      `yaml:"orderers,omitempty"`
    Peers         []*Peer         `yaml:"peers,omitempty"`
    Profiles      []*Profile      `yaml:"profiles,omitempty"`
    Templates     *Templates      `yaml:"templates,omitempty"`
}

Config holds the basic information needed to generate fabric configuration files.

func BasicEtcdRaft Uses

func BasicEtcdRaft() *Config

func BasicKafka Uses

func BasicKafka() *Config

func BasicSolo Uses

func BasicSolo() *Config

BasicSolo is a configuration wtih two organizations and one peer per org.

func BasicSoloWithIdemix Uses

func BasicSoloWithIdemix() *Config

func FullSolo Uses

func FullSolo() *Config

FullSolo is a configuration wtih two organizations and two peers per org.

func MinimalRaft Uses

func MinimalRaft() *Config

func MultiChannelBasicSolo Uses

func MultiChannelBasicSolo() *Config

func MultiChannelEtcdRaft Uses

func MultiChannelEtcdRaft() *Config

func MultiNodeEtcdRaft Uses

func MultiNodeEtcdRaft() *Config

func (*Config) RemovePeer Uses

func (c *Config) RemovePeer(orgName, peerName string)

type Consensus Uses

type Consensus struct {
    Type       string `yaml:"type,omitempty"`
    Brokers    int    `yaml:"brokers,omitempty"`
    ZooKeepers int    `yaml:"zookeepers,omitempty"`
}

Consensus indicates the orderer types and how many broker and zookeeper instances.

type ConsensusMetadataMutator Uses

type ConsensusMetadataMutator func([]byte) []byte

ConsensusMetadataMutator receives ConsensusType.Metadata and mutates it.

type Consortium Uses

type Consortium struct {
    Name          string   `yaml:"name,omitempty"`
    Organizations []string `yaml:"organizations,omitempty"`
}

A Consortium is a named collection of Organizations. It is used to populate the Orderer geneesis block profile.

type DiscoveredPeer Uses

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 Enver Uses

type Enver interface {
    Env() []string
}

type MSPMutator Uses

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

MSPMutator receives FabricMSPConfig and mutates it.

type Network Uses

type Network struct {
    RootDir            string
    StartPort          uint16
    Components         *Components
    DockerClient       *docker.Client
    ExternalBuilders   []fabricconfig.ExternalBuilder
    NetworkID          string
    EventuallyTimeout  time.Duration
    MetricsProvider    string
    StatsdEndpoint     string
    ClientAuthRequired bool

    PortsByBrokerID  map[string]Ports
    PortsByOrdererID map[string]Ports
    PortsByPeerID    map[string]Ports
    Organizations    []*Organization
    SystemChannel    *SystemChannel
    Channels         []*Channel
    Consensus        *Consensus
    Orderers         []*Orderer
    Peers            []*Peer
    Profiles         []*Profile
    Consortiums      []*Consortium
    Templates        *Templates
    // contains filtered or unexported fields
}

Network holds information about a fabric network.

func New Uses

func New(c *Config, rootDir string, client *docker.Client, startPort int, components *Components) *Network

New creates a Network from a simple configuration. All generated or managed artifacts for the network will be located under rootDir. Ports will be allocated sequentially from the specified startPort.

func (*Network) AddOrg Uses

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

AddOrg adds an organization to a network.

func (*Network) AnchorsForChannel Uses

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

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

func (*Network) AnchorsInOrg Uses

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

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

func (*Network) Bootstrap Uses

func (n *Network) Bootstrap()

Bootstrap generates the cryptographic material, orderer system channel genesis block, and create channel transactions needed to run a fabric network.

The cryptogen tool is used to create crypto material from the contents of ${rootDir}/crypto-config.yaml. The generated artifacts will be placed in ${rootDir}/crypto/...

The gensis block is generated from the profile referenced by the SystemChannel.Profile attribute. The block is written to ${rootDir}/${SystemChannel.Name}_block.pb.

The create channel transactions are generated for each Channel referenced by the Network using the channel's Profile attribute. The transactions are written to ${rootDir}/${Channel.Name}_tx.pb.

func (*Network) BrokerAddresses Uses

func (n *Network) BrokerAddresses(portName PortName) []string

BrokerAddresses returns the list of broker addresses for the network.

func (*Network) BrokerGroupRunner Uses

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

BrokerGroupRunner returns a runner that manages the processes that make up the kafka broker network for fabric.

func (*Network) BrokerRunner Uses

func (n *Network) BrokerRunner(id int, zookeepers []string) *runner.Kafka

BrokerRunner returns a runner for an kafka broker instance.

func (*Network) CACertsBundlePath Uses

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) Cleanup Uses

func (n *Network) Cleanup()

Cleanup attempts to cleanup docker related artifacts that may have been created by the network.

func (*Network) ConcatenateTLSCACertificates Uses

func (n *Network) ConcatenateTLSCACertificates()

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

func (*Network) ConfigTxConfigPath Uses

func (n *Network) ConfigTxConfigPath() string

ConfigTxPath returns the path to the generated configtxgen configuration file.

func (*Network) ConfigTxGen Uses

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

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

func (*Network) Consortium Uses

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

Consortium returns information about the named Consortium.

func (*Network) CreateAndJoinChannel Uses

func (n *Network) CreateAndJoinChannel(o *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 Uses

func (n *Network) CreateAndJoinChannels(o *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 Uses

func (n *Network) CreateChannel(channelName string, o *Orderer, p *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 Uses

func (n *Network) CreateChannelExitCode(channelName string, o *Orderer, p *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 Uses

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

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

func (*Network) CryptoConfigPath Uses

func (n *Network) CryptoConfigPath() string

CryptoConfigPath returns the path to the generated cryptogen configuration file.

func (*Network) CryptoPath Uses

func (n *Network) CryptoPath() string

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

func (*Network) Cryptogen Uses

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

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

func (*Network) Discover Uses

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

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

func (*Network) DiscoveredPeer Uses

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

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

func (*Network) GenerateConfigTree Uses

func (n *Network) GenerateConfigTree()

GenerateConfigTree generates the configuration documents required to bootstrap a fabric network. A configuration file will be generated for cryptogen, configtxgen, and for each peer and orderer. The contents of the documents will be based on the Config used to create the Network.

When this method completes, the resulting tree will look something like this:

${rootDir}/configtx.yaml ${rootDir}/crypto-config.yaml ${rootDir}/orderers/orderer0.orderer-org/orderer.yaml ${rootDir}/peers/peer0.org1/core.yaml ${rootDir}/peers/peer0.org2/core.yaml ${rootDir}/peers/peer1.org1/core.yaml ${rootDir}/peers/peer1.org2/core.yaml

func (*Network) GenerateConfigTxConfig Uses

func (n *Network) GenerateConfigTxConfig()

func (*Network) GenerateCoreConfig Uses

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

func (*Network) GenerateCryptoConfig Uses

func (n *Network) GenerateCryptoConfig()

func (*Network) GenerateOrdererConfig Uses

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

func (*Network) IdemixOrgMSPDir Uses

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

func (*Network) IdemixOrgs Uses

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

IdemixOrgs returns all Organizations of type idemix.

func (*Network) IdemixUserMSPDir Uses

func (n *Network) IdemixUserMSPDir(o *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) IdemixUserSession Uses

func (n *Network) IdemixUserSession(p *Peer, idemixOrg *Organization, user string, command Command) (*gexec.Session, error)

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

func (*Network) Idemixgen Uses

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

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

func (*Network) JoinChannel Uses

func (n *Network) JoinChannel(name string, o *Orderer, peers ...*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) NetworkGroupRunner Uses

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

NetworkGroupRunner returns a runner that can be used to start and stop an entire fabric network.

func (*Network) Orderer Uses

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

Orderer returns the information about the named Orderer.

func (*Network) OrdererAddress Uses

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

OrdererAddress returns the address (host and port) exposed by the Orderer for the named port. Command 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 Uses

func (n *Network) OrdererAdminSession(o *Orderer, p *Peer, command 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) OrdererConfigPath Uses

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

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

func (*Network) OrdererDir Uses

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

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

func (*Network) OrdererGroupRunner Uses

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) OrdererLocalCryptoDir Uses

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

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

func (*Network) OrdererLocalMSPDir Uses

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

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

func (*Network) OrdererLocalTLSDir Uses

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

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

func (*Network) OrdererOrgMSPDir Uses

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

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

func (*Network) OrdererOrgs Uses

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

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

func (*Network) OrdererPort Uses

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

OrdererPort returns the named port reserved for the Orderer instance.

func (*Network) OrdererRunner Uses

func (n *Network) OrdererRunner(o *Orderer) *ginkgomon.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 Uses

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

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

func (*Network) OrdererUserKey Uses

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

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

func (*Network) OrdererUserMSPDir Uses

func (n *Network) OrdererUserMSPDir(o *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 Uses

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

OrderersInOrg returns all Orderer instances owned by the named organaiztion.

func (*Network) Organization Uses

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

Organization returns the information about the named Organization.

func (*Network) OrgsForOrderers Uses

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

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

func (*Network) OutputBlockPath Uses

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

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

func (*Network) Peer Uses

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

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

func (*Network) PeerAddress Uses

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

PeerAddress returns the address (host and port) exposed by the Peer for the named port. Command 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) PeerAdminSession Uses

func (n *Network) PeerAdminSession(p *Peer, command 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 cli commands that execute in the context of a peer configuration.

func (*Network) PeerCert Uses

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

PeerCert returns the path to the peer's certificate.

func (*Network) PeerConfigPath Uses

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

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

func (*Network) PeerDir Uses

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

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

func (*Network) PeerGroupRunner Uses

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) PeerLedgerDir Uses

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

PeerLedgerDir returns the ledger root directory for the specified peer.

func (*Network) PeerLocalMSPDir Uses

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

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

func (*Network) PeerLocalTLSDir Uses

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

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

func (*Network) PeerOrgMSPDir Uses

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

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

func (*Network) PeerOrgs Uses

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

PeerOrgs returns all Organizations associated with at least one Peer.

func (*Network) PeerPort Uses

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

PeerPort returns the named port reserved for the Peer instance.

func (*Network) PeerRunner Uses

func (n *Network) PeerRunner(p *Peer, env ...string) *ginkgomon.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 Uses

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

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

func (*Network) PeerUserKey Uses

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

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

func (*Network) PeerUserMSPDir Uses

func (n *Network) PeerUserMSPDir(p *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 Uses

func (n *Network) PeerUserSession(p *Peer, user string, command 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 cli commands that execute in the context of a peer configuration.

func (*Network) PeerUserTLSDir Uses

func (n *Network) PeerUserTLSDir(p *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) PeersInOrg Uses

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

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

func (*Network) PeersWithChannel Uses

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

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

func (*Network) ProfileForChannel Uses

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

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

func (*Network) ReadConfigTxConfig Uses

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

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

func (*Network) ReadOrdererConfig Uses

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

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

func (*Network) ReadPeerConfig Uses

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

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

func (*Network) ReservePort Uses

func (n *Network) ReservePort() uint16

ReservePort allocates the next available port.

func (*Network) StartSession Uses

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) UpdateChannelAnchors Uses

func (n *Network) UpdateChannelAnchors(o *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 Uses

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

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

func (*Network) WriteConfigTxConfig Uses

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

WriteConfigTxConfig serializes the provided configuration to configtx.yaml.

func (*Network) WriteOrdererConfig Uses

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

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

func (*Network) WritePeerConfig Uses

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

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

func (*Network) ZooKeeperRunner Uses

func (n *Network) ZooKeeperRunner(idx int) *runner.ZooKeeper

ZooKeeperRunner returns a runner for a ZooKeeper instance.

type Orderer Uses

type Orderer struct {
    Name         string `yaml:"name,omitempty"`
    Organization string `yaml:"organization,omitempty"`
}

Orderer defines an orderer instance and its owning organization.

func (Orderer) ID Uses

func (o Orderer) ID() string

ID provides a unique identifier for an orderer instance.

type Organization Uses

type Organization struct {
    MSPID         string `yaml:"msp_id,omitempty"`
    MSPType       string `yaml:"msp_type,omitempty"`
    Name          string `yaml:"name,omitempty"`
    Domain        string `yaml:"domain,omitempty"`
    EnableNodeOUs bool   `yaml:"enable_node_organizational_units"`
    Users         int    `yaml:"users,omitempty"`
    CA            *CA    `yaml:"ca,omitempty"`
}

Organization models information about an Organization. It includes the information needed to populate an MSP with cryptogen.

type Peer Uses

type Peer struct {
    Name         string         `yaml:"name,omitempty"`
    Organization string         `yaml:"organization,omitempty"`
    Channels     []*PeerChannel `yaml:"channels,omitempty"`
}

Peer defines a peer instance, it's owning organization, and the list of channels that the peer should be joined to.

func (*Peer) Anchor Uses

func (p *Peer) Anchor() bool

Anchor returns true if this peer is an anchor for any channel it has joined.

func (*Peer) ID Uses

func (p *Peer) ID() string

ID provides a unique identifier for a peer instance.

type PeerChannel Uses

type PeerChannel struct {
    Name   string `yaml:"name,omitempty"`
    Anchor bool   `yaml:"anchor"`
}

PeerChannel names of the channel a peer should be joined to and whether or not the peer should be an anchor for the channel.

type PortName Uses

type PortName string
const (
    ChaincodePort  PortName = "Chaincode"
    EventsPort     PortName = "Events"
    HostPort       PortName = "HostPort"
    ListenPort     PortName = "Listen"
    ProfilePort    PortName = "Profile"
    OperationsPort PortName = "Operations"
    ClusterPort    PortName = "Cluster"
)

func BrokerPortNames Uses

func BrokerPortNames() []PortName

BrokerPortNames returns the list of ports that need to be reserved for a Kafka broker.

func OrdererPortNames Uses

func OrdererPortNames() []PortName

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

func PeerPortNames Uses

func PeerPortNames() []PortName

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

type Ports Uses

type Ports map[PortName]uint16

type Profile Uses

type Profile struct {
    Name                string   `yaml:"name,omitempty"`
    Orderers            []string `yaml:"orderers,omitempty"`
    Consortium          string   `yaml:"consortium,omitempty"`
    Organizations       []string `yaml:"organizations,omitempty"`
    AppCapabilities     []string `yaml:"app_capabilities,omitempty"`
    ChannelCapabilities []string `yaml:"channel_capabilities,omitempty"`
}

A profile encapsulates basic information for a configtxgen profile.

type SystemChannel Uses

type SystemChannel struct {
    Name    string `yaml:"name,omitempty"`
    Profile string `yaml:"profile,omitempty"`
}

The SystemChannel declares the name of the network system channel and its associated configtxgen profile name.

type Templates Uses

type Templates struct {
    ConfigTx string `yaml:"configtx,omitempty"`
    Core     string `yaml:"core,omitempty"`
    Crypto   string `yaml:"crypto,omitempty"`
    Orderer  string `yaml:"orderer,omitempty"`
}

Templates can be used to provide custom templates to GenerateConfigTree.

func (*Templates) ConfigTxTemplate Uses

func (t *Templates) ConfigTxTemplate() string

func (*Templates) CoreTemplate Uses

func (t *Templates) CoreTemplate() string

func (*Templates) CryptoTemplate Uses

func (t *Templates) CryptoTemplate() string

func (*Templates) OrdererTemplate Uses

func (t *Templates) OrdererTemplate() string

type WorkingDirer Uses

type WorkingDirer interface {
    WorkingDir() string
}

Directories

PathSynopsis
commands
fabricconfig

Package nwo imports 45 packages (graph) and is imported by 1 packages. Updated 2020-01-19. Refresh now. Tools for package owners.