github.com/fnagchunpeng/fabric@v2.1.1+incompatible/core/endorser/mocks/txsim.go (about) 1 /* 2 Copyright IBM Corp. 2018 All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package mocks 8 9 import ( 10 commonledger "github.com/hyperledger/fabric/common/ledger" 11 "github.com/hyperledger/fabric/core/ledger" 12 ) 13 14 type MockTxSim struct { 15 GetTxSimulationResultsRv *ledger.TxSimulationResults 16 } 17 18 func (m *MockTxSim) GetState(namespace string, key string) ([]byte, error) { 19 return nil, nil 20 } 21 22 func (m *MockTxSim) GetStateMultipleKeys(namespace string, keys []string) ([][]byte, error) { 23 return nil, nil 24 } 25 26 func (m *MockTxSim) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (commonledger.ResultsIterator, error) { 27 return nil, nil 28 } 29 30 func (m *MockTxSim) GetStateRangeScanIteratorWithMetadata(namespace string, startKey, endKey string, metadata map[string]interface{}) (ledger.QueryResultsIterator, error) { 31 return nil, nil 32 } 33 34 func (m *MockTxSim) ExecuteQuery(namespace, query string) (commonledger.ResultsIterator, error) { 35 return nil, nil 36 } 37 38 func (m *MockTxSim) ExecuteQueryWithMetadata(namespace, query string, metadata map[string]interface{}) (ledger.QueryResultsIterator, error) { 39 return nil, nil 40 } 41 42 func (m *MockTxSim) Done() { 43 } 44 45 func (m *MockTxSim) SetState(namespace string, key string, value []byte) error { 46 return nil 47 } 48 49 func (m *MockTxSim) DeleteState(namespace string, key string) error { 50 return nil 51 } 52 53 func (m *MockTxSim) SetStateMultipleKeys(namespace string, kvs map[string][]byte) error { 54 return nil 55 } 56 57 func (m *MockTxSim) ExecuteUpdate(query string) error { 58 return nil 59 } 60 61 func (m *MockTxSim) GetTxSimulationResults() (*ledger.TxSimulationResults, error) { 62 return m.GetTxSimulationResultsRv, nil 63 } 64 65 func (m *MockTxSim) DeletePrivateData(namespace, collection, key string) error { 66 return nil 67 } 68 69 func (m *MockTxSim) ExecuteQueryOnPrivateData(namespace, collection, query string) (commonledger.ResultsIterator, error) { 70 return nil, nil 71 } 72 73 func (m *MockTxSim) GetPrivateData(namespace, collection, key string) ([]byte, error) { 74 return nil, nil 75 } 76 77 func (m *MockTxSim) GetPrivateDataHash(namespace, collection, key string) ([]byte, error) { 78 return nil, nil 79 } 80 81 func (m *MockTxSim) GetPrivateDataMultipleKeys(namespace, collection string, keys []string) ([][]byte, error) { 82 return nil, nil 83 } 84 85 func (m *MockTxSim) GetPrivateDataRangeScanIterator(namespace, collection, startKey, endKey string) (commonledger.ResultsIterator, error) { 86 return nil, nil 87 } 88 89 func (m *MockTxSim) SetPrivateData(namespace, collection, key string, value []byte) error { 90 return nil 91 } 92 93 func (m *MockTxSim) SetPrivateDataMultipleKeys(namespace, collection string, kvs map[string][]byte) error { 94 return nil 95 } 96 97 func (m *MockTxSim) GetStateMetadata(namespace, key string) (map[string][]byte, error) { 98 return nil, nil 99 } 100 101 func (m *MockTxSim) GetPrivateDataMetadata(namespace, collection, key string) (map[string][]byte, error) { 102 return nil, nil 103 } 104 105 func (m *MockTxSim) GetPrivateDataMetadataByHash(namespace, collection string, keyhash []byte) (map[string][]byte, error) { 106 return nil, nil 107 } 108 109 func (m *MockTxSim) SetStateMetadata(namespace, key string, metadata map[string][]byte) error { 110 return nil 111 } 112 113 func (m *MockTxSim) DeleteStateMetadata(namespace, key string) error { 114 return nil 115 } 116 117 func (m *MockTxSim) SetPrivateDataMetadata(namespace, collection, key string, metadata map[string][]byte) error { 118 return nil 119 } 120 121 func (m *MockTxSim) DeletePrivateDataMetadata(namespace, collection, key string) error { 122 return nil 123 } 124 125 type MockChaincodeDefinition struct { 126 NameRv string 127 VersionRv string 128 EndorsementStr string 129 ValidationStr string 130 ValidationBytes []byte 131 HashRv []byte 132 } 133 134 func (m *MockChaincodeDefinition) CCName() string { 135 return m.NameRv 136 } 137 138 func (m *MockChaincodeDefinition) Hash() []byte { 139 return m.HashRv 140 } 141 142 func (m *MockChaincodeDefinition) CCVersion() string { 143 return m.VersionRv 144 } 145 146 func (m *MockChaincodeDefinition) Validation() (string, []byte) { 147 return m.ValidationStr, m.ValidationBytes 148 } 149 150 func (m *MockChaincodeDefinition) Endorsement() string { 151 return m.EndorsementStr 152 }