public class PersistedCompactionMap extends java.lang.Object implements PartialCompactionMap
PartialCompactionMap
implementation persisting its entries
to segments.
TODO In theory we could also compact the compaction map. Is there any need to do so?Modifier and Type | Field and Description |
---|---|
static int |
BYTES_PER_ENTRY
Rough estimate of the number of bytes of disk space of a map entry.
|
static java.lang.String |
PERSISTED_COMPACTION_MAP
Key used to store meta data associated with the individual map generations.
|
Modifier and Type | Method and Description |
---|---|
void |
compress()
Compressing this map ensures it takes up as little heap as possible.
|
RecordId |
get(RecordId before)
Retrieve the record id
before maps to or null
if no such id exists. |
long |
getEstimatedWeight()
The weight of the compaction map is its heap memory consumption in bytes.
|
long |
getRecordCount()
Number of records referenced by the keys in this map.
|
long |
getSegmentCount()
Number of segments referenced by the keys in this map.
|
boolean |
isEmpty()
Determine whether this map contains keys at all.
|
void |
put(RecordId before,
RecordId after)
Adds a new entry to the compaction map.
|
void |
remove(java.util.Set<java.util.UUID> uuids)
Remove all keys from this map where
keys.contains(key.asUUID()) . |
boolean |
wasCompacted(java.util.UUID uuid)
Checks whether content in the segment with the given identifier was
compacted to new segments.
|
boolean |
wasCompactedTo(RecordId before,
RecordId after)
Checks whether the record with the given
before identifier was
compacted to a new record with the given after identifier. |
public static final int BYTES_PER_ENTRY
public static final java.lang.String PERSISTED_COMPACTION_MAP
public boolean wasCompactedTo(RecordId before, RecordId after)
PartialCompactionMap
before
identifier was
compacted to a new record with the given after
identifier.wasCompactedTo
in interface PartialCompactionMap
before
- before record identifierafter
- after record identifierbefore
was compacted to after
public boolean wasCompacted(java.util.UUID uuid)
PartialCompactionMap
wasCompacted
in interface PartialCompactionMap
uuid
- segment identifierpublic RecordId get(RecordId before)
PartialCompactionMap
before
maps to or null
if no such id exists.get
in interface PartialCompactionMap
before
- before record idnull
public void put(RecordId before, RecordId after)
PartialCompactionMap
put
in interface PartialCompactionMap
before
- before record idafter
- after record idpublic void remove(java.util.Set<java.util.UUID> uuids)
PartialCompactionMap
keys.contains(key.asUUID())
.remove
in interface PartialCompactionMap
uuids
- uuids of the keys to removepublic void compress()
PartialCompactionMap
compress
in interface PartialCompactionMap
public long getSegmentCount()
PartialCompactionMap
getSegmentCount
in interface PartialCompactionMap
public long getRecordCount()
PartialCompactionMap
getRecordCount
in interface PartialCompactionMap
public boolean isEmpty()
PartialCompactionMap
isEmpty
in interface PartialCompactionMap
true
iff this map is emptypublic long getEstimatedWeight()
PartialCompactionMap
getEstimatedWeight
in interface PartialCompactionMap
"Copyright © 2010 - 2018 Adobe Systems Incorporated. All Rights Reserved"