Class Reads

java.lang.Object
io.permazen.kv.KeyRanges
io.permazen.kv.mvcc.Reads
All Implemented Interfaces:
KeyFilter, Cloneable, Iterable<KeyRange>

public class Reads extends KeyRanges
Holds a set of reads from a KVStore.

Only the (ranges of) keys read are retained, not the values.

Instances are not thread safe.

  • Constructor Details

  • Method Details

    • isConflict

      public boolean isConflict(Mutations mutations)
      Determine whether any of the given mutations conflict with any of the keys read by this instance.

      This method is equivalent to invoking findConflict() and checking whether it returns non-null.

      This method guarantees that it will access the given mutations in this order: removes, puts, adjusts.

      Parameters:
      mutations - mutations to check for conflicts
      Returns:
      true if the mutations are invisible to this instance, false if this instance contains a key modified by mutations
      Throws:
      IllegalArgumentException - if mutations is null
      See Also:
    • findConflict

      public Conflict findConflict(Mutations mutations)
      Determine whether any of the given mutations conflict with any of the keys read by this instance, and report the first conflict found.

      If this method returns null, then if two transactions T1 and T2 are based on the same underlying KVStore snapshot, and T1 writes mutations and T2 reads according to this instance, then T2 can be ordered after T1 while still preserving linearizable semantics. That is, the given mutations are invisible to this instance.

      This method guarantees that it will access the given mutations in this order: removes, puts, adjusts.

      Parameters:
      mutations - mutations to check for conflicts
      Returns:
      the first Conflict found, or null if there are no conflicts
      Throws:
      IllegalArgumentException - if mutations is null
      See Also:
    • getConflicts

      public List<String> getConflicts(Mutations mutations)
      List all of the conflicts between the given mutations and any of the keys read by this instance, in String form.

      This method simply invokes getAllConflicts() and returns the resulting list converted into String objects via Object.toString().

      This method guarantees that it will access the given mutations in this order: removes, puts, adjusts.

      Parameters:
      mutations - mutations to check for conflicts with this instance
      Returns:
      a description of each conflict between this instance and the given mutations
      Throws:
      IllegalArgumentException - if mutations is null
      See Also:
    • getAllConflicts

      public List<Conflict> getAllConflicts(Mutations mutations)
      List all of the conflicts between the given mutations and any of the keys read by this instance.

      This method guarantees that it will access the given mutations in this order: removes, puts, adjusts.

      Parameters:
      mutations - mutations to check for conflicts with this instance
      Returns:
      list of each conflict between this instance and the given mutations
      Throws:
      IllegalArgumentException - if mutations is null
      See Also:
    • clone

      public Reads clone()
      Description copied from class: KeyRanges
      Clone this instance.

      The returned clone will always be mutable, even if this instance is not.

      Overrides:
      clone in class KeyRanges
    • readOnlySnapshot

      public Reads readOnlySnapshot()
      Description copied from class: KeyRanges
      Return an immutable snapshot of this instance.
      Overrides:
      readOnlySnapshot in class KeyRanges
      Returns:
      immutable snapshot