1 Star 0 Fork 0

13683679291/fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
.github
bccsp
bddtests
common
cauthdsl
config
msp
api.go
application.go
application_test.go
application_util.go
applicationorg.go
applicationorg_test.go
channel.go
channel_test.go
channel_util.go
consortium.go
consortium_test.go
consortiums.go
consortiums_test.go
consortiums_util.go
orderer.go
orderer_test.go
orderer_util.go
organization.go
organization_test.go
proposer.go
proposer_test.go
realconfig_test.go
root.go
root_test.go
standardvalues.go
standardvalues_test.go
configtx
crypto
errors
flogging
genesis
ledger
localmsp
metadata
mocks
policies
tools
util
viperutil
core
devenv
docs
events
examples
gossip
gotools
images
msp
orderer
peer
proposals/r1
protos
release/templates
release_notes
sampleconfig
scripts
test
unit-test
vendor
.baseimage-release
.dockerignore
.gitattributes
.gitignore
.gitreview
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
LICENSE
Makefile
README.md
docker-env.mk
mkdocs.yml
settings.gradle
克隆/下载
applicationorg.go 2.68 KB
一键复制 编辑 原始数据 按行查看 历史
/*
Copyright IBM Corp. 2017 All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package config
import (
mspconfig "github.com/hyperledger/fabric/common/config/msp"
pb "github.com/hyperledger/fabric/protos/peer"
logging "github.com/op/go-logging"
)
// Application org config keys
const (
// AnchorPeersKey is the key name for the AnchorPeers ConfigValue
AnchorPeersKey = "AnchorPeers"
)
type ApplicationOrgProtos struct {
AnchorPeers *pb.AnchorPeers
}
type ApplicationOrgConfig struct {
*OrganizationConfig
protos *ApplicationOrgProtos
applicationOrgGroup *ApplicationOrgGroup
}
// ApplicationOrgGroup defines the configuration for an application org
type ApplicationOrgGroup struct {
*Proposer
*OrganizationGroup
*ApplicationOrgConfig
}
// NewApplicationOrgGroup creates a new ApplicationOrgGroup
func NewApplicationOrgGroup(id string, mspConfig *mspconfig.MSPConfigHandler) *ApplicationOrgGroup {
aog := &ApplicationOrgGroup{
OrganizationGroup: NewOrganizationGroup(id, mspConfig),
}
aog.Proposer = NewProposer(aog)
return aog
}
// AnchorPeers returns the list of valid orderer addresses to connect to to invoke Broadcast/Deliver
func (aog *ApplicationOrgConfig) AnchorPeers() []*pb.AnchorPeer {
return aog.protos.AnchorPeers.AnchorPeers
}
func (aog *ApplicationOrgGroup) Allocate() Values {
return NewApplicationOrgConfig(aog)
}
func (aoc *ApplicationOrgConfig) Commit() {
aoc.applicationOrgGroup.ApplicationOrgConfig = aoc
aoc.OrganizationConfig.Commit()
}
func NewApplicationOrgConfig(aog *ApplicationOrgGroup) *ApplicationOrgConfig {
aoc := &ApplicationOrgConfig{
protos: &ApplicationOrgProtos{},
OrganizationConfig: NewOrganizationConfig(aog.OrganizationGroup),
applicationOrgGroup: aog,
}
var err error
aoc.standardValues, err = NewStandardValues(aoc.protos, aoc.OrganizationConfig.protos)
if err != nil {
logger.Panicf("Programming error: %s", err)
}
return aoc
}
func (aoc *ApplicationOrgConfig) Validate(tx interface{}, groups map[string]ValueProposer) error {
if logger.IsEnabledFor(logging.DEBUG) {
logger.Debugf("Anchor peers for org %s are %v", aoc.applicationOrgGroup.name, aoc.protos.AnchorPeers)
}
return aoc.OrganizationConfig.Validate(tx, groups)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mmcro/fabric.git
git@gitee.com:mmcro/fabric.git
mmcro
fabric
fabric
v1.0.1

搜索帮助