Package com.facebook.buck.core.rulekey
Class RuleKey
- java.lang.Object
-
- com.facebook.buck.core.rulekey.RuleKey
-
public class RuleKey extends Object
RuleKey encapsulates regimented computation of SHA-1 keys that incorporate all BuildRule state relevant to idempotency. The RuleKey.Builder API conceptually implements the construction of an ordered map, and the key/val pairs are digested using an internal serialization that guarantees a 1:1 mapping for each distinct vector of keys <header,k1,...,kn> in RuleKey.builder(header).set(k1, v1) ... .set(kn, vn).build().Note carefully that in order to reliably avoid accidental collisions, each RuleKey schema, as defined by the key vector, must have a distinct header. Otherwise it is possible (if unlikely) for serialized value data to alias serialized key data, with the result being identical RuleKeys for differing input. In practical terms this means that each BuildRule implementer should specify a distinct header, and that for all RuleKeys built with a particular header, the sequence of set() calls should be identical, even if values are missing. The set() methods specifically handle null values to accommodate this regime.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
com.google.common.hash.HashCode
getHashCode()
int
hashCode()
String
toString()
-
-
-
Constructor Detail
-
RuleKey
public RuleKey(com.google.common.hash.HashCode hashCode)
-
RuleKey
public RuleKey(String hashString)
- Parameters:
hashString
- string that conforms to the contract of the return value ofHashCode.toString()
.
-
-
Method Detail
-
getHashCode
public com.google.common.hash.HashCode getHashCode()
-
toString
public String toString()
-
-