Class CrumRecord

java.lang.Object
io.crums.model.CrumRecord
Direct Known Subclasses:
TrailedRecord, UntrailedRecord

public abstract class CrumRecord
extends java.lang.Object

A record of the life of a witnessed hash. A witnessed hash goes through 3 phases, 2 of which are represented by instances of this class.

  1. Created. A crum, that is just a hash/utc pair, enters the database.
  2. Trailed. The crum enters a Merkle tree.
  3. Trimmed. The crum and its associated Merkle are purged from the database. The only artifact of the crum remaining in the database is the root of the Merkle tree it was in (to which a valid instance of this class is forever provably linked to).

An instance of this class represents of the first 2 states of a crum.

  • Constructor Summary

    Constructors
    Constructor Description
    CrumRecord()  
  • Method Summary

    Modifier and Type Method Description
    abstract Crum crum()
    Returns the record's crum (hash/utc pair).
    boolean equals​(java.lang.Object o)
    Instances are equal if their crums are equal and are both trailed.
    int hashCode()
    Consistent with equals(Object).
    abstract boolean isTrailed()
    Determines whether the record has a crum trail.
    abstract CrumTrail trail()
    Returns the crum trail, or null if it doesn't have one.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CrumRecord

      public CrumRecord()
  • Method Details

    • isTrailed

      public abstract boolean isTrailed()
      Determines whether the record has a crum trail. A CrumRecord begins life without a trail.
      Returns:
      true iff trail() doesn't return null.
      See Also:
      trail()
    • crum

      public abstract Crum crum()
      Returns the record's crum (hash/utc pair).
      Returns:
      never null
    • trail

      public abstract CrumTrail trail()
      Returns the crum trail, or null if it doesn't have one. (A crum has a trail once it's made it into a Merkle tree.)
      Returns:
      possibly null
      See Also:
      isTrailed()
    • equals

      public final boolean equals​(java.lang.Object o)
      Instances are equal if their crums are equal and are both trailed.
      Overrides:
      equals in class java.lang.Object
      See Also:
      hashCode()
    • hashCode

      public final int hashCode()
      Consistent with equals(Object).
      Overrides:
      hashCode in class java.lang.Object