Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LEDGER] merge queryHelper with the queryExecutor #1097

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import (
type collNameValidator struct {
ledgerID string
ccInfoProvider ledger.DeployedChaincodeInfoProvider
queryExecutor *lockBasedQueryExecutor
queryExecutor *queryExecutor
cache collConfigCache
noop bool
}

func newCollNameValidator(ledgerID string, ccInfoProvider ledger.DeployedChaincodeInfoProvider, qe *lockBasedQueryExecutor, noop bool) *collNameValidator {
func newCollNameValidator(ledgerID string, ccInfoProvider ledger.DeployedChaincodeInfoProvider, qe *queryExecutor, noop bool) *collNameValidator {
return &collNameValidator{ledgerID, ccInfoProvider, qe, make(collConfigCache), noop}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func TestPvtGetNoCollection(t *testing.T) {
txMgr := testEnv.getTxMgr().(*LockBasedTxMgr)
cryptoProvider, err := sw.NewDefaultSecurityLevelWithKeystore(sw.NewDummyKeyStore())
assert.NoError(t, err)
queryHelper := newQueryHelper(txMgr, nil, true, cryptoProvider)
valueHash, metadataBytes, err := queryHelper.getPrivateDataValueHash("cc", "coll", "key")
qe := newQueryExecutor(txMgr, "", nil, true, cryptoProvider)
valueHash, metadataBytes, err := qe.getPrivateDataValueHash("cc", "coll", "key")
assert.Nil(t, valueHash)
assert.Nil(t, metadataBytes)
assert.Error(t, err)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (txmgr *LockBasedTxMgr) GetLastSavepoint() (*version.Height, error) {

// NewQueryExecutor implements method in interface `txmgmt.TxMgr`
func (txmgr *LockBasedTxMgr) NewQueryExecutor(txid string) (ledger.QueryExecutor, error) {
qe := newQueryExecutor(txmgr, txid, true, txmgr.hasher)
qe := newQueryExecutor(txmgr, txid, nil, true, txmgr.hasher)
txmgr.commitRWLock.RLock()
return qe, nil
}
Expand All @@ -117,15 +117,15 @@ func (txmgr *LockBasedTxMgr) NewQueryExecutor(txid string) (ledger.QueryExecutor
// querying the ledger state so that the sequence of initialization is explicitly controlled.
// However that needs a bigger refactoring of code.
func (txmgr *LockBasedTxMgr) NewQueryExecutorNoCollChecks() (ledger.QueryExecutor, error) {
qe := newQueryExecutor(txmgr, "", false, txmgr.hasher)
qe := newQueryExecutor(txmgr, "", nil, false, txmgr.hasher)
txmgr.commitRWLock.RLock()
return qe, nil
}

// NewTxSimulator implements method in interface `txmgmt.TxMgr`
func (txmgr *LockBasedTxMgr) NewTxSimulator(txid string) (ledger.TxSimulator, error) {
logger.Debugf("constructing new tx simulator")
s, err := newLockBasedTxSimulator(txmgr, txid, txmgr.hasher)
s, err := newTxSimulator(txmgr, txid, txmgr.hasher)
if err != nil {
return nil, err
}
Expand Down
Loading