Skip to content

Commit 0797a52

Browse files
author
Jason Yellick
committed
[FAB-2321] Cleanup channel config
https://jira.hyperledger.org/browse/FAB-2321 The channel config values handling has been moved around a lot, this is the first in a series of CRs designed to cleanup the style of the config packages. Change-Id: I6456516fe182e1e37bcd9585ebff64f314941a63 Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
1 parent a971b0f commit 0797a52

File tree

27 files changed

+92
-90
lines changed

27 files changed

+92
-90
lines changed

common/configtx/api/api.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ limitations under the License.
1717
package api
1818

1919
import (
20-
configvalues "github.com/hyperledger/fabric/common/configvalues/api"
20+
configvalues "github.com/hyperledger/fabric/common/configvalues"
21+
configvalueschannel "github.com/hyperledger/fabric/common/configvalues/channel"
2122
"github.com/hyperledger/fabric/common/policies"
2223
"github.com/hyperledger/fabric/msp"
2324
cb "github.com/hyperledger/fabric/protos/common"
@@ -51,7 +52,7 @@ type Resources interface {
5152
PolicyManager() policies.Manager
5253

5354
// ChannelConfig returns the ChannelConfig for the chain
54-
ChannelConfig() configvalues.Channel
55+
ChannelConfig() configvalueschannel.ConfigReader
5556

5657
// OrdererConfig returns the configtxorderer.SharedConfig for the channel
5758
OrdererConfig() configvalues.Orderer

common/configtx/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"fmt"
2121

2222
"github.com/hyperledger/fabric/common/configtx/api"
23-
configvaluesapi "github.com/hyperledger/fabric/common/configvalues/api"
23+
configvaluesapi "github.com/hyperledger/fabric/common/configvalues"
2424
"github.com/hyperledger/fabric/common/policies"
2525
cb "github.com/hyperledger/fabric/protos/common"
2626
)

common/configtx/initializer.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121

2222
"github.com/hyperledger/fabric/common/cauthdsl"
2323
"github.com/hyperledger/fabric/common/configtx/api"
24-
configvaluesapi "github.com/hyperledger/fabric/common/configvalues/api"
25-
configtxchannel "github.com/hyperledger/fabric/common/configvalues/channel"
24+
configvaluesapi "github.com/hyperledger/fabric/common/configvalues"
25+
configvalueschannel "github.com/hyperledger/fabric/common/configvalues/channel"
2626
configtxapplication "github.com/hyperledger/fabric/common/configvalues/channel/application"
2727
configtxorderer "github.com/hyperledger/fabric/common/configvalues/channel/orderer"
2828
configtxmsp "github.com/hyperledger/fabric/common/configvalues/msp"
@@ -33,7 +33,7 @@ import (
3333

3434
type resources struct {
3535
policyManager *policies.ManagerImpl
36-
channelConfig *configtxchannel.SharedConfigImpl
36+
channelConfig *configvalueschannel.Config
3737
ordererConfig *configtxorderer.ManagerImpl
3838
applicationConfig *configtxapplication.SharedConfigImpl
3939
mspConfigHandler *configtxmsp.MSPConfigHandler
@@ -45,7 +45,7 @@ func (r *resources) PolicyManager() policies.Manager {
4545
}
4646

4747
// ChannelConfig returns the api.ChannelConfig for the chain
48-
func (r *resources) ChannelConfig() configvaluesapi.Channel {
48+
func (r *resources) ChannelConfig() configvalueschannel.ConfigReader {
4949
return r.channelConfig
5050
}
5151

@@ -85,15 +85,15 @@ func newResources() *resources {
8585

8686
return &resources{
8787
policyManager: policies.NewManagerImpl(RootGroupKey, policyProviderMap),
88-
channelConfig: configtxchannel.NewSharedConfigImpl(ordererConfig, applicationConfig),
88+
channelConfig: configvalueschannel.NewConfig(ordererConfig, applicationConfig),
8989
ordererConfig: ordererConfig,
9090
applicationConfig: applicationConfig,
9191
mspConfigHandler: mspConfigHandler,
9292
}
9393
}
9494

9595
type valueProposerRoot struct {
96-
channelConfig *configtxchannel.SharedConfigImpl
96+
channelConfig *configvalueschannel.Config
9797
mspConfigHandler *configtxmsp.MSPConfigHandler
9898
}
9999

common/configvalues/api/api.go renamed to common/configvalues/api.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,6 @@ import (
2424
pb "github.com/hyperledger/fabric/protos/peer"
2525
)
2626

27-
// Channel stores the common channel config
28-
type Channel interface {
29-
// HashingAlgorithm returns the default algorithm to be used when hashing
30-
// such as computing block hashes, and CreationPolicy digests
31-
HashingAlgorithm() func(input []byte) []byte
32-
33-
// BlockDataHashingStructureWidth returns the width to use when constructing the
34-
// Merkle tree to compute the BlockData hash
35-
BlockDataHashingStructureWidth() uint32
36-
37-
// OrdererAddresses returns the list of valid orderer addresses to connect to to invoke Broadcast/Deliver
38-
OrdererAddresses() []string
39-
}
40-
4127
// Org stores the common organizational config
4228
type Org interface {
4329
// Name returns the name this org is referred to in config

common/configvalues/channel/application/organization.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package application
1919
import (
2020
"fmt"
2121

22-
"github.com/hyperledger/fabric/common/configvalues/api"
22+
"github.com/hyperledger/fabric/common/configvalues"
2323
"github.com/hyperledger/fabric/common/configvalues/channel/common/organization"
2424
mspconfig "github.com/hyperledger/fabric/common/configvalues/msp"
2525
cb "github.com/hyperledger/fabric/protos/common"

common/configvalues/channel/application/organization_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package application
1919
import (
2020
"testing"
2121

22-
"github.com/hyperledger/fabric/common/configvalues/api"
22+
api "github.com/hyperledger/fabric/common/configvalues"
2323
cb "github.com/hyperledger/fabric/protos/common"
2424
pb "github.com/hyperledger/fabric/protos/peer"
2525

common/configvalues/channel/application/sharedconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package application
1818

1919
import (
20-
"github.com/hyperledger/fabric/common/configvalues/api"
20+
api "github.com/hyperledger/fabric/common/configvalues"
2121
"github.com/hyperledger/fabric/common/configvalues/channel/common/organization"
2222
"github.com/hyperledger/fabric/common/configvalues/msp"
2323
cb "github.com/hyperledger/fabric/protos/common"

common/configvalues/channel/application/sharedconfig_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package application
1919
import (
2020
"testing"
2121

22-
"github.com/hyperledger/fabric/common/configvalues/api"
22+
api "github.com/hyperledger/fabric/common/configvalues"
2323

2424
logging "github.com/op/go-logging"
2525
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package organization
1919
import (
2020
"fmt"
2121

22-
"github.com/hyperledger/fabric/common/configvalues/api"
22+
"github.com/hyperledger/fabric/common/configvalues"
2323
mspconfig "github.com/hyperledger/fabric/common/configvalues/msp"
2424
"github.com/hyperledger/fabric/msp"
2525
cb "github.com/hyperledger/fabric/protos/common"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package organization
1919
import (
2020
"testing"
2121

22-
"github.com/hyperledger/fabric/common/configvalues/api"
22+
api "github.com/hyperledger/fabric/common/configvalues"
2323

2424
logging "github.com/op/go-logging"
2525
)

0 commit comments

Comments
 (0)