| Modifier and Type | Field and Description |
|---|---|
| protected final FreeSpaceBitSet | freeSpace
The free spaces between the chunks. |
| private long | |
| private long | |
| private volatile boolean | reuseSpace
Allocation mode: false - new chunk is always allocated at the end of file true - new chunk is allocated as close to the beginning of file, as possible |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected final void | adjustStoreToLastChunk()
Implements abstract org. Make persistent changes after lastChunk was reset |
| private long | Returns: the start position in bytesthe number of bytes to allocate length, long start block index of the reserved area (inclusive) reservedLow, long end block index of the reserved area (exclusive),
special value -1 means beginning of the infinite free area reservedHigh)Allocate a number of blocks and mark them as used. |
| protected final void | allocateChunkSpace(SFChunk
to allocate space for chunk, WriteBuffer to allocate space for buff)Implements abstract org. Allocate logical space and assign position of the buffer within the store. |
| public void | |
| public void | compactMoveChunks(int
do nothing if the file store fill rate is higher
than this targetFillRate, long the number of bytes to move moveSize, MVStore owner of this store mvStore)Compact the store by moving all chunks next to each other, if there is free space between chunks. |
| private void | |
| private void | |
| protected void | compactStore(int
do not compact if store fill rate above this value (0-100) thresholdFillRate, long the maximum time in milliseconds to compact maxCompactTime, int the maximum amount of data to be written as part of this call maxWriteSize, MVStore that owns this FileStore mvStore)Implements abstract org. Compact store file, that is, compact blocks that have a low fill rate, and move chunks next to each other. |
| protected final SFChunk | |
| public SFChunk | createChunk(String
the string s)Implements abstract org. Build a Chunk from the given string. |
| protected SFChunk | |
| protected void | |
| private Iterable | |
| protected void | |
| protected void | freeChunkSpace(Iterable<SFChunk>
chunks to be processed chunks)Implements abstract org. Mark the space occupied by specified chunks as free. |
| private void | |
| private long | |
| protected long | |
| pack-priv long | |
| public int | |
| pack-priv long | |
| private int | |
| public int | Returns: priority, bigger number indicate that chunk need to be moved soonerwhere chunk starts block)Calculates relative "priority" for chunk to be moved. |
| public Collection | |
| private int | |
| protected void | |
| private boolean | |
| public boolean | |
| public void | markUsed(long
the position in bytes pos, int the number of bytes length)Implements abstract org. Mark the space as in use. |
| private long | |
| private boolean | |
| private boolean | |
| private long | Returns: the starting block indexthe number of blocks to allocate blocks, long start block index of the reserved area (inclusive) reservedLow, long end block index of the reserved area (exclusive),
special value -1 means beginning of the infinite free area reservedHigh)Calculate starting position of the prospective allocation. |
| protected void | |
| public void | |
| public boolean | shouldSaveNow(int
amount of unsaved memory, so far unsavedMemory, int configured limit on amount of unsaved memory autoCommitMemory)Implements abstract org. Decision about autocommit is delegated to store |
| private boolean | |
| private void | |
| protected void | shrinkStoreIfPossible(int
the minimum percentage to save minPercent)Implements abstract org. Shrink the store if possible, and if at least a given percentage can be saved. |
| private void | |
| protected abstract void | |
| protected final boolean | |
| protected final void | writeChunk(SFChunk
chunk to write chunk, WriteBuffer to write buffer)Implements abstract org. Write buffer associated with chunk into store at chunk's allocated position |
| protected final void | writeCleanShutdownMark()
Implements abstract org. Performs final preparation before store is closed normally |
| private void |
| freeSpace | back to summary |
|---|---|
| protected final FreeSpaceBitSet freeSpace The free spaces between the chunks. The first block to use is block 2 (the first two blocks are the store header). | |
| reservedHigh | back to summary |
|---|---|
| private long reservedHigh | |
| reservedLow | back to summary |
|---|---|
| private long reservedLow | |
| reuseSpace | back to summary |
|---|---|
| private volatile boolean reuseSpace Allocation mode: false - new chunk is always allocated at the end of file true - new chunk is allocated as close to the beginning of file, as possible | |
| stopIdleHousekeeping | back to summary |
|---|---|
| private boolean stopIdleHousekeeping | |
| RandomAccessStore | back to summary |
|---|---|
| public RandomAccessStore(Map<String, Object> config) | |
| adjustStoreToLastChunk | back to summary |
|---|---|
| protected final void adjustStoreToLastChunk() Implements abstract org. Doc from org. Make persistent changes after lastChunk was reset
| |
| allocate | back to summary |
|---|---|
| private long allocate(int length, long reservedLow, long reservedHigh) Allocate a number of blocks and mark them as used.
| |
| allocateChunkSpace | back to summary |
|---|---|
| protected final void allocateChunkSpace(SFChunk chunk, WriteBuffer buff) Implements abstract org. Doc from org. Allocate logical space and assign position of the buffer within the store.
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides org. Mark the file as empty.
| |
| compactMoveChunks | back to summary |
|---|---|
| public void compactMoveChunks(int targetFillRate, long moveSize, MVStore mvStore) Compact the store by moving all chunks next to each other, if there is free space between chunks. This might temporarily increase the file size. Chunks are overwritten irrespective of the current retention time. Before overwriting chunks and before resizing the file, syncFile() is called.
| |
| compactMoveChunks | back to summary |
|---|---|
| private void compactMoveChunks(long moveSize) | |
| compactMoveChunks | back to summary |
|---|---|
| private void compactMoveChunks(Iterable<SFChunk> move) | |
| compactStore | back to summary |
|---|---|
| protected void compactStore(int thresholdFillRate, long maxCompactTime, int maxWriteSize, MVStore mvStore) Implements abstract org. Compact store file, that is, compact blocks that have a low fill rate, and move chunks next to each other. This will typically shrink the file. Changes are flushed to the file, and old chunks are overwritten.
| |
| createChunk | back to summary |
|---|---|
| protected final SFChunk createChunk(int newChunkId) Implements abstract org.
| |
| createChunk | back to summary |
|---|---|
| public SFChunk createChunk(String s) Implements abstract org. Doc from org. Build a Chunk from the given string. | |
| createChunk | back to summary |
|---|---|
| protected SFChunk createChunk(Map<String, String> map) Implements abstract org.
| |
| doHousekeeping | back to summary |
|---|---|
| protected void doHousekeeping(MVStore mvStore) throws InterruptedException Implements abstract org.
| |
| findChunksToMove | back to summary |
|---|---|
| private Iterable | |
| free | back to summary |
|---|---|
| protected void free(long pos, int length) Mark the space as free.
| |
| freeChunkSpace | back to summary |
|---|---|
| protected void freeChunkSpace(Iterable<SFChunk> chunks) Implements abstract org. Doc from org. Mark the space occupied by specified chunks as free. | |
| freeChunkSpace | back to summary |
|---|---|
| private void freeChunkSpace(SFChunk chunk) | |
| getAfterLastBlock | back to summary |
|---|---|
| private long getAfterLastBlock() Get the index of the first block after last occupied one. It marks the beginning of the last (infinite) free space.
| |
| getAfterLastBlock_ | back to summary |
|---|---|
| protected long getAfterLastBlock_() | |
| getFileLengthInUse | back to summary |
|---|---|
| pack-priv long getFileLengthInUse() | |
| getFillRate | back to summary |
|---|---|
| public int getFillRate() Implements abstract org.
| |
| getFirstFree | back to summary |
|---|---|
| pack-priv long getFirstFree() | |
| getMovePriority | back to summary |
|---|---|
| private int getMovePriority(SFChunk chunk) | |
| getMovePriority | back to summary |
|---|---|
| public int getMovePriority(int block) Calculates relative "priority" for chunk to be moved.
| |
| getRewriteCandidates | back to summary |
|---|---|
| public Collection Overrides org.
| |
| getTargetFillRate | back to summary |
|---|---|
| private int getTargetFillRate(boolean idle) | |
| initializeStoreHeader | back to summary |
|---|---|
| protected void initializeStoreHeader(long time) Implements abstract org.
| |
| isFragmented | back to summary |
|---|---|
| private boolean isFragmented() | |
| isSpaceReused | back to summary |
|---|---|
| public boolean isSpaceReused() Overrides org.
| |
| markUsed | back to summary |
|---|---|
| public void markUsed(long pos, int length) Implements abstract org. Mark the space as in use.
| |
| measureFileLengthInUse | back to summary |
|---|---|
| private long measureFileLengthInUse() | |
| moveChunk | back to summary |
|---|---|
| private boolean moveChunk(SFChunk chunk, long reservedAreaLow, long reservedAreaHigh) Move specified chunk into free area of the file. "Reserved" area specifies file interval to be avoided, when un-allocated space will be chosen for a new chunk's location.
| |
| moveChunkInside | back to summary |
|---|---|
| private boolean moveChunkInside(SFChunk chunkToMove, long boundary) | |
| predictAllocation | back to summary |
|---|---|
| private long predictAllocation(int blocks, long reservedLow, long reservedHigh) Calculate starting position of the prospective allocation.
| |
| readStoreHeader | back to summary |
|---|---|
| protected void readStoreHeader(boolean recoveryMode) Implements abstract org.
| |
| setReuseSpace | back to summary |
|---|---|
| public void setReuseSpace(boolean reuseSpace) Overrides org.
| |
| shouldSaveNow | back to summary |
|---|---|
| public boolean shouldSaveNow(int unsavedMemory, int autoCommitMemory) Implements abstract org. Doc from org. Decision about autocommit is delegated to store
| |
| shouldWriteStoreHeader | back to summary |
|---|---|
| private boolean shouldWriteStoreHeader(SFChunk c, boolean storeAtEndOfFile) | |
| shrinkIfPossible | back to summary |
|---|---|
| private void shrinkIfPossible(int minPercent) | |
| shrinkStoreIfPossible | back to summary |
|---|---|
| protected void shrinkStoreIfPossible(int minPercent) Implements abstract org. Shrink the store if possible, and if at least a given percentage can be saved.
| |
| store | back to summary |
|---|---|
| private void store(long reservedLow, long reservedHigh) | |
| truncate | back to summary |
|---|---|
| protected abstract void truncate(long size) | |
| validateFileLength | back to summary |
|---|---|
| protected final boolean validateFileLength(String msg) Implements abstract org.
| |
| writeChunk | back to summary |
|---|---|
| protected final void writeChunk(SFChunk chunk, WriteBuffer buffer) Implements abstract org. Doc from org. Write buffer associated with chunk into store at chunk's allocated position
| |
| writeCleanShutdownMark | back to summary |
|---|---|
| protected final void writeCleanShutdownMark() Implements abstract org. Doc from org. Performs final preparation before store is closed normally
| |
| writeStoreHeader | back to summary |
|---|---|
| private void writeStoreHeader() | |