Interface CheckedMapProof
-
- All Superinterfaces:
CheckedProof
- All Known Implementing Classes:
CheckedFlatMapProof
public interface CheckedMapProof extends CheckedProof
A checked map proof. In case of incorrect proof all methods (except for getStatus and compareWithRootHash) throw IllegalStateException. Example usage:ByteString key = "The key for which I want a proved value".getBytes(); HashCode expectedRootHash = // get a known root hash from block proof // UncheckedMapProof proof = requestProofForKey(key); // Convert to checked CheckedMapProof checkedProof = proof.check(); // Check the root hash if (checkedProof.isValid() && checkedProof.getRootHash().equals(expectedRootHash)) { // Get and use the value(s) ByteString value = checked.get(key); }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
containsKey(com.google.protobuf.ByteString key)
If this proof is valid, returns true if there is a given key in the proof; false — if there is no such key.com.google.protobuf.ByteString
get(com.google.protobuf.ByteString key)
If this proof is valid, returns the value corresponding to the specified key or null if there is no such key in the proof.java.util.Set<MapEntry<com.google.protobuf.ByteString,com.google.protobuf.ByteString>>
getEntries()
Get all leaf entries of this proof.java.util.Set<com.google.protobuf.ByteString>
getMissingKeys()
Get all keys that were requested, but did not appear in this proof.MapProofStatus
getProofStatus()
Returns the status of this proof: whether it is structurally valid.-
Methods inherited from interface com.exonum.binding.common.proofs.CheckedProof
getRootHash, isValid
-
-
-
-
Method Detail
-
getEntries
java.util.Set<MapEntry<com.google.protobuf.ByteString,com.google.protobuf.ByteString>> getEntries()
Get all leaf entries of this proof.- Throws:
java.lang.IllegalStateException
- if the proof is not valid
-
getMissingKeys
java.util.Set<com.google.protobuf.ByteString> getMissingKeys()
Get all keys that were requested, but did not appear in this proof.- Throws:
java.lang.IllegalStateException
- if the proof is not valid
-
containsKey
boolean containsKey(com.google.protobuf.ByteString key)
If this proof is valid, returns true if there is a given key in the proof; false — if there is no such key.- Throws:
java.lang.IllegalStateException
- if the proof is not valid
-
get
com.google.protobuf.ByteString get(com.google.protobuf.ByteString key)
If this proof is valid, returns the value corresponding to the specified key or null if there is no such key in the proof.- Throws:
java.lang.IllegalStateException
- if the proof is not valid
-
getProofStatus
MapProofStatus getProofStatus()
Returns the status of this proof: whether it is structurally valid.- Specified by:
getProofStatus
in interfaceCheckedProof
-
-