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 getProofStatus) throw IllegalStateException. Example usage:
    
     ByteString key = "The key for which I want a proved value".getBytes();
     HashCode expectedIndexHash = // get a known index hash from block proof //
     UncheckedMapProof proof = requestProofForKey(key);
     // Convert to checked
     CheckedMapProof checkedProof = proof.check();
     // Check the index hash
     if (checkedProof.isValid() && checkedProof.getIndexHash().equals(expectedIndexHash)) {
       // 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.
      Set<MapEntry<com.google.protobuf.ByteString,​com.google.protobuf.ByteString>> getEntries()
      Get all leaf entries of this proof.
      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.
    • Method Detail

      • getEntries

        Set<MapEntry<com.google.protobuf.ByteString,​com.google.protobuf.ByteString>> getEntries()
        Get all leaf entries of this proof.
        Throws:
        IllegalStateException - if the proof is not valid
      • getMissingKeys

        Set<com.google.protobuf.ByteString> getMissingKeys()
        Get all keys that were requested, but did not appear in this proof.
        Throws:
        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:
        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:
        IllegalStateException - if the proof is not valid