diff --git a/core/ledger/kvledger/kv_ledger_provider.go b/core/ledger/kvledger/kv_ledger_provider.go index 75f79640797..b83c8dc0ccf 100644 --- a/core/ledger/kvledger/kv_ledger_provider.go +++ b/core/ledger/kvledger/kv_ledger_provider.go @@ -73,7 +73,7 @@ func NewProvider() (ledger.PeerLedgerProvider, error) { return nil, err } // Initialize the transient store (temporary storage of private rwset) - transientStoreProvider := transientstore.NewStoreProvider() + transientStoreProvider := transientstore.NewCustomPathStoreProvider(ledgerconfig.GetTransientStorePath()) // Initialize the history database (index for history of values by key) var historydbProvider historydb.HistoryDBProvider diff --git a/core/transientstore/store.go b/core/transientstore/store.go index d31cddc583a..0cc001cc81e 100644 --- a/core/transientstore/store.go +++ b/core/transientstore/store.go @@ -95,6 +95,16 @@ func NewStoreProvider() StoreProvider { return &storeProvider{dbProvider: dbProvider} } +// NewCustomPathStoreProvider constructs a StoreProvider at the given path +// This function is used by ledger to construct a dedicated store till the time the store is managed +// by the transient coordinator. A separate store location by the ledger is desired so that +// the coordinator can be developed independently to handle the management of the transient store at default location. +// Once the coordinator is developed, the ledger can stop using the transient store and this function can be removed. +func NewCustomPathStoreProvider(path string) StoreProvider { + dbProvider := leveldbhelper.NewProvider(&leveldbhelper.Conf{DBPath: path}) + return &storeProvider{dbProvider: dbProvider} +} + // OpenStore returns a handle to a ledgerId in Store func (provider *storeProvider) OpenStore(ledgerID string) (Store, error) { dbHandle := provider.dbProvider.GetDBHandle(ledgerID)