@@ -17,87 +17,12 @@ limitations under the License.
1717package  api
1818
1919import  (
20- 	"time" 
21- 
20+ 	configvalues "github.com/hyperledger/fabric/common/configvalues/api" 
2221	"github.com/hyperledger/fabric/common/policies" 
2322	"github.com/hyperledger/fabric/msp" 
2423	cb "github.com/hyperledger/fabric/protos/common" 
25- 	ab "github.com/hyperledger/fabric/protos/orderer" 
26- 	pb "github.com/hyperledger/fabric/protos/peer" 
2724)
2825
29- // ChannelConfig stores the common channel config 
30- type  ChannelConfig  interface  {
31- 	// HashingAlgorithm returns the default algorithm to be used when hashing 
32- 	// such as computing block hashes, and CreationPolicy digests 
33- 	HashingAlgorithm () func (input  []byte ) []byte 
34- 
35- 	// BlockDataHashingStructureWidth returns the width to use when constructing the 
36- 	// Merkle tree to compute the BlockData hash 
37- 	BlockDataHashingStructureWidth () uint32 
38- 
39- 	// OrdererAddresses returns the list of valid orderer addresses to connect to to invoke Broadcast/Deliver 
40- 	OrdererAddresses () []string 
41- }
42- 
43- type  OrgConfig  interface  {
44- 	// Name returns the name this org is referred to in config 
45- 	Name () string 
46- 
47- 	// MSPID returns the MSP ID associated with this org 
48- 	MSPID () string 
49- }
50- 
51- // ApplicationOrgConfig stores the per org application config 
52- type  ApplicationOrgConfig  interface  {
53- 	OrgConfig 
54- 
55- 	// AnchorPeers returns the list of gossip anchor peers 
56- 	AnchorPeers () []* pb.AnchorPeer 
57- }
58- 
59- // ApplicationConfig stores the common shared application config 
60- type  ApplicationConfig  interface  {
61- 	// Organizations returns a map of org ID to ApplicationOrgConfig 
62- 	Organizations () map [string ]ApplicationOrgConfig 
63- }
64- 
65- // OrdererConfig stores the common shared orderer config 
66- type  OrdererConfig  interface  {
67- 	// ConsensusType returns the configured consensus type 
68- 	ConsensusType () string 
69- 
70- 	// BatchSize returns the maximum number of messages to include in a block 
71- 	BatchSize () * ab.BatchSize 
72- 
73- 	// BatchTimeout returns the amount of time to wait before creating a batch 
74- 	BatchTimeout () time.Duration 
75- 
76- 	// ChainCreationPolicyNames returns the policy names which are allowed for chain creation 
77- 	// This field is only set for the system ordering chain 
78- 	ChainCreationPolicyNames () []string 
79- 
80- 	// KafkaBrokers returns the addresses (IP:port notation) of a set of "bootstrap" 
81- 	// Kafka brokers, i.e. this is not necessarily the entire set of Kafka brokers 
82- 	// used for ordering 
83- 	KafkaBrokers () []string 
84- 
85- 	// IngressPolicyNames returns the name of the policy to validate incoming broadcast messages against 
86- 	IngressPolicyNames () []string 
87- 
88- 	// EgressPolicyNames returns the name of the policy to validate incoming broadcast messages against 
89- 	EgressPolicyNames () []string 
90- }
91- 
92- // Handler provides a hook which allows other pieces of code to participate in config proposals 
93- // TODO, this should probably be renamed to ValueHandler 
94- type  Handler  interface  {
95- 	Transactional 
96- 
97- 	// ProposeConfig called when config is added to a proposal 
98- 	ProposeConfig (key  string , configValue  * cb.ConfigValue ) error 
99- }
100- 
10126// Manager provides a mechanism to query and update config 
10227type  Manager  interface  {
10328	Resources 
@@ -126,41 +51,46 @@ type Resources interface {
12651	PolicyManager () policies.Manager 
12752
12853	// ChannelConfig returns the ChannelConfig for the chain 
129- 	ChannelConfig () ChannelConfig 
54+ 	ChannelConfig () configvalues. Channel 
13055
13156	// OrdererConfig returns the configtxorderer.SharedConfig for the channel 
132- 	OrdererConfig () OrdererConfig 
57+ 	OrdererConfig () configvalues. Orderer 
13358
13459	// ApplicationConfig returns the configtxapplication.SharedConfig for the channel 
135- 	ApplicationConfig () ApplicationConfig 
60+ 	ApplicationConfig () configvalues. Application 
13661
13762	// MSPManager returns the msp.MSPManager for the chain 
13863	MSPManager () msp.MSPManager 
13964}
14065
14166// Transactional is an interface which allows for an update to be proposed and rolled back 
14267type  Transactional  interface  {
143- 	// BeginConfig called when a config proposal is begun 
144- 	BeginConfig (groups  []string ) ([]Handler , error )
145- 
14668	// RollbackConfig called when a config proposal is abandoned 
147- 	RollbackConfig ()
69+ 	RollbackProposals ()
14870
14971	// CommitConfig called when a config proposal is committed 
150- 	CommitConfig ()
72+ 	CommitProposals ()
15173}
15274
15375// PolicyHandler is used for config updates to policy 
15476type  PolicyHandler  interface  {
15577	Transactional 
15678
79+ 	BeginConfig (groups  []string ) ([]PolicyHandler , error )
80+ 
15781	ProposePolicy (key  string , path  []string , policy  * cb.ConfigPolicy ) error 
15882}
15983
16084// Initializer is used as indirection between Manager and Handler to allow 
16185// for single Handlers to handle multiple paths 
16286type  Initializer  interface  {
163- 	Handler 
87+ 	// ProposeValue is used for propsing group values 
88+ 	ProposeValue (key  string , configValue  * cb.ConfigValue ) error 
89+ 
90+ 	// BeginValueProposals is called when a config proposal is begun 
91+ 	BeginValueProposals (groups  []string ) ([]configvalues.ValueProposer , error )
92+ 
93+ 	Transactional 
16494
16595	Resources 
16696
0 commit comments