topology

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: 8 Imported by: 7

Documentation

Index

Constants

View Source
const DefaultConfigTxTemplate = `` /* 5702-byte string literal not displayed */
View Source
const DefaultCoreTemplate = `` /* 6032-byte string literal not displayed */
View Source
const DefaultCryptoTemplate = `` /* 1162-byte string literal not displayed */
View Source
const DefaultFSCFabricExtensionTemplate = `` /* 3067-byte string literal not displayed */
View Source
const DefaultOrdererTemplate = `` /* 2569-byte string literal not displayed */
View Source
const OrgUpdateConfigTxTemplate = `` /* 656-byte string literal not displayed */

Variables

This section is empty.

Functions

func WithMREnclave

func WithMREnclave(mrenclave string) func(*ChannelChaincode)

func WithSGXDevicesPaths

func WithSGXDevicesPaths(paths []string) func(*ChannelChaincode)

func WithSGXMode

func WithSGXMode(mode string) func(*ChannelChaincode)

Types

type BCCSP

type BCCSP = config.BCCSP

type CA

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

type Chaincode

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            `yaml:"packageID,omitempty"` // 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

func (c *Chaincode) SetPackageIDFromPackageFile()

type Channel

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

Channel associates a channel name with a configtxgen profile name.

type ChannelChaincode

type ChannelChaincode struct {
	Chaincode          Chaincode           `yaml:"chaincode,omitempty"`
	PrivateChaincode   PrivateChaincode    `yaml:"privatechaincode,omitempty"`
	Path               string              `yaml:"path,omitempty"`
	Channel            string              `yaml:"channel,omitempty"`
	Peers              []string            `yaml:"peers,omitempty"`
	Private            bool                `yaml:"private,omitempty"`
	PostRunInvocations []PostRunInvocation `yaml:"postruninvocations,omitempty"`
}

func (*ChannelChaincode) AddPostRunInvocation

func (c *ChannelChaincode) AddPostRunInvocation(functionName string, expectedResult interface{}, args ...[]byte)

type Consensus

type Consensus struct {
	Type                        string `yaml:"type,omitempty"`
	BootstrapMethod             string `yaml:"bootstrap_method,omitempty"`
	ChannelParticipationEnabled bool   `yaml:"channel_participation_enabled,omitempty"`
}

Consensus indicates the orderer types (we only support SOLO for testing)

type Consortium

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 KeyIDMapping

type KeyIDMapping = config.KeyIDMapping

type Logging

type Logging struct {
	Spec   string `yaml:"spec,omitempty"`
	Format string `yaml:"format,omitempty"`
}

type Orderer

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

Orderer defines an orderer instance and its owning organization.

func (Orderer) ID

func (o Orderer) ID() string

ID provides a unique identifier for an orderer instance.

type Organization

type Organization struct {
	ID            string     `yaml:"id,omitempty"`
	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"`
	UserSpecs     []UserSpec `yaml:"Specs,omitempty"`
	CA            *CA        `yaml:"ca,omitempty"`
}

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

type OrganizationOpt

type OrganizationOpt struct {
	Name string
}

type PKCS11

type PKCS11 = config.PKCS11

type Peer

type Peer struct {
	Name            string          `yaml:"name,omitempty"`
	Organization    string          `yaml:"organization,omitempty"`
	Type            PeerType        `yaml:"type,omitempty"`
	Bootstrap       bool            `yaml:"bootstrap,omitempty"`
	ExecutablePath  string          `yaml:"executablepath,omitempty"`
	Role            string          `yaml:"role,omitempty"`
	Channels        []*PeerChannel  `yaml:"channels,omitempty"`
	DefaultIdentity string          `yaml:"defaultMSP,omitempty"`
	Identities      []*PeerIdentity `yaml:"identities,omitempty"`
	Usage           string          `yaml:"usage,omitempty"`
	SkipInit        bool            `yaml:"skipinit,omitempty"`
	SkipRunning     bool            `yaml:"skiprunning,omitempty"`
	TLSDisabled     bool            `yaml:"tlsdisabled,omitempty"`
	Hostname        string          `yaml:"hostname,omitempty"`
	DevMode         bool
	DefaultNetwork  bool       `yaml:"-"`
	FSCNode         *node.Node `yaml:"-"`
}

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

