@@ -255,18 +255,24 @@ Currently Fabric comes with the following dependencies for validation plugins:
255
255
256
256
// State defines interaction with the world state
257
257
type State interface {
258
- // GetStateMultipleKeys gets the values for multiple keys in a single call
259
- GetStateMultipleKeys(namespace string, keys []string) ([][]byte, error)
258
+ // GetStateMultipleKeys gets the values for multiple keys in a single call
259
+ GetStateMultipleKeys(namespace string, keys []string) ([][]byte, error)
260
260
261
- // GetStateRangeScanIterator returns an iterator that contains all the key-values between given key ranges.
262
- // startKey is included in the results and endKey is excluded. An empty startKey refers to the first available key
263
- // and an empty endKey refers to the last available key. For scanning all the keys, both the startKey and the endKey
264
- // can be supplied as empty strings. However, a full scan should be used judiciously for performance reasons.
265
- // The returned ResultsIterator contains results of type *KV which is defined in protos/ledger/queryresult.
266
- GetStateRangeScanIterator(namespace string, startKey string, endKey string) (ResultsIterator, error)
261
+ // GetStateRangeScanIterator returns an iterator that contains all the key-values between given key ranges.
262
+ // startKey is included in the results and endKey is excluded. An empty startKey refers to the first available key
263
+ // and an empty endKey refers to the last available key. For scanning all the keys, both the startKey and the endKey
264
+ // can be supplied as empty strings. However, a full scan should be used judiciously for performance reasons.
265
+ // The returned ResultsIterator contains results of type *KV which is defined in protos/ledger/queryresult.
266
+ GetStateRangeScanIterator(namespace string, startKey string, endKey string) (ResultsIterator, error)
267
267
268
- // Done releases resources occupied by the State
269
- Done()
268
+ // GetStateMetadata returns the metadata for given namespace and key
269
+ GetStateMetadata(namespace, key string) (map[string][]byte, error)
270
+
271
+ // GetPrivateDataMetadata gets the metadata of a private data item identified by a tuple <namespace, collection, key>
272
+ GetPrivateDataMetadata(namespace, collection, key string) (map[string][]byte, error)
273
+
274
+ // Done releases resources occupied by the State
275
+ Done()
270
276
}
271
277
272
278
Important notes
@@ -290,6 +296,13 @@ Important notes
290
296
of marking the transaction as invalid. This is to prevent state divergence
291
297
between different peers.
292
298
299
+ - **Error handling for private metadata retrieval **: In case a plugin retrieves
300
+ metadata for private data by making use of the ``StateFetcher `` interface,
301
+ it is important that errors are handled as follows: ``CollConfigNotDefinedError''
302
+ and ``InvalidCollNameError'', signalling that the specified collection does
303
+ not exist, should be handled as deterministic errors and should not lead the
304
+ plugin to return an ``ExecutionFailureError ``.
305
+
293
306
- **Importing Fabric code into the plugin **: Importing code that belongs to Fabric
294
307
other than protobufs as part of the plugin is highly discouraged, and can lead
295
308
to issues when the Fabric code changes between releases, or can cause inoperability
0 commit comments