Skip to content

Commit

Permalink
FAB-11029 Make stop take container info
Browse files Browse the repository at this point in the history
Yet another step to remove the chaincode deployment spec dependencies
from the chaincode package.

Change-Id: I4db64faff97da097e6ab6713394c1ba18539faf3
Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
  • Loading branch information
Jason Yellick committed Jul 16, 2018
1 parent 620dffe commit 4f10a14
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 157 deletions.
4 changes: 2 additions & 2 deletions core/chaincode/ccproviderimpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ func (c *CCProviderImpl) ExecuteInit(ctxt context.Context, cccid *ccprovider.CCC
}

// Stop stops the chaincode given context and spec
func (c *CCProviderImpl) Stop(cccid *ccprovider.CCContext, spec *pb.ChaincodeDeploymentSpec) error {
return c.cs.Stop(cccid, spec)
func (c *CCProviderImpl) Stop(ccci *ccprovider.ChaincodeContainerInfo) error {
return c.cs.Stop(ccci)
}
7 changes: 1 addition & 6 deletions core/chaincode/chaincode_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,7 @@ func (cs *ChaincodeSupport) Launch(cccid *ccprovider.CCContext, spec *pb.Chainco
}

// Stop stops a chaincode if running.
func (cs *ChaincodeSupport) Stop(cccid *ccprovider.CCContext, cds *pb.ChaincodeDeploymentSpec) error {
cname := cccid.GetCanonicalName()
defer cs.HandlerRegistry.Deregister(cname)

ccci := ccprovider.DeploymentSpecToChaincodeContainerInfo(cds)
ccci.Version = cccid.Version
func (cs *ChaincodeSupport) Stop(ccci *ccprovider.ChaincodeContainerInfo) error {
err := cs.Runtime.Stop(ccci)
if err != nil {
return err
Expand Down
9 changes: 8 additions & 1 deletion core/chaincode/concurrency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ func TestExecuteConcurrentInvokes(t *testing.T) {

cccid := ccprovider.NewCCContext(chainID, "nkpi", "0", "", false, nil, nil)

defer chaincodeSupport.Stop(cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
ccci := &ccprovider.ChaincodeContainerInfo{
Type: "GOLANG",
Name: "nkpi",
Version: "0",
Path: url,
ContainerType: "DOCKER",
}
defer chaincodeSupport.Stop(ccci)

var nextBlockNumber uint64
_, err = deploy(ctxt, cccid, spec, nextBlockNumber, chaincodeSupport)
Expand Down
Loading

0 comments on commit 4f10a14

Please sign in to comment.