Package io.crums.model
Class Crum
java.lang.Object
io.crums.model.HashUtc
io.crums.model.Crum
- All Implemented Interfaces:
java.lang.Comparable<Crum>
public class Crum extends HashUtc implements java.lang.Comparable<Crum>
A timestamp, witness to a hash. Instances are immutable. This is a 2-tuple: a hash, and a UTC time.
Version 1 Note
This used to be a 3-tuple in version 0. The third field was a rather beefy 256-byte signature derived from the other 2 fields. The signature was meant to bridge the gap in time from when a hash is first witnessed to minutes later when it makes it into the tree. In truth, until the tree is published, the signature doesn't prove anything. It's only usecase is when a user wants to show a hash to another person before the tree is published and that other person already trusts crums.io. That's a tall story for a usecase, especially given the unneeded bloat and complexity it introduces, so the signature was altogether dropped. A signatured version can be layered on top, if the need/usecase arises.
-
Field Summary
Fields inherited from class io.crums.model.HashUtc
data, DATA_SIZE, HASH_COMPARATOR, INCEPTION_UTC, RUN_MAX_UTC
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description int
compareTo(Crum o)
Instances are ordered firstly by hash; secondly in time.static Crum
newSearchKey(byte[] hash)
static Crum
newSearchKey(java.nio.ByteBuffer hash)
Methods inherited from class io.crums.model.HashUtc
equals, equalsHashUtc, hash, hashCode, hashEquals, hashHex, sanityCheckUtc, serialForm, toString, utc, writeToBuffer, writeToBuffer
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
Crum
public Crum(java.nio.ByteBuffer data) -
Crum
public Crum(byte[] hash, long utc) -
Crum
public Crum(java.nio.ByteBuffer hash, long utc)
-
-
Method Details
-
newSearchKey
-
newSearchKey
-
compareTo
Instances are ordered firstly by hash; secondly in time. Consistent with equals.- Specified by:
compareTo
in interfacejava.lang.Comparable<Crum>
-