Skip to content

Commit 2541878

Browse files
author
Jason Yellick
committed
[FAB-2397] Move org config to common Proposer
https://jira.hyperledger.org/browse/FAB-2397 This is the another in a series of changesets migrating the individual config handlers to the common Proposer root structure to eliminate duplicated code. Change-Id: I0836d019e58a0e8edc9ab236480be2f1571b81f6 Signed-off-by: Jason Yellick <[email protected]>
1 parent b609bf0 commit 2541878

File tree

5 files changed

+141
-223
lines changed

5 files changed

+141
-223
lines changed

common/configvalues/channel/common/organization/organization.go

-148
This file was deleted.

common/configvalues/channel/common/organization/organization_test.go

-65
This file was deleted.

common/configvalues/root/applicationorg.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"fmt"
2121

2222
api "github.com/hyperledger/fabric/common/configvalues"
23-
"github.com/hyperledger/fabric/common/configvalues/channel/common/organization"
2423
mspconfig "github.com/hyperledger/fabric/common/configvalues/msp"
2524
cb "github.com/hyperledger/fabric/protos/common"
2625
pb "github.com/hyperledger/fabric/protos/peer"
@@ -42,7 +41,7 @@ type applicationOrgConfig struct {
4241
// SharedConfigImpl is an implementation of Manager and configtx.ConfigHandler
4342
// In general, it should only be referenced as an Impl for the configtx.Manager
4443
type ApplicationOrgConfig struct {
45-
*organization.OrgConfig
44+
*OrganizationGroup
4645
pendingConfig *applicationOrgConfig
4746
config *applicationOrgConfig
4847

@@ -52,8 +51,8 @@ type ApplicationOrgConfig struct {
5251
// NewSharedConfigImpl creates a new SharedConfigImpl with the given CryptoHelper
5352
func NewApplicationOrgConfig(id string, mspConfig *mspconfig.MSPConfigHandler) *ApplicationOrgConfig {
5453
return &ApplicationOrgConfig{
55-
OrgConfig: organization.NewOrgConfig(id, mspConfig),
56-
config: &applicationOrgConfig{},
54+
OrganizationGroup: NewOrganizationGroup(id, mspConfig),
55+
config: &applicationOrgConfig{},
5756
}
5857
}
5958

@@ -72,14 +71,14 @@ func (oc *ApplicationOrgConfig) BeginValueProposals(groups []string) ([]api.Valu
7271
logger.Panicf("Programming error, cannot call begin in the middle of a proposal")
7372
}
7473
oc.pendingConfig = &applicationOrgConfig{}
75-
return oc.OrgConfig.BeginValueProposals(groups)
74+
return oc.OrganizationGroup.BeginValueProposals(groups)
7675
}
7776

7877
// RollbackProposals is used to abandon a new config proposal
7978
func (oc *ApplicationOrgConfig) RollbackProposals() {
8079
logger.Debugf("Rolling back proposed org config")
8180
oc.pendingConfig = nil
82-
oc.OrgConfig.RollbackProposals()
81+
oc.OrganizationGroup.RollbackProposals()
8382
}
8483

8584
// CommitProposals is used to commit a new config proposal
@@ -90,7 +89,7 @@ func (oc *ApplicationOrgConfig) CommitProposals() {
9089
}
9190
oc.config = oc.pendingConfig
9291
oc.pendingConfig = nil
93-
oc.OrgConfig.CommitProposals()
92+
oc.OrganizationGroup.CommitProposals()
9493
}
9594

9695
// ProposeValue is used to add new config to the config proposal
@@ -106,7 +105,7 @@ func (oc *ApplicationOrgConfig) ProposeValue(key string, configValue *cb.ConfigV
106105
}
107106
oc.pendingConfig.anchorPeers = anchorPeers.AnchorPeers
108107
default:
109-
return oc.OrgConfig.ProposeValue(key, configValue)
108+
return oc.OrganizationGroup.ProposeValue(key, configValue)
110109
}
111110

112111
return nil

common/configvalues/root/orderer.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"time"
2525

2626
api "github.com/hyperledger/fabric/common/configvalues"
27-
"github.com/hyperledger/fabric/common/configvalues/channel/common/organization"
2827
"github.com/hyperledger/fabric/common/configvalues/msp"
2928
ab "github.com/hyperledger/fabric/protos/orderer"
3029
)
@@ -80,7 +79,7 @@ func NewOrdererGroup(mspConfig *msp.MSPConfigHandler) *OrdererGroup {
8079

8180
// NewGroup returns an Org instance
8281
func (og *OrdererGroup) NewGroup(name string) (api.ValueProposer, error) {
83-
return organization.NewOrgConfig(name, og.mspConfig), nil
82+
return NewOrganizationGroup(name, og.mspConfig), nil
8483
}
8584

8685
func (og *OrdererGroup) Allocate() Values {

0 commit comments

Comments
 (0)