get specific records after GetHistoryForKey #fabric-chaincode #chaincode #database #fabric-questions


Nikos Karamolegkos
 

Hello, I use Level DB and I am using GetHistoryForKey to get the history of a key which return some records. Is there an efficient way to parse the returned records in order to find some specific values. For example If CAR3 has a history of color change 10 times can I get somehow in which of these was yellow and red without just traversing the output looking for these two colors?  

Another question, is is bad for the BC logic to have Keys that never updated? I mean that every write to ledger create a new key without updating an existing one.


Matthew White
 

Hello;

 

In terms of parsing the history really would need to be parsed to find specific values; depending on the size you could always put the data into a different data structure, so it becomes a classic computer science search problem.

 

In terms of what Fabric itself can you could adjust the keys to take advantage of composite keys. But think this might be applicable in this case.

 

For updating keys, a transaction doesn’t have to both read and write at the same time.

 

Cheers Matthew

 

 

 

From: fabric@... <fabric@...> On Behalf Of Nikos Karamolegkos
Sent: 26 September 2022 09:42
To: fabric@...
Subject: [EXTERNAL] [Hyperledger Fabric] get specific records after GetHistoryForKey #database #fabric-questions #fabric-chaincode #chaincode

 

Hello, I use Level DB and I am using GetHistoryForKey to get the history of a key which return some records. Is there an efficient way to parse the returned records in order to find some specific values. For example If CAR3 has a history of

ZjQcmQRYFpfptBannerStart

This Message Is From an External Sender

This message came from outside your organization.

ZjQcmQRYFpfptBannerEnd

Hello, I use Level DB and I am using GetHistoryForKey to get the history of a key which return some records. Is there an efficient way to parse the returned records in order to find some specific values. For example If CAR3 has a history of color change 10 times can I get somehow in which of these was yellow and red without just traversing the output looking for these two colors?  

Another question, is is bad for the BC logic to have Keys that never updated? I mean that every write to ledger create a new key without updating an existing one.

Unless otherwise stated above:

IBM United Kingdom Limited
Registered in England and Wales with number 741598
Registered office: PO Box 41, North Harbour, Portsmouth, Hants. PO6 3AU