public class TransactionSnapshot extends Object implements TransactionVisibilityState
Constructor and Description |
---|
TransactionSnapshot(long timestamp,
long readPointer,
long writePointer,
Collection<Long> invalid,
NavigableMap<Long,TransactionManager.InProgressTx> inProgress) |
TransactionSnapshot(long timestamp,
long readPointer,
long writePointer,
Collection<Long> invalid,
NavigableMap<Long,TransactionManager.InProgressTx> inProgress,
Map<Long,Set<ChangeId>> committing,
Map<Long,Set<ChangeId>> committed) |
Modifier and Type | Method and Description |
---|---|
static TransactionSnapshot |
copyFrom(long snapshotTime,
long readPointer,
long writePointer,
Collection<Long> invalid,
NavigableMap<Long,TransactionManager.InProgressTx> inProgress,
Map<Long,Set<ChangeId>> committing,
NavigableMap<Long,Set<ChangeId>> committed)
Creates a new
TransactionSnapshot instance with copies of all of the individual collections. |
boolean |
equals(Object obj)
Checks that this instance matches another
TransactionSnapshot instance. |
Map<Long,Set<ChangeId>> |
getCommittedChangeSets()
Returns a map of transaction write pointer to set of changed row keys for transaction that had successfully called
InMemoryTransactionManager.commit(Transaction) at the time of the snapshot. |
Map<Long,Set<ChangeId>> |
getCommittingChangeSets()
Returns a map of transaction write pointer to sets of changed row keys for transactions that had called
InMemoryTransactionManager.canCommit(Transaction, Collection) but not yet called
InMemoryTransactionManager.commit(Transaction) at the time of the snapshot. |
NavigableMap<Long,TransactionManager.InProgressTx> |
getInProgress()
Returns the map of write pointers to in-progress transactions at the time of the snapshot.
|
Collection<Long> |
getInvalid()
Returns the list of invalid write pointers at the time of the snapshot.
|
long |
getReadPointer()
Returns the read pointer at the time of the snapshot.
|
long |
getTimestamp()
Returns the timestamp from when this snapshot was created.
|
long |
getVisibilityUpperBound() |
long |
getWritePointer()
Returns the next write pointer at the time of the snapshot.
|
int |
hashCode() |
String |
toString() |
public TransactionSnapshot(long timestamp, long readPointer, long writePointer, Collection<Long> invalid, NavigableMap<Long,TransactionManager.InProgressTx> inProgress, Map<Long,Set<ChangeId>> committing, Map<Long,Set<ChangeId>> committed)
public TransactionSnapshot(long timestamp, long readPointer, long writePointer, Collection<Long> invalid, NavigableMap<Long,TransactionManager.InProgressTx> inProgress)
public long getTimestamp()
TransactionVisibilityState
getTimestamp
in interface TransactionVisibilityState
public long getReadPointer()
TransactionVisibilityState
getReadPointer
in interface TransactionVisibilityState
public long getWritePointer()
TransactionVisibilityState
getWritePointer
in interface TransactionVisibilityState
public Collection<Long> getInvalid()
TransactionVisibilityState
getInvalid
in interface TransactionVisibilityState
public NavigableMap<Long,TransactionManager.InProgressTx> getInProgress()
TransactionVisibilityState
getInProgress
in interface TransactionVisibilityState
public long getVisibilityUpperBound()
getVisibilityUpperBound
in interface TransactionVisibilityState
X
such that any of the transactions newer than X
might be invisible to
some of the currently in-progress transactions or to those that will be started NOTE: the returned tx id can be invalid.
public Map<Long,Set<ChangeId>> getCommittingChangeSets()
InMemoryTransactionManager.canCommit(Transaction, Collection)
but not yet called
InMemoryTransactionManager.commit(Transaction)
at the time of the snapshot.public Map<Long,Set<ChangeId>> getCommittedChangeSets()
InMemoryTransactionManager.commit(Transaction)
at the time of the snapshot.public boolean equals(Object obj)
TransactionSnapshot
instance. Note that the equality check
ignores the snapshot timestamp value, but includes all other properties.public static TransactionSnapshot copyFrom(long snapshotTime, long readPointer, long writePointer, Collection<Long> invalid, NavigableMap<Long,TransactionManager.InProgressTx> inProgress, Map<Long,Set<ChangeId>> committing, NavigableMap<Long,Set<ChangeId>> committed)
TransactionSnapshot
instance with copies of all of the individual collections.readPointer
- current transaction read pointerwritePointer
- current transaction write pointerinvalid
- current list of invalid write pointersinProgress
- current map of in-progress write pointers to expiration timestampscommitting
- current map of write pointers to change sets which have passed canCommit()
but not
yet committedcommitted
- current map of write pointers to change sets which have committedTransactionSnapshot
instanceCopyright © 2017 The Apache Software Foundation. All rights reserved.