@@ -62,7 +62,7 @@ func NewChaincodeSupport(
62
62
ccStartupTimeout : ccstartuptimeout ,
63
63
keepalive : config .Keepalive ,
64
64
executetimeout : config .ExecuteTimeout ,
65
- handlerRegistry : NewHandlerRegistry (userrunsCC ),
65
+ HandlerRegistry : NewHandlerRegistry (userrunsCC ),
66
66
PackageProvider : packageProvider ,
67
67
ACLProvider : aclProvider ,
68
68
}
@@ -92,7 +92,6 @@ func NewChaincodeSupport(
92
92
// ChaincodeSupport responsible for providing interfacing with chaincodes from the Peer.
93
93
type ChaincodeSupport struct {
94
94
caCert []byte
95
- handlerRegistry * HandlerRegistry
96
95
peerAddress string
97
96
ccStartupTimeout time.Duration
98
97
peerNetworkID string
@@ -103,6 +102,7 @@ type ChaincodeSupport struct {
103
102
ContainerRuntime Runtime
104
103
PackageProvider PackageProvider
105
104
ACLProvider ACLProvider
105
+ HandlerRegistry * HandlerRegistry
106
106
sccp sysccprovider.SystemChaincodeProvider
107
107
}
108
108
@@ -114,24 +114,12 @@ func (cs *ChaincodeSupport) SetSysCCProvider(sccp sysccprovider.SystemChaincodeP
114
114
cs .sccp = sccp
115
115
}
116
116
117
- func (cs * ChaincodeSupport ) registerHandler (chaincodehandler * Handler ) error {
118
- return cs .handlerRegistry .Register (chaincodehandler )
119
- }
120
-
121
- func (cs * ChaincodeSupport ) deregisterHandler (chaincodehandler * Handler ) error {
122
- return cs .handlerRegistry .Deregister (chaincodehandler .ChaincodeID .GetName ())
123
- }
124
-
125
- func (cs * ChaincodeSupport ) ready (chaincodehandler * Handler ) {
126
- cs .handlerRegistry .Ready (chaincodehandler .ChaincodeID .GetName ())
127
- }
128
-
129
117
// launchAndWaitForReady launches a container for the specified chaincode
130
118
// context if one is not already running. It then waits for the chaincode
131
119
// registration to complete or for the process to time out.
132
120
func (cs * ChaincodeSupport ) launchAndWaitForReady (ctx context.Context , cccid * ccprovider.CCContext , cds * pb.ChaincodeDeploymentSpec ) error {
133
121
cname := cccid .GetCanonicalName ()
134
- ready , err := cs .handlerRegistry .Launching (cname )
122
+ ready , err := cs .HandlerRegistry .Launching (cname )
135
123
if err != nil {
136
124
return err
137
125
}
@@ -175,7 +163,7 @@ func (cs *ChaincodeSupport) Stop(ctx context.Context, cccid *ccprovider.CCContex
175
163
return errors .New ("chaincode name not set" )
176
164
}
177
165
178
- defer cs .handlerRegistry .Deregister (cname )
166
+ defer cs .HandlerRegistry .Deregister (cname )
179
167
180
168
err := cs .ContainerRuntime .Stop (ctx , cccid , cds )
181
169
if err != nil {
@@ -191,7 +179,7 @@ func (cs *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CC
191
179
cID := spec .GetChaincodeSpec ().ChaincodeId
192
180
cMsg := spec .GetChaincodeSpec ().Input
193
181
194
- if cs .handlerRegistry .Handler (cname ) != nil {
182
+ if cs .HandlerRegistry .Handler (cname ) != nil {
195
183
return cID , cMsg , nil
196
184
}
197
185
@@ -290,7 +278,7 @@ func (cs *ChaincodeSupport) Execute(ctxt context.Context, cccid *ccprovider.CCCo
290
278
291
279
chaincodeLogger .Debugf ("chaincode canonical name: %s" , canName )
292
280
//we expect the chaincode to be running... sanity check
293
- handler := cs .handlerRegistry .Handler (canName )
281
+ handler := cs .HandlerRegistry .Handler (canName )
294
282
if handler == nil {
295
283
chaincodeLogger .Debugf ("cannot execute-chaincode is not running: %s" , canName )
296
284
return nil , errors .Errorf ("cannot execute transaction for %s" , canName )
0 commit comments