org.h2.mvstore

## Class AppendOnlyMultiFileStore

- java.lang.Object
- - org.h2.mvstore.FileStore<org.h2.mvstore.MFChunk>
  - - org.h2.mvstore.AppendOnlyMultiFileStore

    public final class AppendOnlyMultiFileStore
    extends FileStore<org.h2.mvstore.MFChunk>

Class AppendOnlyMultiFileStore.

### Nested Class Summary

### Nested classes/interfaces inherited from class org.h2.mvstore.FileStore

`FileStore.PageSerializationManager`

### Field Summary

### Fields inherited from class org.h2.mvstore.FileStore

`lastChunk, META_ID_KEY, PIPE_LENGTH, readBytes, readCount, recoveryMode, saveChunkLock, storeHeader, writeBytes, writeCount`

### Constructor Summary

Constructors
Constructor and Description
`AppendOnlyMultiFileStore(java.util.Map<java.lang.String,java.lang.Object> config)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `adjustStoreToLastChunk()` Make persistent changes after lastChunk was reset
`protected void` `allocateChunkSpace(org.h2.mvstore.MFChunk chunk, WriteBuffer buff)` Allocate logical space and assign position of the buffer within the store.
`void` `backup(java.util.zip.ZipOutputStream out)`
`void` `close()` Close this store.
`protected void` `compactStore(int thresholdFillRate, long maxCompactTime, int maxWriteSize, MVStore mvStore)` Compact store file, that is, compact blocks that have a low fill rate, and move chunks next to each other.
`protected org.h2.mvstore.MFChunk` `createChunk(int newChunkId)`
`protected org.h2.mvstore.MFChunk` `createChunk(java.util.Map<java.lang.String,java.lang.String> map)`
`org.h2.mvstore.MFChunk` `createChunk(java.lang.String s)` Build a Chunk from the given string.
`protected void` `doHousekeeping(MVStore mvStore)`
`protected void` `freeChunkSpace(java.lang.Iterable<org.h2.mvstore.MFChunk> chunks)` Mark the space occupied by specified chunks as free.
`int` `getFillRate()`
`protected void` `initializeStoreHeader(long time)`
`void` `markUsed(long pos, int length)` Mark the space as in use.
`AppendOnlyMultiFileStore` `open(java.lang.String fileName, boolean readOnly)`
`void` `open(java.lang.String fileName, boolean readOnly, char[] encryptionKey)`
`java.nio.ByteBuffer` `readFully(org.h2.mvstore.MFChunk chunk, long pos, int len)` Read data from the store.
`protected void` `readStoreHeader(boolean recoveryMode)`
`boolean` `shouldSaveNow(int unsavedMemory, int autoCommitMemory)` Decision about autocommit is delegated to store
`protected void` `shrinkStoreIfPossible(int minPercent)` Shrink store if possible, and if at least a given percentage can be saved.
`protected boolean` `validateFileLength(java.lang.String msg)`
`protected void` `writeChunk(org.h2.mvstore.MFChunk chunk, WriteBuffer buff)` Write buffer associated with chunk into store at chunk's allocated position
`protected void` `writeCleanShutdownMark()` Performs final preparation before store is closed normally
`protected void` `writeFully(org.h2.mvstore.MFChunk chunk, long pos, java.nio.ByteBuffer src)` Write to the file.

### Methods inherited from class org.h2.mvstore.FileStore

`accountForRemovedPage, bind, clear, compact, compactStore, deregisterMapRoot, discoverChunk, dropUnusedChunks, executeFileStoreOperation, findLastChunkWithCompleteValidChunkSet, getAutoCommitDelay, getAutoCompactFillRate, getCacheHitRatio, getCacheSize, getCacheSizeUsed, getChunks, getChunksFillRate, getChunksFromLayoutMap, getCreationTime, getDefaultRetentionTime, getFileName, getLayoutMap, getMaxPageSize, getMetaMapId, getMvStore, getReadBytes, getReadCount, getRetentionTime, getRewriteCandidates, getRootPos, getStoreHeader, getTocCacheHitRatio, getWriteBuffer, getWriteCount, hasChangesSince, hasPersistentData, init, initializeCommonHeaderAttributes, isIdle, isKnownVersion, isReadOnly, isRegularMap, isSpaceReused, lastChunkVersion, populateInfo, processCommonHeaderAttributes, readChunkFooter, readChunkHeaderAndFooter, readChunkHeaderOptionally, readChunkHeaderOptionally, readFully, registerDeadChunk, releaseWriteBuffer, rewriteChunks, rollbackTo, saveChunkMetadataChanges, setAutoCommitDelay, setCacheSize, setLastChunk, setRetentionTime, setReuseSpace, setSize, size, start, stop, store, sync, writeCleanShutdown`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AppendOnlyMultiFileStore

    public AppendOnlyMultiFileStore(java.util.Map<java.lang.String,java.lang.Object> config)

### Method Detail

#### createChunk

    protected final org.h2.mvstore.MFChunk createChunk(int newChunkId)

Specified by:
  `createChunk` in class `FileStore<org.h2.mvstore.MFChunk>`

#### createChunk

    public org.h2.mvstore.MFChunk createChunk(java.lang.String s)

Description copied from class: `FileStore`
Build a Chunk from the given string.

Specified by:
  `createChunk` in class `FileStore<org.h2.mvstore.MFChunk>`
Parameters:
  `s` - the string
Returns:
  the Chunk created

#### createChunk

    protected org.h2.mvstore.MFChunk createChunk(java.util.Map<java.lang.String,java.lang.String> map)

Specified by:
  `createChunk` in class `FileStore<org.h2.mvstore.MFChunk>`

#### shouldSaveNow

    public boolean shouldSaveNow(int unsavedMemory,
                                 int autoCommitMemory)

Description copied from class: `FileStore`
Decision about autocommit is delegated to store

Specified by:
  `shouldSaveNow` in class `FileStore<org.h2.mvstore.MFChunk>`
Parameters:
  `unsavedMemory` - amount of unsaved memory, so far
  `autoCommitMemory` - configured limit on amount of unsaved memory
Returns:
  true if commit should happen now

#### open

    public void open(java.lang.String fileName,
                     boolean readOnly,
                     char[] encryptionKey)

Specified by:
  `open` in class `FileStore<org.h2.mvstore.MFChunk>`

#### open

    public AppendOnlyMultiFileStore open(java.lang.String fileName,
                                         boolean readOnly)

Specified by:
  `open` in class `FileStore<org.h2.mvstore.MFChunk>`

#### close

    public void close()

Close this store.

Overrides:
  `close` in class `FileStore<org.h2.mvstore.MFChunk>`

#### writeFully

    protected void writeFully(org.h2.mvstore.MFChunk chunk,
                              long pos,
                              java.nio.ByteBuffer src)

Description copied from class: `FileStore`
Write to the file.

Specified by:
  `writeFully` in class `FileStore<org.h2.mvstore.MFChunk>`
Parameters:
  `chunk` - to write
  `pos` - the write position
  `src` - the source buffer

#### readFully

    public java.nio.ByteBuffer readFully(org.h2.mvstore.MFChunk chunk,
                                         long pos,
                                         int len)

Description copied from class: `FileStore`
Read data from the store.

Specified by:
  `readFully` in class `FileStore<org.h2.mvstore.MFChunk>`
Parameters:
  `chunk` - that owns data to be read
  `pos` - the read "position"
  `len` - the number of bytes to read
Returns:
  the byte buffer with data requested

#### initializeStoreHeader

    protected void initializeStoreHeader(long time)

Specified by:
  `initializeStoreHeader` in class `FileStore<org.h2.mvstore.MFChunk>`

#### readStoreHeader

    protected void readStoreHeader(boolean recoveryMode)

Specified by:
  `readStoreHeader` in class `FileStore<org.h2.mvstore.MFChunk>`

#### allocateChunkSpace

    protected void allocateChunkSpace(org.h2.mvstore.MFChunk chunk,
                                      WriteBuffer buff)

Description copied from class: `FileStore`
Allocate logical space and assign position of the buffer within the store.

Specified by:
  `allocateChunkSpace` in class `FileStore<org.h2.mvstore.MFChunk>`
Parameters:
  `chunk` - to allocate space for
  `buff` - to allocate space for

#### writeChunk

    protected void writeChunk(org.h2.mvstore.MFChunk chunk,
                              WriteBuffer buff)

Description copied from class: `FileStore`
Write buffer associated with chunk into store at chunk's allocated position

Specified by:
  `writeChunk` in class `FileStore<org.h2.mvstore.MFChunk>`
Parameters:
  `chunk` - chunk to write
  `buff` - to write

#### writeCleanShutdownMark

    protected void writeCleanShutdownMark()

Description copied from class: `FileStore`
Performs final preparation before store is closed normally

Specified by:
  `writeCleanShutdownMark` in class `FileStore<org.h2.mvstore.MFChunk>`

#### adjustStoreToLastChunk

    protected void adjustStoreToLastChunk()

Description copied from class: `FileStore`
Make persistent changes after lastChunk was reset

Specified by:
  `adjustStoreToLastChunk` in class `FileStore<org.h2.mvstore.MFChunk>`

#### compactStore

    protected void compactStore(int thresholdFillRate,
                                long maxCompactTime,
                                int maxWriteSize,
                                MVStore mvStore)

Description copied from class: `FileStore`
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.

Specified by:
  `compactStore` in class `FileStore<org.h2.mvstore.MFChunk>`
Parameters:
  `thresholdFillRate` - do not compact if store fill rate above this value (0-100)
  `maxCompactTime` - the maximum time in milliseconds to compact
  `maxWriteSize` - the maximum amount of data to be written as part of this call
  `mvStore` - that owns this FileStore

#### doHousekeeping

    protected void doHousekeeping(MVStore mvStore)
                           throws java.lang.InterruptedException

Specified by:
  `doHousekeeping` in class `FileStore<org.h2.mvstore.MFChunk>`
Throws:
  `java.lang.InterruptedException`

#### getFillRate

    public int getFillRate()

Specified by:
  `getFillRate` in class `FileStore<org.h2.mvstore.MFChunk>`

#### shrinkStoreIfPossible

    protected void shrinkStoreIfPossible(int minPercent)

Description copied from class: `FileStore`
Shrink store if possible, and if at least a given percentage can be saved.

Specified by:
  `shrinkStoreIfPossible` in class `FileStore<org.h2.mvstore.MFChunk>`
Parameters:
  `minPercent` - the minimum percentage to save

#### markUsed

    public void markUsed(long pos,
                         int length)

Description copied from class: `FileStore`
Mark the space as in use.

Specified by:
  `markUsed` in class `FileStore<org.h2.mvstore.MFChunk>`
Parameters:
  `pos` - the position in bytes
  `length` - the number of bytes

#### freeChunkSpace

    protected void freeChunkSpace(java.lang.Iterable<org.h2.mvstore.MFChunk> chunks)

Description copied from class: `FileStore`
Mark the space occupied by specified chunks as free.

Specified by:
  `freeChunkSpace` in class `FileStore<org.h2.mvstore.MFChunk>`
Parameters:
  `chunks` - chunks to be processed

#### validateFileLength

    protected boolean validateFileLength(java.lang.String msg)

Specified by:
  `validateFileLength` in class `FileStore<org.h2.mvstore.MFChunk>`

#### backup

    public void backup(java.util.zip.ZipOutputStream out)
                throws java.io.IOException

Specified by:
  `backup` in class `FileStore<org.h2.mvstore.MFChunk>`
Throws:
  `java.io.IOException`