-
denyeart authored
https://jira.hyperledger.org/browse/FAB-728 This commit adds a transaction manager (state database) based on CouchDB, and a sample client to demonstrate/test it. KVLedger will continue to use file based block storage for the blockchain, but will use CouchDB as the state database for simulation and commit. This experimental feature is enabled via a feature toggle switch in the code (useCouchDB). CouchDB must be already installed separately. There is a script to start CouchDB in dev env and download a docker image of CouchDB if not already downloaded. Run this command anywhere inside the dev env /fabric: "couchdb start" To switch ledger to use CouchDB, update kv_ledger_config.go variable useCouchDB to true. In kv_ledger.go NewKVLedger(), you will also need to set the CouchDB connection host, port, db name, id, password if using a non-local secured CouchDB. This initial commit is only a stand alone ledger prototype and not meant for end-to-end chaincode processing. That will come in a subsequent commit. To run the sample: In CouchDB http://localhost:5984/_utils create a db named marbles_app. You can do this from your host which has port 5984 mapped to guest 5984 (assuming you have done vagrant up after https://gerrit.hyperledger.org/r/#/c/1935/ went in Oct 25th, as that changeset open up vagrant port 5984). Then run the sample as follows: /core/ledgernext/kvledger/marble_example/main$ go run marble_example.go After running the sample, you can view the marble1 document in CouchDB. Be sure to delete it in CouchDB if you'd like to re-run the sample. Change-Id: Iea4f6ad498dc0e637f0254b6f749060e0298622c Signed-off-by: denyeart <enyeart@us.ibm.com>
c1529a47