@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
16
17
- package sharedconfig
17
+ package application
18
18
19
19
import (
20
20
"fmt"
@@ -34,40 +34,31 @@ const (
34
34
35
35
var logger = logging .MustGetLogger ("peer/sharedconfig" )
36
36
37
- // Descriptor stores the common peer config
38
- // It is intended to be the primary accessor of DescriptorImpl
39
- // It is intended to discourage use of the other exported DescriptorImpl methods
40
- // which are used for updating the chain config by the configtx.Manager
41
- type Descriptor interface {
42
- // AnchorPeers returns the list of anchor peers for the channel
43
- AnchorPeers () []* pb.AnchorPeer
44
- }
45
-
46
37
type sharedConfig struct {
47
38
anchorPeers []* pb.AnchorPeer
48
39
}
49
40
50
- // DescriptorImpl is an implementation of Manager and configtx.ConfigHandler
41
+ // SharedConfigImpl is an implementation of Manager and configtx.ConfigHandler
51
42
// In general, it should only be referenced as an Impl for the configtx.Manager
52
- type DescriptorImpl struct {
43
+ type SharedConfigImpl struct {
53
44
pendingConfig * sharedConfig
54
45
config * sharedConfig
55
46
}
56
47
57
- // NewDescriptorImpl creates a new DescriptorImpl with the given CryptoHelper
58
- func NewDescriptorImpl () * DescriptorImpl {
59
- return & DescriptorImpl {
48
+ // NewSharedConfigImpl creates a new SharedConfigImpl with the given CryptoHelper
49
+ func NewSharedConfigImpl () * SharedConfigImpl {
50
+ return & SharedConfigImpl {
60
51
config : & sharedConfig {},
61
52
}
62
53
}
63
54
64
55
// AnchorPeers returns the list of valid orderer addresses to connect to to invoke Broadcast/Deliver
65
- func (di * DescriptorImpl ) AnchorPeers () []* pb.AnchorPeer {
56
+ func (di * SharedConfigImpl ) AnchorPeers () []* pb.AnchorPeer {
66
57
return di .config .anchorPeers
67
58
}
68
59
69
60
// BeginConfig is used to start a new config proposal
70
- func (di * DescriptorImpl ) BeginConfig () {
61
+ func (di * SharedConfigImpl ) BeginConfig () {
71
62
logger .Debugf ("Beginning a possible new peer shared config" )
72
63
if di .pendingConfig != nil {
73
64
logger .Panicf ("Programming error, cannot call begin in the middle of a proposal" )
@@ -76,13 +67,13 @@ func (di *DescriptorImpl) BeginConfig() {
76
67
}
77
68
78
69
// RollbackConfig is used to abandon a new config proposal
79
- func (di * DescriptorImpl ) RollbackConfig () {
70
+ func (di * SharedConfigImpl ) RollbackConfig () {
80
71
logger .Debugf ("Rolling back proposed peer shared config" )
81
72
di .pendingConfig = nil
82
73
}
83
74
84
75
// CommitConfig is used to commit a new config proposal
85
- func (di * DescriptorImpl ) CommitConfig () {
76
+ func (di * SharedConfigImpl ) CommitConfig () {
86
77
logger .Debugf ("Committing new peer shared config" )
87
78
if di .pendingConfig == nil {
88
79
logger .Panicf ("Programming error, cannot call commit without an existing proposal" )
@@ -92,7 +83,7 @@ func (di *DescriptorImpl) CommitConfig() {
92
83
}
93
84
94
85
// ProposeConfig is used to add new config to the config proposal
95
- func (di * DescriptorImpl ) ProposeConfig (configItem * cb.ConfigItem ) error {
86
+ func (di * SharedConfigImpl ) ProposeConfig (configItem * cb.ConfigItem ) error {
96
87
if configItem .Type != cb .ConfigItem_Peer {
97
88
return fmt .Errorf ("Expected type of ConfigItem_Peer, got %v" , configItem .Type )
98
89
}
0 commit comments