[FAB-6292] Fix spelling error

[FAB_6292] fix spelling error in high-throughput.

Change-Id: I6f0d3a8ccdbd3b5b0762e3f346292340862354ac
Signed-off-by: Zhangjiong Xuan <xuanzhangjiong@hyperchain.cn>
This commit is contained in:
Zhangjiong Xuan 2017-09-26 15:24:26 +08:00
parent 56af764006
commit c9b0c62975
2 changed files with 17 additions and 17 deletions

View file

@ -16,7 +16,7 @@ frequently added to or removed from. For example, with a bank or credit card acc
of money in the account is the result of all of these additions and subtractions aggregated together. A typical person's bank account may not be of money in the account is the result of all of these additions and subtractions aggregated together. A typical person's bank account may not be
used frequently enough to require highly-parallel throughput, but an organizational account used to store the money collected from customers on an used frequently enough to require highly-parallel throughput, but an organizational account used to store the money collected from customers on an
e-commerce platform may very well receive a very high number of transactions from all over the world all at once. In fact, this use case is the only e-commerce platform may very well receive a very high number of transactions from all over the world all at once. In fact, this use case is the only
use case for cryptocurrencies like Bitcoin: a user's unspent transaction output (UTXO) is the result of all transactions he or she has been a part of use case for crypto currencies like Bitcoin: a user's unspent transaction output (UTXO) is the result of all transactions he or she has been a part of
since joining the blockchain. Other use cases that can employ this technique might be IOT sensors which frequently update their sensed value in the since joining the blockchain. Other use cases that can employ this technique might be IOT sensors which frequently update their sensed value in the
cloud. cloud.

View file

