Constructor and Description |
---|
Reads()
Construct an empty instance.
|
Reads(InputStream input)
Constructor to deserialize an instance created by
serialize() . |
Reads(KeyRanges ranges)
Construct an instance containing the given key ranges.
|
Modifier and Type | Method and Description |
---|---|
Reads |
clone()
Clone this instance.
|
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.
|
List<Conflict> |
getAllConflicts(Mutations mutations)
List all of the conflicts between the given mutations and any of the keys read by this instance.
|
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. |
Reads |
immutableSnapshot()
Return an immutable snapshot of this instance.
|
boolean |
isConflict(Mutations mutations)
Determine whether any of the given mutations conflict with any of the keys read by this instance.
|
add, add, asList, asSet, clear, contains, contains, contains, deserializeIterator, empty, equals, findKey, forPrefix, full, getMax, getMin, hashCode, intersect, intersect, intersects, inverse, isEmpty, isFull, iterator, prefixedBy, remove, remove, seekHigher, seekLower, serialize, serializedLength, size, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public Reads()
public Reads(KeyRanges ranges)
ranges
- initial key rangesIllegalArgumentException
- if ranges
is nullpublic Reads(InputStream input) throws IOException
serialize()
.input
- input stream containing data from serialize()
IOException
- if an I/O error occursEOFException
- if the input ends unexpectedlyIllegalArgumentException
- if input
is nullIllegalArgumentException
- if input
is invalidpublic boolean isConflict(Mutations mutations)
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.
mutations
- mutations to check for conflictsmutations
are invisible to this instance, false if this instance contains a
key modified by mutations
IllegalArgumentException
- if mutations
is nullfindConflict()
,
getAllConflicts()
public Conflict findConflict(Mutations mutations)
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.
mutations
- mutations to check for conflictsConflict
found, or null if there are no conflictsIllegalArgumentException
- if mutations
is nullgetAllConflicts()
,
isConflict()
public List<String> getConflicts(Mutations mutations)
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.
mutations
- mutations to check for conflicts with this instanceIllegalArgumentException
- if mutations
is nullgetAllConflicts()
public List<Conflict> getAllConflicts(Mutations mutations)
This method guarantees that it will access the given mutations
in this order: removes, puts, adjusts.
mutations
- mutations to check for conflicts with this instanceIllegalArgumentException
- if mutations
is nullfindConflict()
,
isConflict()
public Reads clone()
KeyRanges
The returned clone will always be mutable, even if this instance is not.
public Reads immutableSnapshot()
KeyRanges
immutableSnapshot
in class KeyRanges
Copyright © 2019. All rights reserved.