Package org.iq80.leveldb.impl
Class VersionSet
java.lang.Object
org.iq80.leveldb.impl.VersionSet
- All Implemented Interfaces:
Iterable<Map.Entry<InternalKey,,Slice>> SeekingIterable<InternalKey,Slice>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA helper class so we can efficiently apply a whole sequence of edits to a particular state without creating intermediate Versions that contain full copies of the intermediate state. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<Integer, InternalKey> private Versionprivate final Fileprivate LogWriterprivate final InternalKeyComparatorprivate static final intprivate longprivate longprivate longstatic final longprivate final AtomicLongprivate longprivate final TableCachestatic final int -
Constructor Summary
ConstructorsConstructorDescriptionVersionSet(File databaseDir, TableCache tableCache, InternalKeyComparator internalKeyComparator) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidappendVersion(Version version) private static <V> Vcoalesce(V... values) compactRange(int level, InternalKey begin, InternalKey end) voiddestroy()private voidfinalizeVersion(Version version) longlonglonglonglong(package private) List<FileMetaData> getOverlappingInputs(int level, InternalKey begin, InternalKey end) longprivate Map.Entry<InternalKey, InternalKey> getRange(List<FileMetaData>... inputLists) private voiditerator()voidlogAndApply(VersionEdit edit) private static doublemaxBytesForLevel(int level) static longmaxFileSizeForLevel(int level) booleanlongnumberOfBytesInLevel(int level) intnumberOfFilesInLevel(int level) booleanoverlapInLevel(int level, Slice smallestUserKey, Slice largestUserKey) voidrecover()voidremoveVersion(Version version) voidsetLastSequence(long newLastSequence) private CompactionsetupOtherInputs(int level, List<FileMetaData> levelInputs) private voidwriteSnapshot(LogWriter log) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
L0_COMPACTION_TRIGGER
private static final int L0_COMPACTION_TRIGGER- See Also:
-
TARGET_FILE_SIZE
public static final int TARGET_FILE_SIZE- See Also:
-
MAX_GRAND_PARENT_OVERLAP_BYTES
public static final long MAX_GRAND_PARENT_OVERLAP_BYTES- See Also:
-
nextFileNumber
-
manifestFileNumber
private long manifestFileNumber -
current
-
lastSequence
private long lastSequence -
logNumber
private long logNumber -
prevLogNumber
private long prevLogNumber -
activeVersions
-
databaseDir
-
tableCache
-
internalKeyComparator
-
descriptorLog
-
compactPointers
-
-
Constructor Details
-
VersionSet
public VersionSet(File databaseDir, TableCache tableCache, InternalKeyComparator internalKeyComparator) throws IOException - Throws:
IOException
-
-
Method Details
-
initializeIfNeeded
- Throws:
IOException
-
destroy
- Throws:
IOException
-
appendVersion
-
removeVersion
-
getInternalKeyComparator
-
getTableCache
-
getCurrent
-
getManifestFileNumber
public long getManifestFileNumber() -
getNextFileNumber
public long getNextFileNumber() -
getLogNumber
public long getLogNumber() -
getPrevLogNumber
public long getPrevLogNumber() -
iterator
- Specified by:
iteratorin interfaceIterable<Map.Entry<InternalKey,Slice>> - Specified by:
iteratorin interfaceSeekingIterable<InternalKey,Slice>
-
makeInputIterator
-
get
-
overlapInLevel
-
numberOfFilesInLevel
public int numberOfFilesInLevel(int level) -
numberOfBytesInLevel
public long numberOfBytesInLevel(int level) -
getLastSequence
public long getLastSequence() -
setLastSequence
public void setLastSequence(long newLastSequence) -
logAndApply
- Throws:
IOException
-
writeSnapshot
- Throws:
IOException
-
recover
- Throws:
IOException
-
finalizeVersion
-
coalesce
private static <V> V coalesce(V... values) -
getLiveFiles
-
maxBytesForLevel
private static double maxBytesForLevel(int level) -
maxFileSizeForLevel
public static long maxFileSizeForLevel(int level) -
needsCompaction
public boolean needsCompaction() -
compactRange
-
pickCompaction
-
setupOtherInputs
-
getOverlappingInputs
-
getRange
-
getMaxNextLevelOverlappingBytes
public long getMaxNextLevelOverlappingBytes()
-