org.apache.ignite.internal.processors.cache.persistence.pagemem

## Class DelayedDirtyPageStoreWrite

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.pagemem.DelayedDirtyPageStoreWrite

All Implemented Interfaces:
  PageStoreWriter

    public class DelayedDirtyPageStoreWrite
    extends Object
    implements PageStoreWriter

Not thread safe and stateful class for page replacement of one page with write() delay. This allows to write page content without holding segment lock. Page data is copied into temp buffer during `writePage(FullPageId, ByteBuffer, int)` and then sent to real implementation by `finishReplacement()`.

### Constructor Summary

Constructors
Constructor and Description
`DelayedDirtyPageStoreWrite(PageStoreWriter flushDirtyPage, ThreadLocal<ByteBuffer> byteBufThreadLoc, int pageSize, DelayedPageReplacementTracker tracker)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `finishReplacement()` Runs actual write if required.
`void` `writePage(FullPageId fullPageId, ByteBuffer byteBuf, int tag)` Callback for write page.

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

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

### Constructor Detail

#### DelayedDirtyPageStoreWrite

    public DelayedDirtyPageStoreWrite(PageStoreWriter flushDirtyPage,
                                      ThreadLocal<ByteBuffer> byteBufThreadLoc,
                                      int pageSize,
                                      DelayedPageReplacementTracker tracker)

Parameters:
  `flushDirtyPage` - real writer to save page to store.
  `byteBufThreadLoc` - thread local buffers to use for pages copying.
  `pageSize` - page size.
  `tracker` - tracker to lock/unlock page reads.

### Method Detail

#### writePage

    public void writePage(FullPageId fullPageId,
                          ByteBuffer byteBuf,
                          int tag)

Callback for write page. `PageMemoryEx` will copy page content to buffer before call.

Specified by:
  `writePage` in interface `PageStoreWriter`
Parameters:
  `fullPageId` - Page ID to get byte buffer for. The page ID must be present in the collection returned by the `PageMemoryEx.beginCheckpoint(IgniteInternalFuture)` method call.
  `byteBuf` - Temporary buffer to write changes into.
  `tag` - `Partition generation` if data was read, `null` otherwise (data already saved to storage).

#### finishReplacement

    public void finishReplacement()
                           throws IgniteCheckedException

Runs actual write if required. Method is 'no op' if there was no page selected for replacement.

Throws:
  `IgniteCheckedException` - if write failed.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020