Class Issue

java.lang.Object
io.permazen.jsck.Issue
Direct Known Subclasses:
InvalidKey, InvalidValue, MissingKey

public abstract class Issue extends Object
Represents a point of corruption or inconsistency in a Permazen key/value database.

Issues are specific to a single key/value pair in the database.

  • Constructor Details

    • Issue

      protected Issue(String description, byte[] key, byte[] oldValue, byte[] newValue)
      Constructor.
      Parameters:
      description - short description of the issue
      key - key of invalid key/value pair
      oldValue - the original, invalid value for key, or null if key was missing or don't care
      newValue - the corrected replacement value for key, or null if key should be deleted
      Throws:
      IllegalArgumentException - if key is null
      IllegalArgumentException - if oldValue and newValue are equal
  • Method Details

    • getKey

      public byte[] getKey()
      Get the databse key.
      Returns:
      key of this issue
    • getOldValue

      public byte[] getOldValue()
      Get the original value, if any.
      Returns:
      original value, null if key/value pair was missing
    • getNewValue

      public byte[] getNewValue()
      Get the replacement value, if any.
      Returns:
      replacement value, null if key/value pair was missing or should be deleted
    • apply

      public void apply(KVStore kvstore)
      Apply the fix for this issue to the given KVStore.

      This overwrites the key/value pair with the new value, or deletes it if getNewValue() is null.

      Parameters:
      kvstore - target key/value store
      Throws:
      IllegalArgumentException - if kvstore is null
    • setDetail

      public Issue setDetail(String detail)
    • setDetail

      public Issue setDetail(ObjId id, String detail)
    • setDetail

      public Issue setDetail(ObjId id, Field<?> field, String detail)
    • setDetail

      public Issue setDetail(ObjId id, CompositeIndex index, String detail)
    • setDetail

      public Issue setDetail(io.permazen.jsck.Index<?> index, String detail)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object