private class UniqueTracker.UniqueIndex
extends java.lang.Object
DMO
.Modifier and Type | Class and Description |
---|---|
private class |
UniqueTracker.UniqueIndex.Key
The key used for tracking a record within an unique index.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Long,UniqueTracker.UniqueIndex.Key> |
entries
Unique index keys mapped by primary keys
|
private java.util.BitSet |
fieldMap
Bitset whereby set bits describe the components of the index by position in the data
|
private int[] |
fieldPos
The set of fields of the
BaseRecord which comprise the index. |
private java.util.concurrent.locks.ReentrantLock |
lock
Mutex lock
|
private java.util.Map<UniqueTracker.UniqueIndex.Key,java.lang.Long> |
records
The set of unique records, keyed by
Key , mapping to the original
id of the record. |
Constructor and Description |
---|
UniqueIndex(java.util.BitSet fieldMap)
Creates a new structure that contains data related to an unique index of a table.
|
Modifier and Type | Method and Description |
---|---|
(package private) UniqueTracker.UniqueIndex.Key |
createKey(BaseRecord dmo)
Create a
Key for the given record within the current index. |
(package private) void |
lock()
Lock this resource exclusively.
|
(package private) void |
unlock()
Release the lock on this resource.
|
private final java.util.concurrent.locks.ReentrantLock lock
private int[] fieldPos
BaseRecord
which comprise the index. The order is
irrelevant and this array uses the 'natural' order in which the fields were declared at
the definition of the table.private java.util.BitSet fieldMap
private final java.util.Map<UniqueTracker.UniqueIndex.Key,java.lang.Long> records
Key
, mapping to the original
id
of the record.private final java.util.Map<java.lang.Long,UniqueTracker.UniqueIndex.Key> entries
public UniqueIndex(java.util.BitSet fieldMap)
fieldMap
- The bitmap of the index, that is, the bits corresponding to field component of
the index.void lock()
void unlock()
UniqueTracker.UniqueIndex.Key createKey(BaseRecord dmo)
Key
for the given record within the current index. This is just
a wrapper for the Key
constructor with access to its implicit UniqueIndex.this
reference.dmo
- Database record.Key
instance.