fabadmin

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Overview

Package fabadmin handles administration commands for hyperledger fabric

Package fabadmin handles administration commands for hyperledger fabric

Package fabadmin handles administration commands for hyperledger fabric

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseConnection

func CloseConnection()

CloseConnection cleans up cache and closes all connections

func CreateChannel

func CreateChannel(channel, configRoot string, ordererOrg *Organization, peerOrgs []*Organization) (uint64, error)

CreateChannel creates a specified channel. This require multiple org admins' signature; this proecess should be separated into multiple steps, if nobody knows signing keys for all peer orgs

func GetClientOrgName

func GetClientOrgName() string

GetClientOrgName returns the name of the configured client's org

func InitAdminContext

func InitAdminContext(configPath, entityMatcherOverride string) error

InitAdminContext initialize SDK based on specified config.yaml and entity-matcher file

func ParseChaincodePath

func ParseChaincodePath(path string) []string

ParseChaincodePath separates path of format xxx/src/yyy, and returns [xxx, yyy] as array of 2 elements, or the original string with env replaced by Subst()

func Subst

func Subst(path string) string

Subst replaces instances of '${VARNAME}' (eg ${GOPATH}) with the variable. Variables names that are not set by the SDK are replaced with the environment variable.

Types

type AdminContext

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

AdminContext provides configuration of admin client

type BackendConfig

type BackendConfig struct {
	Version                string
	Client                 ClientConfig
	Channels               map[string]fab.ChannelEndpointConfig
	Organizations          map[string]fab.OrganizationConfig
	Orderers               map[string]fab.OrdererConfig
	Peers                  map[string]fab.PeerConfig
	CertificateAuthorities map[string]CAConfig
	EntityMatchers         map[string][]fab.MatchConfig
}

BackendConfig provides the definition of backend configuration

func (*BackendConfig) GetClientOrgName

func (bc *BackendConfig) GetClientOrgName() string

GetClientOrgName returns the name of the client's org

func (*BackendConfig) GetOrdererName

func (bc *BackendConfig) GetOrdererName() string

GetOrdererName returns the name of first non-default orderer

func (*BackendConfig) GetOrganizationConfig

func (bc *BackendConfig) GetOrganizationConfig(name string) *Organization

GetOrganizationConfig returns configured attributes of a specified organization

type CAConfig

type CAConfig struct {
	URL         string
	GRPCOptions map[string]interface{}
	Registrar   EnrollCredentials
	CAName      string
	TLSCACerts  TLSCAConfig
}

CAConfig defines a CA configuration

type ChaincodePackage

type ChaincodePackage struct {
	Name    string
	Path    string
	Version string
	Package *resource.CCPackage
}

ChaincodePackage contains chaincode and installation metadata

func CreateCCPackage

func CreateCCPackage(ccPath, ccRoot, name, version string) (*ChaincodePackage, error)

CreateCCPackage creates a new golang chaincode package that contains source code under ${ccRoot}/src/${ccPath}

type ClientConfig

type ClientConfig struct {
	Organization string
	CryptoConfig PathConfig
	TLSCerts     fab.ClientTLSConfig
}

ClientConfig provides the definition of the client configuration

type EnrollCredentials

type EnrollCredentials struct {
	EnrollID     string
	EnrollSecret string
}

EnrollCredentials holds credentials used for enrollment

type Organization

type Organization struct {
	Name                   string
	MSPID                  string
	CryptoPath             string
	AdminUser              string
	AdminContext           context.ClientProvider
	Peers                  []fab.Peer // discovered peers; unique id peer.URL()
	CertificateAuthorities []string
	IsOrdererOrg           bool
}

Organization provides the definition of an organization in the network

func InitOrganization

func InitOrganization(orgName, orgAdminUser string) *Organization

InitOrganization iniailizes admin client of a specified org

func (*Organization) InstallChaincode

func (org *Organization) InstallChaincode(pkg *ChaincodePackage, peerURLs ...string) error

InstallChaincode installs a chaincode package on specified peers of an org. Install it on all peers of the org if peer URLs are not specified.

func (*Organization) InstantiateChaincode

func (org *Organization) InstantiateChaincode(pkg *ChaincodePackage, channelID string, policy string, initArgs string) error

InstantiateChaincode instantiates a chaincode on all peers of the specified org

func (*Organization) IsCCInstalled

func (org *Organization) IsCCInstalled(pkg *ChaincodePackage, peers ...fab.Peer) (bool, error)

IsCCInstalled returns true if the specified CC is already installed on all specified peers of an org. check all peers if peers are not specified

func (*Organization) IsJoinedChannel

func (org *Organization) IsJoinedChannel(channel string, peers ...fab.Peer) (bool, error)

IsJoinedChannel returns true if the org joined a specified channel on specified peers. check all peers if peer is not specified.

func (*Organization) JoinChannel

func (org *Organization) JoinChannel(channel string) error

JoinChannel makes the org join a specified channel

func (*Organization) UpdateChannelAnchor

func (org *Organization) UpdateChannelAnchor(channel, configRoot string, lastConfigBlock uint64) (uint64, error)

UpdateChannelAnchor updates channel config to set anchor peer for an org

func (*Organization) UpgradeChaincode

func (org *Organization) UpgradeChaincode(pkg *ChaincodePackage, channelID string, policy string, initArgs string) error

UpgradeChaincode instantiates a chaincode on all peers of the specified org

type PathConfig

type PathConfig struct {
	Path string
}

PathConfig provide the definition with a path attribute

type TLSCAConfig

type TLSCAConfig struct {
	Path   string
	Client endpoint.TLSKeyPair
}

TLSCAConfig contains the TLS CA configuration

Jump to

Keyboard shortcuts

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