@ -12,7 +12,7 @@
* of millions of rows of data. * of millions of rows of data.
* *
* @author Alexandre Pauwels for IBM * @author Alexandre Pauwels for IBM
* @created 17 Aug 2017 * @created 17 Aug 2017
*/ */
package main package main
@ -22,8 +22,8 @@ package main
* 2 specific Hyperledger Fabric specific libraries for Smart Contracts * 2 specific Hyperledger Fabric specific libraries for Smart Contracts
*/ */
import ( import (
"strconv"
"fmt" "fmt"
"strconv"
"github.com/hyperledger/fabric/core/chaincode/shim" "github.com/hyperledger/fabric/core/chaincode/shim"
sc "github.com/hyperledger/fabric/protos/peer" sc "github.com/hyperledger/fabric/protos/peer"
@ -35,8 +35,8 @@ type SmartContract struct {
// Define Status codes for the response // Define Status codes for the response
const ( const (
OK = 200 OK = 200
ERROR = 500 ERROR = 500
) )
// Init is called when the smart contract is instantiated // Init is called when the smart contract is instantiated
@ -76,7 +76,7 @@ func (s *SmartContract) Invoke(APIstub shim.ChaincodeStubInterface) sc.Response
} }
/** /**
* Updates the ledger to include a new delta for a particluar variable. If this is the first time * Updates the ledger to include a new delta for a particular variable. If this is the first time
* this variable is being added to the ledger, then its initial value is assumed to be 0. The arguments * this variable is being added to the ledger, then its initial value is assumed to be 0. The arguments
* to give in the args array are as follows: * to give in the args array are as follows:
* - args[0] -> name of the variable * - args[0] -> name of the variable
@ -110,7 +110,7 @@ func (s *SmartContract) update(APIstub shim.ChaincodeStubInterface, args []strin
// Retrieve info needed for the update procedure // Retrieve info needed for the update procedure
txid := APIstub.GetTxID() txid := APIstub.GetTxID()
compositeIndexName := "varName~op~value~txID" compositeIndexName := "varName~op~value~txID"
// Create the composite key that will allow us to query for all deltas on a particular variable // Create the composite key that will allow us to query for all deltas on a particular variable
compositeKey, compositeErr := APIstub.CreateCompositeKey(compositeIndexName, []string{name, op, args[1], txid}) compositeKey, compositeErr := APIstub.CreateCompositeKey(compositeIndexName, []string{name, op, args[1], txid})
if compositeErr != nil { if compositeErr != nil {
@ -122,7 +122,7 @@ func (s *SmartContract) update(APIstub shim.ChaincodeStubInterface, args []strin
if compositePutErr != nil { if compositePutErr != nil {
return shim.Error(fmt.Sprintf("Could not put operation for %s in the ledger: %s", name, compositePutErr.Error())) return shim.Error(fmt.Sprintf("Could not put operation for %s in the ledger: %s", name, compositePutErr.Error()))
} }
return shim.Success([]byte(fmt.Sprintf("Successfully added %s%s to %s", op, args[1], name))) return shim.Success([]byte(fmt.Sprintf("Successfully added %s%s to %s", op, args[1], name)))
} }
@ -175,7 +175,7 @@ func (s *SmartContract) get(APIstub shim.ChaincodeStubInterface, args []string)
// Retrieve the delta value and operation // Retrieve the delta value and operation
operation := keyParts[1] operation := keyParts[1]
valueStr := keyParts[2] valueStr := keyParts[2]
// Convert the value string and perform the operation // Convert the value string and perform the operation
value, convErr := strconv.ParseFloat(valueStr, 64) value, convErr := strconv.ParseFloat(valueStr, 64)
if convErr != nil { if convErr != nil {
@ -190,7 +190,7 @@ func (s *SmartContract) get(APIstub shim.ChaincodeStubInterface, args []string)
default: default:
return shim.Error(fmt.Sprintf("Unrecognized operation %s", operation)) return shim.Error(fmt.Sprintf("Unrecognized operation %s", operation))
} }
} }
return shim.Success([]byte(strconv.FormatFloat(finalVal, 'f', -1, 64))) return shim.Success([]byte(strconv.FormatFloat(finalVal, 'f', -1, 64)))
} }
@ -248,7 +248,7 @@ func (s *SmartContract) pruneFast(APIstub shim.ChaincodeStubInterface, args []st
// Retrieve the operation and value // Retrieve the operation and value
operation := keyParts[1] operation := keyParts[1]
valueStr := keyParts[2] valueStr := keyParts[2]
// Convert the value to a float // Convert the value to a float
value, convErr := strconv.ParseFloat(valueStr, 64) value, convErr := strconv.ParseFloat(valueStr, 64)
if convErr != nil { if convErr != nil {
@ -270,8 +270,8 @@ func (s *SmartContract) pruneFast(APIstub shim.ChaincodeStubInterface, args []st
default: default:
return shim.Error(fmt.Sprintf("Unrecognized operation %s", operation)) return shim.Error(fmt.Sprintf("Unrecognized operation %s", operation))
} }
} }
// Update the ledger with the final value and return // Update the ledger with the final value and return
updateResp := s.update(APIstub, []string{name, strconv.FormatFloat(finalVal, 'f', -1, 64), "+"}) updateResp := s.update(APIstub, []string{name, strconv.FormatFloat(finalVal, 'f', -1, 64), "+"})
if updateResp.Status == OK { if updateResp.Status == OK {
@ -339,8 +339,8 @@ func (s *SmartContract) pruneSafe(APIstub shim.ChaincodeStubInterface, args []st
if deltaRowDelErr != nil { if deltaRowDelErr != nil {
return shim.Error(fmt.Sprintf("Could not delete delta row: %s", deltaRowDelErr.Error())) return shim.Error(fmt.Sprintf("Could not delete delta row: %s", deltaRowDelErr.Error()))
} }
} }
// Insert new row for the final value // Insert new row for the final value
updateResp := s.update(APIstub, []string{name, valueStr, "+"}) updateResp := s.update(APIstub, []string{name, valueStr, "+"})
if updateResp.Status == ERROR { if updateResp.Status == ERROR {
@ -427,7 +427,7 @@ func main() {
} }
} }
/** /**
* All functions below this are for testing traditional editing of a single row * All functions below this are for testing traditional editing of a single row
*/ */
func (s *SmartContract) putStandard(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { func (s *SmartContract) putStandard(APIstub shim.ChaincodeStubInterface, args []string) sc.Response {
@ -443,7 +443,7 @@ func (s *SmartContract) putStandard(APIstub shim.ChaincodeStubInterface, args []
if putErr != nil { if putErr != nil {
return shim.Error(fmt.Sprintf("Failed to put state: %s", putErr.Error())) return shim.Error(fmt.Sprintf("Failed to put state: %s", putErr.Error()))
} }
return shim.Success(nil) return shim.Success(nil)
} }