public class PersistedCompactionMap extends 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 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(Set<UUID> uuids)
Remove all keys from this map where
keys.contains(key.asUUID()). |
boolean |
wasCompacted(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 String PERSISTED_COMPACTION_MAP
public boolean wasCompactedTo(@Nonnull RecordId before, @Nonnull RecordId after)
PartialCompactionMapbefore identifier was
compacted to a new record with the given after identifier.wasCompactedTo in interface PartialCompactionMapbefore - before record identifierafter - after record identifierbefore was compacted to afterpublic boolean wasCompacted(@Nonnull UUID uuid)
PartialCompactionMapwasCompacted in interface PartialCompactionMapuuid - segment identifier@CheckForNull public RecordId get(@Nonnull RecordId before)
PartialCompactionMapbefore maps to or null
if no such id exists.get in interface PartialCompactionMapbefore - before record idnullpublic void put(@Nonnull RecordId before, @Nonnull RecordId after)
PartialCompactionMapput in interface PartialCompactionMapbefore - before record idafter - after record idpublic void remove(@Nonnull Set<UUID> uuids)
PartialCompactionMapkeys.contains(key.asUUID()).remove in interface PartialCompactionMapuuids - uuids of the keys to removepublic void compress()
PartialCompactionMapcompress in interface PartialCompactionMappublic long getSegmentCount()
PartialCompactionMapgetSegmentCount in interface PartialCompactionMappublic long getRecordCount()
PartialCompactionMapgetRecordCount in interface PartialCompactionMappublic boolean isEmpty()
PartialCompactionMapisEmpty in interface PartialCompactionMaptrue iff this map is emptypublic long getEstimatedWeight()
PartialCompactionMapgetEstimatedWeight in interface PartialCompactionMapCopyright © 2012-2016 The Apache Software Foundation. All Rights Reserved.