Skip to content

Commit 2b0cc33

Browse files
committed
[FAB-11945] fix minor issues in pvt data tutorial
likes of code formatting Change-Id: I37871130e26e1ca7feec53f842d528eed00a5f48 Signed-off-by: ChanderG <mail@chandergovind.org>
1 parent e188e53 commit 2b0cc33

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

docs/source/private_data_tutorial.rst

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ of organizations.
99
The information in this tutorial assumes knowledge of private data
1010
stores and their use cases. For more information, check out :doc:`private-data/private-data`.
1111

12-
The tutorial will take you through the following steps for practice defining,
12+
The tutorial will take you through the following steps to practice defining,
1313
configuring and using private data with Fabric:
1414

1515
#. :ref:`pd-build-json`
@@ -80,7 +80,7 @@ have the private data in their private database.
8080
For more information on building a policy definition refer to the :doc:`endorsement-policies`
8181
topic.
8282

83-
.. code-block:: JSON
83+
.. code:: json
8484
8585
// collections_config.json
8686
@@ -137,7 +137,7 @@ be accessed.
137137
Price int `json:"price"`
138138
}
139139
140-
Specifically access to the private data will be restricted as follows:
140+
Specifically access to the private data will be restricted as follows:
141141

142142
- ``name, color, size, and owner`` will be visible to all members of the channel (Org1 and Org2)
143143
- ``price`` only visible to members of Org1
@@ -432,61 +432,61 @@ database. As an authorized peer in Org1, we will query both sets of private data
432432
The first ``query`` command calls the ``readMarble`` function which passes
433433
``collectionMarbles`` as an argument.
434434

435-
.. code:: GO
435+
.. code-block:: GO
436436
437437
// ===============================================
438438
// readMarble - read a marble from chaincode state
439439
// ===============================================
440440
441441
func (t *SimpleChaincode) readMarble(stub shim.ChaincodeStubInterface, args []string) pb.Response {
442-
var name, jsonResp string
443-
var err error
444-
if len(args) != 1 {
445-
return shim.Error("Incorrect number of arguments. Expecting name of the marble to query")
446-
}
447-
448-
name = args[0]
449-
valAsbytes, err := stub.GetPrivateData("collectionMarbles", name) //get the marble from chaincode state
450-
451-
if err != nil {
452-
jsonResp = "{\"Error\":\"Failed to get state for " + name + "\"}"
453-
return shim.Error(jsonResp)
454-
} else if valAsbytes == nil {
455-
jsonResp = "{\"Error\":\"Marble does not exist: " + name + "\"}"
456-
return shim.Error(jsonResp)
457-
}
458-
459-
return shim.Success(valAsbytes)
442+
var name, jsonResp string
443+
var err error
444+
if len(args) != 1 {
445+
return shim.Error("Incorrect number of arguments. Expecting name of the marble to query")
446+
}
447+
448+
name = args[0]
449+
valAsbytes, err := stub.GetPrivateData("collectionMarbles", name) //get the marble from chaincode state
450+
451+
if err != nil {
452+
jsonResp = "{\"Error\":\"Failed to get state for " + name + "\"}"
453+
return shim.Error(jsonResp)
454+
} else if valAsbytes == nil {
455+
jsonResp = "{\"Error\":\"Marble does not exist: " + name + "\"}"
456+
return shim.Error(jsonResp)
457+
}
458+
459+
return shim.Success(valAsbytes)
460460
}
461461
462-
The second ``query`` command calls the ``readMarblereadMarblePrivateDetails``
462+
The second ``query`` command calls the ``readMarblePrivateDetails``
463463
function which passes ``collectionMarblePrivateDetails`` as an argument.
464464

465-
.. code:: GO
465+
.. code-block:: GO
466466
467467
// ===============================================
468-
// readMarblereadMarblePrivateDetails - read a marble private details from chaincode state
468+
// readMarblePrivateDetails - read a marble private details from chaincode state
469469
// ===============================================
470470
471471
func (t *SimpleChaincode) readMarblePrivateDetails(stub shim.ChaincodeStubInterface, args []string) pb.Response {
472-
var name, jsonResp string
473-
var err error
474-
475-
if len(args) != 1 {
476-
return shim.Error("Incorrect number of arguments. Expecting name of the marble to query")
477-
}
478-
479-
name = args[0]
480-
valAsbytes, err := stub.GetPrivateData("collectionMarblePrivateDetails", name) //get the marble private details from chaincode state
481-
482-
if err != nil {
483-
jsonResp = "{\"Error\":\"Failed to get private details for " + name + ": " + err.Error() + "\"}"
484-
return shim.Error(jsonResp)
485-
} else if valAsbytes == nil {
486-
jsonResp = "{\"Error\":\"Marble private details does not exist: " + name + "\"}"
487-
return shim.Error(jsonResp)
488-
}
489-
return shim.Success(valAsbytes)
472+
var name, jsonResp string
473+
var err error
474+
475+
if len(args) != 1 {
476+
return shim.Error("Incorrect number of arguments. Expecting name of the marble to query")
477+
}
478+
479+
name = args[0]
480+
valAsbytes, err := stub.GetPrivateData("collectionMarblePrivateDetails", name) //get the marble private details from chaincode state
481+
482+
if err != nil {
483+
jsonResp = "{\"Error\":\"Failed to get private details for " + name + ": " + err.Error() + "\"}"
484+
return shim.Error(jsonResp)
485+
} else if valAsbytes == nil {
486+
jsonResp = "{\"Error\":\"Marble private details does not exist: " + name + "\"}"
487+
return shim.Error(jsonResp)
488+
}
489+
return shim.Success(valAsbytes)
490490
}
491491
492492
Now :guilabel:`Try it yourself`
@@ -664,7 +664,7 @@ price private data is purged.
664664
665665
{"docType":"marblePrivateDetails","name":"marble1","price":99}
666666
667-
The ``price`` data is still on the private data ledger.
667+
The ``price`` data is still in the private data ledger.
668668

669669
Create a new **marble2** by issuing the following command. This transaction
670670
creates a new block on the chain.

0 commit comments

Comments
 (0)