func (*Peer) Anchor

func (p *Peer) Anchor() bool

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

func (*Peer) ID

func (p *Peer) ID() string

ID provides a unique identifier for a peer instance.

type PeerChannel

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 PeerIdentity

type PeerIdentity struct {
	ID           string
	Default      bool
	EnrollmentID string
	MSPType      string
	MSPID        string
	CacheSize    int
	Org          string
	Path         string `yaml:"path,omitempty"`
	Opts         *BCCSP `yaml:"opts,omitempty"`
}

type PeerType

type PeerType string
const (
	FabricPeer PeerType = "FabricPeer"
	FSCPeer    PeerType = "FSCNode"
)

type Policy

type Policy struct {
	Name string
	Type string
	Rule string
}

type PostRunInvocation

type PostRunInvocation struct {
	FunctionName   string
	ExpectedResult interface{}
	Args           [][]byte
}

type PrivateChaincode

type PrivateChaincode struct {
	Image           string
	SGXMode         string
	SGXDevicesPaths []string
	MREnclave       string
}

type Profile

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"`
	Policies            []*Policy `yaml:"policies,omitempty"`
}

Profile encapsulates basic information for a configtxgen profile.

type SoftwareProvider

type SoftwareProvider = config.SoftwareProvider

type SystemChannel

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

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

func (t *Templates) ConfigTxTemplate() string

func (*Templates) CoreTemplate

func (t *Templates) CoreTemplate() string

func (*Templates) CryptoTemplate

func (t *Templates) CryptoTemplate() string

func (*Templates) FSCFabricExtensionTemplate

func (t *Templates) FSCFabricExtensionTemplate() string

func (*Templates) OrdererTemplate

func (t *Templates) OrdererTemplate() string

type Topology

type Topology struct {
	TopologyName      string                 `yaml:"name,omitempty"`
	TopologyType      string                 `yaml:"type,omitempty"`
	Default           bool                   `yaml:"default,omitempty"`
	Driver            string                 `yaml:"driver,omitempty"`
	Logging           *Logging               `yaml:"logging,omitempty"`
	Organizations     []*Organization        `yaml:"organizations,omitempty"`
	Peers             []*Peer                `yaml:"peers,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"`
	Profiles          []*Profile             `yaml:"profiles,omitempty"`
	Templates         *Templates             `yaml:"templates,omitempty"`
	Chaincodes        []*ChannelChaincode    `yaml:"chaincodes,omitempty"`
	PvtTxSupport      bool                   `yaml:"pvttxsupport,omitempty"`
	PvtTxCCSupport    bool                   `yaml:"pvttxccsupport,omitempty"`
	MSPvtTxSupport    bool                   `yaml:"mspvttxsupport,omitempty"`
	MSPvtCCSupport    bool                   `yaml:"mspvtccsupport,omitempty"`
	FabTokenSupport   bool                   `yaml:"fabtokensupport,omitempty"`
	FabTokenCCSupport bool                   `yaml:"fabtokenccsupport,omitempty"`
	GRPCLogging       bool                   `yaml:"grpcLogging,omitempty"`
	NodeOUs           bool                   `yaml:"nodeous,omitempty"`
	FPC               bool                   `yaml:"fpc,omitempty"`
	Weaver            bool                   `yaml:"weaver,omitempty"`
	LogPeersToFile    bool                   `yaml:"logPeersToFile,omitempty"`
	LogOrderersToFile bool                   `yaml:"logOrderersToFile,omitempty"`
	TLSEnabled        bool                   `yaml:"tlsEnabled,omitempty"`
	ExtraParams       map[string]interface{} `yaml:"-"`
}

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

