如果链代码调用同时查询和更新私有数据,则提案请求将 return 出错。为什么?
If a chaincode invocation both queries and updates private data, the proposal request will return an error. WHY?
Chaincode that executes range or rich JSON queries and updates data in
a single transaction is not supported, as the query results cannot be
validated on the peers that don’t have access to the private data, or
on peers that are missing the private data that they have access to.
If a chaincode invocation both queries and updates private data, the
proposal request will return an error. If your application can
tolerate result set changes between chaincode execution and
validation/commit time, then you could call one chaincode function to
perform the query, and then call a second chaincode function to make
the updates. Note that calls to GetPrivateData() to retrieve
individual keys can be made in the same transaction as
PutPrivateData() calls, since all peers can validate key reads based
on the hashed key version.
Find Link Here
我在 fabric 中看到了这个与 limitation of querying Private Data
相关的小段落。我对私人数据概念非常陌生。
我的理解是这样的,
CC调用需要
范围或丰富 JSON 查询并更新两者,私有数据导致提议 return 错误。
最好调用一个链码函数来执行查询,然后调用第二个链码函数来进行更新
通常,GetPrivateData()
检索单个密钥可以在与 PutPrivateData()
调用相同的事务中进行,因为所有对等点都可以根据散列密钥版本验证密钥读取。
我的理解正确吗?
如果是,那么为什么私人数据如此?
如果没有那么请赐予我智慧
因此,首先 - 无论是私有数据还是非私有数据,富查询都不会在提交时重新执行。
现在,对于范围查询 - 请记住,范围查询都是关于键之间按字母顺序排列的假设。
但是,无论对等方是否拥有私有数据,交易都需要通过 MVCC 检查,但如果对等方没有私有数据,那么它只能看到哈希,(不是真正的键名)和散列没有按字母顺序排序 - 因此它无法验证范围查询模拟是否过时。
Chaincode that executes range or rich JSON queries and updates data in a single transaction is not supported, as the query results cannot be validated on the peers that don’t have access to the private data, or on peers that are missing the private data that they have access to. If a chaincode invocation both queries and updates private data, the proposal request will return an error. If your application can tolerate result set changes between chaincode execution and validation/commit time, then you could call one chaincode function to perform the query, and then call a second chaincode function to make the updates. Note that calls to GetPrivateData() to retrieve individual keys can be made in the same transaction as PutPrivateData() calls, since all peers can validate key reads based on the hashed key version. Find Link Here
我在 fabric 中看到了这个与 limitation of querying Private Data
相关的小段落。我对私人数据概念非常陌生。
我的理解是这样的,
CC调用需要 范围或丰富 JSON 查询并更新两者,私有数据导致提议 return 错误。
最好调用一个链码函数来执行查询,然后调用第二个链码函数来进行更新
通常,
GetPrivateData()
检索单个密钥可以在与PutPrivateData()
调用相同的事务中进行,因为所有对等点都可以根据散列密钥版本验证密钥读取。
我的理解正确吗? 如果是,那么为什么私人数据如此? 如果没有那么请赐予我智慧
因此,首先 - 无论是私有数据还是非私有数据,富查询都不会在提交时重新执行。
现在,对于范围查询 - 请记住,范围查询都是关于键之间按字母顺序排列的假设。
但是,无论对等方是否拥有私有数据,交易都需要通过 MVCC 检查,但如果对等方没有私有数据,那么它只能看到哈希,(不是真正的键名)和散列没有按字母顺序排序 - 因此它无法验证范围查询模拟是否过时。