Class CheckedFlatMapProof
- java.lang.Object
-
- com.exonum.binding.common.proofs.map.CheckedFlatMapProof
-
- All Implemented Interfaces:
CheckedProof,CheckedMapProof
public class CheckedFlatMapProof extends java.lang.Object implements CheckedMapProof
A checked flat map proof, which does not include any intermediate nodes.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(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.static CheckedFlatMapProofcorrect(HashCode rootHash, java.util.Set<MapEntry<com.google.protobuf.ByteString,com.google.protobuf.ByteString>> entries, java.util.Set<com.google.protobuf.ByteString> missingKeys)Creates a valid map proof.com.google.protobuf.ByteStringget(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.MapProofStatusgetProofStatus()Returns the status of this proof: whether it is structurally valid.HashCodegetRootHash()Returns the calculated root hash of the proof.static CheckedFlatMapProofinvalid(MapProofStatus status)Creates an invalid map proof.booleanisValid()Returns true if proof status is valid, false otherwise.
-
-
-
Method Detail
-
correct
public static CheckedFlatMapProof correct(HashCode rootHash, java.util.Set<MapEntry<com.google.protobuf.ByteString,com.google.protobuf.ByteString>> entries, java.util.Set<com.google.protobuf.ByteString> missingKeys)
Creates a valid map proof.- Parameters:
rootHash- the Merkle root hash calculated by the validatorentries- the set of entries that are proved to be in the mapmissingKeys- the set of keys that are proved not to be in the map- Returns:
- a new checked proof
-
invalid
public static CheckedFlatMapProof invalid(MapProofStatus status)
Creates an invalid map proof.- Parameters:
status- the status explaining why the proof is not valid; must not beMapProofStatus.CORRECT- Returns:
- a new checked proof
-
getEntries
public java.util.Set<MapEntry<com.google.protobuf.ByteString,com.google.protobuf.ByteString>> getEntries()
Description copied from interface:CheckedMapProofGet all leaf entries of this proof.- Specified by:
getEntriesin interfaceCheckedMapProof
-
getMissingKeys
public java.util.Set<com.google.protobuf.ByteString> getMissingKeys()
Description copied from interface:CheckedMapProofGet all keys that were requested, but did not appear in this proof.- Specified by:
getMissingKeysin interfaceCheckedMapProof
-
containsKey
public boolean containsKey(com.google.protobuf.ByteString key)
Description copied from interface:CheckedMapProofIf this proof is valid, returns true if there is a given key in the proof; false — if there is no such key.- Specified by:
containsKeyin interfaceCheckedMapProof
-
getRootHash
public HashCode getRootHash()
Description copied from interface:CheckedProofReturns the calculated root hash of the proof. Must be equal to the Merkle root hash of the collection, providing this proof.- Specified by:
getRootHashin interfaceCheckedProof
-
get
public com.google.protobuf.ByteString get(com.google.protobuf.ByteString key)
Description copied from interface:CheckedMapProofIf this proof is valid, returns the value corresponding to the specified key or null if there is no such key in the proof.- Specified by:
getin interfaceCheckedMapProof
-
getProofStatus
public MapProofStatus getProofStatus()
Description copied from interface:CheckedMapProofReturns the status of this proof: whether it is structurally valid.- Specified by:
getProofStatusin interfaceCheckedMapProof- Specified by:
getProofStatusin interfaceCheckedProof
-
isValid
public boolean isValid()
Description copied from interface:CheckedProofReturns true if proof status is valid, false otherwise. Details about the proof verification status could be obtained viaCheckedProof.getProofStatus().- Specified by:
isValidin interfaceCheckedProof
-
-