Skip to content

Commit

Permalink
[FAB-5787] Ledger specific path for transient store
Browse files Browse the repository at this point in the history
This CR allows ledger to use the transient store at an isolated path
so that the transient store can be used in the transient data coordinator
independently.

Change-Id: I10815675f4d0b3588822552e361a720b24be13da
Signed-off-by: manish <manish.sethi@gmail.com>
  • Loading branch information
manish-sethi committed Aug 15, 2017
1 parent 8a86221 commit e7ffce1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/ledger/kvledger/kv_ledger_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions core/transientstore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e7ffce1

Please sign in to comment.