Skip to content

Commit

Permalink
FAB-1035 move peer specific proto files to peer folder
Browse files Browse the repository at this point in the history
https://jira.hyperledger.org/browse/FAB-1035

Just a reorg of the files in keeping with creation of
"common" and "orderer" package files with corresponding
import changes.

A final cleanup of removing unused messages and renaming
"2" suffixed protos needs to be done as a final cleanup

Change-Id: I81cfa970ca5b4ff668dd70247117bd4e34548ad5
Signed-off-by: Srinivasan Muralidharan <muralisr@us.ibm.com>
  • Loading branch information
Srinivasan Muralidharan committed Nov 11, 2016
1 parent 3508592 commit 5712ce3
Show file tree
Hide file tree
Showing 150 changed files with 898 additions and 864 deletions.
2 changes: 1 addition & 1 deletion bddtests/chaincode.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
putils "github.com/hyperledger/fabric/protos/utils"
)

Expand Down
2 changes: 1 addition & 1 deletion bddtests/endorser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/DATA-DOG/godog"
"github.com/DATA-DOG/godog/gherkin"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
Expand Down
7 changes: 4 additions & 3 deletions bddtests/syschaincode/noop/chaincode.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ import (

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/protos"

pb "github.com/hyperledger/fabric/protos/peer"
)

var logger = shim.NewLogger("noop")

type ledgerHandler interface {
GetTransactionByID(txID string) (*protos.Transaction, error)
GetTransactionByID(txID string) (*pb.Transaction, error)
}

