@@ -10,6 +10,7 @@ import (
1010 "github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors"
1111 committer2 "github.com/hyperledger-labs/fabric-smart-client/platform/common/core/generic/committer"
1212 driver2 "github.com/hyperledger-labs/fabric-smart-client/platform/common/driver"
13+ "github.com/hyperledger-labs/fabric-smart-client/platform/common/utils"
1314 digutils "github.com/hyperledger-labs/fabric-smart-client/platform/common/utils/dig"
1415 "github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core"
1516 "github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic"
@@ -23,8 +24,11 @@ import (
2324 "github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/rwset"
2425 "github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/vault"
2526 "github.com/hyperledger-labs/fabric-smart-client/platform/fabric/driver"
27+ "github.com/hyperledger-labs/fabric-smart-client/platform/fabric/services"
2628 vdriver "github.com/hyperledger-labs/fabric-smart-client/platform/view/driver"
29+ sdk "github.com/hyperledger-labs/fabric-smart-client/platform/view/sdk/dig"
2730 dbdriver "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/db/driver"
31+ mem "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/db/driver/memory"
2832 "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/events"
2933 "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/hash"
3034 "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/kvs"
@@ -176,3 +180,21 @@ func NewChannelProvider(in struct {
176180 []common.HeaderType {common .HeaderType_ENDORSER_TRANSACTION },
177181 )
178182}
183+
184+ func NewEndorseTxStore (in struct {
185+ dig.In
186+ KVS * kvs.KVS
187+ Config driver.ConfigService
188+ Drivers []dbdriver.NamedDriver `group:"db-drivers"`
189+ }) (driver.EndorseTxStore , error ) {
190+ driverName := driver2 .PersistenceType (utils .DefaultString (in .Config .GetString ("fsc.endorsetx.persistence.type" ), string (mem .MemoryPersistence )))
191+ if sdk .UnsupportedStores .Contains (driverName ) {
192+ return services .NewKVSBasedEndorseTxStore (in .KVS ), nil
193+ }
194+ for _ , d := range in .Drivers {
195+ if d .Name == driverName {
196+ return services .NewDBBasedEndorseTxStore (d .Driver , "_default" , in .Config )
197+ }
198+ }
199+ return nil , errors .New ("driver not found" )
200+ }
0 commit comments