func (*Topology) AddChaincode

func (t *Topology) AddChaincode(cc *ChannelChaincode)

func (*Topology) AddFPC

func (t *Topology) AddFPC(name, image string, options ...func(*ChannelChaincode)) *ChannelChaincode

AddFPC adds the Fabric Private Chaincode with the passed name and image. The Fabric Private Chaincode is installed on all organizations registered so far. The endorsement policy is set to the majority of the organization on which the chaincode has been installed.

func (*Topology) AddFPCAtOrgs

func (t *Topology) AddFPCAtOrgs(name, image string, orgs []string, options ...func(*ChannelChaincode)) *ChannelChaincode

AddFPCAtOrgs adds the Fabric Private Chaincode with the passed name, image, and organizations If no orgs are specified, then the Fabric Private Chaincode is installed on all organizations registered so far. The endorsement policy is set to the majority of the organization on which the chaincode has been installed.

func (*Topology) AddManagedNamespace

func (t *Topology) AddManagedNamespace(name string, policy string, chaincode string, ctor string, peers ...string)

func (*Topology) AddNamespace

func (t *Topology) AddNamespace(name string, policy string, peers ...string)

func (*Topology) AddNamespaceWithOneOutOfN

func (t *Topology) AddNamespaceWithOneOutOfN(name string, orgs ...string)

func (*Topology) AddNamespaceWithUnanimity

func (t *Topology) AddNamespaceWithUnanimity(name string, orgs ...string) *namespace

func (*Topology) AddOrganization

func (t *Topology) AddOrganization(name string) *fscOrg

func (*Topology) AddOrganizations

func (t *Topology) AddOrganizations(num int) *Topology

func (*Topology) AddOrganizationsByMapping

func (t *Topology) AddOrganizationsByMapping(mapping map[string][]string) *Topology

func (*Topology) AddOrganizationsByName

func (t *Topology) AddOrganizationsByName(names ...string) *Topology

func (*Topology) AddPeer

func (t *Topology) AddPeer(name string, org string, typ PeerType, bootstrap bool, executable string) *Peer

func (*Topology) AppendOrganization

func (t *Topology) AppendOrganization(org *Organization)

func (*Topology) AppendPeer

func (t *Topology) AppendPeer(peer *Peer)

func (*Topology) EnableFPC

func (t *Topology) EnableFPC()

EnableFPC enables FPC by adding the Enclave Registry Chaincode definition. The ERCC is installed on all organizations and the endorsement policy is set to the majority of the organization on which the chaincode has been installed.

func (*Topology) EnableGRPCLogging

func (t *Topology) EnableGRPCLogging()

func (*Topology) EnableIdemix

func (t *Topology) EnableIdemix() *fscOrg

func (*Topology) EnableLogOrderersToFile

func (t *Topology) EnableLogOrderersToFile()

func (*Topology) EnableLogPeersToFile

func (t *Topology) EnableLogPeersToFile()

func (*Topology) EnableNodeOUs

func (t *Topology) EnableNodeOUs()

func (*Topology) EnableWeaver

func (t *Topology) EnableWeaver()

func (*Topology) Name

func (t *Topology) Name() string

func (*Topology) SetDefault

func (t *Topology) SetDefault() *Topology

func (*Topology) SetLogging

func (t *Topology) SetLogging(spec, format string)

func (*Topology) SetNamespaceApproverOrgs

func (t *Topology) SetNamespaceApproverOrgs(orgs ...string)

func (*Topology) SetNamespaceApproverOrgsOR

func (t *Topology) SetNamespaceApproverOrgsOR(orgs ...string)

func (*Topology) Type

func (t *Topology) Type() string

type UserSpec

type UserSpec struct {
	Name string `yaml:"Name"`
	HSM  bool   `yaml:"HSM"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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