// SystemChaincode is type representing the chaincode
Expand Down Expand Up @@ -78,7 +79,7 @@ func (t *SystemChaincode) Query(stub shim.ChaincodeStubInterface) ([]byte, error
if nil != txerr || nil == tx {
return nil, txerr
}
newCCIS := &protos.ChaincodeInvocationSpec{}
newCCIS := &pb.ChaincodeInvocationSpec{}
var merr = proto.Unmarshal(tx.Payload, newCCIS)
if nil != merr {
return nil, merr
Expand Down
9 changes: 5 additions & 4 deletions bddtests/syschaincode/noop/chaincode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import (
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/core/util"
"github.com/hyperledger/fabric/protos"

pb "github.com/hyperledger/fabric/protos/peer"
)

var something = "c29tZXRoaW5n"
Expand Down Expand Up @@ -122,11 +123,11 @@ func TestQueryGetTranExisting(t *testing.T) {
type mockLedger struct {
}

func (ml mockLedger) GetTransactionByID(txID string) (*protos.Transaction, error) {
func (ml mockLedger) GetTransactionByID(txID string) (*pb.Transaction, error) {
if txID == "noSuchTX" {
return nil, fmt.Errorf("Some error")
}
newCCIS := &protos.ChaincodeInvocationSpec{ChaincodeSpec: &protos.ChaincodeSpec{CtorMsg: &protos.ChaincodeInput{Args: util.ToChaincodeArgs("execute", something)}}}
newCCIS := &pb.ChaincodeInvocationSpec{ChaincodeSpec: &pb.ChaincodeSpec{CtorMsg: &pb.ChaincodeInput{Args: util.ToChaincodeArgs("execute", something)}}}
pl, _ := proto.Marshal(newCCIS)
return &protos.Transaction{Payload: pl}, nil
return &pb.Transaction{Payload: pl}, nil
}
2 changes: 1 addition & 1 deletion bddtests/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package bddtests
import (
"fmt"

pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

// UserRegistration represents a user in the peer network
Expand Down
2 changes: 1 addition & 1 deletion bddtests/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package bddtests

import (
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

// KeyedProposalResponse the response for an endorsement for internal usage in maps
Expand Down
2 changes: 1 addition & 1 deletion core/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

"github.com/golang/protobuf/ptypes/empty"
"github.com/hyperledger/fabric/flogging"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

var log = logging.MustGetLogger("server")
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/chaincode_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/hyperledger/fabric/core/crypto"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/flogging"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

// ChainName is the name of the chain to which this chaincode support belongs to.
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/chaincodeexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"

"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

//create a Transactions - this has to change to Proposal when we move chaincode to use Proposals
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/exectransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"golang.org/x/net/context"

"github.com/hyperledger/fabric/events/producer"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

//Execute - execute transaction or a query
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/exectransaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
"github.com/hyperledger/fabric/core/ledger/kvledger"
"github.com/hyperledger/fabric/core/peer"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
putils "github.com/hyperledger/fabric/protos/utils"

"github.com/golang/protobuf/proto"
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/hyperledger/fabric/core/crypto"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/looplab/fsm"
"github.com/op/go-logging"
"golang.org/x/net/context"
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/lccc.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/ledger/kvledger"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/op/go-logging"
"golang.org/x/net/context"
)
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/lccc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/core/container"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
"google.golang.org/grpc"
)

Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/car/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

//generateHashcode gets hashcode of the code under path. If path is a HTTP(s) url
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/car/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"time"

cutil "github.com/hyperledger/fabric/core/container/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

func download(path string) (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/car/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package car

import (
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

// Platform for the CAR type
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/car/test/car_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/hyperledger/fabric/core/config"
"github.com/hyperledger/fabric/core/container"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/golang/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

cutil "github.com/hyperledger/fabric/core/container/util"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

var logger = logging.MustGetLogger("golang/hash")
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/golang/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/spf13/viper"

cutil "github.com/hyperledger/fabric/core/container/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

//tw is expected to have the chaincode in it from GenerateHashcode. This method
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/golang/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"os"
"path/filepath"

pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

// Platform for chaincodes written in Go
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/java/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/golang/protobuf/proto"
cutil "github.com/hyperledger/fabric/core/container/util"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

//hashFilesInDir computes h=hash(h,file bytes) for each file in a directory
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/java/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

cutil "github.com/hyperledger/fabric/core/container/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/spf13/viper"
)

Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/java/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/url"
"os"

pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
// "path/filepath"
)

Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/java/test/java_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/hyperledger/fabric/core/config"
"github.com/hyperledger/fabric/core/container"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/platforms.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/hyperledger/fabric/core/chaincode/platforms/car"
"github.com/hyperledger/fabric/core/chaincode/platforms/golang"
"github.com/hyperledger/fabric/core/chaincode/platforms/java"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

// Interface for validating the specification and and writing the package for
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/shim/chaincode.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"github.com/hyperledger/fabric/core/chaincode/shim/crypto/ecdsa"
"github.com/hyperledger/fabric/core/comm"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/op/go-logging"
"github.com/spf13/viper"
"golang.org/x/net/context"
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/shim/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"sync"

"github.com/golang/protobuf/proto"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/looplab/fsm"
)

Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/shim/inprocstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package shim

import (
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
)

// PeerChaincodeStream interface for stream between Peer and chaincode instance.
Expand Down
4 changes: 2 additions & 2 deletions core/chaincode/shim/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ task copyToLib(type: Copy) {

task copyProtos(type:Copy){

from ("${rootDir}/protos"){
from ("${rootDir}/protos/peer"){
include '**/chaincodeevent.proto'
include '**/chaincode.proto'
}
Expand All @@ -93,7 +93,7 @@ task copyProtos(type:Copy){
include '**/table.proto'
exclude 'java'
}
into "${projectDir}/src/main/proto"
into "${projectDir}/src/main/proto/peer"

}

Expand Down
19 changes: 10 additions & 9 deletions core/chaincode/sysccapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import (
"github.com/hyperledger/fabric/core/container/inproccontroller"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/ledger/kvledger"
"github.com/hyperledger/fabric/protos"
"github.com/op/go-logging"
"github.com/spf13/viper"

pb "github.com/hyperledger/fabric/protos/peer"
)

var sysccLogger = logging.MustGetLogger("sysccapi")
Expand Down Expand Up @@ -70,8 +71,8 @@ func RegisterSysCC(syscc *SystemChaincode) error {
}
}

chaincodeID := &protos.ChaincodeID{Path: syscc.Path, Name: syscc.Name}
spec := protos.ChaincodeSpec{Type: protos.ChaincodeSpec_Type(protos.ChaincodeSpec_Type_value["GOLANG"]), ChaincodeID: chaincodeID, CtorMsg: &protos.ChaincodeInput{Args: syscc.InitArgs}}
chaincodeID := &pb.ChaincodeID{Path: syscc.Path, Name: syscc.Name}
spec := pb.ChaincodeSpec{Type: pb.ChaincodeSpec_Type(pb.ChaincodeSpec_Type_value["GOLANG"]), ChaincodeID: chaincodeID, CtorMsg: &pb.ChaincodeInput{Args: syscc.InitArgs}}

//PDMP - use default chain to get the simulator
//Note that we are just colleting simulation though
Expand Down Expand Up @@ -100,8 +101,8 @@ func RegisterSysCC(syscc *SystemChaincode) error {

// deregisterSysCC stops the system chaincode and deregisters it from inproccontroller
func deregisterSysCC(syscc *SystemChaincode) error {
chaincodeID := &protos.ChaincodeID{Path: syscc.Path, Name: syscc.Name}
spec := &protos.ChaincodeSpec{Type: protos.ChaincodeSpec_Type(protos.ChaincodeSpec_Type_value["GOLANG"]), ChaincodeID: chaincodeID, CtorMsg: &protos.ChaincodeInput{Args: syscc.InitArgs}}
chaincodeID := &pb.ChaincodeID{Path: syscc.Path, Name: syscc.Name}
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_Type(pb.ChaincodeSpec_Type_value["GOLANG"]), ChaincodeID: chaincodeID, CtorMsg: &pb.ChaincodeInput{Args: syscc.InitArgs}}

ctx := context.Background()
// First build and get the deployment spec
Expand All @@ -121,14 +122,14 @@ func deregisterSysCC(syscc *SystemChaincode) error {
}

// buildLocal builds a given chaincode code
func buildSysCC(context context.Context, spec *protos.ChaincodeSpec) (*protos.ChaincodeDeploymentSpec, error) {
func buildSysCC(context context.Context, spec *pb.ChaincodeSpec) (*pb.ChaincodeDeploymentSpec, error) {
var codePackageBytes []byte
chaincodeDeploymentSpec := &protos.ChaincodeDeploymentSpec{ExecEnv: protos.ChaincodeDeploymentSpec_SYSTEM, ChaincodeSpec: spec, CodePackage: codePackageBytes}
chaincodeDeploymentSpec := &pb.ChaincodeDeploymentSpec{ExecEnv: pb.ChaincodeDeploymentSpec_SYSTEM, ChaincodeSpec: spec, CodePackage: codePackageBytes}
return chaincodeDeploymentSpec, nil
}

// DeploySysCC deploys the supplied system chaincode to the local peer
func DeploySysCC(ctx context.Context, spec *protos.ChaincodeSpec) error {
func DeploySysCC(ctx context.Context, spec *pb.ChaincodeSpec) error {
// First build and get the deployment spec
chaincodeDeploymentSpec, err := buildSysCC(ctx, spec)

Expand All @@ -137,7 +138,7 @@ func DeploySysCC(ctx context.Context, spec *protos.ChaincodeSpec) error {
return err
}

transaction, err := protos.NewChaincodeDeployTransaction(chaincodeDeploymentSpec, chaincodeDeploymentSpec.ChaincodeSpec.ChaincodeID.Name)
transaction, err := pb.NewChaincodeDeployTransaction(chaincodeDeploymentSpec, chaincodeDeploymentSpec.ChaincodeSpec.ChaincodeID.Name)
if err != nil {
return fmt.Errorf("Error deploying chaincode: %s ", err)
}
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/systemchaincode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/hyperledger/fabric/core/ledger/kvledger"
"github.com/hyperledger/fabric/core/system_chaincode/samplesyscc"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
pb "github.com/hyperledger/fabric/protos/peer"
"github.com/spf13/viper"
"golang.org/x/net/context"
"google.golang.org/grpc"
Expand Down
Loading

0 comments on commit 5712ce3

Please sign in to comment.