@@ -21,11 +21,12 @@ import (
21
21
22
22
var logger = flogging .MustGetLogger ("transientstore" )
23
23
24
- var emptyValue = []byte {}
25
- var nilByte = byte ('\x00' )
26
-
27
- // ErrStoreEmpty is used to indicate that there are no entries in transient store
28
- var ErrStoreEmpty = errors .New ("Transient store is empty" )
24
+ var (
25
+ emptyValue = []byte {}
26
+ nilByte = byte ('\x00' )
27
+ // ErrStoreEmpty is used to indicate that there are no entries in transient store
28
+ ErrStoreEmpty = errors .New ("Transient store is empty" )
29
+ )
29
30
30
31
//////////////////////////////////////////////
31
32
// Interfaces and data types
@@ -39,12 +40,10 @@ type StoreProvider interface {
39
40
40
41
// RWSetScanner provides an iterator for EndorserPvtSimulationResults
41
42
type RWSetScanner interface {
42
- // NextWithConfig returns the next EndorserPvtSimulationResultsWithConfig from the RWSetScanner.
43
+ // Next returns the next EndorserPvtSimulationResults from the RWSetScanner.
43
44
// It may return nil, nil when it has no further data, and also may return an error
44
45
// on failure
45
- // TODO: Once the related gossip changes are made as per FAB-5096, remove the above function
46
- // and rename the below function to Next form NextWithConfig.
47
- NextWithConfig () (* EndorserPvtSimulationResultsWithConfig , error )
46
+ Next () (* EndorserPvtSimulationResults , error )
48
47
// Close frees the resources associated with this RWSetScanner
49
48
Close ()
50
49
}
@@ -53,11 +52,9 @@ type RWSetScanner interface {
53
52
// Ideally, a ledger can remove the data from this storage when it is committed to
54
53
// the permanent storage or the pruning of some data items is enforced by the policy
55
54
type Store interface {
56
- // TODO: Once the related gossip changes are made as per FAB-5096, remove the above function
57
- // and rename the below function to Persist form PersistWithConfig.
58
- // PersistWithConfig stores the private write set of a transaction along with the collection config
55
+ // Persist stores the private write set of a transaction along with the collection config
59
56
// in the transient store based on txid and the block height the private data was received at
60
- PersistWithConfig (txid string , blockHeight uint64 , privateSimulationResultsWithConfig * transientstore.TxPvtReadWriteSetWithConfigInfo ) error
57
+ Persist (txid string , blockHeight uint64 , privateSimulationResultsWithConfig * transientstore.TxPvtReadWriteSetWithConfigInfo ) error
61
58
// GetTxPvtRWSetByTxid returns an iterator due to the fact that the txid may have multiple private
62
59
// write sets persisted from different endorsers (via Gossip)
63
60
GetTxPvtRWSetByTxid (txid string , filter ledger.PvtNsCollFilter ) (RWSetScanner , error )
@@ -76,8 +73,8 @@ type Store interface {
76
73
Shutdown ()
77
74
}
78
75
79
- // EndorserPvtSimulationResultsWithConfig captures the details of the simulation results specific to an endorser
80
- type EndorserPvtSimulationResultsWithConfig struct {
76
+ // EndorserPvtSimulationResults captures the details of the simulation results specific to an endorser
77
+ type EndorserPvtSimulationResults struct {
81
78
ReceivedAtBlockHeight uint64
82
79
PvtSimulationResultsWithConfig * transientstore.TxPvtReadWriteSetWithConfigInfo
83
80
}
@@ -126,11 +123,9 @@ func (provider *storeProvider) Close() {
126
123
provider .dbProvider .Close ()
127
124
}
128
125
129
- // PersistWithConfig stores the private write set of a transaction along with the collection config
126
+ // Persist stores the private write set of a transaction along with the collection config
130
127
// in the transient store based on txid and the block height the private data was received at
131
- // TODO: Once the related gossip changes are made as per FAB-5096, rename this function to Persist
132
- // form PersistWithConfig.
133
- func (s * store ) PersistWithConfig (txid string , blockHeight uint64 ,
128
+ func (s * store ) Persist (txid string , blockHeight uint64 ,
134
129
privateSimulationResultsWithConfig * transientstore.TxPvtReadWriteSetWithConfigInfo ) error {
135
130
136
131
logger .Debugf ("Persisting private data to transient store for txid [%s] at block height [%d]" , txid , blockHeight )
@@ -312,9 +307,8 @@ func (s *store) Shutdown() {
312
307
}
313
308
314
309
// Next moves the iterator to the next key/value pair.
315
- // It returns whether the iterator is exhausted.
316
- // TODO: Once the related gossip changes are made as per FAB-5096, rename this function to Next
317
- func (scanner * RwsetScanner ) NextWithConfig () (* EndorserPvtSimulationResultsWithConfig , error ) {
310
+ // It returns <nil, nil> when the iterator is exhausted.
311
+ func (scanner * RwsetScanner ) Next () (* EndorserPvtSimulationResults , error ) {
318
312
if ! scanner .dbItr .Next () {
319
313
return nil , nil
320
314
}
@@ -351,7 +345,7 @@ func (scanner *RwsetScanner) NextWithConfig() (*EndorserPvtSimulationResultsWith
351
345
352
346
txPvtRWSetWithConfig .PvtRwset = filteredTxPvtRWSet
353
347
354
- return & EndorserPvtSimulationResultsWithConfig {
348
+ return & EndorserPvtSimulationResults {
355
349
ReceivedAtBlockHeight : blockHeight ,
356
350
PvtSimulationResultsWithConfig : txPvtRWSetWithConfig ,
357
351
}, nil
0 commit comments