Skip to content

Commit

Permalink
FAB-853 remove ledger and move ledgernext to ledger
Browse files Browse the repository at this point in the history
FAB-853

Ledger is removed from
   . core/peer/peer.go
   . core/rest/api.go

Ledger package itself is removed. "ledgernext" is
replaced with "ledger".

Change-Id: Ie7dfbd9bf94afa0031aef759fc46929e4fb3b400
Signed-off-by: Srinivasan Muralidharan <muralisr@us.ibm.com>
  • Loading branch information
Srinivasan Muralidharan committed Oct 26, 2016
1 parent 0157a51 commit e9ad121
Show file tree
Hide file tree
Showing 113 changed files with 93 additions and 6,908 deletions.
5 changes: 0 additions & 5 deletions bddtests/syschaincode/noop/chaincode.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

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

Expand All @@ -40,10 +39,6 @@ type SystemChaincode struct {

func (t *SystemChaincode) getLedger() ledgerHandler {
if t.mockLedgerH == nil {
lh, err := ld.GetLedger()
if err == nil {
return lh
}
panic("Chaincode is unable to get the ledger.")
} else {
return t.mockLedgerH
Expand Down
6 changes: 3 additions & 3 deletions core/chaincode/chaincode_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"github.com/hyperledger/fabric/core/container"
"github.com/hyperledger/fabric/core/container/ccintf"
"github.com/hyperledger/fabric/core/crypto"
ledgernext "github.com/hyperledger/fabric/core/ledgernext"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/flogging"
pb "github.com/hyperledger/fabric/protos"
)
Expand Down Expand Up @@ -64,8 +64,8 @@ func init() {
}

//use this for ledger access and make sure TXSimulator is being used
func getTxSimulator(context context.Context) ledgernext.TxSimulator {
if txsim, ok := context.Value(TXSimulatorKey).(ledgernext.TxSimulator); ok {
func getTxSimulator(context context.Context) ledger.TxSimulator {
if txsim, ok := context.Value(TXSimulatorKey).(ledger.TxSimulator); ok {
return txsim
}
panic("!!!---Not Using ledgernext---!!!")
Expand Down
12 changes: 6 additions & 6 deletions core/chaincode/exectransaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"github.com/hyperledger/fabric/core/container"
"github.com/hyperledger/fabric/core/container/ccintf"
"github.com/hyperledger/fabric/core/crypto"
ledgernext "github.com/hyperledger/fabric/core/ledgernext"
"github.com/hyperledger/fabric/core/ledgernext/kvledger"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/ledger/kvledger"
"github.com/hyperledger/fabric/core/util"
"github.com/hyperledger/fabric/membersrvc/ca"
pb "github.com/hyperledger/fabric/protos"
Expand Down Expand Up @@ -154,7 +154,7 @@ func finitPeer(lis net.Listener) {
os.RemoveAll(filepath.Join(os.TempDir(), "hyperledger"))
}

func startTxSimulation(ctxt context.Context) (context.Context, ledgernext.TxSimulator, error) {
func startTxSimulation(ctxt context.Context) (context.Context, ledger.TxSimulator, error) {
ledgername := string(DefaultChain)
lgr := kvledger.GetLedger(ledgername)
txsim, err := lgr.NewTxSimulator()
Expand All @@ -166,7 +166,7 @@ func startTxSimulation(ctxt context.Context) (context.Context, ledgernext.TxSimu
return ctxt, txsim, nil
}

func endTxSimulation(txsim ledgernext.TxSimulator, payload []byte, commit bool) error {
func endTxSimulation(txsim ledger.TxSimulator, payload []byte, commit bool) error {
txsim.Done()
ledgername := string(DefaultChain)
if lgr := kvledger.GetLedger(ledgername); lgr != nil {
Expand Down Expand Up @@ -361,7 +361,7 @@ func invoke(ctx context.Context, spec *pb.ChaincodeSpec) (ccevt *pb.ChaincodeEve
return nil, uuid, nil, fmt.Errorf("Error invoking chaincode: %s ", err)
}

var txsim ledgernext.TxSimulator
var txsim ledger.TxSimulator
ctx, txsim, err = startTxSimulation(ctx)
if err != nil {
return nil, uuid, nil, fmt.Errorf("Failed to get handle to simulator: %s ", err)
Expand Down Expand Up @@ -1120,7 +1120,7 @@ func TestChaincodeQueryChaincodeWithSec(t *testing.T) {

// Test the invocation of a transaction.
func TestRangeQuery(t *testing.T) {
//TODO enable after ledgernext enables RangeQuery
//TODO enable after ledger enables RangeQuery
t.Skip()

lis, err := initPeer()
Expand Down
16 changes: 8 additions & 8 deletions core/chaincode/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/golang/protobuf/proto"
ccintf "github.com/hyperledger/fabric/core/container/ccintf"
"github.com/hyperledger/fabric/core/crypto"
ledgernext "github.com/hyperledger/fabric/core/ledgernext"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
"github.com/looplab/fsm"
Expand Down Expand Up @@ -58,9 +58,9 @@ type transactionContext struct {
responseNotifier chan *pb.ChaincodeMessage

// tracks open iterators used for range queries
rangeQueryIteratorMap map[string]ledgernext.ResultsIterator
rangeQueryIteratorMap map[string]ledger.ResultsIterator

txsimulator ledgernext.TxSimulator
txsimulator ledger.TxSimulator
}

type nextStateInfo struct {
Expand Down Expand Up @@ -123,7 +123,7 @@ func (handler *Handler) createTxContext(ctxt context.Context, txid string, tx *p
return nil, fmt.Errorf("txid:%s exists", txid)
}
txctx := &transactionContext{transactionSecContext: tx, responseNotifier: make(chan *pb.ChaincodeMessage, 1),
rangeQueryIteratorMap: make(map[string]ledgernext.ResultsIterator)}
rangeQueryIteratorMap: make(map[string]ledger.ResultsIterator)}
handler.txCtxs[txid] = txctx
txctx.txsimulator = getTxSimulator(ctxt)

Expand All @@ -145,13 +145,13 @@ func (handler *Handler) deleteTxContext(txid string) {
}

func (handler *Handler) putRangeQueryIterator(txContext *transactionContext, txid string,
rangeScanIterator ledgernext.ResultsIterator) {
rangeScanIterator ledger.ResultsIterator) {
handler.Lock()
defer handler.Unlock()
txContext.rangeQueryIteratorMap[txid] = rangeScanIterator
}

func (handler *Handler) getRangeQueryIterator(txContext *transactionContext, txid string) ledgernext.ResultsIterator {
func (handler *Handler) getRangeQueryIterator(txContext *transactionContext, txid string) ledger.ResultsIterator {
handler.Lock()
defer handler.Unlock()
return txContext.rangeQueryIteratorMap[txid]
Expand Down Expand Up @@ -727,7 +727,7 @@ func (handler *Handler) handleRangeQueryState(msg *pb.ChaincodeMessage) {
return
}
//PDMP - let it panic if not KV
kv := qresult.(ledgernext.KV)
kv := qresult.(ledger.KV)
// Decrypt the data if the confidential is enabled
decryptedValue, decryptErr := handler.decrypt(msg.Txid, kv.Value)
if decryptErr != nil {
Expand Down Expand Up @@ -835,7 +835,7 @@ func (handler *Handler) handleRangeQueryStateNext(msg *pb.ChaincodeMessage) {
return
}
//PDMP - let it panic if not KV
kv := qresult.(ledgernext.KV)
kv := qresult.(ledger.KV)
// Decrypt the data if the confidential is enabled
decryptedValue, decryptErr := handler.decrypt(msg.Txid, kv.Value)
if decryptErr != nil {
Expand Down
8 changes: 0 additions & 8 deletions core/chaincode/importsysccs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,12 @@ package chaincode

import (
//import system chain codes here
"github.com/hyperledger/fabric/bddtests/syschaincode/noop"
"github.com/hyperledger/fabric/core/system_chaincode/escc"
"github.com/hyperledger/fabric/core/system_chaincode/vscc"
)

//see systemchaincode_test.go for an example using "sample_syscc"
var systemChaincodes = []*SystemChaincode{
{
Enabled: true,
Name: "noop",
Path: "github.com/hyperledger/fabric/bddtests/syschaincode/noop",
InitArgs: [][]byte{},
Chaincode: &noop.SystemChaincode{},
},
{
Enabled: true,
Name: "lccc",
Expand Down
4 changes: 2 additions & 2 deletions core/chaincode/lccc.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/chaincode/shim"
ledger "github.com/hyperledger/fabric/core/ledgernext"
"github.com/hyperledger/fabric/core/ledgernext/kvledger"
"github.com/hyperledger/fabric/core/ledger"
"github.com/hyperledger/fabric/core/ledger/kvledger"
pb "github.com/hyperledger/fabric/protos"
"github.com/op/go-logging"
"golang.org/x/net/context"
Expand Down
6 changes: 3 additions & 3 deletions core/chaincode/sysccapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (

"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/core/container/inproccontroller"
ledgernext "github.com/hyperledger/fabric/core/ledgernext"
"github.com/hyperledger/fabric/core/ledgernext/kvledger"
"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"
Expand Down Expand Up @@ -80,7 +80,7 @@ func RegisterSysCC(syscc *SystemChaincode) error {
chainName := string(DefaultChain)

lgr := kvledger.GetLedger(chainName)
var txsim ledgernext.TxSimulator
var txsim ledger.TxSimulator
if txsim, err = lgr.NewTxSimulator(); err != nil {
return 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 @@ -21,7 +21,7 @@ import (
"testing"
"time"

"github.com/hyperledger/fabric/core/ledgernext/kvledger"
"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"
Expand Down
2 changes: 1 addition & 1 deletion core/committer/noopssinglechain/committer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/chaincode"
"github.com/hyperledger/fabric/core/committer"
"github.com/hyperledger/fabric/core/ledgernext/kvledger"
"github.com/hyperledger/fabric/core/ledger/kvledger"
ab "github.com/hyperledger/fabric/orderer/atomicbroadcast"
"golang.org/x/net/context"
"google.golang.org/grpc"
Expand Down
95 changes: 0 additions & 95 deletions core/crypto/validator_validity_period.go

This file was deleted.

4 changes: 2 additions & 2 deletions core/endorser/endorser.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"golang.org/x/net/context"

"github.com/hyperledger/fabric/core/chaincode"
ledger "github.com/hyperledger/fabric/core/ledgernext"
"github.com/hyperledger/fabric/core/ledgernext/kvledger"
"github.com/hyperledger/fabric/core/ledger"
"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"
Expand Down
2 changes: 1 addition & 1 deletion core/endorser/endorser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/hyperledger/fabric/core/container"
"github.com/hyperledger/fabric/core/crypto"
"github.com/hyperledger/fabric/core/db"
"github.com/hyperledger/fabric/core/ledgernext/kvledger"
"github.com/hyperledger/fabric/core/ledger/kvledger"
u "github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
"github.com/spf13/viper"
Expand Down
17 changes: 0 additions & 17 deletions core/ledger/README.md

This file was deleted.

File renamed without changes.
Loading

0 comments on commit e9ad121

Please sign in to comment.