@@ -17,87 +17,12 @@ limitations under the License.
17
17
package api
18
18
19
19
import (
20
- "time"
21
-
20
+ configvalues "github.com/hyperledger/fabric/common/configvalues/api"
22
21
"github.com/hyperledger/fabric/common/policies"
23
22
"github.com/hyperledger/fabric/msp"
24
23
cb "github.com/hyperledger/fabric/protos/common"
25
- ab "github.com/hyperledger/fabric/protos/orderer"
26
- pb "github.com/hyperledger/fabric/protos/peer"
27
24
)
28
25
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
-
101
26
// Manager provides a mechanism to query and update config
102
27
type Manager interface {
103
28
Resources
@@ -126,41 +51,46 @@ type Resources interface {
126
51
PolicyManager () policies.Manager
127
52
128
53
// ChannelConfig returns the ChannelConfig for the chain
129
- ChannelConfig () ChannelConfig
54
+ ChannelConfig () configvalues. Channel
130
55
131
56
// OrdererConfig returns the configtxorderer.SharedConfig for the channel
132
- OrdererConfig () OrdererConfig
57
+ OrdererConfig () configvalues. Orderer
133
58
134
59
// ApplicationConfig returns the configtxapplication.SharedConfig for the channel
135
- ApplicationConfig () ApplicationConfig
60
+ ApplicationConfig () configvalues. Application
136
61
137
62
// MSPManager returns the msp.MSPManager for the chain
138
63
MSPManager () msp.MSPManager
139
64
}
140
65
141
66
// Transactional is an interface which allows for an update to be proposed and rolled back
142
67
type Transactional interface {
143
- // BeginConfig called when a config proposal is begun
144
- BeginConfig (groups []string ) ([]Handler , error )
145
-
146
68
// RollbackConfig called when a config proposal is abandoned
147
- RollbackConfig ()
69
+ RollbackProposals ()
148
70
149
71
// CommitConfig called when a config proposal is committed
150
- CommitConfig ()
72
+ CommitProposals ()
151
73
}
152
74
153
75
// PolicyHandler is used for config updates to policy
154
76
type PolicyHandler interface {
155
77
Transactional
156
78
79
+ BeginConfig (groups []string ) ([]PolicyHandler , error )
80
+
157
81
ProposePolicy (key string , path []string , policy * cb.ConfigPolicy ) error
158
82
}
159
83
160
84
// Initializer is used as indirection between Manager and Handler to allow
161
85
// for single Handlers to handle multiple paths
162
86
type 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
164
94
165
95
Resources
166
96
0 commit comments