public final class RecordNursery
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
RecordNursery.Key
A hash key with which to store and retrieve indexed records.
|
Modifier and Type | Field and Description |
---|---|
private FastFindCache |
ffCache
Fast-find cache, which must be invalidated when an index is updated, to prevent stale results
|
private java.util.Map<RecordNursery.Key,java.util.Map<BaseRecord,RecordBuffer>> |
indexedRecords
Maps of newly created records to buffers, organized by the indices they have caused to be updated
|
private java.util.Map<BaseRecord,java.util.Set<RecordNursery.Key>> |
keysByDmo
Map of record to keys in
indexedRecords map, to allow faster cleanup of the latter |
Constructor and Description |
---|
RecordNursery(FastFindCache ffCache)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
indexUpdated(RecordBuffer buffer,
int idxUid,
BaseRecord dmo)
An index was updated by changes to a newly created, as yet unvalidated record.
|
void |
makeVisible(int dmoUid,
java.lang.Integer multiplex,
int idxUid)
Make all newly created records which have been stored in the nursery on a particular index visible
(searchable).
|
void |
remove(BaseRecord dmo)
The given record was flushed to the database or determined to be invalid; remove it from the nursery.
|
void |
transactionEnded()
The current transaction ended; clean up data structures.
|
private final java.util.Map<RecordNursery.Key,java.util.Map<BaseRecord,RecordBuffer>> indexedRecords
private final java.util.Map<BaseRecord,java.util.Set<RecordNursery.Key>> keysByDmo
indexedRecords
map, to allow faster cleanup of the latterprivate final FastFindCache ffCache
public RecordNursery(FastFindCache ffCache)
public void indexUpdated(RecordBuffer buffer, int idxUid, BaseRecord dmo)
buffer
- Record buffer containing the record.idxUid
- Index identifier (unique within DMO type/table).dmo
- Record to be stored.public void transactionEnded()
public void remove(BaseRecord dmo)
dmo
- The record to be removed.public void makeVisible(int dmoUid, java.lang.Integer multiplex, int idxUid) throws PersistenceException
dmoUid
- Unique DMO type/table identifier.multiplex
- Optional multiplex ID (temp-tables only; otherwise null
.idxUid
- Index identifier (unique within DMO type/table).PersistenceException
- if there is any error persisting the record to its primary or dirty database.